dm: core: Add address translation in fdt_get_resource - fixes
cover dm: core: Add address translation in fdt_get_resource - fixes
Hi,
This serie push again 2 modifications proposed in previous serie V3 [1] but missing in master branch as only patchset V1 [2] is merged.
Simon, I don't add your Reviewed-by, even you sent it for [1].
The first patch solves a issue see by horatiu.vultur at microchip.com in V1 [2].
Regards,
Patrick
[1] [v3] dm: core: Add address translation in fdt_get_resource
http://patchwork.ozlabs.org/project/uboot/list/?series=242010&state=*
[2] dm: core: Add address translation in fdt_get_resource
http://patchwork.ozlabs.org/project/uboot/list/?series=237557&state=*
Patrick Delaunay (2):
net: luton: remove address translation after ofnode_read_resource
test: add dm_test_read_resource
drivers/net/mscc_eswitch/luton_switch.c | 5 +--- test/dm/test-fdt.c | 33 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/2 net: luton: remove address translation after ofnode_read_resource
Removed call of ofnode_translate_address() after ofnode_read_resource in luton_switch.c:luton_probe(); it is unnecessary since the commit feb7ac457c20 ("dm: core: Add address translation in fdt_get_resource").
---
drivers/net/mscc_eswitch/luton_switch.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/mscc_eswitch/luton_switch.c +1 -4
@@ -588,7 +588,6 @@ static int luton_probe(struct udevice *dev)struct luton_private *priv =dev_get_priv (dev);int i, ret;struct resource res; -fdt32_t faddr;phys_addr_t addr_base;unsigned long addr_size;ofnode eth_node, node, mdio_node;
@@ -658,9 +657,7 @@ static int luton_probe(struct udevice *dev)if (ofnode_read_resource (mdio_node,0 , &res))return -ENOMEM ; - faddr =cpu_to_fdt32 (res.start); - - addr_base =ofnode_translate_address (mdio_node, &faddr); + addr_base = res.start; addr_size = res.end - res.start;/* If the bus is new then create a new bus */
Signature · 1 line
2.17.1
PATCH 1/2 net: luton: remove address translation after ofnode_read_resource
Quoted 38 lines · Patrick Delaunay
Removed call of
ofnode_translate_address()afterofnode_read_resourcein luton_switch.c:luton_probe(); it is unnecessary since the commitfeb7ac457c20("dm: core: Add address translation infdt_get_resource").Fixes feb7ac457c20 ("dm: core: Add address translation in fdt_get_resource")Reported-by Horatiu Vultur <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>---
drivers/net/mscc_eswitch/luton_switch.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/net/mscc_eswitch/luton_switch.c +1
-5@@ -588,7 +588,6 @@ static int luton_probe(struct udevice *dev)struct luton_private *priv =dev_get_priv (dev);int i, ret;struct resource res; -fdt32_t faddr;phys_addr_t addr_base;unsigned long addr_size;ofnode eth_node, node, mdio_node;@@ -658,9 +657,7 @@ static int luton_probe(struct udevice *dev)if (ofnode_read_resource (mdio_node,0 , &res))return -ENOMEM ; - faddr =cpu_to_fdt32 (res.start); - - addr_base =ofnode_translate_address (mdio_node, &faddr); + addr_base = res.start; addr_size = res.end - res.start;/* If the bus is new then create a new bus */ --
Quoted 2 lines
2.17.1
PATCH 2/2 test: add dm_test_read_resource
In reply to Patrick DelaunayAdd a test of dev_read_resource with translation or without translation
---
test/dm/test-fdt.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
test/dm/test-fdt.c +33 -0
@@ -19,6 +19,7 @@#include <dm/util.h> #include <dm/lists.h> #include <dm/of_access.h> +#include <linux/ioport.h> #include <test/test.h> #include <test/ut.h>
@@ -1165,3 +1166,35 @@ static int dm_test_decode_display_timing(struct unit_test_state *uts)return 0 ; }DM_TEST (dm_test_decode_display_timing,UT_TESTF_SCAN_PDATA |UT_TESTF_SCAN_FDT ); + +/* Test read_resourcee() */ +static int dm_test_read_resource (struct unit_test_state *uts) +{ +struct udevice *dev; +struct resource res; + +/* test resource without translation */ +ut_assertok (uclass_find_device_by_name (UCLASS_SIMPLE_BUS ,"syscon at 2" , &dev)); +ut_assertok (dev_read_resource (dev,0 , &res)); +ut_asserteq (0x40 , res.start); +ut_asserteq (0x44 , res.end); +ut_assertok (dev_read_resource (dev,1 , &res)); +ut_asserteq (0x48 , res.start); +ut_asserteq (0x4D , res.end); + +/* test resource with translation */ +ut_assertok (uclass_find_device_by_name (UCLASS_TEST_DUMMY ,"dev at 1,100" , &dev)); +ut_assertok (dev_read_resource (dev,0 , &res)); +ut_asserteq (0x9000 , res.start); +ut_asserteq (0x9FFF , res.end); + +/* test named resource */ +ut_assertok (uclass_find_device_by_name (UCLASS_TEST_DUMMY ,"dev at 0,0" , &dev)); +ut_assertok (dev_read_resource_byname (dev,"sandbox-dummy-0" , &res)); +ut_asserteq (0x8000 , res.start); +ut_asserteq (0x8FFF , res.end); + +return 0 ; +} + +DM_TEST (dm_test_read_resource,UT_TESTF_SCAN_PDATA |UT_TESTF_SCAN_FDT );
Signature · 1 line
2.17.1
PATCH 2/2 test: add dm_test_read_resource
Quoted 8 lines · Patrick Delaunay
Add a test of
dev_read_resourcewith translation or without translationSigned-off-by Patrick Delaunay <[email protected]>---
test/dm/test-fdt.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
But can you use lower-case hex?