]> git.dujemihanovic.xyz Git - u-boot.git/commit
dm: core: Add address translation in fdt_get_resource
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Tue, 6 Apr 2021 07:38:06 +0000 (09:38 +0200)
committerSimon Glass <sjg@chromium.org>
Thu, 29 Apr 2021 10:23:39 +0000 (03:23 -0700)
commitfeb7ac457c20ac575749471141722b0bbe6303ca
treed313185a6a75fa108a2da7b5e9798ee4bd792508
parent1736575b0cfe5dfe511a2904dd84289fc781728e
dm: core: Add address translation in fdt_get_resource

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>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
drivers/firmware/scmi/smt.c
drivers/net/mscc_eswitch/jr2_switch.c
drivers/net/mscc_eswitch/ocelot_switch.c
drivers/net/mscc_eswitch/serval_switch.c
drivers/net/mscc_eswitch/servalt_switch.c
lib/fdtdec.c