summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-07-06 12:54:35 -0600
committerSimon Glass <sjg@chromium.org>2015-07-21 17:39:33 -0600
commit04035fd36c9c793ab7b6e7c4513fe6a053daf5dd (patch)
tree7830bc280ef6d4c8b5b833f22c0689e3191af5f4 /drivers/misc
parent3c43fba3d240a5d7b6042bfb834c274a8921ebd8 (diff)
dm: test: Add a test for the system controller uclass
Add a test to confirm that we can access system controllers and find their driver data. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/syscon_sandbox.c27
2 files changed, 28 insertions, 0 deletions
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 629de25a428..5218b91c0ba 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -29,6 +29,7 @@ endif
obj-$(CONFIG_SMSC_LPC47M) += smsc_lpc47m.o
obj-$(CONFIG_STATUS_LED) += status_led.o
obj-$(CONFIG_SANDBOX) += swap_case.o
+obj-$(CONFIG_SANDBOX) += syscon_sandbox.o
obj-$(CONFIG_TWL4030_LED) += twl4030_led.o
obj-$(CONFIG_FSL_IFC) += fsl_ifc.o
obj-$(CONFIG_FSL_SEC_MON) += fsl_sec_mon.o
diff --git a/drivers/misc/syscon_sandbox.c b/drivers/misc/syscon_sandbox.c
new file mode 100644
index 00000000000..ccfab3ef987
--- /dev/null
+++ b/drivers/misc/syscon_sandbox.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015 Google, Inc
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <syscon.h>
+#include <asm/test.h>
+#include <dm/lists.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const struct udevice_id sandbox_syscon_ids[] = {
+ { .compatible = "sandbox,syscon0", .data = SYSCON0 },
+ { .compatible = "sandbox,syscon1", .data = SYSCON1 },
+ { }
+};
+
+U_BOOT_DRIVER(sandbox_syscon) = {
+ .name = "sandbox_syscon",
+ .id = UCLASS_SYSCON,
+ .of_match = sandbox_syscon_ids,
+};