dt-bindings: Document JZ47xx VPU auxiliary processor
Paul Cercueil
maintainerPATCH v4 1/5 dt-bindings: Document JZ47xx VPU auxiliary processor
Inside the Video Processing Unit (VPU) of the recent JZ47xx SoCs from Ingenic is a second Xburst MIPS CPU very similar to the main core. This document describes the devicetree bindings for this auxiliary processor.
---
Notes:
v2: Update TCSM0 address in example
v3: Change node name to 'video-decoder'
v4: Convert to YAML. I didn't add Rob's Ack on v3 because of that (sorry Rob)
.../bindings/remoteproc/ingenic,vpu.yaml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/ingenic,vpu.yaml
Documentation/devicetree/bindings/remoteproc/ingenic,vpu.yaml new file +76 -0
@@ -0,0 +1,76 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/remoteproc/ingenic,vpu.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Ingenic Video Processing Unit bindings + +description: + Inside the Video Processing Unit (VPU) of the recent JZ47xx SoCs from + Ingenic is a second Xburst MIPS CPU very similar to the main core. + This document describes the devicetree bindings for this auxiliary + processor. + +maintainers: + - Paul Cercueil <[email protected]> + +properties: + compatible: + const: ingenic,jz4770-vpu-rproc + + reg: + items: + - description: aux registers + - description: tcsm0 registers + - description: tcsm1 registers + - description: sram registers + + reg-names: + items: + - const: aux + - const: tcsm0 + - const: tcsm1 + - const: sram + + clocks: + items: + - description: aux clock + - description: vpu clock + + clock-names: + items: + - const: aux + - const: vpu + + interrupts: + description: VPU hardware interrupt + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - interrupts + +additionalProperties: false + +examples: + - | + vpu: video-decoder@132a0000 { + compatible = "ingenic,jz4770-vpu-rproc"; + + reg = <0x132a0000 0x20 /* AUX */ + 0x132b0000 0x4000 /* TCSM0 */ + 0x132c0000 0xc000 /* TCSM1 */ + 0x132f0000 0x7000 /* SRAM */ + >; + reg-names = "aux", "tcsm0", "tcsm1", "sram"; + + clocks = <&cgu JZ4770_CLK_AUX>, <&cgu JZ4770_CLK_VPU>; + clock-names = "aux", "vpu"; + + interrupt-parent = <&cpuintc>; + interrupts = <3>; + };
Signature · 1 line
2.24.0
Paul Cercueil
maintainerPATCH v4 2/5 remoteproc: Add device-managed variants of rproc_alloc/rproc_add
Add API functions devm_rproc_alloc() and devm_rproc_add(), which behave like rproc_alloc() and rproc_add() respectively, but register their respective cleanup function to be called on driver detach.
---
Notes:
v3: New patch
v4: No change
drivers/remoteproc/remoteproc_core.c | 67 ++++++++++++++++++++++++++++ include/linux/remoteproc.h | 5 +++ 2 files changed, 72 insertions(+)
drivers/remoteproc/remoteproc_core.c +67 -0
@@ -1932,6 +1932,33 @@ int rproc_add(struct rproc *rproc) }EXPORT_SYMBOL (rproc_add); +static void devm_rproc_remove (void *rproc) +{ +rproc_del (rproc); +} + +/** +* devm_rproc_add() - resource managed rproc_add() +* @dev: the underlying device +* @rproc: the remote processor handle to register +* +* This function performs like rproc_add() but the registered rproc device will +* automatically be removed on driver detach. +* +* Returns 0 on success and an appropriate error code otherwise. +*/ +int devm_rproc_add (struct device *dev,struct rproc *rproc) +{ +int err; + + err =rproc_add (rproc); +if (err) +return err; + +return devm_add_action_or_reset (dev, devm_rproc_remove, rproc); +} +EXPORT_SYMBOL (devm_rproc_add); +/** * rproc_type_release() - release a remote processor instance * @dev: the rproc's device
@@ -2149,6 +2176,46 @@ int rproc_del(struct rproc *rproc) }EXPORT_SYMBOL (rproc_del); +static void devm_rproc_free (struct device *dev,void *res) +{ +rproc_free (*(struct rproc **)res); +} + +/** +* devm_rproc_alloc() - resource managed rproc_alloc() +* @dev: the underlying device +* @name: name of this remote processor +* @ops: platform-specific handlers (mainly start/stop) +* @firmware: name of firmware file to load, can be NULL +* @len: length of private data needed by the rproc driver (in bytes) +* +* This function performs like rproc_alloc() but the acuired rproc device will +* automatically be released on driver detach. +* +* On success the new rproc is returned, and on failure, NULL. +*/ +struct rproc *devm_rproc_alloc (struct device *dev,const char *name, +const struct rproc_ops *ops, +const char *firmware,int len) +{ +struct rproc **ptr, *rproc; + + ptr =devres_alloc (devm_rproc_free,sizeof (*ptr),GFP_KERNEL ); +if (!ptr) +return ERR_PTR (-ENOMEM ); + + rproc =rproc_alloc (dev, name, ops, firmware, len); +if (rproc) { + *ptr = rproc; +devres_add (dev, ptr); + }else { +devres_free (ptr); + } + +return rproc; +} +EXPORT_SYMBOL (devm_rproc_alloc); +/** * rproc_add_subdev() - add a subdevice to a remoteproc * @rproc: rproc handle to add the subdevice to
include/linux/remoteproc.h +5 -0
@@ -595,6 +595,11 @@ int rproc_add(struct rproc *rproc);int rproc_del (struct rproc *rproc);void rproc_free (struct rproc *rproc); +struct rproc *devm_rproc_alloc (struct device *dev,const char *name, +const struct rproc_ops *ops, +const char *firmware,int len); +int devm_rproc_add (struct device *dev,struct rproc *rproc); +void rproc_add_carveout (struct rproc *rproc,struct rproc_mem_entry *mem); struct rproc_mem_entry *
Signature · 1 line
2.24.0
Re: [PATCH v4 2/5] remoteproc: Add device-managed variants of rproc_alloc/rproc_add
Hi Paul,
Good initiative! See me remarks below.
drivers/remoteproc/remoteproc_core.c
Quoted 19 lines · Paul Cercueil
Add API functions
devm_rproc_alloc()anddevm_rproc_add(), which behave likerproc_alloc()andrproc_add()respectively, but register their respective cleanup function to be called on driver detach.Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v3: New patch
v4: No changedrivers/remoteproc/remoteproc_core.c | 67 ++++++++++++++++++++++++++++ include/linux/remoteproc.h | 5 +++ 2 files changed, 72 insertions(+)drivers/remoteproc/remoteproc_core.c +0
-0
Maybe these devm function shall be defined in a new remoteproc/devres.c file. Although it seems to be a common usage I don't know if there is a rule for that.
Quoted 42 lines
drivers/remoteproc/remoteproc_core.c +31
-0@@ -1932,6 +1932,33 @@ int rproc_add(struct rproc *rproc) }EXPORT_SYMBOL (rproc_add); +static void devm_rproc_remove (void *rproc) +{ +rproc_del (rproc); +} + +/** +* devm_rproc_add() - resource managed rproc_add() +* @dev: the underlying device +* @rproc: the remote processor handle to register +* +* This function performs like rproc_add() but the registered rproc device will +* automatically be removed on driver detach. +* +* Returns 0 on success and an appropriate error code otherwise. +*/ +int devm_rproc_add (struct device *dev,struct rproc *rproc) +{ +int err; + + err =rproc_add (rproc); +if (err) +return err; + +return devm_add_action_or_reset (dev, devm_rproc_remove, rproc); +} +EXPORT_SYMBOL (devm_rproc_add); +/** * rproc_type_release() - release a remote processor instance * @dev: the rproc's device @@ -2149,6 +2176,46 @@ int rproc_del(struct rproc *rproc) }EXPORT_SYMBOL (rproc_del); +static void devm_rproc_free (struct device *dev,void *res) +{ +rproc_free (*(struct rproc **)res); +}
drivers/remoteproc/remoteproc_core.c int rproc_del(struct rproc *rproc) · line 2192
Quoted 10 lines
drivers/remoteproc/remoteproc_core.c +10
-0+ +/** +* devm_rproc_alloc() - resource managed rproc_alloc() +* @dev: the underlying device +* @name: name of this remote processor +* @ops: platform-specific handlers (mainly start/stop) +* @firmware: name of firmware file to load, can be NULL +* @len: length of private data needed by the rproc driver (in bytes) +* +* This function performs like rproc_alloc() but the acuired rproc device will
typo: s/acuired/acquired
Quoted 13 lines
drivers/remoteproc/remoteproc_core.c +13
-0+* automatically be released on driver detach. +* +* On success the new rproc is returned, and on failure, NULL. +*/ +struct rproc *devm_rproc_alloc (struct device *dev,const char *name, +const struct rproc_ops *ops, +const char *firmware,int len) +{ +struct rproc **ptr, *rproc; + + ptr =devres_alloc (devm_rproc_free,sizeof (*ptr),GFP_KERNEL ); +if (!ptr) +return ERR_PTR (-ENOMEM );
drivers/remoteproc/remoteproc_core.c int rproc_del(struct rproc *rproc) · line 2215
Quoted 10 lines
drivers/remoteproc/remoteproc_core.c +10
-0+ + rproc =rproc_alloc (dev, name, ops, firmware, len); +if (rproc) { + *ptr = rproc; +devres_add (dev, ptr); + }else { +devres_free (ptr); + } + +return rproc;
Can't you use devm_add_action_or_reset() here too?
Quoted 12 lines
drivers/remoteproc/remoteproc_core.c +3
-0+} +EXPORT_SYMBOL (devm_rproc_alloc); +/** * rproc_add_subdev() - add a subdevice to a remoteproc * @rproc: rproc handle to add the subdevice to include/linux/remoteproc.h +0
-0@@ -595,6 +595,11 @@ int rproc_add(struct rproc *rproc);int rproc_del (struct rproc *rproc);
include/linux/remoteproc.h int rproc_add(struct rproc *rproc); · line 605
Quoted 10 lines
include/linux/remoteproc.h +5
-0void rproc_free (struct rproc *rproc); +struct rproc *devm_rproc_alloc (struct device *dev,const char *name, +const struct rproc_ops *ops, +const char *firmware,int len); +int devm_rproc_add (struct device *dev,struct rproc *rproc); +void rproc_add_carveout (struct rproc *rproc,struct rproc_mem_entry *mem); struct rproc_mem_entry *
BR
Fabien
Paul Cercueil
maintainerRe: [PATCH v4 2/5] remoteproc: Add device-managed variants of rproc_alloc/rproc_add
Hi Fabien,
Quoted 31 lines · Fabien DESSENNE
Hi Paul,
Good initiative! See me remarks below.
Quoted 17 lines · Paul Cercueil
Add API functions
devm_rproc_alloc()anddevm_rproc_add(), which
behave
likerproc_alloc()andrproc_add()respectively, but register their respective cleanup function to be called on driver detach.Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v3: New patch
v4: No changedrivers/remoteproc/remoteproc_core.c | 67 ++++++++++++++++++++++++++++ include/linux/remoteproc.h | 5 +++ 2 files changed, 72 insertions(+)Quoted 5 lines
diff --git
a/drivers/remoteproc/remoteproc_core.cb/drivers/remoteproc/remoteproc_core.c
index307df98347ba..0a9fc7fdd1c3100644 ---a/drivers/remoteproc/remoteproc_core.c+++b/drivers/remoteproc/remoteproc_core.c
Quoted 3 lines
Maybe these devm function shall be defined in a new
remoteproc/devres.cfile. Although it seems to be a common usage I don't know if there is a rule for that.
It's not a rule, more like a good practice. I'll do that.
Quoted 87 lines
Quoted 40 lines
@@ -1932,6 +1932,33 @@ int
rproc_add(struct rproc *rproc)
}
EXPORT_SYMBOL(rproc_add);+static void
devm_rproc_remove(void *rproc)
+{
+rproc_del(rproc);
+}
+
+/**
+ *devm_rproc_add()- resource managedrproc_add()
+ * @dev: the underlying device
+ * @rproc: the remote processor handle to register
+ *
+ * This function performs likerproc_add()but the registered
rproc device will
+ * automatically be removed on driver detach.
+ *
+ * Returns 0 on success and an appropriate error code otherwise.
+ */
+intdevm_rproc_add(struct device *dev, struct rproc *rproc)+{
+ int err;
+
+ err =rproc_add(rproc);
+ if (err)
+ return err;
+
+ returndevm_add_action_or_reset(dev, devm_rproc_remove, rproc);
+}
+EXPORT_SYMBOL(devm_rproc_add);
+
/**
*rproc_type_release()- release a remote processor instance
* @dev: the rproc's device
@@ -2149,6 +2176,46 @@ intrproc_del(struct rproc *rproc)
}
EXPORT_SYMBOL(rproc_del);Quoted 16 lines
+static void
devm_rproc_free(struct device *dev, void *res)+{
+rproc_free(*(struct rproc **)res);
+}
+
+/**
+ *devm_rproc_alloc()- resource managedrproc_alloc()
+ * @dev: the underlying device
+ * @name: name of this remote processor
+ * @ops: platform-specific handlers (mainly start/stop)
+ * @firmware: name of firmware file to load, can be NULL
+ * @len: length of private data needed by the rproc driver (in
bytes)
+ *
+ * This function performs likerproc_alloc()but the acuired rproc
device willtypo: s/acuired/acquired
Quoted 16 lines
+ * automatically be released on driver detach.
+ *
+ * On success the new rproc is returned, and on failure, NULL.
+ */
+struct rproc *devm_rproc_alloc(struct device *dev, const char
*name,
+ const structrproc_ops*ops,
+ const char *firmware, int len)
+{
+ struct rproc **ptr, *rproc;
+
+ ptr =devres_alloc(devm_rproc_free, sizeof(*ptr), GFP_KERNEL);
+ if (!ptr)
+ returnERR_PTR(-ENOMEM);
+
+ rproc =rproc_alloc(dev, name, ops, firmware, len);Quoted 8 lines
+ if (rproc) {
+ *ptr = rproc;
+devres_add(dev, ptr);
+ } else {
+devres_free(ptr);
+ }
+
+ return rproc;
Quoted 1 line
Can't you use
devm_add_action_or_reset()here too?
Yes, I guess that will make things simpler.
Thanks,
-Paul
Quoted 30 lines
Quoted 24 lines
+}
+EXPORT_SYMBOL(devm_rproc_alloc);
+
/**
*rproc_add_subdev()- add a subdevice to a remoteproc
* @rproc: rproc handle to add the subdevice to
diff --gita/include/linux/remoteproc.hb/include/linux/remoteproc.hindex16ad66683ad0..5f201f0c86c3100644
---a/include/linux/remoteproc.h
+++b/include/linux/remoteproc.h@@ -595,6 +595,11 @@ int rproc_add(struct rproc *rproc); int rproc_del(struct rproc *rproc); void rproc_free(struct rproc *rproc);+struct rproc *devm_rproc_alloc(struct device *dev, const char
*name,
+ const structrproc_ops*ops,
+ const char *firmware, int len);
+intdevm_rproc_add(struct device *dev, struct rproc *rproc); +
void rproc_add_carveout(struct rproc *rproc, structrproc_mem_entry*mem);Quoted 1 line
struct
rproc_mem_entry*BR
Fabien
Re: [PATCH v4 2/5] remoteproc: Add device-managed variants of rproc_alloc/rproc_add
In reply to Fabien DESSENNEQuoted 5 lines · Fabien DESSENNE
Hi Paul,
Good initiative! See me remarks below.
I concur!
Quoted 17 lines · Paul Cercueil
Quoted 15 lines
Add API functions
devm_rproc_alloc()anddevm_rproc_add(), which behave likerproc_alloc()andrproc_add()respectively, but register their respective cleanup function to be called on driver detach.Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v3: New patch
v4: No changedrivers/remoteproc/remoteproc_core.c | 67 ++++++++++++++++++++++++++++ include/linux/remoteproc.h | 5 +++ 2 files changed, 72 insertions(+)
Quoted 10 lines
drivers/remoteproc/remoteproc_core.c
Quoted 4 lines
drivers/remoteproc/remoteproc_core.c +0
-0Maybe these devm function shall be defined in a new
remoteproc/devres.cfile. Although it seems to be a common usage I don't know if there is a rule for that.
Let's keep it in this same file, the devres.c would be tiny.
Quoted 76 lines
Quoted 43 lines
drivers/remoteproc/remoteproc_core.c +31
-0@@ -1932,6 +1932,33 @@ int rproc_add(struct rproc *rproc) }EXPORT_SYMBOL (rproc_add); +static void devm_rproc_remove (void *rproc) +{ +rproc_del (rproc); +} + +/** +* devm_rproc_add() - resource managed rproc_add() +* @dev: the underlying device +* @rproc: the remote processor handle to register +* +* This function performs like rproc_add() but the registered rproc device will +* automatically be removed on driver detach. +* +* Returns 0 on success and an appropriate error code otherwise. +*/ +int devm_rproc_add (struct device *dev,struct rproc *rproc) +{ +int err; + + err =rproc_add (rproc); +if (err) +return err; + +return devm_add_action_or_reset (dev, devm_rproc_remove, rproc); +} +EXPORT_SYMBOL (devm_rproc_add); +/** * rproc_type_release() - release a remote processor instance * @dev: the rproc's device @@ -2149,6 +2176,46 @@ int rproc_del(struct rproc *rproc) }EXPORT_SYMBOL (rproc_del); +static void devm_rproc_free (struct device *dev,void *res) +{ +rproc_free (*(struct rproc **)res); +}drivers/remoteproc/remoteproc_core.c int rproc_del(struct rproc *rproc) · line 2192
Quoted 10 lines
drivers/remoteproc/remoteproc_core.c +10
-0+ +/** +* devm_rproc_alloc() - resource managed rproc_alloc() +* @dev: the underlying device +* @name: name of this remote processor +* @ops: platform-specific handlers (mainly start/stop) +* @firmware: name of firmware file to load, can be NULL +* @len: length of private data needed by the rproc driver (in bytes) +* +* This function performs like rproc_alloc() but the acuired rproc device will typo: s/acuired/acquired
Quoted 18 lines
drivers/remoteproc/remoteproc_core.c +18
-0+* automatically be released on driver detach. +* +* On success the new rproc is returned, and on failure, NULL. +*/ +struct rproc *devm_rproc_alloc (struct device *dev,const char *name, +const struct rproc_ops *ops, +const char *firmware,int len) +{ +struct rproc **ptr, *rproc; + + ptr =devres_alloc (devm_rproc_free,sizeof (*ptr),GFP_KERNEL ); +if (!ptr) +return ERR_PTR (-ENOMEM ); + + rproc =rproc_alloc (dev, name, ops, firmware, len); +if (rproc) { + *ptr = rproc; +devres_add (dev, ptr);
Quoted 9 lines
drivers/remoteproc/remoteproc_core.c int rproc_del(struct rproc *rproc) · line 2215
Quoted 5 lines
drivers/remoteproc/remoteproc_core.c +5
-0+ }else { +devres_free (ptr); + } + +return rproc;Can't you use
devm_add_action_or_reset()here too?
The proposed function matches how everyone else is doing devm_*_alloc(), so I would like to keep it as is.
Regards,
Bjorn
Quoted 28 lines
Quoted 13 lines
drivers/remoteproc/remoteproc_core.c +3
-0+} +EXPORT_SYMBOL (devm_rproc_alloc); +/** * rproc_add_subdev() - add a subdevice to a remoteproc * @rproc: rproc handle to add the subdevice to include/linux/remoteproc.h +0
-0@@ -595,6 +595,11 @@ int rproc_add(struct rproc *rproc);int rproc_del (struct rproc *rproc);include/linux/remoteproc.h int rproc_add(struct rproc *rproc); · line 605
Quoted 10 lines
include/linux/remoteproc.h +5
-0void rproc_free (struct rproc *rproc); +struct rproc *devm_rproc_alloc (struct device *dev,const char *name, +const struct rproc_ops *ops, +const char *firmware,int len); +int devm_rproc_add (struct device *dev,struct rproc *rproc); +void rproc_add_carveout (struct rproc *rproc,struct rproc_mem_entry *mem); struct rproc_mem_entry *BR
Fabien
Re: [PATCH v4 2/5] remoteproc: Add device-managed variants of rproc_alloc/rproc_add
In reply to Paul CercueilHi Paul,
I tested it on our driver and freeing/remove are called correctly on probe error and on module removal.
Regards,
Clément
Quoted 119 lines · ----- On 10 Dec, 2019, at 17:40, Paul Cercueil [email protected] wrote:
Add API functions
devm_rproc_alloc()anddevm_rproc_add(), which behave likerproc_alloc()andrproc_add()respectively, but register their respective cleanup function to be called on driver detach.Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v3: New patch
v4: No change
drivers/remoteproc/remoteproc_core.c| 67 ++++++++++++++++++++++++++++include/linux/remoteproc.h| 5 +++2 files changed, 72 insertions(+)drivers/remoteproc/remoteproc_core.c +67
-0@@ -1932,6 +1932,33 @@ int rproc_add(struct rproc *rproc) }EXPORT_SYMBOL (rproc_add); +static void devm_rproc_remove (void *rproc) +{ +rproc_del (rproc); +} + +/** +* devm_rproc_add() - resource managed rproc_add() +* @dev: the underlying device +* @rproc: the remote processor handle to register +* +* This function performs like rproc_add() but the registered rproc device will +* automatically be removed on driver detach. +* +* Returns 0 on success and an appropriate error code otherwise. +*/ +int devm_rproc_add (struct device *dev,struct rproc *rproc) +{ +int err; + + err =rproc_add (rproc); +if (err) +return err; + +return devm_add_action_or_reset (dev, devm_rproc_remove, rproc); +} +EXPORT_SYMBOL (devm_rproc_add); +/** * rproc_type_release() - release a remote processor instance * @dev: the rproc's device @@ -2149,6 +2176,46 @@ int rproc_del(struct rproc *rproc) }EXPORT_SYMBOL (rproc_del); +static void devm_rproc_free (struct device *dev,void *res) +{ +rproc_free (*(struct rproc **)res); +} + +/** +* devm_rproc_alloc() - resource managed rproc_alloc() +* @dev: the underlying device +* @name: name of this remote processor +* @ops: platform-specific handlers (mainly start/stop) +* @firmware: name of firmware file to load, can be NULL +* @len: length of private data needed by the rproc driver (in bytes) +* +* This function performs like rproc_alloc() but the acuired rproc device will +* automatically be released on driver detach. +* +* On success the new rproc is returned, and on failure, NULL. +*/ +struct rproc *devm_rproc_alloc (struct device *dev,const char *name, +const struct rproc_ops *ops, +const char *firmware,int len) +{ +struct rproc **ptr, *rproc; + + ptr =devres_alloc (devm_rproc_free,sizeof (*ptr),GFP_KERNEL ); +if (!ptr) +return ERR_PTR (-ENOMEM ); + + rproc =rproc_alloc (dev, name, ops, firmware, len); +if (rproc) { + *ptr = rproc; +devres_add (dev, ptr); + }else { +devres_free (ptr); + } + +return rproc; +} +EXPORT_SYMBOL (devm_rproc_alloc); +/** * rproc_add_subdev() - add a subdevice to a remoteproc * @rproc: rproc handle to add the subdevice to include/linux/remoteproc.h +5
-0@@ -595,6 +595,11 @@ int rproc_add(struct rproc *rproc);int rproc_del (struct rproc *rproc);void rproc_free (struct rproc *rproc); +struct rproc *devm_rproc_alloc (struct device *dev,const char *name, +const struct rproc_ops *ops, +const char *firmware,int len); +int devm_rproc_add (struct device *dev,struct rproc *rproc); +void rproc_add_carveout (struct rproc *rproc,struct rproc_mem_entry *mem);struct
rproc_mem_entry*
--
2.24.0
Paul Cercueil
maintainerRe: [PATCH v4 2/5] remoteproc: Add device-managed variants of rproc_alloc/rproc_add
Hi Clément,
Quoted 5 lines · Clément Leger
Hi Paul,
I tested it on our driver and freeing/remove are called correctly on probe error and on module removal.
Tested-by Clement Leger <[email protected]>
Great, thanks.
Did you also test the prepare/unprepare callbacks? Is it working for you?
Thanks,
-Paul
Quoted 130 lines
----- On 10 Dec, 2019, at 17:40, Paul Cercueil [email protected]
Quoted 127 lines · wrote:
Add API functions
devm_rproc_alloc()anddevm_rproc_add(), which
behave
likerproc_alloc()andrproc_add()respectively, but register their respective cleanup function to be called on driver detach.Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v3: New patch
v4: No changedrivers/remoteproc/remoteproc_core.c | 67 ++++++++++++++++++++++++++++ include/linux/remoteproc.h | 5 +++ 2 files changed, 72 insertions(+)diff --git
a/drivers/remoteproc/remoteproc_core.cb/drivers/remoteproc/remoteproc_core.c
index307df98347ba..0a9fc7fdd1c3100644
---a/drivers/remoteproc/remoteproc_core.c
+++b/drivers/remoteproc/remoteproc_core.c
@@ -1932,6 +1932,33 @@ intrproc_add(struct rproc *rproc)}
EXPORT_SYMBOL(rproc_add);+static void
devm_rproc_remove(void *rproc)
+{
+rproc_del(rproc);
+}
+
+/**
+ *devm_rproc_add()- resource managedrproc_add()
+ * @dev: the underlying device
+ * @rproc: the remote processor handle to register
+ *
+ * This function performs likerproc_add()but the registered
rproc device will
+ * automatically be removed on driver detach.
+ *
+ * Returns 0 on success and an appropriate error code otherwise.
+ */
+intdevm_rproc_add(struct device *dev, struct rproc *rproc)+{
+ int err;
+
+ err =rproc_add(rproc);
+ if (err)
+ return err;
+
+ returndevm_add_action_or_reset(dev, devm_rproc_remove, rproc);
+}
+EXPORT_SYMBOL(devm_rproc_add);
+
/**
*rproc_type_release()- release a remote processor instance
* @dev: the rproc's device
@@ -2149,6 +2176,46 @@ intrproc_del(struct rproc *rproc)}
EXPORT_SYMBOL(rproc_del);+static void
devm_rproc_free(struct device *dev, void *res)+{
+rproc_free(*(struct rproc **)res);
+}
+
+/**
+ *devm_rproc_alloc()- resource managedrproc_alloc()
+ * @dev: the underlying device
+ * @name: name of this remote processor
+ * @ops: platform-specific handlers (mainly start/stop)
+ * @firmware: name of firmware file to load, can be NULL
+ * @len: length of private data needed by the rproc driver (in
bytes)
+ *
+ * This function performs likerproc_alloc()but the acuired rproc
device will
+ * automatically be released on driver detach.
+ *
+ * On success the new rproc is returned, and on failure, NULL.
+ */
+struct rproc *devm_rproc_alloc(struct device *dev, const char
*name,
+ const structrproc_ops*ops,
+ const char *firmware, int len)
+{
+ struct rproc **ptr, *rproc;
+
+ ptr =devres_alloc(devm_rproc_free, sizeof(*ptr), GFP_KERNEL);
+ if (!ptr)
+ returnERR_PTR(-ENOMEM);
+
+ rproc =rproc_alloc(dev, name, ops, firmware, len);
+ if (rproc) {
+ *ptr = rproc;
+devres_add(dev, ptr);
+ } else {
+devres_free(ptr);
+ }
+
+ return rproc;
+}
+EXPORT_SYMBOL(devm_rproc_alloc);
+
/**
*rproc_add_subdev()- add a subdevice to a remoteproc
* @rproc: rproc handle to add the subdevice to
diff --gita/include/linux/remoteproc.hb/include/linux/remoteproc.hindex16ad66683ad0..5f201f0c86c3100644
---a/include/linux/remoteproc.h
+++b/include/linux/remoteproc.h
@@ -595,6 +595,11 @@ intrproc_add(struct rproc *rproc); intrproc_del(struct rproc *rproc);
voidrproc_free(struct rproc *rproc);+struct rproc *devm_rproc_alloc(struct device *dev, const char
*name,
+ const structrproc_ops*ops,
+ const char *firmware, int len);
+intdevm_rproc_add(struct device *dev, struct rproc *rproc); +
void rproc_add_carveout(struct rproc *rproc, structrproc_mem_entry
*mem);struct
rproc_mem_entry*
--
2.24.0
Re: [PATCH v4 2/5] remoteproc: Add device-managed variants of rproc_alloc/rproc_add
In reply to Paul CercueilOn Tue 10 Dec 08:40 PST 2019, Paul Cercueil wrote:
[..]
Quoted 9 lines
+/**
+ *devm_rproc_add()- resource managedrproc_add()
+ * @dev: the underlying device
+ * @rproc: the remote processor handle to register
+ *
+ * This function performs likerproc_add()but the registered rproc device will
+ * automatically be removed on driver detach.
+ *
+ * Returns 0 on success and an appropriate error code otherwise.
The kerneldoc format is "Return: foo on bar...". So please update this to
Return: 0 on success, negative errno on failure
Quoted 3 lines
+ */
drivers/remoteproc/remoteproc_core.c +2
-0+int devm_rproc_add (struct device *dev,struct rproc *rproc) +{
[..]
Quoted 4 lines
+/**
+ *devm_rproc_alloc()- resource managedrproc_alloc()
+ * @dev: the underlying device
+ * @name: name of this remote processor
Quoted 8 lines
+ * @ops: platform-specific handlers (mainly start/stop)
+ * @firmware: name of firmware file to load, can be NULL
+ * @len: length of private data needed by the rproc driver (in bytes)
+ *
+ * This function performs likerproc_alloc()but the acuired rproc device will
+ * automatically be released on driver detach.
+ *
+ * On success the new rproc is returned, and on failure, NULL.
Return: new rproc instance, NULL on failure
Regards,
Bjorn
Paul Cercueil
maintainerPATCH v4 3/5 remoteproc: Add prepare/unprepare callbacks
In reply to Paul CercueilThe .prepare() callback is called before the firmware is loaded to memory. This is useful for instance in the case where some setup is required for the memory to be accessible.
---
Notes:
v2-v4: No change
drivers/remoteproc/remoteproc_core.c | 16 +++++++++++++++- include/linux/remoteproc.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-)
drivers/remoteproc/remoteproc_core.c +15 -1
@@ -1299,11 +1299,19 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw)struct device *dev = &rproc->dev;int ret; +if (rproc->ops->prepare) { + ret = rproc->ops->prepare (rproc); +if (ret) { +dev_err (dev,"Failed to prepare rproc: %d\n" , ret); +return ret; + } + } +/* load the ELF segments to memory */ ret =rproc_load_segments (rproc, fw);if (ret) {dev_err (dev,"Failed to load program segments: %d\n" , ret); -return ret; + goto unprepare_rproc; }/*
@@ -1354,6 +1362,9 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw)rproc_unprepare_subdevices (rproc); reset_table_ptr: rproc->table_ptr = rproc->cached_table; +unprepare_rproc: +if (rproc->ops->unprepare) + rproc->ops->unprepare (rproc);return ret; }
@@ -1483,6 +1494,9 @@ static int rproc_stop(struct rproc *rproc, bool crashed) rproc->state =RPROC_OFFLINE ; +if (rproc->ops->unprepare) + rproc->ops->unprepare (rproc); +dev_info (dev,"stopped remote processor %s\n" , rproc->name);return 0 ;
include/linux/remoteproc.h +4 -0
@@ -355,6 +355,8 @@ enum rsc_handling_status {/** * struct rproc_ops - platform-specific device handlers +* @prepare: prepare the device for power up (before the firmware is loaded) +* @unprepare: unprepare the device after it is stopped * @start: power on the device and boot it * @stop: power off the device * @kick: kick a virtqueue (virtqueue id given as a parameter)
@@ -371,6 +373,8 @@ enum rsc_handling_status {* @get_boot_addr: get boot address to entry point specified in firmware */ struct rproc_ops { +int (*prepare)(struct rproc *rproc); +void (*unprepare)(struct rproc *rproc);int (*start)(struct rproc *rproc);int (*stop)(struct rproc *rproc);void (*kick)(struct rproc *rproc,int vqid);
Signature · 1 line
2.24.0
Re: [PATCH v4 3/5] remoteproc: Add prepare/unprepare callbacks
Hi Paul
Quoted 3 lines · Paul Cercueil
The .prepare() callback is called before the firmware is loaded to memory. This is useful for instance in the case where some setup is required for the memory to be accessible.
I am trying to figure out what king of 'setup' may be required. From the ingenic driver I understand that you need to enable clocks to allow some memory access.
Instead of adding this new ops, why not enabling clocks in probe()?
BR
Fabien
Quoted 78 lines
Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2-v4: No changedrivers/remoteproc/remoteproc_core.c | 16 +++++++++++++++- include/linux/remoteproc.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-)drivers/remoteproc/remoteproc_core.c +15
-1@@ -1299,11 +1299,19 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw)struct device *dev = &rproc->dev;int ret; +if (rproc->ops->prepare) { + ret = rproc->ops->prepare (rproc); +if (ret) { +dev_err (dev,"Failed to prepare rproc: %d\n" , ret); +return ret; + } + } +/* load the ELF segments to memory */ ret =rproc_load_segments (rproc, fw);if (ret) {dev_err (dev,"Failed to load program segments: %d\n" , ret); -return ret; + goto unprepare_rproc; }/* @@ -1354,6 +1362,9 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw)rproc_unprepare_subdevices (rproc); reset_table_ptr: rproc->table_ptr = rproc->cached_table; +unprepare_rproc: +if (rproc->ops->unprepare) + rproc->ops->unprepare (rproc);return ret; }@@ -1483,6 +1494,9 @@ static int rproc_stop(struct rproc *rproc, bool crashed) rproc->state =RPROC_OFFLINE ; +if (rproc->ops->unprepare) + rproc->ops->unprepare (rproc); +dev_info (dev,"stopped remote processor %s\n" , rproc->name);return 0 ;include/linux/remoteproc.h +4
-0@@ -355,6 +355,8 @@ enum rsc_handling_status {/** * struct rproc_ops - platform-specific device handlers +* @prepare: prepare the device for power up (before the firmware is loaded) +* @unprepare: unprepare the device after it is stopped * @start: power on the device and boot it * @stop: power off the device * @kick: kick a virtqueue (virtqueue id given as a parameter) @@ -371,6 +373,8 @@ enum rsc_handling_status {* @get_boot_addr: get boot address to entry point specified in firmware */ struct rproc_ops { +int (*prepare)(struct rproc *rproc); +void (*unprepare)(struct rproc *rproc);int (*start)(struct rproc *rproc);int (*stop)(struct rproc *rproc);void (*kick)(struct rproc *rproc,int vqid);
Paul Cercueil
maintainerRe: [PATCH v4 3/5] remoteproc: Add prepare/unprepare callbacks
Hi Fabien,
Quoted 9 lines · Fabien DESSENNE
Hi Paul
Quoted 3 lines · Paul Cercueil
The .prepare() callback is called before the firmware is loaded to memory. This is useful for instance in the case where some setup is required for the memory to be accessible.
Quoted 5 lines
I am trying to figure out what king of 'setup' may be required. From the ingenic driver I understand that you need to enable clocks to allow some memory access.
Instead of adding this new ops, why not enabling clocks in
probe()?
Enabling the clocks in the probe means that the clocks will be unconditionally enabled until the driver is removed, even if the remote processor end up being unused. That would be a waste of power.
Cheers,
-Paul
Quoted 90 lines
BR
Fabien
Quoted 84 lines
Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2-v4: No changedrivers/remoteproc/remoteproc_core.c | 16 +++++++++++++++- include/linux/remoteproc.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-)diff --git
a/drivers/remoteproc/remoteproc_core.cb/drivers/remoteproc/remoteproc_core.c
index0a9fc7fdd1c3..3ea5f675a148100644
---a/drivers/remoteproc/remoteproc_core.c
+++b/drivers/remoteproc/remoteproc_core.c
@@ -1299,11 +1299,19 @@ static int rproc_start(struct rproc *rproc,
const struct firmware *fw)struct device *dev = &rproc->dev; int ret;+ if (
rproc->ops->prepare) {
+ ret =rproc->ops->prepare(rproc);
+ if (ret) {
+dev_err(dev, "Failed to prepare rproc: %d\n", ret);
+ return ret;
+ }
+ }
+
/* load the ELF segments to memory */ret = rproc_load_segments(rproc, fw); if (ret) { dev_err(dev, "Failed to load program segments: %d\n", ret); - return ret; + goto unprepare_rproc; } /* @@ -1354,6 +1362,9 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) rproc_unprepare_subdevices(rproc); reset_table_ptr: rproc->table_ptr = rproc->cached_table;+unprepare_rproc:
+ if (rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);return ret; }@@ -1483,6 +1494,9 @@ static int rproc_stop(struct rproc *rproc,
bool crashed)rproc->state = RPROC_OFFLINE;+ if (
rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);
+
dev_info(dev, "stopped remote processor %s\n", rproc->name);return 0;diff --git
a/include/linux/remoteproc.hb/include/linux/remoteproc.hindex5f201f0c86c3..a6272d1ba384100644
---a/include/linux/remoteproc.h
+++b/include/linux/remoteproc.h
@@ -355,6 +355,8 @@ enumrsc_handling_status{/**
* structrproc_ops- platform-specific device handlers
+ * @prepare: prepare the device for power up (before the firmware
is loaded)
+ * @unprepare: unprepare the device after it is stopped
* @start: power on the device and boot it
* @stop: power off the device
* @kick: kick a virtqueue (virtqueue id given as a parameter)
@@ -371,6 +373,8 @@ enumrsc_handling_status{
* @get_boot_addr: get boot address to entry point specified in
firmware*/ struct rproc_ops { + int (*prepare)(struct rproc *rproc); + void (*unprepare)(struct rproc *rproc); int (*start)(struct rproc *rproc); int (*stop)(struct rproc *rproc); void (*kick)(struct rproc *rproc, int vqid);
Re: [PATCH v4 3/5] remoteproc: Add prepare/unprepare callbacks
Hi Paul
Quoted 20 lines · ----- On 14 Dec, 2019, at 23:30, Paul Cercueil [email protected] wrote:
Hi Fabien,
Quoted 15 lines · Fabien DESSENNE
Hi Paul
Quoted 3 lines · Paul Cercueil
The .prepare() callback is called before the firmware is loaded to memory. This is useful for instance in the case where some setup is required for the memory to be accessible.
I am trying to figure out what king of 'setup' may be required. From the
ingenic driver I understand that you need to enable clocks to allow some
memory access.
Quoted 5 lines
Quoted 1 line
Instead of adding this new ops, why not enabling clocks in
probe()?Enabling the clocks in the probe means that the clocks will be unconditionally enabled until the driver is removed, even if the remote processor end up being unused. That would be a waste of power.
We have the same kind of "problem" for k1c remoteproc driver (not yet upstream, depends on new arch). We need to enable clocks to load code into remote processor memory and currently we do that in probe. However, as you stated, we would like to enable them as late as possible (just before loading code) to avoid wasting power unnecessarily. So the "prepare" callback totally makes sense.
Regards,
Clément
Quoted 95 lines
Cheers,
-PaulQuoted 90 lines
BR
Fabien
Quoted 84 lines
Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2-v4: No changedrivers/remoteproc/remoteproc_core.c | 16 +++++++++++++++- include/linux/remoteproc.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-)diff --git
a/drivers/remoteproc/remoteproc_core.cb/drivers/remoteproc/remoteproc_core.c
index0a9fc7fdd1c3..3ea5f675a148100644
---a/drivers/remoteproc/remoteproc_core.c
+++b/drivers/remoteproc/remoteproc_core.c
@@ -1299,11 +1299,19 @@ static int rproc_start(struct rproc *rproc,
const struct firmware *fw)struct device *dev = &rproc->dev; int ret;+ if (
rproc->ops->prepare) {
+ ret =rproc->ops->prepare(rproc);
+ if (ret) {
+dev_err(dev, "Failed to prepare rproc: %d\n", ret);
+ return ret;
+ }
+ }
+
/* load the ELF segments to memory */ret = rproc_load_segments(rproc, fw); if (ret) { dev_err(dev, "Failed to load program segments: %d\n", ret); - return ret; + goto unprepare_rproc; } /* @@ -1354,6 +1362,9 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) rproc_unprepare_subdevices(rproc); reset_table_ptr: rproc->table_ptr = rproc->cached_table;+unprepare_rproc:
+ if (rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);return ret; }@@ -1483,6 +1494,9 @@ static int rproc_stop(struct rproc *rproc,
bool crashed)rproc->state = RPROC_OFFLINE;+ if (
rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);
+
dev_info(dev, "stopped remote processor %s\n", rproc->name);return 0;diff --git
a/include/linux/remoteproc.hb/include/linux/remoteproc.hindex5f201f0c86c3..a6272d1ba384100644
---a/include/linux/remoteproc.h
+++b/include/linux/remoteproc.h
@@ -355,6 +355,8 @@ enumrsc_handling_status{/**
* structrproc_ops- platform-specific device handlers
+ * @prepare: prepare the device for power up (before the firmware
is loaded)
+ * @unprepare: unprepare the device after it is stopped
* @start: power on the device and boot it
* @stop: power off the device
* @kick: kick a virtqueue (virtqueue id given as a parameter)
@@ -371,6 +373,8 @@ enumrsc_handling_status{
* @get_boot_addr: get boot address to entry point specified in
firmware*/ struct rproc_ops { + int (*prepare)(struct rproc *rproc); + void (*unprepare)(struct rproc *rproc); int (*start)(struct rproc *rproc); int (*stop)(struct rproc *rproc); void (*kick)(struct rproc *rproc, int vqid);
Re: [PATCH v4 3/5] remoteproc: Add prepare/unprepare callbacks
Hi Paul,
I tested your patch and implemented the prepare callback only. This is working correctly and the callback is correctly called to enable clocks right before loading code into memory.
Regarding unprepare, I have no usecase for this since clocks disabling and resetting is done in rproc_stop. Thus, I did not tested this part. Did you add it to be called after the subdevices unprepare call ? If not, what is the use case for this ? ie, what are you doing in unprepare that you don't do in stop ?
Obviously it should work but I can't say I tested it completely !
Regards,
Clément
Quoted 136 lines · ----- On 16 Dec, 2019, at 09:42, Clément Leger [email protected] wrote:
Hi Paul
Quoted 20 lines · ----- On 14 Dec, 2019, at 23:30, Paul Cercueil [email protected] wrote:
Hi Fabien,
Quoted 15 lines · Fabien DESSENNE
Hi Paul
Quoted 3 lines · Paul Cercueil
The .prepare() callback is called before the firmware is loaded to memory. This is useful for instance in the case where some setup is required for the memory to be accessible.
I am trying to figure out what king of 'setup' may be required. From the
ingenic driver I understand that you need to enable clocks to allow some
memory access.Quoted 5 lines
Quoted 1 line
Instead of adding this new ops, why not enabling clocks in
probe()?Enabling the clocks in the probe means that the clocks will be unconditionally enabled until the driver is removed, even if the remote processor end up being unused. That would be a waste of power.
We have the same kind of "problem" for k1c remoteproc driver (not yet upstream, depends on new arch). We need to enable clocks to load code into remote processor memory and currently we do that in probe. However, as you stated, we would like to enable them as late as possible (just before loading code) to avoid wasting power unnecessarily. So the "prepare" callback totally makes sense.
Regards,
Clément
Quoted 95 lines
Cheers,
-PaulQuoted 90 lines
BR
Fabien
Quoted 84 lines
Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2-v4: No changedrivers/remoteproc/remoteproc_core.c | 16 +++++++++++++++- include/linux/remoteproc.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-)diff --git
a/drivers/remoteproc/remoteproc_core.cb/drivers/remoteproc/remoteproc_core.c
index0a9fc7fdd1c3..3ea5f675a148100644
---a/drivers/remoteproc/remoteproc_core.c
+++b/drivers/remoteproc/remoteproc_core.c
@@ -1299,11 +1299,19 @@ static int rproc_start(struct rproc *rproc,
const struct firmware *fw)struct device *dev = &rproc->dev; int ret;+ if (
rproc->ops->prepare) {
+ ret =rproc->ops->prepare(rproc);
+ if (ret) {
+dev_err(dev, "Failed to prepare rproc: %d\n", ret);
+ return ret;
+ }
+ }
+
/* load the ELF segments to memory */ret = rproc_load_segments(rproc, fw); if (ret) { dev_err(dev, "Failed to load program segments: %d\n", ret); - return ret; + goto unprepare_rproc; } /* @@ -1354,6 +1362,9 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) rproc_unprepare_subdevices(rproc); reset_table_ptr: rproc->table_ptr = rproc->cached_table;+unprepare_rproc:
+ if (rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);return ret; }@@ -1483,6 +1494,9 @@ static int rproc_stop(struct rproc *rproc,
bool crashed)rproc->state = RPROC_OFFLINE;+ if (
rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);
+
dev_info(dev, "stopped remote processor %s\n", rproc->name);return 0;diff --git
a/include/linux/remoteproc.hb/include/linux/remoteproc.hindex5f201f0c86c3..a6272d1ba384100644
---a/include/linux/remoteproc.h
+++b/include/linux/remoteproc.h
@@ -355,6 +355,8 @@ enumrsc_handling_status{/**
* structrproc_ops- platform-specific device handlers
+ * @prepare: prepare the device for power up (before the firmware
is loaded)
+ * @unprepare: unprepare the device after it is stopped
* @start: power on the device and boot it
* @stop: power off the device
* @kick: kick a virtqueue (virtqueue id given as a parameter)
@@ -371,6 +373,8 @@ enumrsc_handling_status{
* @get_boot_addr: get boot address to entry point specified in
firmware*/ struct rproc_ops { + int (*prepare)(struct rproc *rproc); + void (*unprepare)(struct rproc *rproc); int (*start)(struct rproc *rproc); int (*stop)(struct rproc *rproc); void (*kick)(struct rproc *rproc, int vqid);
Re: [PATCH v4 3/5] remoteproc: Add prepare/unprepare callbacks
In reply to Paul CercueilHi Paul
Quoted 18 lines · Paul Cercueil
Hi Fabien,
Quoted 13 lines · Fabien DESSENNE
Hi Paul
Quoted 3 lines · Paul Cercueil
The .prepare() callback is called before the firmware is loaded to memory. This is useful for instance in the case where some setup is required for the memory to be accessible.
I am trying to figure out what king of 'setup' may be required. From the ingenic driver I understand that you need to enable clocks to allow some memory access.
Quoted 5 lines
Quoted 1 line
Instead of adding this new ops, why not enabling clocks in
probe()?Enabling the clocks in the probe means that the clocks will be unconditionally enabled until the driver is removed, even if the remote processor end up being unused. That would be a waste of power.
OK I understand.
Nevertheless I think that you may need to call .prepare() from rproc_fw_boot() since you may need to access some memories from the point rproc_handle_resources() is called (this sets up virtio which is used if you have a resource table defining vdev).
And rproc_fw_boot() calls rproc_enable_iommu(), which sounds like "prepare memory", so this may be the right place to call .prepare()
BR
Fabien
Quoted 97 lines
Cheers,
-PaulQuoted 90 lines
BR
Fabien
Quoted 84 lines
Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2-v4: No change
drivers/remoteproc/remoteproc_core.c| 16 +++++++++++++++- include/linux/remoteproc.h | 4 ++++2 files changed, 19 insertions(+), 1 deletion(-)diff --git
a/drivers/remoteproc/remoteproc_core.cb/drivers/remoteproc/remoteproc_core.c
index0a9fc7fdd1c3..3ea5f675a148100644
---a/drivers/remoteproc/remoteproc_core.c
+++b/drivers/remoteproc/remoteproc_core.c
@@ -1299,11 +1299,19 @@ static intrproc_start(struct rproc *rproc, const struct firmware *fw)
struct device *dev =&rproc->dev;
int ret;+ if (
rproc->ops->prepare) {
+ ret =rproc->ops->prepare(rproc);
+ if (ret) {
+dev_err(dev, "Failed to prepare rproc: %d\n", ret); + return ret;
+ }
+ }
+
/* load the ELF segments to memory */
ret =rproc_load_segments(rproc, fw);
if (ret) {
dev_err(dev, "Failed to load program segments: %d\n", ret); - return ret;
+ gotounprepare_rproc;
}/*
@@ -1354,6 +1362,9 @@ static intrproc_start(struct rproc *rproc, const struct firmware *fw)rproc_unprepare_subdevices(rproc);reset_table_ptr:
rproc->table_ptr=rproc->cached_table; +unprepare_rproc:
+ if (rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);return ret;
}
@@ -1483,6 +1494,9 @@ static intrproc_stop(struct rproc *rproc, bool crashed)
rproc->state=RPROC_OFFLINE;+ if (
rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);
+
dev_info(dev, "stopped remote processor %s\n", rproc->name);return 0;
diff --gita/include/linux/remoteproc.hb/include/linux/remoteproc.hindex5f201f0c86c3..a6272d1ba384100644
---a/include/linux/remoteproc.h
+++b/include/linux/remoteproc.h
@@ -355,6 +355,8 @@ enumrsc_handling_status{/**
* structrproc_ops- platform-specific device handlers
+ * @prepare: prepare the device for power up (before the firmware is loaded)
+ * @unprepare: unprepare the device after it is stopped
* @start: power on the device and boot it
* @stop: power off the device
* @kick: kick a virtqueue (virtqueue id given as a parameter) @@ -371,6 +373,8 @@ enumrsc_handling_status{
* @get_boot_addr: get boot address to entry point specified in firmware
*/
structrproc_ops{
+ int (*prepare)(struct rproc *rproc);
+ void (*unprepare)(struct rproc *rproc);
int (*start)(struct rproc *rproc);
int (*stop)(struct rproc *rproc);
void (*kick)(struct rproc *rproc, int vqid);
Re: [PATCH v4 3/5] remoteproc: Add prepare/unprepare callbacks
In reply to Paul CercueilQuoted 4 lines · Paul Cercueil
The .prepare() callback is called before the firmware is loaded to memory. This is useful for instance in the case where some setup is required for the memory to be accessible.
Would it make sense to somehow tie this prepare/unprepare to the actual struct rproc_mem_entry that needs the resource enabled?
Regards,
Bjorn
Quoted 80 lines
Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2-v4: No changedrivers/remoteproc/remoteproc_core.c | 16 +++++++++++++++- include/linux/remoteproc.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-)drivers/remoteproc/remoteproc_core.c +15
-1@@ -1299,11 +1299,19 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw)struct device *dev = &rproc->dev;int ret; +if (rproc->ops->prepare) { + ret = rproc->ops->prepare (rproc); +if (ret) { +dev_err (dev,"Failed to prepare rproc: %d\n" , ret); +return ret; + } + } +/* load the ELF segments to memory */ ret =rproc_load_segments (rproc, fw);if (ret) {dev_err (dev,"Failed to load program segments: %d\n" , ret); -return ret; + goto unprepare_rproc; }/* @@ -1354,6 +1362,9 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw)rproc_unprepare_subdevices (rproc); reset_table_ptr: rproc->table_ptr = rproc->cached_table; +unprepare_rproc: +if (rproc->ops->unprepare) + rproc->ops->unprepare (rproc);return ret; }@@ -1483,6 +1494,9 @@ static int rproc_stop(struct rproc *rproc, bool crashed) rproc->state =RPROC_OFFLINE ; +if (rproc->ops->unprepare) + rproc->ops->unprepare (rproc); +dev_info (dev,"stopped remote processor %s\n" , rproc->name);return 0 ;include/linux/remoteproc.h +4
-0@@ -355,6 +355,8 @@ enum rsc_handling_status {/** * struct rproc_ops - platform-specific device handlers +* @prepare: prepare the device for power up (before the firmware is loaded) +* @unprepare: unprepare the device after it is stopped * @start: power on the device and boot it * @stop: power off the device * @kick: kick a virtqueue (virtqueue id given as a parameter) @@ -371,6 +373,8 @@ enum rsc_handling_status {* @get_boot_addr: get boot address to entry point specified in firmware */ struct rproc_ops { +int (*prepare)(struct rproc *rproc); +void (*unprepare)(struct rproc *rproc);int (*start)(struct rproc *rproc);int (*stop)(struct rproc *rproc);void (*kick)(struct rproc *rproc,int vqid);Signature · 1 line
2.24.0
Paul Cercueil
maintainerRe: [PATCH v4 3/5] remoteproc: Add prepare/unprepare callbacks
Hi Bjorn,
Quoted 9 lines · Bjorn Andersson
Quoted 4 lines · Paul Cercueil
The .prepare() callback is called before the firmware is loaded to memory. This is useful for instance in the case where some setup is required for the memory to be accessible.
Would it make sense to somehow tie this prepare/unprepare to the actual struct
rproc_mem_entrythat needs the resource enabled?
Do you need such granularity?
In my case, the three memories need the same clock to be enabled.
-Paul
Quoted 87 lines
Quoted 87 lines
Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2-v4: No changedrivers/remoteproc/remoteproc_core.c | 16 +++++++++++++++- include/linux/remoteproc.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-)diff --git
a/drivers/remoteproc/remoteproc_core.cb/drivers/remoteproc/remoteproc_core.c
index0a9fc7fdd1c3..3ea5f675a148100644
---a/drivers/remoteproc/remoteproc_core.c
+++b/drivers/remoteproc/remoteproc_core.c
@@ -1299,11 +1299,19 @@ static int rproc_start(struct rproc *rproc,
const struct firmware *fw)
struct device *dev =&rproc->dev;
int ret;+ if (
rproc->ops->prepare) {
+ ret =rproc->ops->prepare(rproc);
+ if (ret) {
+dev_err(dev, "Failed to prepare rproc: %d\n", ret);
+ return ret;
+ }
+ }
+
/* load the ELF segments to memory */
ret =rproc_load_segments(rproc, fw);
if (ret) {
dev_err(dev, "Failed to load program segments: %d\n", ret);
- return ret;
+ gotounprepare_rproc;
}/*
@@ -1354,6 +1362,9 @@ static int rproc_start(struct rproc *rproc,
const struct firmware *fw)
rproc_unprepare_subdevices(rproc);
reset_table_ptr:
rproc->table_ptr=rproc->cached_table;
+unprepare_rproc:
+ if (rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);return ret;
}
@@ -1483,6 +1494,9 @@ static int rproc_stop(struct rproc *rproc,
bool crashed)rproc->state = RPROC_OFFLINE;+ if (
rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);
+
dev_info(dev, "stopped remote processor %s\n", rproc->name);return 0;
diff --gita/include/linux/remoteproc.hb/include/linux/remoteproc.hindex5f201f0c86c3..a6272d1ba384100644
---a/include/linux/remoteproc.h
+++b/include/linux/remoteproc.h
@@ -355,6 +355,8 @@ enumrsc_handling_status{/**
* structrproc_ops- platform-specific device handlers
+ * @prepare: prepare the device for power up (before the firmware
is loaded)
+ * @unprepare: unprepare the device after it is stopped
* @start: power on the device and boot it
* @stop: power off the device
* @kick: kick a virtqueue (virtqueue id given as a parameter)
@@ -371,6 +373,8 @@ enumrsc_handling_status{
* @get_boot_addr: get boot address to entry point specified in
firmware
*/
structrproc_ops{
+ int (*prepare)(struct rproc *rproc);
+ void (*unprepare)(struct rproc *rproc);
int (*start)(struct rproc *rproc);
int (*stop)(struct rproc *rproc);
void (*kick)(struct rproc *rproc, int vqid);
--
2.24.0
Re: [PATCH v4 3/5] remoteproc: Add prepare/unprepare callbacks
Quoted 12 lines · Paul Cercueil
Hi Bjorn,
Le sam., d�c. 21, 2019 at 12:20, Bjorn Andersson <[email protected]> a �crit :
Quoted 7 lines · Paul Cercueil
Quoted 5 lines
The .prepare() callback is called before the firmware is loaded to memory. This is useful for instance in the case where some setup is required for the memory to be accessible.
Quoted 5 lines
Quoted 2 lines
Would it make sense to somehow tie this prepare/unprepare to the actual struct
rproc_mem_entrythat needs the resource enabled?Do you need such granularity?
I don't have such needs, but given some of the memory structure that Suman and Loic has been talking about I would expect that such need exists.
Quoted 2 lines
In my case, the three memories need the same clock to be enabled.
But we can update your driver to associate your one clock with the memory objects if/when we end up implementing this later.
Regards,
Bjorn
Quoted 92 lines
-Paul
Quoted 87 lines
Quoted 87 lines
Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2-v4: No changedrivers/remoteproc/remoteproc_core.c | 16 +++++++++++++++- include/linux/remoteproc.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-)diff --git
a/drivers/remoteproc/remoteproc_core.cb/drivers/remoteproc/remoteproc_core.c
index0a9fc7fdd1c3..3ea5f675a148100644
---a/drivers/remoteproc/remoteproc_core.c
+++b/drivers/remoteproc/remoteproc_core.c
@@ -1299,11 +1299,19 @@ static int rproc_start(struct rproc *rproc,
const struct firmware *fw)
struct device *dev =&rproc->dev;
int ret;+ if (
rproc->ops->prepare) {
+ ret =rproc->ops->prepare(rproc);
+ if (ret) {
+dev_err(dev, "Failed to prepare rproc: %d\n", ret);
+ return ret;
+ }
+ }
+
/* load the ELF segments to memory */
ret =rproc_load_segments(rproc, fw);
if (ret) {
dev_err(dev, "Failed to load program segments: %d\n", ret);
- return ret;
+ gotounprepare_rproc;
}/*
@@ -1354,6 +1362,9 @@ static int rproc_start(struct rproc *rproc,
const struct firmware *fw)
rproc_unprepare_subdevices(rproc);
reset_table_ptr:
rproc->table_ptr=rproc->cached_table;
+unprepare_rproc:
+ if (rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);return ret;
}
@@ -1483,6 +1494,9 @@ static int rproc_stop(struct rproc *rproc,
bool crashed)rproc->state = RPROC_OFFLINE;+ if (
rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);
+
dev_info(dev, "stopped remote processor %s\n", rproc->name);return 0;
diff --gita/include/linux/remoteproc.hb/include/linux/remoteproc.hindex5f201f0c86c3..a6272d1ba384100644
---a/include/linux/remoteproc.h
+++b/include/linux/remoteproc.h
@@ -355,6 +355,8 @@ enumrsc_handling_status{/**
* structrproc_ops- platform-specific device handlers
+ * @prepare: prepare the device for power up (before the firmware
is loaded)
+ * @unprepare: unprepare the device after it is stopped
* @start: power on the device and boot it
* @stop: power off the device
* @kick: kick a virtqueue (virtqueue id given as a parameter)
@@ -371,6 +373,8 @@ enumrsc_handling_status{
* @get_boot_addr: get boot address to entry point specified in
firmware
*/
structrproc_ops{
+ int (*prepare)(struct rproc *rproc);
+ void (*unprepare)(struct rproc *rproc);
int (*start)(struct rproc *rproc);
int (*stop)(struct rproc *rproc);
void (*kick)(struct rproc *rproc, int vqid);
--
2.24.0
Re: [PATCH v4 3/5] remoteproc: Add prepare/unprepare callbacks
Hi Bjorn,Paul,
Quoted 24 lines · Bjorn Andersson
Quoted 12 lines · Paul Cercueil
Hi Bjorn,
Quoted 7 lines · Bjorn Andersson
Quoted 4 lines · Paul Cercueil
The .prepare() callback is called before the firmware is loaded to memory. This is useful for instance in the case where some setup is required for the memory to be accessible.
Quoted 5 lines
Quoted 2 lines
Would it make sense to somehow tie this prepare/unprepare to the actual struct
rproc_mem_entrythat needs the resource enabled?Do you need such granularity?
I don't have such needs, but given some of the memory structure that Suman and Loic has been talking about I would expect that such need exists
Quoted 5 lines
Quoted 2 lines
In my case, the three memories need the same clock to be enabled.
But we can update your driver to associate your one clock with the memory objects if/when we end up implementing this later.
IMHO, as mention Fabien the prepare/unprepare should probably not in the stop/start
but in rproc_fw_boot and rproc_resource_cleanup. This should cover more usecases (such as power domain) and avoid a unprepare/prepare on crash recovery.
Nevertheless I'm wondering if it's more like PM runtime that should be implemented here...?
Regards,
Arnaud
Quoted 97 lines
Regards,
BjornQuoted 93 lines
-Paul
Quoted 88 lines
Quoted 88 lines
Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2-v4: No changedrivers/remoteproc/remoteproc_core.c | 16 +++++++++++++++- include/linux/remoteproc.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-)diff --git
a/drivers/remoteproc/remoteproc_core.cb/drivers/remoteproc/remoteproc_core.c
index0a9fc7fdd1c3..3ea5f675a148100644
---a/drivers/remoteproc/remoteproc_core.c
+++b/drivers/remoteproc/remoteproc_core.c
@@ -1299,11 +1299,19 @@ static int rproc_start(struct rproc *rproc,
const struct firmware *fw)
struct device *dev =&rproc->dev;
int ret;+ if (
rproc->ops->prepare) {
+ ret =rproc->ops->prepare(rproc);
+ if (ret) {
+dev_err(dev, "Failed to prepare rproc: %d\n", ret);
+ return ret;
+ }
+ }
+/* load the ELF segments to memory */
ret =rproc_load_segments(rproc, fw);
if (ret) {
dev_err(dev, "Failed to load program segments: %d\n", ret);
- return ret;
+ gotounprepare_rproc;
}/*
@@ -1354,6 +1362,9 @@ static int rproc_start(struct rproc *rproc,
const struct firmware *fw)
rproc_unprepare_subdevices(rproc);
reset_table_ptr:
rproc->table_ptr=rproc->cached_table;
+unprepare_rproc:
+ if (rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);return ret;
}
@@ -1483,6 +1494,9 @@ static int rproc_stop(struct rproc *rproc,
bool crashed)rproc->state = RPROC_OFFLINE;+ if (
rproc->ops->unprepare)
+rproc->ops->unprepare(rproc);
+
dev_info(dev, "stopped remote processor %s\n", rproc->name);return 0;
diff --gita/include/linux/remoteproc.hb/include/linux/remoteproc.hindex5f201f0c86c3..a6272d1ba384100644
---a/include/linux/remoteproc.h
+++b/include/linux/remoteproc.h
@@ -355,6 +355,8 @@ enumrsc_handling_status{/**
* structrproc_ops- platform-specific device handlers
+ * @prepare: prepare the device for power up (before the firmware
is loaded)
+ * @unprepare: unprepare the device after it is stopped
* @start: power on the device and boot it
* @stop: power off the device
* @kick: kick a virtqueue (virtqueue id given as a parameter)
@@ -371,6 +373,8 @@ enumrsc_handling_status{
* @get_boot_addr: get boot address to entry point specified in
firmware
*/
structrproc_ops{
+ int (*prepare)(struct rproc *rproc);
+ void (*unprepare)(struct rproc *rproc);
int (*start)(struct rproc *rproc);
int (*stop)(struct rproc *rproc);
void (*kick)(struct rproc *rproc, int vqid);
--
2.24.0
Paul Cercueil
maintainerPATCH v4 4/5 remoteproc: ingenic: Added remoteproc driver
In reply to Paul CercueilThis driver is used to boot, communicate with and load firmwares to the MIPS co-processor found in the VPU hardware of the JZ47xx SoCs from Ingenic.
---
Notes:
v2: Remove exception for always-mapped memories
v3: - Use clk_bulk API
- Move device-managed code to its own patch [3/4]
- Move devicetree table right above ingenic_rproc_driver
- Removed #ifdef CONFIG_OF around devicetree table
- Removed .owner = THIS_MODULE in ingenic_rproc_driver
- Removed useless platform_set_drvdata()
v4: - Add fix reported by Julia
- Change Kconfig symbol to INGENIC_VPU_RPROC
- Add documentation to struct vpu
- disable_irq_nosync() -> disable_irq()
drivers/remoteproc/Kconfig | 8 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/ingenic_rproc.c | 247 +++++++++++++++++++++++++++++ 3 files changed, 256 insertions(+) create mode 100644 drivers/remoteproc/ingenic_rproc.c
drivers/remoteproc/Kconfig +8 -0
@@ -214,6 +214,14 @@ config STM32_RPROC This can be either built-in or a loadable module. +config INGENIC_VPU_RPROC + tristate "Ingenic JZ47xx VPU remoteproc support" + depends on MIPS || COMPILE_TEST + help + Say y or m here to support the VPU in the JZ47xx SoCs from Ingenic. + This can be either built-in or a loadable module. + If unsure say N. + endif # REMOTEPROC endmenu
drivers/remoteproc/Makefile +1 -0
@@ -10,6 +10,7 @@ remoteproc-y += remoteproc_sysfs.o remoteproc-y += remoteproc_virtio.o remoteproc-y += remoteproc_elf_loader.o obj-$(CONFIG_IMX_REMOTEPROC) += imx_rproc.o +obj-$(CONFIG_INGENIC_VPU_RPROC) += ingenic_rproc.o obj-$(CONFIG_OMAP_REMOTEPROC) += omap_remoteproc.o obj-$(CONFIG_WKUP_M3_RPROC) += wkup_m3_rproc.o obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o
drivers/remoteproc/ingenic_rproc.c new file +247 -0
247 lines not on this page · raw message
Signature · 1 line
2.24.0
Paul Cercueil
maintainerPATCH v4 5/5 MAINTAINERS: Add myself as reviewer for Ingenic rproc driver
In reply to Paul CercueilAdd myself as the reviewer for the Ingenic VPU remoteproc driver.
---
Notes:
v4: New patch
MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -8197,6 +8197,7 @@ F: drivers/mtd/nand/raw/ingenic/ F: drivers/pinctrl/pinctrl-ingenic.c F: drivers/power/supply/ingenic-battery.c F: drivers/pwm/pwm-jz4740.c +F: drivers/remoteproc/ingenic_rproc.c F: drivers/rtc/rtc-jz4740.c F: drivers/tty/serial/8250/8250_ingenic.c F: drivers/usb/musb/jz4740.c
Signature · 1 line
2.24.0
Rob Herring
maintainerQuoted 84 lines · Paul Cercueil
Inside the Video Processing Unit (VPU) of the recent JZ47xx SoCs from Ingenic is a second Xburst MIPS CPU very similar to the main core. This document describes the devicetree bindings for this auxiliary processor.
Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2: Update TCSM0 address in example
v3: Change node name to 'video-decoder'
v4: Convert to YAML. I didn't add Rob's Ack on v3 because of that (sorry Rob).../bindings/remoteproc/ingenic,vpu.yaml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/ingenic,vpu.yamlDocumentation/devicetree/bindings/remoteproc/ingenic,vpu.yaml new file +61
-0@@ -0,0 +1,76 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/remoteproc/ingenic,vpu.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Ingenic Video Processing Unit bindings + +description: + Inside the Video Processing Unit (VPU) of the recent JZ47xx SoCs from + Ingenic is a second Xburst MIPS CPU very similar to the main core. + This document describes the devicetree bindings for this auxiliary + processor. + +maintainers: + - Paul Cercueil <[email protected]> + +properties: + compatible: + const: ingenic,jz4770-vpu-rproc + + reg: + items: + - description: aux registers + - description: tcsm0 registers + - description: tcsm1 registers + - description: sram registers + + reg-names: + items: + - const: aux + - const: tcsm0 + - const: tcsm1 + - const: sram + + clocks: + items: + - description: aux clock + - description: vpu clock + + clock-names: + items: + - const: aux + - const: vpu + + interrupts: + description: VPU hardware interrupt + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - interrupts + +additionalProperties: false + +examples: + - | + vpu: video-decoder@132a0000 {
Documentation/devicetree/bindings/remoteproc/ingenic,vpu.yaml line 71
Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/ingenic,vpu.yaml new file +10
-0+ compatible = "ingenic,jz4770-vpu-rproc"; + + reg = <0x132a0000 0x20 /* AUX */ + 0x132b0000 0x4000 /* TCSM0 */ + 0x132c0000 0xc000 /* TCSM1 */ + 0x132f0000 0x7000 /* SRAM */ + >; + reg-names = "aux", "tcsm0", "tcsm1", "sram"; + + clocks = <&cgu JZ4770_CLK_AUX>, <&cgu JZ4770_CLK_VPU>;
Examples are built now by 'make dt_binding_check' and this fails. You need to add the include for these defines.
Also, the schema should complain after that on 'reg'. You need to <> each entry (addr and size).
Quoted 8 lines
Documentation/devicetree/bindings/remoteproc/ingenic,vpu.yaml new file +5
-0+ clock-names = "aux", "vpu"; + + interrupt-parent = <&cpuintc>; + interrupts = <3>; + };Signature · 1 line
2.24.0
Paul Cercueil
maintainerHi Rob,
Quoted 104 lines · Rob Herring
Quoted 98 lines · Paul Cercueil
Inside the Video Processing Unit (VPU) of the recent JZ47xx SoCs
from
Ingenic is a second Xburst MIPS CPU very similar to the main core. This document describes the devicetree bindings for this auxiliary processor.Signed-off-by Paul Cercueil <[email protected]>---
Notes:
v2: Update TCSM0 address in example
v3: Change node name to 'video-decoder'
v4: Convert to YAML. I didn't add Rob's Ack on v3 because of
that (sorry Rob).../bindings/remoteproc/ingenic,vpu.yaml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+)create mode 100644
Documentation/devicetree/bindings/remoteproc/ingenic,vpu.yamldiff --git
a/Documentation/devicetree/bindings/remoteproc/ingenic,vpu.yamlb/Documentation/devicetree/bindings/remoteproc/ingenic,vpu.yaml
new file mode 100644
index 000000000000..9f876d16a5a6
---/dev/null
+++b/Documentation/devicetree/bindings/remoteproc/ingenic,vpu.yaml
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/remoteproc/ingenic,vpu.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Ingenic Video Processing Unit bindings
+
+description:
+ Inside the Video Processing Unit (VPU) of the recent JZ47xx SoCs
from
+ Ingenic is a second Xburst MIPS CPU very similar to the main
core.
+ This document describes the devicetree bindings for this
auxiliary
+ processor.
+
+maintainers:
+ - Paul Cercueil <[email protected]>
+
+properties:
+ compatible:
+ const: ingenic,jz4770-vpu-rproc
+
+ reg:
+ items:+ - description: aux registers + - description: tcsm0 registers + - description: tcsm1 registers + - description: sram registers + + reg-names: + items: + - const: aux + - const: tcsm0 + - const: tcsm1 + - const: sram + + clocks: + items: + - description: aux clock + - description: vpu clock + + clock-names: + items: + - const: aux + - const: vpu + + interrupts: + description: VPU hardware interrupt + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - interrupts + +additionalProperties: false + +examples: + - | + vpu: video-decoder@132a0000 { + compatible = "ingenic,jz4770-vpu-rproc"; + + reg = <0x132a0000 0x20 /* AUX */ + 0x132b0000 0x4000 /* TCSM0 */ + 0x132c0000 0xc000 /* TCSM1 */ + 0x132f0000 0x7000 /* SRAM */Quoted 4 lines
+ >;
+ reg-names = "aux", "tcsm0", "tcsm1", "sram";
+
+ clocks = <&cguJZ4770_CLK_AUX>, <&cguJZ4770_CLK_VPU>;
Quoted 2 lines
Examples are built now by 'make
dt_binding_check' and this fails. You need to add the include for these defines.
Strange, "make dt_binding_check" does not complain here about this file with your latest dt-schema tool and Linux 5.5-rc1.
Quoted 3 lines
Also, the schema should complain after that on 'reg'. You need to <> each entry (addr and size).
Ok.
-Paul
Quoted 9 lines
Quoted 9 lines
+ clock-names = "aux", "vpu";
+
+ interrupt-parent = <&cpuintc>;
+ interrupts = <3>;
+ };
--
2.24.0