* [PATCH 0/2] dm: core: Add address translation in fdt_get_resource - fixes
@ 2021-05-18 13:40 Patrick Delaunay
2021-05-18 13:40 ` [PATCH 1/2] net: luton: remove address translation after ofnode_read_resource Patrick Delaunay
2021-05-18 13:40 ` [PATCH 2/2] test: add dm_test_read_resource Patrick Delaunay
0 siblings, 2 replies; 5+ messages in thread
From: Patrick Delaunay @ 2021-05-18 13:40 UTC (permalink / raw)
To: u-boot
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(-)
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] net: luton: remove address translation after ofnode_read_resource
2021-05-18 13:40 [PATCH 0/2] dm: core: Add address translation in fdt_get_resource - fixes Patrick Delaunay
@ 2021-05-18 13:40 ` Patrick Delaunay
2021-05-20 4:37 ` Ramon Fried
2021-05-18 13:40 ` [PATCH 2/2] test: add dm_test_read_resource Patrick Delaunay
1 sibling, 1 reply; 5+ messages in thread
From: Patrick Delaunay @ 2021-05-18 13:40 UTC (permalink / raw)
To: u-boot
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").
Fixes: feb7ac457c20 ("dm: core: Add address translation in fdt_get_resource")
Reported-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---
drivers/net/mscc_eswitch/luton_switch.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/mscc_eswitch/luton_switch.c b/drivers/net/mscc_eswitch/luton_switch.c
index 54afa14c9d..73c950d118 100644
--- a/drivers/net/mscc_eswitch/luton_switch.c
+++ b/drivers/net/mscc_eswitch/luton_switch.c
@@ -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 */
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] test: add dm_test_read_resource
2021-05-18 13:40 [PATCH 0/2] dm: core: Add address translation in fdt_get_resource - fixes Patrick Delaunay
2021-05-18 13:40 ` [PATCH 1/2] net: luton: remove address translation after ofnode_read_resource Patrick Delaunay
@ 2021-05-18 13:40 ` Patrick Delaunay
2021-05-19 15:34 ` Simon Glass
1 sibling, 1 reply; 5+ messages in thread
From: Patrick Delaunay @ 2021-05-18 13:40 UTC (permalink / raw)
To: u-boot
Add a test of dev_read_resource with translation or without translation
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---
test/dm/test-fdt.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 9b771fdf19..b1736fbe27 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -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);
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] test: add dm_test_read_resource
2021-05-18 13:40 ` [PATCH 2/2] test: add dm_test_read_resource Patrick Delaunay
@ 2021-05-19 15:34 ` Simon Glass
0 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2021-05-19 15:34 UTC (permalink / raw)
To: u-boot
On Tue, 18 May 2021 at 07:40, Patrick Delaunay
<patrick.delaunay@foss.st.com> wrote:
>
> Add a test of dev_read_resource with translation or without translation
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
> test/dm/test-fdt.c | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
But can you use lower-case hex?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] net: luton: remove address translation after ofnode_read_resource
2021-05-18 13:40 ` [PATCH 1/2] net: luton: remove address translation after ofnode_read_resource Patrick Delaunay
@ 2021-05-20 4:37 ` Ramon Fried
0 siblings, 0 replies; 5+ messages in thread
From: Ramon Fried @ 2021-05-20 4:37 UTC (permalink / raw)
To: u-boot
On Tue, May 18, 2021 at 4:40 PM Patrick Delaunay
<patrick.delaunay@foss.st.com> wrote:
>
> 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").
>
> Fixes: feb7ac457c20 ("dm: core: Add address translation in fdt_get_resource")
> Reported-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
> drivers/net/mscc_eswitch/luton_switch.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/mscc_eswitch/luton_switch.c b/drivers/net/mscc_eswitch/luton_switch.c
> index 54afa14c9d..73c950d118 100644
> --- a/drivers/net/mscc_eswitch/luton_switch.c
> +++ b/drivers/net/mscc_eswitch/luton_switch.c
> @@ -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 */
> --
> 2.17.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-20 4:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 13:40 [PATCH 0/2] dm: core: Add address translation in fdt_get_resource - fixes Patrick Delaunay
2021-05-18 13:40 ` [PATCH 1/2] net: luton: remove address translation after ofnode_read_resource Patrick Delaunay
2021-05-20 4:37 ` Ramon Fried
2021-05-18 13:40 ` [PATCH 2/2] test: add dm_test_read_resource Patrick Delaunay
2021-05-19 15:34 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.