diff options
author | Simon Glass <sjg@chromium.org> | 2021-08-07 07:24:11 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-09-25 09:46:15 -0600 |
commit | 3e57ad907caa55bab8ba52ef87ddbc5130aede2c (patch) | |
tree | e06d04c0dbb964ec388ca885aa4544da2398963d /test/dm | |
parent | f521be6083db98e8e17b5b05626bfa6a0d5acf9b (diff) | |
download | u-boot-3e57ad907caa55bab8ba52ef87ddbc5130aede2c.tar.gz u-boot-3e57ad907caa55bab8ba52ef87ddbc5130aede2c.tar.bz2 u-boot-3e57ad907caa55bab8ba52ef87ddbc5130aede2c.zip |
irq: Tidy up of-platdata irq support
This function is available but not exported. More generally it does not
really work as intended.
Reimplement it and add a sandbox test too.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/of_platdata.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c index c4a2d11410..082989021d 100644 --- a/test/dm/of_platdata.c +++ b/test/dm/of_platdata.c @@ -4,6 +4,7 @@ #include <clk.h> #include <dm.h> #include <dt-structs.h> +#include <irq.h> #include <dm/test.h> #include <test/test.h> #include <test/ut.h> @@ -28,11 +29,9 @@ static int dm_test_of_plat_props(struct unit_test_state *uts) struct udevice *dev; int i; - /* Skip the clock */ - ut_assertok(uclass_first_device_err(UCLASS_MISC, &dev)); - ut_asserteq_str("sandbox_clk_test", dev->name); + ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "sandbox_spl_test", + &dev)); - ut_assertok(uclass_next_device_err(&dev)); plat = dev_get_plat(dev); ut_assert(plat->boolval); ut_asserteq(1, plat->intval); @@ -241,3 +240,22 @@ static int dm_test_of_plat_clk(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_of_plat_clk, UT_TESTF_SCAN_PDATA); + +/* Test irqs with of-platdata */ +static int dm_test_of_plat_irq(struct unit_test_state *uts) +{ + struct dtd_sandbox_irq_test *plat; + struct udevice *dev; + struct irq irq; + + ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "sandbox_irq_test", + &dev)); + plat = dev_get_plat(dev); + + ut_assertok(irq_get_by_phandle(dev, &plat->interrupts_extended[0], + &irq)); + ut_asserteq_str("sandbox_irq", irq.dev->name); + + return 0; +} +DM_TEST(dm_test_of_plat_irq, UT_TESTF_SCAN_PDATA); |