scmi: translate the resource only when livetree is not activated
PATCH 1/1 scmi: translate the resource only when livetree is not activated
Call the translation function on the ofnode_read_resource result only when the livetree is not activated.
Today of_address_to_resource() calls ofnode_read_resource() for livetree support and fdt_get_resource() when livetree is not supported.
The fdt_get_resource() doesn't do the address translation so when it is required when livetree is activated but this address translation is already done by ofnode_read_resource().
---
Hi,
This patch is a short-term workaround for ofnode_read_resource translation issue on stm32mp15 boards when scmi is used and OF_LIVE is activated.
A full solution is a patch in core to have the same behavior of the API ofnode_read_resource() when livretree is activated or not:
fdt_get_resource()
...
while (ptr + na + ns <= end) {
if (i == index) { - res->start = fdtdec_get_number(ptr, na);
+ if (CONFIG_IS_ENABLED(OF_TRANSLATE))
+ res->start = fdt_translate_address(fdt, node, ptr);
+ else
+ res->start = fdtdec_get_number(ptr, na);
+
I will propose it soon but it is more aggressive and impacts all the user of fdt_get_resource() or fdt_get_named_resource() function; this correct patch need more tests.
So I think it will take many time to be integrated so I prefer to propose the current patch for a short term integration on v2021.07.
Patrick
drivers/firmware/scmi/smt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/firmware/scmi/smt.c +7 -2
@@ -41,8 +41,13 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt)if (ret)return ret; - faddr =cpu_to_fdt32 (resource.start); - paddr =ofnode_translate_address (args.node, &faddr); +/* TEMP workaround for ofnode_read_resource translation issue */ +if (of_live_active ()) { + paddr = resource.start; + }else { + faddr =cpu_to_fdt32 (resource.start); + paddr =ofnode_translate_address (args.node, &faddr); + } smt->size =resource_size (&resource);if (smt->size <sizeof (struct scmi_smt_header )) {
Signature · 1 line
2.17.1
PATCH 1/1 scmi: translate the resource only when livetree is not activated
Hi,
Quoted 32 lines · Patrick Delaunay
Call the translation function on the
ofnode_read_resourceresult only when the livetree is not activated.Today
of_address_to_resource()callsofnode_read_resource()for livetree support andfdt_get_resource()when livetree is not supported.The
fdt_get_resource()doesn't do the address translation so when it is required when livetree is activated but this address translation is already done byofnode_read_resource().Fixes 240720e9052f ("firmware: scmi: mailbox/smt agent device")Signed-off-by Patrick Delaunay <[email protected]>---
Hi,This patch is a short-term workaround for
ofnode_read_resourcetranslation issue on stm32mp15 boards when scmi is used andOF_LIVEis activated.A full solution is a patch in core to have the same behavior of the API
ofnode_read_resource()when livretree is activated or not:
fdt_get_resource()
...while (ptr + na + ns <= end) { if (i == index) { - res->start = fdtdec_get_number(ptr, na); + if (CONFIG_IS_ENABLED(OF_TRANSLATE)) + res->start = fdt_translate_address(fdt, node, ptr); + else + res->start = fdtdec_get_number(ptr, na); +
Quoted 3 lines
I will propose it soon but it is more aggressive and impacts all the user of
fdt_get_resource()orfdt_get_named_resource()function; this correct patch need more tests.
For information the proposed patch with a full correction in dm core is now available:
"dm: core: Add address translation in fdt_get_resource"
http://patchwork.ozlabs.org/project/uboot/list/?series=237557&state=*
Quoted 20 lines
So I think it will take many time to be integrated so I prefer to propose the current patch for a short term integration on v2021.07.
Patrick
drivers/firmware/scmi/smt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/firmware/scmi/smt.c +0
-2@@ -41,8 +41,13 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt)if (ret)return ret; - faddr =cpu_to_fdt32 (resource.start); - paddr =ofnode_translate_address (args.node, &faddr);
drivers/firmware/scmi/smt.c int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt) · line 53
Quoted 10 lines
drivers/firmware/scmi/smt.c +7
-0+/* TEMP workaround for ofnode_read_resource translation issue */ +if (of_live_active ()) { + paddr = resource.start; + }else { + faddr =cpu_to_fdt32 (resource.start); + paddr =ofnode_translate_address (args.node, &faddr); + } smt->size =resource_size (&resource);if (smt->size <sizeof (struct scmi_smt_header )) {
Regards
Patrick
PATCH 1/1 scmi: translate the resource only when livetree is not activated
In reply to Patrick DelaunayQuoted 6 lines · Patrick Delaunay
Call the translation function on the
ofnode_read_resourceresult only when the livetree is not activated.Today
of_address_to_resource()callsofnode_read_resource()for livetree support andfdt_get_resource()when livetree is not supported.
Quoted 6 lines
The
fdt_get_resource()doesn't do the address translation so when it is required when livetree is activated but this address translation is already done byofnode_read_resource().Fixes 240720e9052f ("firmware: scmi: mailbox/smt agent device")Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210413/99216cc8/attachment.sig>