mbox series

[v3,0/6] TI K3 DSP remoteproc driver for C66x DSPs

Message ID 20200612224914.7634-1-s-anna@ti.com
Headers show
Series TI K3 DSP remoteproc driver for C66x DSPs | expand

Message

Suman Anna June 12, 2020, 10:49 p.m. UTC
Hi All,

The following is v3 of the K3 DSP remoteproc driver supporting the C66x DSPs
on the TI K3 J721E SoCs. The patches are based on the latest commit on the
master branch 44ebe016df3a.

The main changes in v3 are mostly around the bindings to address various
comments from Rob. The bindings patch is the only patch without an Ack on
v2.

Main changes in v3:
 - Introduced a new common ti-sci-proc bindings yaml file (Patch #3)
   that can be used by both K3 DSP and R5F
 - Updated dt-bindings to address most comments (Patch #4)
 - Moved the common ti-sci-helper patch (Patch #2) between R5 and DSP drivers
   from the R5F series to this series, so that this series is standalone and
   can be merged by itself.

Please see the individual patches for further delta differences.

v2: https://patchwork.kernel.org/cover/11561787/
v1: https://patchwork.kernel.org/cover/11458573/

regards
Suman

Suman Anna (6):
  remoteproc: Introduce rproc_of_parse_firmware() helper
  remoteproc: k3: Add TI-SCI processor control helper functions
  dt-bindings: remoteproc: Add common TI SCI rproc bindings
  dt-bindings: remoteproc: Add bindings for C66x DSPs on TI K3 SoCs
  remoteproc: k3-dsp: Add a remoteproc driver of K3 C66x DSPs
  remoteproc: k3-dsp: Add support for L2RAM loading on C66x DSPs

 .../bindings/remoteproc/ti,k3-dsp-rproc.yaml  | 139 ++++
 .../bindings/remoteproc/ti,k3-sci-proc.yaml   |  51 ++
 drivers/remoteproc/Kconfig                    |  13 +
 drivers/remoteproc/Makefile                   |   1 +
 drivers/remoteproc/remoteproc_core.c          |  23 +
 drivers/remoteproc/remoteproc_internal.h      |   2 +
 drivers/remoteproc/ti_k3_dsp_remoteproc.c     | 774 ++++++++++++++++++
 drivers/remoteproc/ti_sci_proc.h              | 102 +++
 8 files changed, 1105 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yaml
 create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yaml
 create mode 100644 drivers/remoteproc/ti_k3_dsp_remoteproc.c
 create mode 100644 drivers/remoteproc/ti_sci_proc.h

Comments

Mathieu Poirier June 22, 2020, 5:35 p.m. UTC | #1
Hi Suman,

Apologies for the late reply, this one slipped through the cracks...


On Fri, Jun 12, 2020 at 05:49:10PM -0500, Suman Anna wrote:
> Texas Instruments' K3 generation SoCs have specific modules/register
> spaces used for configuring the various aspects of a remote processor.
> These include power, reset, boot vector and other configuration features
> specific to each compute processor present on the SoC. These registers
> are managed by the System Controller such as DMSC on K3 AM65x SoCs.
> 
> The Texas Instrument's System Control Interface (TI-SCI) Message Protocol
> is used to communicate to the System Controller from various compute
> processors to invoke specific services provided by the firmware running
> on the System Controller.
> 
> Add a common processor control interface header file that can be used by
> multiple remoteproc drivers. The helper functions within this header file
> abstract the various TI SCI protocol ops for the remoteproc drivers, and
> allow them to request the System Controller to be able to program and
> manage various remote processors on the SoC. The remoteproc drivers are
> expected to manage the life-cycle of their ti_sci_proc_dev local
> structures.
> 
> Signed-off-by: Suman Anna <s-anna@ti.com>
> ---
> v3: New to this series, but the patch is identical to the one from the
>     K3 R5F series posted previously, with patch title adjusted
>     https://patchwork.kernel.org/patch/11456379/
> 
>  drivers/remoteproc/ti_sci_proc.h | 102 +++++++++++++++++++++++++++++++
>  1 file changed, 102 insertions(+)
>  create mode 100644 drivers/remoteproc/ti_sci_proc.h
> 
> diff --git a/drivers/remoteproc/ti_sci_proc.h b/drivers/remoteproc/ti_sci_proc.h
> new file mode 100644
> index 000000000000..e42d8015b8e7
> --- /dev/null
> +++ b/drivers/remoteproc/ti_sci_proc.h
> @@ -0,0 +1,102 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Texas Instruments TI-SCI Processor Controller Helper Functions
> + *
> + * Copyright (C) 2018-2020 Texas Instruments Incorporated - http://www.ti.com/
> + *	Suman Anna
> + */
> +
> +#ifndef REMOTEPROC_TI_SCI_PROC_H
> +#define REMOTEPROC_TI_SCI_PROC_H
> +
> +/**
> + * struct ti_sci_proc - structure representing a processor control client
> + * @sci: cached TI-SCI protocol handle
> + * @ops: cached TI-SCI proc ops
> + * @dev: cached client device pointer
> + * @proc_id: processor id for the consumer remoteproc device
> + * @host_id: host id to pass the control over for this consumer remoteproc
> + *	     device
> + */
> +struct ti_sci_proc {
> +	const struct ti_sci_handle *sci;
> +	const struct ti_sci_proc_ops *ops;
> +	struct device *dev;

Please include the proper header files for the above structures.  I would also
have expected the name of the structure to be ti_sci_rproc but that choice is
entirely your.

With the proper header files included:

Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

> +	u8 proc_id;
> +	u8 host_id;
> +};
> +
> +static inline int ti_sci_proc_request(struct ti_sci_proc *tsp)
> +{
> +	int ret;
> +
> +	ret = tsp->ops->request(tsp->sci, tsp->proc_id);
> +	if (ret)
> +		dev_err(tsp->dev, "ti-sci processor request failed: %d\n",
> +			ret);
> +	return ret;
> +}
> +
> +static inline int ti_sci_proc_release(struct ti_sci_proc *tsp)
> +{
> +	int ret;
> +
> +	ret = tsp->ops->release(tsp->sci, tsp->proc_id);
> +	if (ret)
> +		dev_err(tsp->dev, "ti-sci processor release failed: %d\n",
> +			ret);
> +	return ret;
> +}
> +
> +static inline int ti_sci_proc_handover(struct ti_sci_proc *tsp)
> +{
> +	int ret;
> +
> +	ret = tsp->ops->handover(tsp->sci, tsp->proc_id, tsp->host_id);
> +	if (ret)
> +		dev_err(tsp->dev, "ti-sci processor handover of %d to %d failed: %d\n",
> +			tsp->proc_id, tsp->host_id, ret);
> +	return ret;
> +}
> +
> +static inline int ti_sci_proc_set_config(struct ti_sci_proc *tsp,
> +					 u64 boot_vector,
> +					 u32 cfg_set, u32 cfg_clr)
> +{
> +	int ret;
> +
> +	ret = tsp->ops->set_config(tsp->sci, tsp->proc_id, boot_vector,
> +				   cfg_set, cfg_clr);
> +	if (ret)
> +		dev_err(tsp->dev, "ti-sci processor set_config failed: %d\n",
> +			ret);
> +	return ret;
> +}
> +
> +static inline int ti_sci_proc_set_control(struct ti_sci_proc *tsp,
> +					  u32 ctrl_set, u32 ctrl_clr)
> +{
> +	int ret;
> +
> +	ret = tsp->ops->set_control(tsp->sci, tsp->proc_id, ctrl_set, ctrl_clr);
> +	if (ret)
> +		dev_err(tsp->dev, "ti-sci processor set_control failed: %d\n",
> +			ret);
> +	return ret;
> +}
> +
> +static inline int ti_sci_proc_get_status(struct ti_sci_proc *tsp,
> +					 u64 *boot_vector, u32 *cfg_flags,
> +					 u32 *ctrl_flags, u32 *status_flags)
> +{
> +	int ret;
> +
> +	ret = tsp->ops->get_status(tsp->sci, tsp->proc_id, boot_vector,
> +				   cfg_flags, ctrl_flags, status_flags);
> +	if (ret)
> +		dev_err(tsp->dev, "ti-sci processor get_status failed: %d\n",
> +			ret);
> +	return ret;
> +}
> +
> +#endif /* REMOTEPROC_TI_SCI_PROC_H */
> -- 
> 2.26.0
>
Suman Anna June 22, 2020, 8:24 p.m. UTC | #2
Hi Mathieu,

On 6/22/20 12:35 PM, Mathieu Poirier wrote:
> Hi Suman,
> 
> Apologies for the late reply, this one slipped through the cracks...

No problem :)

> 
> 
> On Fri, Jun 12, 2020 at 05:49:10PM -0500, Suman Anna wrote:
>> Texas Instruments' K3 generation SoCs have specific modules/register
>> spaces used for configuring the various aspects of a remote processor.
>> These include power, reset, boot vector and other configuration features
>> specific to each compute processor present on the SoC. These registers
>> are managed by the System Controller such as DMSC on K3 AM65x SoCs.
>>
>> The Texas Instrument's System Control Interface (TI-SCI) Message Protocol
>> is used to communicate to the System Controller from various compute
>> processors to invoke specific services provided by the firmware running
>> on the System Controller.
>>
>> Add a common processor control interface header file that can be used by
>> multiple remoteproc drivers. The helper functions within this header file
>> abstract the various TI SCI protocol ops for the remoteproc drivers, and
>> allow them to request the System Controller to be able to program and
>> manage various remote processors on the SoC. The remoteproc drivers are
>> expected to manage the life-cycle of their ti_sci_proc_dev local
>> structures.
>>
>> Signed-off-by: Suman Anna <s-anna@ti.com>
>> ---
>> v3: New to this series, but the patch is identical to the one from the
>>      K3 R5F series posted previously, with patch title adjusted
>>      https://patchwork.kernel.org/patch/11456379/
>>
>>   drivers/remoteproc/ti_sci_proc.h | 102 +++++++++++++++++++++++++++++++
>>   1 file changed, 102 insertions(+)
>>   create mode 100644 drivers/remoteproc/ti_sci_proc.h
>>
>> diff --git a/drivers/remoteproc/ti_sci_proc.h b/drivers/remoteproc/ti_sci_proc.h
>> new file mode 100644
>> index 000000000000..e42d8015b8e7
>> --- /dev/null
>> +++ b/drivers/remoteproc/ti_sci_proc.h
>> @@ -0,0 +1,102 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +/*
>> + * Texas Instruments TI-SCI Processor Controller Helper Functions
>> + *
>> + * Copyright (C) 2018-2020 Texas Instruments Incorporated - http://www.ti.com/
>> + *	Suman Anna
>> + */
>> +
>> +#ifndef REMOTEPROC_TI_SCI_PROC_H
>> +#define REMOTEPROC_TI_SCI_PROC_H
>> +
>> +/**
>> + * struct ti_sci_proc - structure representing a processor control client
>> + * @sci: cached TI-SCI protocol handle
>> + * @ops: cached TI-SCI proc ops
>> + * @dev: cached client device pointer
>> + * @proc_id: processor id for the consumer remoteproc device
>> + * @host_id: host id to pass the control over for this consumer remoteproc
>> + *	     device
>> + */
>> +struct ti_sci_proc {
>> +	const struct ti_sci_handle *sci;
>> +	const struct ti_sci_proc_ops *ops;
>> +	struct device *dev;
> 
> Please include the proper header files for the above structures.  

OK, I will move the #include <linux/soc/ti/ti_sci_protocol.h> from the 
driver source files to here.

I would also
> have expected the name of the structure to be ti_sci_rproc but that choice is
> entirely your.

This follows the terminology used in the TI SCI protocol and firmware 
code. I will leave it unchanged.

> 
> With the proper header files included:
> 
> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Thanks, I will await any comments from Rob on the bindings patch before 
I refresh this series.

regards
Suman

> 
>> +	u8 proc_id;
>> +	u8 host_id;
>> +};
>> +
>> +static inline int ti_sci_proc_request(struct ti_sci_proc *tsp)
>> +{
>> +	int ret;
>> +
>> +	ret = tsp->ops->request(tsp->sci, tsp->proc_id);
>> +	if (ret)
>> +		dev_err(tsp->dev, "ti-sci processor request failed: %d\n",
>> +			ret);
>> +	return ret;
>> +}
>> +
>> +static inline int ti_sci_proc_release(struct ti_sci_proc *tsp)
>> +{
>> +	int ret;
>> +
>> +	ret = tsp->ops->release(tsp->sci, tsp->proc_id);
>> +	if (ret)
>> +		dev_err(tsp->dev, "ti-sci processor release failed: %d\n",
>> +			ret);
>> +	return ret;
>> +}
>> +
>> +static inline int ti_sci_proc_handover(struct ti_sci_proc *tsp)
>> +{
>> +	int ret;
>> +
>> +	ret = tsp->ops->handover(tsp->sci, tsp->proc_id, tsp->host_id);
>> +	if (ret)
>> +		dev_err(tsp->dev, "ti-sci processor handover of %d to %d failed: %d\n",
>> +			tsp->proc_id, tsp->host_id, ret);
>> +	return ret;
>> +}
>> +
>> +static inline int ti_sci_proc_set_config(struct ti_sci_proc *tsp,
>> +					 u64 boot_vector,
>> +					 u32 cfg_set, u32 cfg_clr)
>> +{
>> +	int ret;
>> +
>> +	ret = tsp->ops->set_config(tsp->sci, tsp->proc_id, boot_vector,
>> +				   cfg_set, cfg_clr);
>> +	if (ret)
>> +		dev_err(tsp->dev, "ti-sci processor set_config failed: %d\n",
>> +			ret);
>> +	return ret;
>> +}
>> +
>> +static inline int ti_sci_proc_set_control(struct ti_sci_proc *tsp,
>> +					  u32 ctrl_set, u32 ctrl_clr)
>> +{
>> +	int ret;
>> +
>> +	ret = tsp->ops->set_control(tsp->sci, tsp->proc_id, ctrl_set, ctrl_clr);
>> +	if (ret)
>> +		dev_err(tsp->dev, "ti-sci processor set_control failed: %d\n",
>> +			ret);
>> +	return ret;
>> +}
>> +
>> +static inline int ti_sci_proc_get_status(struct ti_sci_proc *tsp,
>> +					 u64 *boot_vector, u32 *cfg_flags,
>> +					 u32 *ctrl_flags, u32 *status_flags)
>> +{
>> +	int ret;
>> +
>> +	ret = tsp->ops->get_status(tsp->sci, tsp->proc_id, boot_vector,
>> +				   cfg_flags, ctrl_flags, status_flags);
>> +	if (ret)
>> +		dev_err(tsp->dev, "ti-sci processor get_status failed: %d\n",
>> +			ret);
>> +	return ret;
>> +}
>> +
>> +#endif /* REMOTEPROC_TI_SCI_PROC_H */
>> -- 
>> 2.26.0
>>