soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure
Subsystems (2)
PATCH 1/1 soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure
The remoteproc framework has been enhanced recently to provide new OF API to retrieve a remoteproc handle by client drivers through a standard 'rprocs' property in client nodes. The wkup_m3_ipc driver has been using a custom 'ti,rproc' property until now, switch this to use this new OF infrastructure. The wkup_m3_ipc driver has been fixed up to provide backward compatibility for older DTBs by replacing the older property with the standard newer property.
The wkup_m3_ipc binding has also been updated accordingly.
---
This patch is based on the discussion [1] for introducing new standard OF API in remoteproc core series [2] and the exporting of couple of functions in OF base code [3].
With this in place, the remoteproc core need not be looking for the TI specific property anymore. I will submit the DTS changes once this makes it to mainline.
regards
Suman
[1] https://patchwork.kernel.org/patch/9237767/
[2] http://marc.info/?l=linux-kernel&m=146894341701010&w=2
[3] https://patchwork.kernel.org/patch/9276181/
.../devicetree/bindings/soc/ti/wkup_m3_ipc.txt | 9 ++++++-- drivers/soc/ti/wkup_m3_ipc.c | 26 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt +7 -2
@@ -23,12 +23,17 @@ Required properties: with the Wakeup M3 processor - interrupts: Contains the interrupt information for the wkup_m3 interrupt that signals the MPU. -- ti,rproc: phandle to the wkup_m3 rproc node so the IPC driver +- rprocs: phandle to the wkup_m3 rproc node so the IPC driver can boot it. - mboxes: phandles used by IPC framework to get correct mbox channel for communication. Must point to appropriate mbox_wkupm3 child node. +Deprecated properties: +---------------------- +- ti,rproc: This property has been replaced with the "rprocs" + property. + Example: -------- /* AM33xx */
@@ -48,7 +53,7 @@ Example: compatible = "ti,am3352-wkup-m3-ipc"; reg = <0x1324 0x24>; interrupts = <78>; - ti,rproc = <&wkup_m3>; + rprocs = <&wkup_m3>; mboxes = <&mailbox &mbox_wkupm3>; };
drivers/soc/ti/wkup_m3_ipc.c +25 -1
@@ -1,7 +1,7 @@/* * AMx3 Wkup M3 IPC driver * -* Copyright (C) 2015 Texas Instruments, Inc. +* Copyright (C) 2015-2016 Texas Instruments, Inc. * * Dave Gerlach <[email protected]> *
@@ -390,6 +390,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)struct resource *res;struct task_struct *task;struct wkup_m3_ipc *m3_ipc; +struct property *nprop, *oprop; +const char nprop_name[] ="rprocs" ; m3_ipc =devm_kzalloc (dev,sizeof (*m3_ipc),GFP_KERNEL );if (!m3_ipc)
@@ -415,6 +417,28 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)return ret; } +/* provide compatibility for older DTBs using ti,rproc property */ + nprop =of_find_property (dev->of_node,"rprocs" ,NULL ); +if (!nprop) { + oprop =of_find_property (dev->of_node,"ti,rproc" ,NULL ); +if (!oprop) { +dev_err (&pdev->dev,"node is missing ti,rproc property\n" ); +return -ENODEV ; + } + + nprop =kzalloc (sizeof (*nprop) +sizeof (nprop_name), +GFP_KERNEL ); +if (!nprop) +return -ENOMEM ; + + nprop->name = (char *)nprop +sizeof (*nprop); +snprintf (nprop->name,sizeof (nprop_name), nprop_name); + nprop->value = oprop->value; + nprop->length = oprop->length; +of_update_property (dev->of_node, nprop); +of_remove_property (dev->of_node, oprop); + } + m3_ipc->mbox_client.dev = dev; m3_ipc->mbox_client.tx_done =NULL ; m3_ipc->mbox_client.tx_prepare =NULL ;
Signature · 1 line
2.9.0
kbuild test robot
build botreproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…
Hi Suman,
[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.8-rc1 next-20160811]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Suman-Anna/soc-ti-wkup_m3_ipc-switch-to-using-remoteproc-OF-infrastructure/20160812-085217 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: arm-allmodconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm
All errors (new ones prefixed by >>):
>> ERROR: "of_update_property" [drivers/soc/ti/wkup_m3_ipc.ko] undefined! >> ERROR: "of_remove_property" [drivers/soc/ti/wkup_m3_ipc.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 58499 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160812/cb144d63/attachment-0001.obj>
PATCH 1/1 soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure
In reply to Suman AnnaQuoted 101 lines · Suman Anna
The remoteproc framework has been enhanced recently to provide new OF API to retrieve a remoteproc handle by client drivers through a standard 'rprocs' property in client nodes. The
wkup_m3_ipcdriver has been using a custom 'ti,rproc' property until now, switch this to use this new OF infrastructure. Thewkup_m3_ipcdriver has been fixed up to provide backward compatibility for older DTBs by replacing the older property with the standard newer property.The
wkup_m3_ipcbinding has also been updated accordingly.Signed-off-by Suman Anna <[email protected]>---
This patch is based on the discussion [1] for introducing new standard OF API in remoteproc core series [2] and the exporting of couple of functions in OF base code [3].With this in place, the remoteproc core need not be looking for the TI specific property anymore. I will submit the DTS changes once this makes it to mainline.
regards
Suman[1] https://patchwork.kernel.org/patch/9237767/
[2] http://marc.info/?l=linux-kernel&m=146894341701010&w=2
[3] https://patchwork.kernel.org/patch/9276181/.../devicetree/bindings/soc/ti/wkup_m3_ipc.txt | 9 ++++++-- drivers/soc/ti/wkup_m3_ipc.c | 26 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt +7
-2@@ -23,12 +23,17 @@ Required properties: with the Wakeup M3 processor - interrupts: Contains the interrupt information for the wkup_m3 interrupt that signals the MPU. -- ti,rproc: phandle to the wkup_m3 rproc node so the IPC driver +- rprocs: phandle to the wkup_m3 rproc node so the IPC driver can boot it. - mboxes: phandles used by IPC framework to get correct mbox channel for communication. Must point to appropriate mbox_wkupm3 child node. +Deprecated properties: +---------------------- +- ti,rproc: This property has been replaced with the "rprocs" + property. + Example: -------- /* AM33xx */@@ -48,7 +53,7 @@ Example: compatible = "ti,am3352-wkup-m3-ipc"; reg = <0x1324 0x24>; interrupts = <78>; - ti,rproc = <&wkup_m3>; + rprocs = <&wkup_m3>; mboxes = <&mailbox &mbox_wkupm3>; };drivers/soc/ti/wkup_m3_ipc.c +15
-1@@ -1,7 +1,7 @@/* * AMx3 Wkup M3 IPC driver * -* Copyright (C) 2015 Texas Instruments, Inc. +* Copyright (C) 2015-2016 Texas Instruments, Inc. * * Dave Gerlach <[email protected]> * @@ -390,6 +390,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)struct resource *res;struct task_struct *task;struct wkup_m3_ipc *m3_ipc; +struct property *nprop, *oprop; +const char nprop_name[] ="rprocs" ; m3_ipc =devm_kzalloc (dev,sizeof (*m3_ipc),GFP_KERNEL );if (!m3_ipc)@@ -415,6 +417,28 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)return ret; } +/* provide compatibility for older DTBs using ti,rproc property */ + nprop =of_find_property (dev->of_node,"rprocs" ,NULL ); +if (!nprop) { + oprop =of_find_property (dev->of_node,"ti,rproc" ,NULL ); +if (!oprop) { +dev_err (&pdev->dev,"node is missing ti,rproc property\n" ); +return -ENODEV ; + } + + nprop =kzalloc (sizeof (*nprop) +sizeof (nprop_name), +GFP_KERNEL ); +if (!nprop)
drivers/soc/ti/wkup_m3_ipc.c static int wkup_m3_ipc_probe(struct platform_device *pdev) · line 441
Quoted 10 lines
drivers/soc/ti/wkup_m3_ipc.c +10
-0+return -ENOMEM ; + + nprop->name = (char *)nprop +sizeof (*nprop); +snprintf (nprop->name,sizeof (nprop_name), nprop_name); + nprop->value = oprop->value; + nprop->length = oprop->length; +of_update_property (dev->of_node, nprop); +of_remove_property (dev->of_node, oprop); + } +
+1 for getting the functionality out of core code.
-100 for having to jump though all these hoops.
If you are going to keep all of this, I would at least tuck it away in a header file or something.
Quoted 3 lines
drivers/soc/ti/wkup_m3_ipc.c +0
-0m3_ipc->mbox_client.dev = dev; m3_ipc->mbox_client.tx_done =NULL ; m3_ipc->mbox_client.tx_prepare =NULL ;
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH 1/1 soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure
Quoted 116 lines · Lee Jones
Quoted 101 lines · Suman Anna
The remoteproc framework has been enhanced recently to provide new OF API to retrieve a remoteproc handle by client drivers through a standard 'rprocs' property in client nodes. The
wkup_m3_ipcdriver has been using a custom 'ti,rproc' property until now, switch this to use this new OF infrastructure. Thewkup_m3_ipcdriver has been fixed up to provide backward compatibility for older DTBs by replacing the older property with the standard newer property.The
wkup_m3_ipcbinding has also been updated accordingly.Signed-off-by Suman Anna <[email protected]>---
This patch is based on the discussion [1] for introducing new standard OF API in remoteproc core series [2] and the exporting of couple of functions in OF base code [3].With this in place, the remoteproc core need not be looking for the TI specific property anymore. I will submit the DTS changes once this makes it to mainline.
regards
Suman[1] https://patchwork.kernel.org/patch/9237767/
[2] http://marc.info/?l=linux-kernel&m=146894341701010&w=2
[3] https://patchwork.kernel.org/patch/9276181/.../devicetree/bindings/soc/ti/wkup_m3_ipc.txt | 9 ++++++-- drivers/soc/ti/wkup_m3_ipc.c | 26 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt +7
-2@@ -23,12 +23,17 @@ Required properties: with the Wakeup M3 processor - interrupts: Contains the interrupt information for the wkup_m3 interrupt that signals the MPU. -- ti,rproc: phandle to the wkup_m3 rproc node so the IPC driver +- rprocs: phandle to the wkup_m3 rproc node so the IPC driver can boot it. - mboxes: phandles used by IPC framework to get correct mbox channel for communication. Must point to appropriate mbox_wkupm3 child node. +Deprecated properties: +---------------------- +- ti,rproc: This property has been replaced with the "rprocs" + property. + Example: -------- /* AM33xx */@@ -48,7 +53,7 @@ Example: compatible = "ti,am3352-wkup-m3-ipc"; reg = <0x1324 0x24>; interrupts = <78>; - ti,rproc = <&wkup_m3>; + rprocs = <&wkup_m3>; mboxes = <&mailbox &mbox_wkupm3>; };drivers/soc/ti/wkup_m3_ipc.c +15
-1@@ -1,7 +1,7 @@/* * AMx3 Wkup M3 IPC driver * -* Copyright (C) 2015 Texas Instruments, Inc. +* Copyright (C) 2015-2016 Texas Instruments, Inc. * * Dave Gerlach <[email protected]> * @@ -390,6 +390,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)struct resource *res;struct task_struct *task;struct wkup_m3_ipc *m3_ipc; +struct property *nprop, *oprop; +const char nprop_name[] ="rprocs" ; m3_ipc =devm_kzalloc (dev,sizeof (*m3_ipc),GFP_KERNEL );if (!m3_ipc)@@ -415,6 +417,28 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)return ret; } +/* provide compatibility for older DTBs using ti,rproc property */ + nprop =of_find_property (dev->of_node,"rprocs" ,NULL ); +if (!nprop) { + oprop =of_find_property (dev->of_node,"ti,rproc" ,NULL ); +if (!oprop) { +dev_err (&pdev->dev,"node is missing ti,rproc property\n" ); +return -ENODEV ; + } + + nprop =kzalloc (sizeof (*nprop) +sizeof (nprop_name), +GFP_KERNEL ); +if (!nprop)drivers/soc/ti/wkup_m3_ipc.c static int wkup_m3_ipc_probe(struct platform_device *pdev) · line 441
Quoted 10 lines
drivers/soc/ti/wkup_m3_ipc.c +10
-0+return -ENOMEM ; + + nprop->name = (char *)nprop +sizeof (*nprop); +snprintf (nprop->name,sizeof (nprop_name), nprop_name); + nprop->value = oprop->value; + nprop->length = oprop->length; +of_update_property (dev->of_node, nprop); +of_remove_property (dev->of_node, oprop); + } ++1 for getting the functionality out of core code.
Quoted 4 lines
-100 for having to jump though all these hoops.
If you are going to keep all of this, I would at least tuck it away in a header file or something.
Hiding it somewhere else won't make much of a difference though. If this is such an eyesore, we still can do this cleanly without jumping through these hoops. I would say this is a direct result of the removal of the rproc_get_by_phandle API in Patch 2 of your OF remoteproc series [2]. That API is still an agnostic API. We can just add the of_rproc_get() convenience helper in your Patch 1 and drop patch 2 completely with no references to ti,rproc in the core code in the first place. The other option, if we do want to remove that API is to add an additional property name argument (NULL to mean "rprocs") to of_rproc_get_by_index(), and it can be hidden away under of_rproc_get() API - which is what I am expecting most of the new client users would use anyway.
Once "rprocs" hits mainline, I will definitely switch over the wkup_m3_ipc nodes to use that standard property and can fix this driver independently.
Anyway, I have given all sorts of inputs to arrive at a clean solution in both remoteproc core and this driver. I will leave it to Bjorn and Tony/Santosh to decide what they want in each driver. As it is, this patch will be moot if the core OF exports patch falls through.
regards
Suman
PATCH 1/1 soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure
Quoted 135 lines · Suman Anna
Quoted 116 lines · Lee Jones
Quoted 101 lines · Suman Anna
The remoteproc framework has been enhanced recently to provide new OF API to retrieve a remoteproc handle by client drivers through a standard 'rprocs' property in client nodes. The
wkup_m3_ipcdriver has been using a custom 'ti,rproc' property until now, switch this to use this new OF infrastructure. Thewkup_m3_ipcdriver has been fixed up to provide backward compatibility for older DTBs by replacing the older property with the standard newer property.The
wkup_m3_ipcbinding has also been updated accordingly.Signed-off-by Suman Anna <[email protected]>---
This patch is based on the discussion [1] for introducing new standard OF API in remoteproc core series [2] and the exporting of couple of functions in OF base code [3].With this in place, the remoteproc core need not be looking for the TI specific property anymore. I will submit the DTS changes once this makes it to mainline.
regards
Suman[1] https://patchwork.kernel.org/patch/9237767/
[2] http://marc.info/?l=linux-kernel&m=146894341701010&w=2
[3] https://patchwork.kernel.org/patch/9276181/.../devicetree/bindings/soc/ti/wkup_m3_ipc.txt | 9 ++++++-- drivers/soc/ti/wkup_m3_ipc.c | 26 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt +7
-2@@ -23,12 +23,17 @@ Required properties: with the Wakeup M3 processor - interrupts: Contains the interrupt information for the wkup_m3 interrupt that signals the MPU. -- ti,rproc: phandle to the wkup_m3 rproc node so the IPC driver +- rprocs: phandle to the wkup_m3 rproc node so the IPC driver can boot it. - mboxes: phandles used by IPC framework to get correct mbox channel for communication. Must point to appropriate mbox_wkupm3 child node. +Deprecated properties: +---------------------- +- ti,rproc: This property has been replaced with the "rprocs" + property. + Example: -------- /* AM33xx */@@ -48,7 +53,7 @@ Example: compatible = "ti,am3352-wkup-m3-ipc"; reg = <0x1324 0x24>; interrupts = <78>; - ti,rproc = <&wkup_m3>; + rprocs = <&wkup_m3>; mboxes = <&mailbox &mbox_wkupm3>; };drivers/soc/ti/wkup_m3_ipc.c +15
-1@@ -1,7 +1,7 @@/* * AMx3 Wkup M3 IPC driver * -* Copyright (C) 2015 Texas Instruments, Inc. +* Copyright (C) 2015-2016 Texas Instruments, Inc. * * Dave Gerlach <[email protected]> * @@ -390,6 +390,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)struct resource *res;struct task_struct *task;struct wkup_m3_ipc *m3_ipc; +struct property *nprop, *oprop; +const char nprop_name[] ="rprocs" ; m3_ipc =devm_kzalloc (dev,sizeof (*m3_ipc),GFP_KERNEL );if (!m3_ipc)@@ -415,6 +417,28 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)return ret; } +/* provide compatibility for older DTBs using ti,rproc property */ + nprop =of_find_property (dev->of_node,"rprocs" ,NULL ); +if (!nprop) { + oprop =of_find_property (dev->of_node,"ti,rproc" ,NULL ); +if (!oprop) { +dev_err (&pdev->dev,"node is missing ti,rproc property\n" ); +return -ENODEV ; + } + + nprop =kzalloc (sizeof (*nprop) +sizeof (nprop_name), +GFP_KERNEL ); +if (!nprop)drivers/soc/ti/wkup_m3_ipc.c static int wkup_m3_ipc_probe(struct platform_device *pdev) · line 441
Quoted 10 lines
drivers/soc/ti/wkup_m3_ipc.c +10
-0+return -ENOMEM ; + + nprop->name = (char *)nprop +sizeof (*nprop); +snprintf (nprop->name,sizeof (nprop_name), nprop_name); + nprop->value = oprop->value; + nprop->length = oprop->length; +of_update_property (dev->of_node, nprop); +of_remove_property (dev->of_node, oprop); + } ++1 for getting the functionality out of core code.
Quoted 4 lines
-100 for having to jump though all these hoops.
If you are going to keep all of this, I would at least tuck it away in a header file or something.
Hiding it somewhere else won't make much of a difference though. If this is such an eyesore, we still can do this cleanly without jumping through these hoops. I would say this is a direct result of the removal of the
rproc_get_by_phandleAPI in Patch 2 of your OF remoteproc series [2]. That API is still an agnostic API. We can just add theof_rproc_get()convenience helper in your Patch 1 and drop patch 2 completely with no references to ti,rproc in the core code in the first place. The other option, if we do want to remove that API is to add an additional property name argument (NULL to mean "rprocs") toof_rproc_get_by_index(), and it can be hidden away underof_rproc_get()API - which is what I am expecting most of the new client users would use anyway.
Quoted 4 lines
Once "rprocs" hits mainline, I will definitely switch over the
wkup_m3_ipcnodes to use that standard property and can fix this driver independently.
We're stuck with this problem all over the place, as the world continues to evolve we will have issues with DT being static. This has been discussed many times before and the suggested solution is always what you implemented here - make the code deal with both versions, preferably by patching.
The fact that you had to export the of_ operations indicates that no-one has tried this before and I'm happy you did. I'm however not happy about the size of the chunk of code it takes to do this dance.
I think for this to be practical we need to provide higher level operations for DT modification - in this case a of_rename_property().
@Rob, any comments on this?
Quoted 5 lines
Anyway, I have given all sorts of inputs to arrive at a clean solution in both remoteproc core and this driver. I will leave it to Bjorn and Tony/Santosh to decide what they want in each driver. As it is, this patch will be moot if the core OF exports patch falls through.
I appreciate your input and we need to settle above discussion regardless of this case - and by then have it implemented as you have suggested.
Regards,
Bjorn
PATCH 1/1 soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure
Quoted 148 lines · Bjorn Andersson
Quoted 135 lines · Suman Anna
Quoted 116 lines · Lee Jones
Quoted 101 lines · Suman Anna
The remoteproc framework has been enhanced recently to provide new OF API to retrieve a remoteproc handle by client drivers through a standard 'rprocs' property in client nodes. The
wkup_m3_ipcdriver has been using a custom 'ti,rproc' property until now, switch this to use this new OF infrastructure. Thewkup_m3_ipcdriver has been fixed up to provide backward compatibility for older DTBs by replacing the older property with the standard newer property.The
wkup_m3_ipcbinding has also been updated accordingly.Signed-off-by Suman Anna <[email protected]>---
This patch is based on the discussion [1] for introducing new standard OF API in remoteproc core series [2] and the exporting of couple of functions in OF base code [3].With this in place, the remoteproc core need not be looking for the TI specific property anymore. I will submit the DTS changes once this makes it to mainline.
regards
Suman[1] https://patchwork.kernel.org/patch/9237767/
[2] http://marc.info/?l=linux-kernel&m=146894341701010&w=2
[3] https://patchwork.kernel.org/patch/9276181/.../devicetree/bindings/soc/ti/wkup_m3_ipc.txt | 9 ++++++-- drivers/soc/ti/wkup_m3_ipc.c | 26 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt +7
-2@@ -23,12 +23,17 @@ Required properties: with the Wakeup M3 processor - interrupts: Contains the interrupt information for the wkup_m3 interrupt that signals the MPU. -- ti,rproc: phandle to the wkup_m3 rproc node so the IPC driver +- rprocs: phandle to the wkup_m3 rproc node so the IPC driver can boot it. - mboxes: phandles used by IPC framework to get correct mbox channel for communication. Must point to appropriate mbox_wkupm3 child node. +Deprecated properties: +---------------------- +- ti,rproc: This property has been replaced with the "rprocs" + property. + Example: -------- /* AM33xx */@@ -48,7 +53,7 @@ Example: compatible = "ti,am3352-wkup-m3-ipc"; reg = <0x1324 0x24>; interrupts = <78>; - ti,rproc = <&wkup_m3>; + rprocs = <&wkup_m3>; mboxes = <&mailbox &mbox_wkupm3>; };drivers/soc/ti/wkup_m3_ipc.c +15
-1@@ -1,7 +1,7 @@/* * AMx3 Wkup M3 IPC driver * -* Copyright (C) 2015 Texas Instruments, Inc. +* Copyright (C) 2015-2016 Texas Instruments, Inc. * * Dave Gerlach <[email protected]> * @@ -390,6 +390,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)struct resource *res;struct task_struct *task;struct wkup_m3_ipc *m3_ipc; +struct property *nprop, *oprop; +const char nprop_name[] ="rprocs" ; m3_ipc =devm_kzalloc (dev,sizeof (*m3_ipc),GFP_KERNEL );if (!m3_ipc)@@ -415,6 +417,28 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)return ret; } +/* provide compatibility for older DTBs using ti,rproc property */ + nprop =of_find_property (dev->of_node,"rprocs" ,NULL ); +if (!nprop) { + oprop =of_find_property (dev->of_node,"ti,rproc" ,NULL ); +if (!oprop) { +dev_err (&pdev->dev,"node is missing ti,rproc property\n" ); +return -ENODEV ; + } + + nprop =kzalloc (sizeof (*nprop) +sizeof (nprop_name), +GFP_KERNEL ); +if (!nprop)drivers/soc/ti/wkup_m3_ipc.c static int wkup_m3_ipc_probe(struct platform_device *pdev) · line 441
Quoted 10 lines
drivers/soc/ti/wkup_m3_ipc.c +10
-0+return -ENOMEM ; + + nprop->name = (char *)nprop +sizeof (*nprop); +snprintf (nprop->name,sizeof (nprop_name), nprop_name); + nprop->value = oprop->value; + nprop->length = oprop->length; +of_update_property (dev->of_node, nprop); +of_remove_property (dev->of_node, oprop); + } ++1 for getting the functionality out of core code.
Quoted 4 lines
-100 for having to jump though all these hoops.
If you are going to keep all of this, I would at least tuck it away in a header file or something.
Hiding it somewhere else won't make much of a difference though. If this is such an eyesore, we still can do this cleanly without jumping through these hoops. I would say this is a direct result of the removal of the
rproc_get_by_phandleAPI in Patch 2 of your OF remoteproc series [2]. That API is still an agnostic API. We can just add theof_rproc_get()convenience helper in your Patch 1 and drop patch 2 completely with no references to ti,rproc in the core code in the first place. The other option, if we do want to remove that API is to add an additional property name argument (NULL to mean "rprocs") toof_rproc_get_by_index(), and it can be hidden away underof_rproc_get()API - which is what I am expecting most of the new client users would use anyway.Quoted 4 lines
Once "rprocs" hits mainline, I will definitely switch over the
wkup_m3_ipcnodes to use that standard property and can fix this driver independently.We're stuck with this problem all over the place, as the world continues to evolve we will have issues with DT being static. This has been discussed many times before and the suggested solution is always what you implemented here - make the code deal with both versions, preferably by patching.
Quoted 8 lines
The fact that you had to export the
of_operations indicates that no-one has tried this before and I'm happy you did. I'm however not happy about the size of the chunk of code it takes to do this dance.I think for this to be practical we need to provide higher level operations for DT modification - in this case a
of_rename_property().@Rob, any comments on this?
I agree. Pantelis submitted some helpers in this area a while back (for the changeset API IIRC). I believe they were mostly fine, but needed some users.
Rob
PATCH 1/1 soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure
Hi Rob,
Quoted 154 lines · Rob Herring
Quoted 152 lines · Bjorn Andersson
Quoted 135 lines · Suman Anna
Quoted 116 lines · Lee Jones
Quoted 101 lines · Suman Anna
The remoteproc framework has been enhanced recently to provide new OF API to retrieve a remoteproc handle by client drivers through a standard 'rprocs' property in client nodes. The
wkup_m3_ipcdriver has been using a custom 'ti,rproc' property until now, switch this to use this new OF infrastructure. Thewkup_m3_ipcdriver has been fixed up to provide backward compatibility for older DTBs by replacing the older property with the standard newer property.The
wkup_m3_ipcbinding has also been updated accordingly.Signed-off-by Suman Anna <[email protected]>---
This patch is based on the discussion [1] for introducing new standard OF API in remoteproc core series [2] and the exporting of couple of functions in OF base code [3].With this in place, the remoteproc core need not be looking for the TI specific property anymore. I will submit the DTS changes once this makes it to mainline.
regards
Suman[1] https://patchwork.kernel.org/patch/9237767/
[2] http://marc.info/?l=linux-kernel&m=146894341701010&w=2
[3] https://patchwork.kernel.org/patch/9276181/.../devicetree/bindings/soc/ti/wkup_m3_ipc.txt | 9 ++++++-- drivers/soc/ti/wkup_m3_ipc.c | 26 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt +7
-2@@ -23,12 +23,17 @@ Required properties: with the Wakeup M3 processor - interrupts: Contains the interrupt information for the wkup_m3 interrupt that signals the MPU. -- ti,rproc: phandle to the wkup_m3 rproc node so the IPC driver +- rprocs: phandle to the wkup_m3 rproc node so the IPC driver can boot it. - mboxes: phandles used by IPC framework to get correct mbox channel for communication. Must point to appropriate mbox_wkupm3 child node. +Deprecated properties: +---------------------- +- ti,rproc: This property has been replaced with the "rprocs" + property. + Example: -------- /* AM33xx */@@ -48,7 +53,7 @@ Example: compatible = "ti,am3352-wkup-m3-ipc"; reg = <0x1324 0x24>; interrupts = <78>; - ti,rproc = <&wkup_m3>; + rprocs = <&wkup_m3>; mboxes = <&mailbox &mbox_wkupm3>; };drivers/soc/ti/wkup_m3_ipc.c +15
-1@@ -1,7 +1,7 @@/* * AMx3 Wkup M3 IPC driver * -* Copyright (C) 2015 Texas Instruments, Inc. +* Copyright (C) 2015-2016 Texas Instruments, Inc. * * Dave Gerlach <[email protected]> * @@ -390,6 +390,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)struct resource *res;struct task_struct *task;struct wkup_m3_ipc *m3_ipc; +struct property *nprop, *oprop; +const char nprop_name[] ="rprocs" ; m3_ipc =devm_kzalloc (dev,sizeof (*m3_ipc),GFP_KERNEL );if (!m3_ipc)@@ -415,6 +417,28 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)return ret; } +/* provide compatibility for older DTBs using ti,rproc property */ + nprop =of_find_property (dev->of_node,"rprocs" ,NULL ); +if (!nprop) { + oprop =of_find_property (dev->of_node,"ti,rproc" ,NULL ); +if (!oprop) { +dev_err (&pdev->dev,"node is missing ti,rproc property\n" ); +return -ENODEV ; + } + + nprop =kzalloc (sizeof (*nprop) +sizeof (nprop_name), +GFP_KERNEL ); +if (!nprop)drivers/soc/ti/wkup_m3_ipc.c static int wkup_m3_ipc_probe(struct platform_device *pdev) · line 441
Quoted 10 lines
drivers/soc/ti/wkup_m3_ipc.c +10
-0+return -ENOMEM ; + + nprop->name = (char *)nprop +sizeof (*nprop); +snprintf (nprop->name,sizeof (nprop_name), nprop_name); + nprop->value = oprop->value; + nprop->length = oprop->length; +of_update_property (dev->of_node, nprop); +of_remove_property (dev->of_node, oprop); + } ++1 for getting the functionality out of core code.
Quoted 4 lines
-100 for having to jump though all these hoops.
If you are going to keep all of this, I would at least tuck it away in a header file or something.
Hiding it somewhere else won't make much of a difference though. If this is such an eyesore, we still can do this cleanly without jumping through these hoops. I would say this is a direct result of the removal of the
rproc_get_by_phandleAPI in Patch 2 of your OF remoteproc series [2]. That API is still an agnostic API. We can just add theof_rproc_get()convenience helper in your Patch 1 and drop patch 2 completely with no references to ti,rproc in the core code in the first place. The other option, if we do want to remove that API is to add an additional property name argument (NULL to mean "rprocs") toof_rproc_get_by_index(), and it can be hidden away underof_rproc_get()API - which is what I am expecting most of the new client users would use anyway.Quoted 4 lines
Once "rprocs" hits mainline, I will definitely switch over the
wkup_m3_ipcnodes to use that standard property and can fix this driver independently.We're stuck with this problem all over the place, as the world continues to evolve we will have issues with DT being static. This has been discussed many times before and the suggested solution is always what you implemented here - make the code deal with both versions, preferably by patching.
The fact that you had to export the
of_operations indicates that no-one has tried this before and I'm happy you did. I'm however not happy about the size of the chunk of code it takes to do this dance.
Quoted 9 lines
Quoted 4 lines
I think for this to be practical we need to provide higher level operations for DT modification - in this case a
of_rename_property().@Rob, any comments on this?
I agree. Pantelis submitted some helpers in this area a while back (for the changeset API IIRC). I believe they were mostly fine, but needed some users.
Is this the series you are talking about?
http://marc.info/?l=devicetree&m=146341689512653&w=2
It looks like that series is effective only when OF_DYNAMIC is enabled. Probably a dumb question, but is this limited to DT Overlays? This particular usage is a one-time change (first-time module is insmod'd) mainly to provide compatibility for older DTBs, thereafter we wouldn't be required to make any changes. It is definitely not a bulk update and we don't want to unroll the changes even if we removed the module.
regards
Suman
PATCH 1/1 soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure
Quoted 10 lines · Suman Anna
Hi Rob,
Quoted 7 lines · Rob Herring
Quoted 5 lines · Bjorn Andersson
Quoted 3 lines · Suman Anna
Quoted 2 lines · Lee Jones
On Thu, 11 Aug 2016, Suman Anna wrote:
[...]
Quoted 25 lines
Quoted 15 lines
Quoted 15 lines
Quoted 4 lines
Once "rprocs" hits mainline, I will definitely switch over the
wkup_m3_ipcnodes to use that standard property and can fix this driver independently.We're stuck with this problem all over the place, as the world continues to evolve we will have issues with DT being static. This has been discussed many times before and the suggested solution is always what you implemented here - make the code deal with both versions, preferably by patching.
The fact that you had to export the
of_operations indicates that no-one has tried this before and I'm happy you did. I'm however not happy about the size of the chunk of code it takes to do this dance.Quoted 9 lines
Quoted 4 lines
I think for this to be practical we need to provide higher level operations for DT modification - in this case a
of_rename_property().@Rob, any comments on this?
I agree. Pantelis submitted some helpers in this area a while back (for the changeset API IIRC). I believe they were mostly fine, but needed some users.
Quoted 4 lines
Is this the series you are talking about?
http://marc.info/?l=devicetree&m=146341689512653&w=2It looks like that series is effective only when
OF_DYNAMICis enabled.
Yes, as changeset API allows adding/removing nodes. It's probably just a matter of time until OF_DYNAMIC is always enabled.
Quoted 1 line
Probably a dumb question, but is this limited to DT Overlays?
No, changesets are the mechanism overlays use to apply changes.
Quoted 5 lines
This
particular usage is a one-time change (first-time module is insmod'd) mainly to provide compatibility for older DTBs, thereafter we wouldn't be required to make any changes. It is definitely not a bulk update and we don't want to unroll the changes even if we removed the module.
If you only need property changes, then we could do similar helpers to make it easier for callers.
Rob
PATCH 1/1 soc: ti: wkup_m3_ipc: switch to using remoteproc OF infrastructure
Quoted 51 lines · Rob Herring
Quoted 10 lines · Suman Anna
Hi Rob,
Quoted 7 lines · Rob Herring
Quoted 5 lines · Bjorn Andersson
Quoted 3 lines · Suman Anna
Quoted 2 lines · Lee Jones
On Thu, 11 Aug 2016, Suman Anna wrote:
[...]
Quoted 25 lines
Quoted 15 lines
Quoted 15 lines
Quoted 4 lines
Once "rprocs" hits mainline, I will definitely switch over the
wkup_m3_ipcnodes to use that standard property and can fix this driver independently.We're stuck with this problem all over the place, as the world continues to evolve we will have issues with DT being static. This has been discussed many times before and the suggested solution is always what you implemented here - make the code deal with both versions, preferably by patching.
The fact that you had to export the
of_operations indicates that no-one has tried this before and I'm happy you did. I'm however not happy about the size of the chunk of code it takes to do this dance.Quoted 9 lines
Quoted 4 lines
I think for this to be practical we need to provide higher level operations for DT modification - in this case a
of_rename_property().@Rob, any comments on this?
I agree. Pantelis submitted some helpers in this area a while back (for the changeset API IIRC). I believe they were mostly fine, but needed some users.
Quoted 4 lines
Is this the series you are talking about?
http://marc.info/?l=devicetree&m=146341689512653&w=2It looks like that series is effective only when
OF_DYNAMICis enabled.Yes, as changeset API allows adding/removing nodes. It's probably just a matter of time until
OF_DYNAMICis always enabled.Quoted 1 line
Probably a dumb question, but is this limited to DT Overlays?
No, changesets are the mechanism overlays use to apply changes.
Quoted 8 lines
Quoted 5 lines
This
particular usage is a one-time change (first-time module is insmod'd) mainly to provide compatibility for older DTBs, thereafter we wouldn't be required to make any changes. It is definitely not a bulk update and we don't want to unroll the changes even if we removed the module.If you only need property changes, then we could do similar helpers to make it easier for callers.
So if you are ok with an of_rename_property() API, I can submit a patch for the same.
regards
Suman