diff options
author | Tom Rini <trini@konsulko.com> | 2018-12-05 20:32:25 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-12-05 20:32:25 -0500 |
commit | 2a055ea53260ac8addeeb94eb671172844bc9106 (patch) | |
tree | 5998b40de7145d98b553d7eb78b7a16be79aac75 /test/dm | |
parent | 9450ab2ba8d720bd9f73bccc0af2e2b5a2c2aaf1 (diff) | |
parent | b288cd9600724ad3a0e55c8786e70741dd13deae (diff) |
Merge tag 'dm-pull-5dec18' of git://git.denx.de/u-boot-dm
Minor sandbox enhancements / fixes
tpm improvements to clear up v1/v2 support
buildman toolchain fixes
New serial options to set/get config
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/serial.c | 12 | ||||
-rw-r--r-- | test/dm/sysreset.c | 4 | ||||
-rw-r--r-- | test/dm/test-fdt.c | 82 |
3 files changed, 94 insertions, 4 deletions
diff --git a/test/dm/serial.c b/test/dm/serial.c index 5c603e1f42..19a15d5d95 100644 --- a/test/dm/serial.c +++ b/test/dm/serial.c @@ -11,7 +11,9 @@ static int dm_test_serial(struct unit_test_state *uts) { + struct serial_device_info info_serial = {0}; struct udevice *dev_serial; + uint value_serial; ut_assertok(uclass_get_device_by_name(UCLASS_SERIAL, "serial", &dev_serial)); @@ -22,6 +24,16 @@ static int dm_test_serial(struct unit_test_state *uts) * sandbox_serial driver */ ut_assertok(serial_setconfig(SERIAL_DEFAULT_CONFIG)); + ut_assertok(serial_getconfig(&value_serial)); + ut_assert(value_serial == SERIAL_DEFAULT_CONFIG); + ut_assertok(serial_getinfo(&info_serial)); + ut_assert(info_serial.type == SERIAL_CHIP_UNKNOWN); + ut_assert(info_serial.addr == SERIAL_DEFAULT_ADDRESS); + /* + * test with a parameter which is NULL pointer + */ + ut_asserteq(-EINVAL, serial_getconfig(NULL)); + ut_asserteq(-EINVAL, serial_getinfo(NULL)); /* * test with a serial config which is not supported by * sandbox_serial driver: test with wrong parity diff --git a/test/dm/sysreset.c b/test/dm/sysreset.c index e1b7bf5277..5b2358ef67 100644 --- a/test/dm/sysreset.c +++ b/test/dm/sysreset.c @@ -102,10 +102,10 @@ static int dm_test_sysreset_get_last(struct unit_test_state *uts) /* Device 2 is the cold sysreset device */ ut_assertok(uclass_get_device(UCLASS_SYSRESET, 2, &dev)); - ut_asserteq(SYSRESET_COLD, sysreset_get_last(dev)); + ut_asserteq(SYSRESET_POWER, sysreset_get_last(dev)); /* This is device 0, the non-DT one */ - ut_asserteq(SYSRESET_COLD, sysreset_get_last_walk()); + ut_asserteq(SYSRESET_POWER, sysreset_get_last_walk()); return 0; } diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 0fbd9be765..96d2528acc 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -490,7 +490,6 @@ static int dm_test_fdt_translation(struct unit_test_state *uts) } DM_TEST(dm_test_fdt_translation, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); -/* Test devfdt_remap_addr_index() */ static int dm_test_fdt_remap_addr_flat(struct unit_test_state *uts) { struct udevice *dev; @@ -511,7 +510,46 @@ static int dm_test_fdt_remap_addr_flat(struct unit_test_state *uts) DM_TEST(dm_test_fdt_remap_addr_flat, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); -/* Test dev_remap_addr_index() */ +static int dm_test_fdt_remap_addr_index_flat(struct unit_test_state *uts) +{ + struct udevice *dev; + fdt_addr_t addr; + void *paddr; + + ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); + + addr = devfdt_get_addr_index(dev, 0); + ut_asserteq(0x8000, addr); + + paddr = map_physmem(addr, 0, MAP_NOCACHE); + ut_assertnonnull(paddr); + ut_asserteq_ptr(paddr, devfdt_remap_addr_index(dev, 0)); + + return 0; +} +DM_TEST(dm_test_fdt_remap_addr_index_flat, + DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); + +static int dm_test_fdt_remap_addr_name_flat(struct unit_test_state *uts) +{ + struct udevice *dev; + fdt_addr_t addr; + void *paddr; + + ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); + + addr = devfdt_get_addr_name(dev, "sandbox-dummy-0"); + ut_asserteq(0x8000, addr); + + paddr = map_physmem(addr, 0, MAP_NOCACHE); + ut_assertnonnull(paddr); + ut_asserteq_ptr(paddr, devfdt_remap_addr_name(dev, "sandbox-dummy-0")); + + return 0; +} +DM_TEST(dm_test_fdt_remap_addr_name_flat, + DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); + static int dm_test_fdt_remap_addr_live(struct unit_test_state *uts) { struct udevice *dev; @@ -532,6 +570,46 @@ static int dm_test_fdt_remap_addr_live(struct unit_test_state *uts) DM_TEST(dm_test_fdt_remap_addr_live, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +static int dm_test_fdt_remap_addr_index_live(struct unit_test_state *uts) +{ + struct udevice *dev; + fdt_addr_t addr; + void *paddr; + + ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); + + addr = dev_read_addr_index(dev, 0); + ut_asserteq(0x8000, addr); + + paddr = map_physmem(addr, 0, MAP_NOCACHE); + ut_assertnonnull(paddr); + ut_asserteq_ptr(paddr, dev_remap_addr_index(dev, 0)); + + return 0; +} +DM_TEST(dm_test_fdt_remap_addr_index_live, + DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +static int dm_test_fdt_remap_addr_name_live(struct unit_test_state *uts) +{ + struct udevice *dev; + fdt_addr_t addr; + void *paddr; + + ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev)); + + addr = dev_read_addr_name(dev, "sandbox-dummy-0"); + ut_asserteq(0x8000, addr); + + paddr = map_physmem(addr, 0, MAP_NOCACHE); + ut_assertnonnull(paddr); + ut_asserteq_ptr(paddr, dev_remap_addr_name(dev, "sandbox-dummy-0")); + + return 0; +} +DM_TEST(dm_test_fdt_remap_addr_name_live, + DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + static int dm_test_fdt_livetree_writing(struct unit_test_state *uts) { struct udevice *dev; |