TI K3 DSP remoteproc driver for C66x DSPs
Subsystems (2)
v3 cover TI K3 DSP remoteproc driver for C66x DSPs
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
Signature · 1 line
2.26.0
PATCH v3 1/6 remoteproc: Introduce rproc_of_parse_firmware() helper
Add a new helper function rproc_of_parse_firmware() to the remoteproc core that can be used by various remoteproc drivers to look up the the "firmware-name" property from a rproc device node. This property is already being used by multiple drivers, so this helper can avoid repeating equivalent code in remoteproc drivers.
---
v3: No changes, picked up review tags
v2: https://patchwork.kernel.org/patch/11561791/
drivers/remoteproc/remoteproc_core.c | 23 +++++++++++++++++++++++ drivers/remoteproc/remoteproc_internal.h | 2 ++ 2 files changed, 25 insertions(+)
drivers/remoteproc/remoteproc_core.c +23 -0
@@ -1034,6 +1034,29 @@ rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len, }EXPORT_SYMBOL (rproc_of_resm_mem_entry_init); +/** +* rproc_of_parse_firmware() - parse and return the firmware-name +* @dev: pointer on device struct representing a rproc +* @index: index to use for the firmware-name retrieval +* @fw_name: pointer to a character string, in which the firmware +* name is returned on success and unmodified otherwise. +* +* This is an OF helper function that parses a device's DT node for +* the "firmware-name" property and returns the firmware name pointer +* in @fw_name on success. +* +* Return: 0 on success, or an appropriate failure. +*/ +int rproc_of_parse_firmware (struct device *dev,int index,const char **fw_name) +{ +int ret; + + ret =of_property_read_string_index (dev->of_node,"firmware-name" , + index, fw_name); +return ret ? ret :0 ; +} +EXPORT_SYMBOL (rproc_of_parse_firmware); +/* * A lookup table for resource handlers. The indices are defined in * enum fw_resource_type.
drivers/remoteproc/remoteproc_internal.h +2 -0
@@ -28,6 +28,8 @@ struct rproc_debug_trace {void rproc_release (struct kref *kref);irqreturn_t rproc_vq_interrupt (struct rproc *rproc,int vq_id);void rproc_vdev_release (struct kref *ref); +int rproc_of_parse_firmware (struct device *dev,int index, +const char **fw_name);/* from remoteproc_virtio.c */ int rproc_add_virtio_dev (struct rproc_vdev *rvdev,int id);
Signature · 1 line
2.26.0
PATCH v3 2/6 remoteproc: k3: Add TI-SCI processor control helper functions
In reply to Suman AnnaTexas 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.
---
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
drivers/remoteproc/ti_sci_proc.h new file +102 -0
@@ -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; +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 */
Signature · 1 line
2.26.0
Re: [PATCH v3 2/6] remoteproc: k3: Add TI-SCI processor control helper functions
Hi Suman,
Apologies for the late reply, this one slipped through the cracks...
Quoted 49 lines · Suman Anna
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_devlocal structures.Signed-off-by Suman Anna <[email protected]>---
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.hdrivers/remoteproc/ti_sci_proc.h new file +14
-0@@ -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
drivers/remoteproc/ti_sci_proc.h line 24
Quoted 10 lines
drivers/remoteproc/ti_sci_proc.h new file +10
-0+* @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:
Quoted 81 lines
drivers/remoteproc/ti_sci_proc.h new file +78
-0+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 */ Signature · 1 line
2.26.0
Re: [PATCH v3 2/6] remoteproc: k3: Add TI-SCI processor control helper functions
Hi Mathieu,
Quoted 3 lines · Mathieu Poirier
Hi Suman,
Apologies for the late reply, this one slipped through the cracks...
No problem :)
Quoted 56 lines · Suman Anna
Quoted 53 lines
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_devlocal structures.Signed-off-by Suman Anna <[email protected]>---
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.hdrivers/remoteproc/ti_sci_proc.h new file +18
-0@@ -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
Quoted 8 lines
drivers/remoteproc/ti_sci_proc.h line 24
Quoted 6 lines
drivers/remoteproc/ti_sci_proc.h new file +6
-0+* 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
Quoted 2 lines
have expected the name of the structure to be
ti_sci_rprocbut that choice is entirely your.
This follows the terminology used in the TI SCI protocol and firmware code. I will leave it unchanged.
Quoted 4 lines
With the proper header files included:
Reviewed-by Mathieu Poirier <[email protected]>
Thanks, I will await any comments from Rob on the bindings patch before I refresh this series.
regards
Suman
Quoted 82 lines
Quoted 82 lines
drivers/remoteproc/ti_sci_proc.h new file +78
-0+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 */ Signature · 1 line
2.26.0
PATCH v3 3/6 dt-bindings: remoteproc: Add common TI SCI rproc bindings
In reply to Suman AnnaAdd a bindings document that lists the common TI SCI properties used by the K3 R5F and DSP remoteproc devices.
---
v3: New Patch refactoring out the common ti-sci-proc properties
.../bindings/remoteproc/ti,k3-sci-proc.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yaml
Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yaml new file +51 -0
@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/remoteproc/ti,k3-sci-proc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Common TI K3 remote processor device bindings + +maintainers: + - Suman Anna <[email protected]> + +description: | + The TI K3 family of SoCs usually have one or more remote processor sub-systems + like the dual-core R5F sub-system or a C66x or C71x DSP processor subsystem. + The device management of these remote processors is managed by a dedicated + System Processor, and the communication with that processor is managed through + the TI-SCI protocol. + + Each remote processor device node should define a common set of properties + that allows the System Processor firmware to perform the device management + such as powering the IPs, asserting/deasserting the resets for each of these + processors. + +properties: + ti,sci: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Should be a phandle to the TI-SCI System Controller node + + ti,sci-dev-id: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Should contain the TI-SCI device id corresponding to the remote processor + core. Please refer to the corresponding System Controller documentation + for valid values. + + ti,sci-proc-ids: + description: Should contain a single tuple of <proc_id host_id>. + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32-array + - maxItems: 1 + items: + items: + - description: TI-SCI processor id for the remote processor device + - description: TI-SCI host id to which processor control + ownership should be transferred to + +required: + - ti,sci + - ti,sci-dev-id + - ti,sci-proc-ids
Signature · 1 line
2.26.0
Rob Herring
maintainerRe: [PATCH v3 3/6] dt-bindings: remoteproc: Add common TI SCI rproc bindings
Quoted 46 lines · Suman Anna
Add a bindings document that lists the common TI SCI properties used by the K3 R5F and DSP remoteproc devices.
Signed-off-by Suman Anna <[email protected]>---
v3: New Patch refactoring out the common ti-sci-proc properties.../bindings/remoteproc/ti,k3-sci-proc.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yamlDocumentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yaml new file +29
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/remoteproc/ti,k3-sci-proc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Common TI K3 remote processor device bindings + +maintainers: + - Suman Anna <[email protected]> + +description: | + The TI K3 family of SoCs usually have one or more remote processor sub-systems + like the dual-core R5F sub-system or a C66x or C71x DSP processor subsystem. + The device management of these remote processors is managed by a dedicated + System Processor, and the communication with that processor is managed through + the TI-SCI protocol. + + Each remote processor device node should define a common set of properties + that allows the System Processor firmware to perform the device management + such as powering the IPs, asserting/deasserting the resets for each of these + processors. + +properties: + ti,sci: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Should be a phandle to the TI-SCI System Controller node +
Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yaml line 39
Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yaml new file +10
-0+ ti,sci-dev-id: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Should contain the TI-SCI device id corresponding to the remote processor + core. Please refer to the corresponding System Controller documentation + for valid values. + + ti,sci-proc-ids: + description: Should contain a single tuple of <proc_id host_id>. + allOf:
You can drop allOf now.
Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yaml line 42
Quoted 3 lines
Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yaml new file +3
-0+ - $ref: /schemas/types.yaml#/definitions/uint32-array + - maxItems: 1 + items:
You don't need 'maxItems' or 1st 'items' here.
Quoted 12 lines
Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yaml new file +9
-0+ items: + - description: TI-SCI processor id for the remote processor device + - description: TI-SCI host id to which processor control + ownership should be transferred to + +required: + - ti,sci + - ti,sci-dev-id + - ti,sci-proc-idsSignature · 1 line
2.26.0
Re: [PATCH v3 3/6] dt-bindings: remoteproc: Add common TI SCI rproc bindings
In reply to Suman AnnaQuoted 11 lines · Suman Anna
Add a bindings document that lists the common TI SCI properties used by the K3 R5F and DSP remoteproc devices.
Signed-off-by Suman Anna <[email protected]>---
v3: New Patch refactoring out the common ti-sci-proc properties.../bindings/remoteproc/ti,k3-sci-proc.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yaml
Re: [PATCH v3 3/6] dt-bindings: remoteproc: Add common TI SCI rproc bindings
Quoted 9 lines · Rob Herring
Quoted 7 lines · Suman Anna
Add a bindings document that lists the common TI SCI properties used by the K3 R5F and DSP remoteproc devices.
Signed-off-by Suman Anna <[email protected]>---
v3: New Patch refactoring out the common ti-sci-proc properties
Quoted 6 lines
Quoted 4 lines
.../bindings/remoteproc/ti,k3-sci-proc.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,k3-sci-proc.yamlReviewed-by Rob Herring <[email protected]>
Oops, wrong patch.
PATCH v3 4/6 dt-bindings: remoteproc: Add bindings for C66x DSPs on TI K3 SoCs
In reply to Suman AnnaSome Texas Instruments K3 family of SoCs have one of more Digital Signal Processor (DSP) subsystems that are comprised of either a TMS320C66x CorePac and/or a next-generation TMS320C71x CorePac processor subsystem. Add the device tree bindings document for the C66x DSP devices on these SoCs. The added example illustrates the DT nodes for the first C66x DSP device present on the K3 J721E family of SoCs.
---
v3:
- Refactored the common ti-sci properties "ti,sci", "ti,sci-dev-id" and "ti,sci-proc-ids" into a separate binding ti,k3-sci-proc.yaml.
- Dropped the general description and maxItems against reg and reg-names
- Added items list under reg
- Removed the other binding references from the description for resets and mboxes
- Revised the memory-region description and listed the mandatory items
- Updated example to drop reserved-memory nodes, unused node labels
v2: https://patchwork.kernel.org/patch/11561781/
.../bindings/remoteproc/ti,k3-dsp-rproc.yaml | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yaml
Documentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yaml new file +139 -0
@@ -0,0 +1,139 @@ +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/remoteproc/ti,k3-dsp-rproc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TI K3 DSP devices + +maintainers: + - Suman Anna <[email protected]> + +description: | + The TI K3 family of SoCs usually have one or more TI DSP Core sub-systems + that are used to offload some of the processor-intensive tasks or algorithms, + for achieving various system level goals. + + These processor sub-systems usually contain additional sub-modules like + L1 and/or L2 caches/SRAMs, an Interrupt Controller, an external memory + controller, a dedicated local power/sleep controller etc. The DSP processor + cores in the K3 SoCs are usually either a TMS320C66x CorePac processor or a + TMS320C71x CorePac processor. + + Each DSP Core sub-system is represented as a single DT node. Each node has a + number of required or optional properties that enable the OS running on the + host processor (Arm CorePac) to perform the device management of the remote + processor and to communicate with the remote processor. + +allOf: + - $ref: "ti,k3-sci-proc.yaml#" + +properties: + compatible: + const: ti,j721e-c66-dsp + description: + Use "ti,j721e-c66-dsp" for C66x DSPs on K3 J721E SoCs + + reg: + items: + - description: Address and Size of the L2 SRAM internal memory region + - description: Address and Size of the L1 PRAM internal memory region + - description: Address and Size of the L1 DRAM internal memory region + + reg-names: + items: + - const: l2sram + - const: l1pram + - const: l1dram + + resets: + description: | + Should contain the phandle to the reset controller node managing the + local resets for this device, and a reset specifier. + maxItems: 1 + + firmware-name: + description: | + Should contain the name of the default firmware image + file located on the firmware search path + + mboxes: + description: | + OMAP Mailbox specifier denoting the sub-mailbox, to be used for + communication with the remote processor. This property should match + with the sub-mailbox node used in the firmware image. + maxItems: 1 + + memory-region: + minItems: 2 + maxItems: 8 + description: | + phandle to the reserved memory nodes to be associated with the remoteproc + device. There should be at least two reserved memory nodes defined. The + reserved memory nodes should be carveout nodes, and should be defined as + per the bindings in + Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt + items: + - description: region used for dynamic DMA allocations like vrings and + vring buffers + - description: region reserved for firmware image sections + additionalItems: true + +# Optional properties: +# -------------------- + + sram: + $ref: /schemas/types.yaml#/definitions/phandle-array + minItems: 1 + maxItems: 4 + description: | + phandles to one or more reserved on-chip SRAM regions. The regions + should be defined as child nodes of the respective SRAM node, and + should be defined as per the generic bindings in, + Documentation/devicetree/bindings/sram/sram.yaml + +required: + - compatible + - reg + - reg-names + - resets + - firmware-name + - mboxes + - memory-region + +unevaluatedProperties: false + +examples: + - | + / { + model = "Texas Instruments K3 J721E SoC"; + compatible = "ti,j721e"; + #address-cells = <2>; + #size-cells = <2>; + + bus@100000 { + compatible = "simple-bus"; + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x00 0x00100000 0x00 0x00100000 0x00 0x00020000>, /* ctrl mmr */ + <0x4d 0x80800000 0x4d 0x80800000 0x00 0x00800000>, /* C66_0 */ + <0x4d 0x81800000 0x4d 0x81800000 0x00 0x00800000>; /* C66_1 */ + + /* J721E C66_0 DSP node */ + dsp@4d80800000 { + compatible = "ti,j721e-c66-dsp"; + reg = <0x4d 0x80800000 0x00 0x00048000>, + <0x4d 0x80e00000 0x00 0x00008000>, + <0x4d 0x80f00000 0x00 0x00008000>; + reg-names = "l2sram", "l1pram", "l1dram"; + ti,sci = <&dmsc>; + ti,sci-dev-id = <142>; + ti,sci-proc-ids = <0x03 0xFF>; + resets = <&k3_reset 142 1>; + firmware-name = "j7-c66_0-fw"; + memory-region = <&c66_0_dma_memory_region>, + <&c66_0_memory_region>; + mboxes = <&mailbox0_cluster3 &mbox_c66_0>; + }; + }; + };
Signature · 7 lines
2.26.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v3 4/6] dt-bindings: remoteproc: Add bindings for C66x DSPs on TI K3 SoCs
Hi Rob,
Quoted 8 lines · Suman Anna
Some Texas Instruments K3 family of SoCs have one of more Digital Signal Processor (DSP) subsystems that are comprised of either a TMS320C66x CorePac and/or a next-generation TMS320C71x CorePac processor subsystem. Add the device tree bindings document for the C66x DSP devices on these SoCs. The added example illustrates the DT nodes for the first C66x DSP device present on the K3 J721E family of SoCs.
Signed-off-by Suman Anna <[email protected]>
Quoted 10 lines
---
v3:
- Refactored the common ti-sci properties "ti,sci", "ti,sci-dev-id" and "ti,sci-proc-ids" into a separate binding ti,k3-sci-proc.yaml.
- Dropped the general description and maxItems against reg and reg-names
- Added items list under reg
- Removed the other binding references from the description for resets and mboxes
- Revised the memory-region description and listed the mandatory items
- Updated example to drop reserved-memory nodes, unused node labels
Thanks for acking the corresponding C71x binding update [1] that is on top of this patch.
Can you provide your Ack for this updated patch and the refactored ti,k3-sci-proc.yaml binding if you don't have any comments?
regards
Suman
[1] https://patchwork.kernel.org/comment/23421509/
Quoted 152 lines
v2: https://patchwork.kernel.org/patch/11561781/
.../bindings/remoteproc/ti,k3-dsp-rproc.yaml | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+)create mode 100644
Documentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yamlDocumentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yaml new file +139
-0@@ -0,0 +1,139 @@ +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/remoteproc/ti,k3-dsp-rproc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TI K3 DSP devices + +maintainers: + - Suman Anna <[email protected]> + +description: | + The TI K3 family of SoCs usually have one or more TI DSP Core sub-systems + that are used to offload some of the processor-intensive tasks or algorithms, + for achieving various system level goals. + + These processor sub-systems usually contain additional sub-modules like + L1 and/or L2 caches/SRAMs, an Interrupt Controller, an external memory + controller, a dedicated local power/sleep controller etc. The DSP processor + cores in the K3 SoCs are usually either a TMS320C66x CorePac processor or a + TMS320C71x CorePac processor. + + Each DSP Core sub-system is represented as a single DT node. Each node has a + number of required or optional properties that enable the OS running on the + host processor (Arm CorePac) to perform the device management of the remote + processor and to communicate with the remote processor. + +allOf: + - $ref: "ti,k3-sci-proc.yaml#" + +properties: + compatible: + const: ti,j721e-c66-dsp + description: + Use "ti,j721e-c66-dsp" for C66x DSPs on K3 J721E SoCs + + reg: + items: + - description: Address and Size of the L2 SRAM internal memory region + - description: Address and Size of the L1 PRAM internal memory region + - description: Address and Size of the L1 DRAM internal memory region + + reg-names: + items: + - const: l2sram + - const: l1pram + - const: l1dram + + resets: + description: | + Should contain the phandle to the reset controller node managing the + local resets for this device, and a reset specifier. + maxItems: 1 + + firmware-name: + description: | + Should contain the name of the default firmware image + file located on the firmware search path + + mboxes: + description: | + OMAP Mailbox specifier denoting the sub-mailbox, to be used for + communication with the remote processor. This property should match + with the sub-mailbox node used in the firmware image. + maxItems: 1 + + memory-region: + minItems: 2 + maxItems: 8 + description: | + phandle to the reserved memory nodes to be associated with the remoteproc + device. There should be at least two reserved memory nodes defined. The + reserved memory nodes should be carveout nodes, and should be defined as + per the bindings in + Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt + items: + - description: region used for dynamic DMA allocations like vrings and + vring buffers + - description: region reserved for firmware image sections + additionalItems: true + +# Optional properties: +# -------------------- + + sram: + $ref: /schemas/types.yaml#/definitions/phandle-array + minItems: 1 + maxItems: 4 + description: | + phandles to one or more reserved on-chip SRAM regions. The regions + should be defined as child nodes of the respective SRAM node, and + should be defined as per the generic bindings in, + Documentation/devicetree/bindings/sram/sram.yaml + +required: + - compatible + - reg + - reg-names + - resets + - firmware-name + - mboxes + - memory-region + +unevaluatedProperties: false + +examples: + - | + / { + model = "Texas Instruments K3 J721E SoC"; + compatible = "ti,j721e"; + #address-cells = <2>; + #size-cells = <2>; + + bus@100000 { + compatible = "simple-bus"; + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x00 0x00100000 0x00 0x00100000 0x00 0x00020000>, /* ctrl mmr */ + <0x4d 0x80800000 0x4d 0x80800000 0x00 0x00800000>, /* C66_0 */ + <0x4d 0x81800000 0x4d 0x81800000 0x00 0x00800000>; /* C66_1 */ + + /* J721E C66_0 DSP node */ + dsp@4d80800000 { + compatible = "ti,j721e-c66-dsp"; + reg = <0x4d 0x80800000 0x00 0x00048000>, + <0x4d 0x80e00000 0x00 0x00008000>, + <0x4d 0x80f00000 0x00 0x00008000>; + reg-names = "l2sram", "l1pram", "l1dram"; + ti,sci = <&dmsc>; + ti,sci-dev-id = <142>; + ti,sci-proc-ids = <0x03 0xFF>; + resets = <&k3_reset 142 1>; + firmware-name = "j7-c66_0-fw"; + memory-region = <&c66_0_dma_memory_region>, + <&c66_0_memory_region>; + mboxes = <&mailbox0_cluster3 &mbox_c66_0>; + }; + }; + };
Re: [PATCH v3 4/6] dt-bindings: remoteproc: Add bindings for C66x DSPs on TI K3 SoCs
In reply to Suman AnnaQuoted 20 lines · Suman Anna
Some Texas Instruments K3 family of SoCs have one of more Digital Signal Processor (DSP) subsystems that are comprised of either a TMS320C66x CorePac and/or a next-generation TMS320C71x CorePac processor subsystem. Add the device tree bindings document for the C66x DSP devices on these SoCs. The added example illustrates the DT nodes for the first C66x DSP device present on the K3 J721E family of SoCs.
Signed-off-by Suman Anna <[email protected]>---
v3:
- Refactored the common ti-sci properties "ti,sci", "ti,sci-dev-id" and "ti,sci-proc-ids" into a separate binding ti,k3-sci-proc.yaml.
- Dropped the general description and maxItems against reg and reg-names
- Added items list under reg
- Removed the other binding references from the description for resets and mboxes
- Revised the memory-region description and listed the mandatory items
- Updated example to drop reserved-memory nodes, unused node labels
v2: https://patchwork.kernel.org/patch/11561781/
Quoted 4 lines
.../bindings/remoteproc/ti,k3-dsp-rproc.yaml | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yaml
PATCH v3 5/6 remoteproc: k3-dsp: Add a remoteproc driver of K3 C66x DSPs
In reply to Suman AnnaThe Texas Instrument's K3 J721E SoCs have two C66x DSP Subsystems in MAIN voltage domain that are based on the TI's standard TMS320C66x DSP CorePac module. Each subsystem has a Fixed/Floating-Point DSP CPU, with 32 KB each of L1P & L1D SRAMs that can be configured and partitioned as either RAM and/or Cache, and 288 KB of L2 SRAM with 256 KB of memory configurable as either RAM and/or Cache. The CorePac also includes an Internal DMA (IDMA), External Memory Controller (EMC), Extended Memory Controller (XMC) with a Region Address Translator (RAT) unit for 32-bit to 48-bit address extension/translations, an Interrupt Controller (INTC) and a Powerdown Controller (PDC).
A new remoteproc module is added to perform the device management of these DSP devices. The support is limited to images using only external DDR memory at the moment, the loading support to internal memories and any on-chip RAM memories will be added in a subsequent patch. RAT support is also left for a future patch, and as such the reserved memory carveout regions are all expected to be using memory regions within the first 2 GB. Error Recovery and Power Management features are not currently supported.
The C66x remote processors do not have an MMU, and so require fixed memory carveout regions matching the firmware image addresses. Support for this is provided by mandating multiple memory regions to be attached to the remoteproc device. The first memory region will be used to serve as the DMA pool for all dynamic allocations like the vrings and vring buffers. The remaining memory regions are mapped into the kernel at device probe time, and are used to provide address translations for firmware image segments without the need for any RSC_CARVEOUT entries. Any firmware image using memory outside of the supplied reserved memory carveout regions will be errored out.
The driver uses various TI-SCI interfaces to talk to the System Controller (DMSC) for managing configuration, power and reset management of these cores. IPC between the A72 cores and the DSP cores is supported through the virtio rpmsg stack using shared memory and OMAP Mailboxes.
---
v3:
- Included slab.h to fix compile errors against latest master
- Switched from remoteproc/k3-dsp to remoteproc: k3-dsp in patch title
- Picked up review tags
- No other code changes
v2: https://patchwork.kernel.org/patch/11561783/
drivers/remoteproc/Kconfig | 13 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/ti_k3_dsp_remoteproc.c | 702 ++++++++++++++++++++++ 3 files changed, 716 insertions(+) create mode 100644 drivers/remoteproc/ti_k3_dsp_remoteproc.c
drivers/remoteproc/Kconfig +13 -0
@@ -249,6 +249,19 @@ config STM32_RPROC This can be either built-in or a loadable module. +config TI_K3_DSP_REMOTEPROC + tristate "TI K3 DSP remoteproc support" + depends on ARCH_K3 + select MAILBOX + select OMAP2PLUS_MBOX + help + Say m here to support TI's C66x and C71x DSP remote processor + subsystems on various TI K3 family of SoCs through the remote + processor framework. + + It's safe to say N here if you're not interested in utilizing + the DSP slave processors. + endif # REMOTEPROC endmenu
drivers/remoteproc/Makefile +1 -0
@@ -30,3 +30,4 @@ qcom_wcnss_pil-y += qcom_wcnss_iris.o obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o obj-$(CONFIG_STM32_RPROC) += stm32_rproc.o +obj-$(CONFIG_TI_K3_DSP_REMOTEPROC) += ti_k3_dsp_remoteproc.o
drivers/remoteproc/ti_k3_dsp_remoteproc.c new file +702 -0
702 lines not on this page · raw message
Signature · 1 line
2.26.0
PATCH v3 6/6 remoteproc: k3-dsp: Add support for L2RAM loading on C66x DSPs
In reply to Suman AnnaThe resets for the DSP processors on K3 SoCs are managed through the Power and Sleep Controller (PSC) module. Each DSP typically has two resets - a global module reset for powering on the device, and a local reset that affects only the CPU while allowing access to the other sub-modules within the DSP processor sub-systems.
The C66x DSPs have two levels of internal RAMs that can be used to boot from, and the firmware loading into these RAMs require the local reset to be asserted with the device powered on/enabled using the module reset. Enhance the K3 DSP remoteproc driver to add support for loading into the internal RAMs. The local reset is deasserted on SoC power-on-reset, so logic has to be added in probe in remoteproc mode to balance the remoteproc state-machine.
Note that the local resets are a no-op on C71x cores, and the hardware does not supporting loading into its internal RAMs.
---
v3: No code changes, picked up review tags, switched to : in patch title
v2: https://patchwork.kernel.org/patch/11561785/
drivers/remoteproc/ti_k3_dsp_remoteproc.c | 72 +++++++++++++++++++++++ 1 file changed, 72 insertions(+)
drivers/remoteproc/ti_k3_dsp_remoteproc.c +72 -0
@@ -175,6 +175,9 @@ static int k3_dsp_rproc_reset(struct k3_dsp_rproc *kproc)return ret; } +if (kproc->data->uses_lreset) +return ret; + ret = kproc->ti_sci->ops.dev_ops.put_device (kproc->ti_sci, kproc->ti_sci_id);if (ret) {
@@ -192,6 +195,9 @@ static int k3_dsp_rproc_release(struct k3_dsp_rproc *kproc)struct device *dev = kproc->dev;int ret; +if (kproc->data->uses_lreset) + goto lreset; + ret = kproc->ti_sci->ops.dev_ops.get_device (kproc->ti_sci, kproc->ti_sci_id);if (ret) {
@@ -199,6 +205,7 @@ static int k3_dsp_rproc_release(struct k3_dsp_rproc *kproc)return ret; } +lreset: ret =reset_control_deassert (kproc->reset);if (ret) {dev_err (dev,"local-reset deassert failed, ret = %d\n" , ret);
@@ -210,6 +217,53 @@ static int k3_dsp_rproc_release(struct k3_dsp_rproc *kproc)return ret; } +/* +* The C66x DSP cores have a local reset that affects only the CPU, and a +* generic module reset that powers on the device and allows the DSP internal +* memories to be accessed while the local reset is asserted. This function is +* used to release the global reset on C66x DSPs to allow loading into the DSP +* internal RAMs. The .prepare() ops is invoked by remoteproc core before any +* firmware loading, and is followed by the .start() ops after loading to +* actually let the C66x DSP cores run. +*/ +static int k3_dsp_rproc_prepare (struct rproc *rproc) +{ +struct k3_dsp_rproc *kproc = rproc->priv; +struct device *dev = kproc->dev; +int ret; + + ret = kproc->ti_sci->ops.dev_ops.get_device (kproc->ti_sci, + kproc->ti_sci_id); +if (ret) +dev_err (dev,"module-reset deassert failed, cannot enable internal RAM loading, ret = %d\n" , + ret); + +return ret; +} + +/* +* This function implements the .unprepare() ops and performs the complimentary +* operations to that of the .prepare() ops. The function is used to assert the +* global reset on applicable C66x cores. This completes the second portion of +* powering down the C66x DSP cores. The cores themselves are only halted in the +* .stop() callback through the local reset, and the .unprepare() ops is invoked +* by the remoteproc core after the remoteproc is stopped to balance the global +* reset. +*/ +static int k3_dsp_rproc_unprepare (struct rproc *rproc) +{ +struct k3_dsp_rproc *kproc = rproc->priv; +struct device *dev = kproc->dev; +int ret; + + ret = kproc->ti_sci->ops.dev_ops.put_device (kproc->ti_sci, + kproc->ti_sci_id); +if (ret) +dev_err (dev,"module-reset assert failed, ret = %d\n" , ret); + +return ret; +} +/* * Power up the DSP remote processor. *
@@ -353,6 +407,8 @@ static void *k3_dsp_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len) }static const struct rproc_ops k3_dsp_rproc_ops = { + .prepare = k3_dsp_rproc_prepare, + .unprepare = k3_dsp_rproc_unprepare, .start = k3_dsp_rproc_start, .stop = k3_dsp_rproc_stop, .kick = k3_dsp_rproc_kick,
@@ -615,6 +671,22 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev) goto release_tsp; } +/* +* ensure the DSP local reset is asserted to ensure the DSP doesn't +* execute bogus code in .prepare() when the module reset is released. +*/ +if (data->uses_lreset) { + ret =reset_control_status (kproc->reset); +if (ret <0 ) { +dev_err (dev,"failed to get reset status, status = %d\n" , + ret); + goto release_mem; + }else if (ret ==0 ) { +dev_warn (dev,"local reset is deasserted for device\n" ); +k3_dsp_rproc_reset (kproc); + } + } + ret =rproc_add (rproc);if (ret) { dev_err(dev, "failed to add register device with remoteproc core, status = %d\n",
Signature · 1 line
2.26.0