aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio/sandbox_test.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-08-07 07:24:12 -0600
committerSimon Glass <sjg@chromium.org>2021-09-25 09:46:15 -0600
commit48609d0789f811014b33e6eefc2c27c99be7fea7 (patch)
treea60a6c721d5776859926501269c2a9f08235bb26 /drivers/gpio/sandbox_test.c
parent3e57ad907caa55bab8ba52ef87ddbc5130aede2c (diff)
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 'drivers/gpio/sandbox_test.c')
-rw-r--r--drivers/gpio/sandbox_test.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpio/sandbox_test.c b/drivers/gpio/sandbox_test.c
new file mode 100644
index 0000000000..c76e199741
--- /dev/null
+++ b/drivers/gpio/sandbox_test.c
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Sandbox driver for testing GPIOs with of-platdata
+ *
+ * Copyright 2021 Google LLC
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <asm-generic/gpio.h>
+
+static const struct udevice_id sandbox_gpio_test_ids[] = {
+ { .compatible = "sandbox,gpio-test" },
+ { }
+};
+
+U_BOOT_DRIVER(sandbox_gpio_test) = {
+ .name = "sandbox_gpio_test",
+ .id = UCLASS_MISC,
+ .of_match = sandbox_gpio_test_ids,
+};