
Hi Patrick,
On Wed, 28 Apr 2021 at 03:39, Patrick Delaunay patrick.delaunay@foss.st.com wrote:
Today of_address_to_resource() is called only in ofnode_read_resource() for livetree support and fdt_get_resource() is called when livetree is not supported.
The fdt_get_resource() doesn't do the address translation so when it is required, but the address translation is done by ofnode_read_resource() caller, for example in drivers/firmware/scmi/smt.c::scmi_dt_get_smt_buffer() { ... ret = ofnode_read_resource(args.node, 0, &resource); if (ret) return ret;
faddr = cpu_to_fdt32(resource.start); paddr = ofnode_translate_address(args.node, &faddr);
...
The both behavior should be aligned and the address translation must be called in fdt_get_resource() and removed for each caller.
Fixes: a44810123f9e ("dm: core: Add dev_read_resource() to read device resources") Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
This patch allows to remove the workaround in smci/smt.c introduced by [1].
But it impact with all user of
- ofnode_read_resource
- ofnode_read_resource_byname
- dev_read_resource
- dev_read_resource_byname
After my first check, the only impacts are in drivers/net/mscc_eswitch => I remove the unnecessary translate after code review, this patch need to be verify on real hardware
I proposed to merge the workaround [1] as soon as possible to avoid issue on stm32mp1 platform and this patch can be merged when it will be acked by mscc_eswitch maintainers and other API users.
[1] "scmi: translate the resource only when livetree is not activated" http://patchwork.ozlabs.org/project/uboot/list/?series=236526&state=*
Changes in v2:
- remove translate in luton_switch.c:luton_probe()
drivers/firmware/scmi/smt.c | 12 +----------- drivers/net/mscc_eswitch/jr2_switch.c | 4 +--- drivers/net/mscc_eswitch/luton_switch.c | 5 +---- drivers/net/mscc_eswitch/ocelot_switch.c | 4 +--- drivers/net/mscc_eswitch/serval_switch.c | 4 +--- drivers/net/mscc_eswitch/servalt_switch.c | 4 +--- lib/fdtdec.c | 6 +++++- 7 files changed, 11 insertions(+), 28 deletions(-)
Can you please also add a test for fdt_get_resource()?
Regards, Simon