summaryrefslogtreecommitdiff
path: root/drivers/soc/soc_sandbox.c
diff options
context:
space:
mode:
authorDave Gerlach <d-gerlach@ti.com>2020-07-15 23:39:58 -0500
committerSimon Glass <sjg@chromium.org>2020-07-20 11:37:47 -0600
commitfbde39f41725c5e6b85872ca6cc1c0c425c9bd0a (patch)
tree65f953797308c5460455f0e56ed1a21eea9fb1af /drivers/soc/soc_sandbox.c
parent6426a26f4c314ad59d833456932312ce574e9b71 (diff)
downloadu-boot-fbde39f41725c5e6b85872ca6cc1c0c425c9bd0a.tar.gz
u-boot-fbde39f41725c5e6b85872ca6cc1c0c425c9bd0a.tar.bz2
u-boot-fbde39f41725c5e6b85872ca6cc1c0c425c9bd0a.zip
test: Add tests for SOC uclass
Add a sandbox SOC driver, and some tests for the SOC uclass. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Diffstat (limited to 'drivers/soc/soc_sandbox.c')
-rw-r--r--drivers/soc/soc_sandbox.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/soc/soc_sandbox.c b/drivers/soc/soc_sandbox.c
new file mode 100644
index 0000000000..5c82ad84fc
--- /dev/null
+++ b/drivers/soc/soc_sandbox.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Sandbox driver for the SOC uclass
+ *
+ * (C) Copyright 2020 - Texas Instruments Incorporated - http://www.ti.com/
+ * Dave Gerlach <d-gerlach@ti.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <soc.h>
+
+int soc_sandbox_get_family(struct udevice *dev, char *buf, int size)
+{
+ snprintf(buf, size, "SANDBOX1xx");
+
+ return 0;
+}
+
+int soc_sandbox_get_machine(struct udevice *dev, char *buf, int size)
+{
+ snprintf(buf, size, "SANDBOX123");
+
+ return 0;
+}
+
+int soc_sandbox_get_revision(struct udevice *dev, char *buf, int size)
+{
+ snprintf(buf, size, "1.0");
+
+ return 0;
+}
+
+static const struct soc_ops soc_sandbox_ops = {
+ .get_family = soc_sandbox_get_family,
+ .get_revision = soc_sandbox_get_revision,
+ .get_machine = soc_sandbox_get_machine,
+};
+
+int soc_sandbox_probe(struct udevice *dev)
+{
+ return 0;
+}
+
+static const struct udevice_id soc_sandbox_ids[] = {
+ { .compatible = "sandbox,soc" },
+ { }
+};
+
+U_BOOT_DRIVER(soc_sandbox) = {
+ .name = "soc_sandbox",
+ .id = UCLASS_SOC,
+ .ops = &soc_sandbox_ops,
+ .of_match = soc_sandbox_ids,
+ .probe = soc_sandbox_probe,
+};