diff options
author | Sekhar Nori | 2019-08-01 19:12:56 +0530 |
---|---|---|
committer | Tom Rini | 2019-08-12 13:33:39 -0400 |
commit | f5b904796fa876bbfdf6eb9d2b311f9d01d80f5a (patch) | |
tree | 696d7835d6784adde746d196fcd455ca59a59401 /test/dm | |
parent | acbb7cd4d34caec36ff6d044a8f55325fa27459f (diff) |
dm: core: add support for getting register address and size
Current dev_read_*() API lacks support to get address and size
of a "reg" property by name or index. Add support for the same.
Livetree support has been added but not tested on real hardware.
The existing unit tests testing reading address from device-tree
have been updated to test address as well as size.
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/test-fdt.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index ad8591639da..1fb8b5c248d 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -549,12 +549,14 @@ static int dm_test_fdt_remap_addr_index_flat(struct unit_test_state *uts) { struct udevice *dev; fdt_addr_t addr; + fdt_size_t size; void *paddr; ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); - addr = devfdt_get_addr_index(dev, 0); + addr = devfdt_get_addr_size_index(dev, 0, &size); ut_asserteq(0x8000, addr); + ut_asserteq(0x1000, size); paddr = map_physmem(addr, 0, MAP_NOCACHE); ut_assertnonnull(paddr); @@ -569,12 +571,14 @@ static int dm_test_fdt_remap_addr_name_flat(struct unit_test_state *uts) { struct udevice *dev; fdt_addr_t addr; + fdt_size_t size; void *paddr; ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); - addr = devfdt_get_addr_name(dev, "sandbox-dummy-0"); + addr = devfdt_get_addr_size_name(dev, "sandbox-dummy-0", &size); ut_asserteq(0x8000, addr); + ut_asserteq(0x1000, size); paddr = map_physmem(addr, 0, MAP_NOCACHE); ut_assertnonnull(paddr); @@ -609,12 +613,14 @@ static int dm_test_fdt_remap_addr_index_live(struct unit_test_state *uts) { struct udevice *dev; fdt_addr_t addr; + fdt_size_t size; void *paddr; ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); - addr = dev_read_addr_index(dev, 0); + addr = dev_read_addr_size_index(dev, 0, &size); ut_asserteq(0x8000, addr); + ut_asserteq(0x1000, size); paddr = map_physmem(addr, 0, MAP_NOCACHE); ut_assertnonnull(paddr); @@ -629,12 +635,14 @@ static int dm_test_fdt_remap_addr_name_live(struct unit_test_state *uts) { struct udevice *dev; fdt_addr_t addr; + fdt_size_t size; void *paddr; ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); - addr = dev_read_addr_name(dev, "sandbox-dummy-0"); + addr = dev_read_addr_size_name(dev, "sandbox-dummy-0", &size); ut_asserteq(0x8000, addr); + ut_asserteq(0x1000, size); paddr = map_physmem(addr, 0, MAP_NOCACHE); ut_assertnonnull(paddr); |