diff options
author | Simon Glass <sjg@chromium.org> | 2021-08-07 07:24:12 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-09-25 09:46:15 -0600 |
commit | 48609d0789f811014b33e6eefc2c27c99be7fea7 (patch) | |
tree | a60a6c721d5776859926501269c2a9f08235bb26 /test | |
parent | 3e57ad907caa55bab8ba52ef87ddbc5130aede2c (diff) | |
download | u-boot-48609d0789f811014b33e6eefc2c27c99be7fea7.tar.gz u-boot-48609d0789f811014b33e6eefc2c27c99be7fea7.tar.bz2 u-boot-48609d0789f811014b33e6eefc2c27c99be7fea7.zip |
dm: gpio: Add of-platdata support
Add support for accessing GPIOs using of-plata. This uses the same
mechanism as for clocks, but allows use of the xlate() method so that
the driver can interpret the parameters.
Update the condition for GPIO_HOG so that it is not built into SPL,
since it needs SPL_OF_REAL which is not enabled in sandbox_spl.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/of_platdata.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c index 082989021d..ec41087a55 100644 --- a/test/dm/of_platdata.c +++ b/test/dm/of_platdata.c @@ -8,6 +8,7 @@ #include <dm/test.h> #include <test/test.h> #include <test/ut.h> +#include <asm-generic/gpio.h> #include <asm/global_data.h> /* Test that we can find a device using of-platdata */ @@ -259,3 +260,22 @@ static int dm_test_of_plat_irq(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_of_plat_irq, UT_TESTF_SCAN_PDATA); + +/* Test GPIOs with of-platdata */ +static int dm_test_of_plat_gpio(struct unit_test_state *uts) +{ + struct dtd_sandbox_gpio_test *plat; + struct udevice *dev; + struct gpio_desc desc; + + ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "sandbox_gpio_test", + &dev)); + plat = dev_get_plat(dev); + + ut_assertok(gpio_request_by_phandle(dev, &plat->test_gpios[0], &desc, + GPIOD_IS_OUT)); + ut_asserteq_str("sandbox_gpio", desc.dev->name); + + return 0; +} +DM_TEST(dm_test_of_plat_gpio, UT_TESTF_SCAN_PDATA); |