]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: core: Add support for simple-bus
authorSimon Glass <sjg@chromium.org>
Sat, 4 Oct 2014 17:29:37 +0000 (11:29 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 22 Oct 2014 16:36:56 +0000 (10:36 -0600)
Add a driver for the simple-bus nodes, which allows devices within these
nodes to be bound.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/core/Makefile
drivers/core/simple-bus.c [new file with mode: 0644]
include/dm/uclass-id.h

index c7905b14409fcf4fe56653655960de8407c5348b..151c2398a4d47fce304d43a6ae775befd379baa2 100644 (file)
@@ -5,3 +5,4 @@
 #
 
 obj-y := device.o lists.o root.o uclass.o util.o
+obj-$(CONFIG_OF_CONTROL) += simple-bus.o
diff --git a/drivers/core/simple-bus.c b/drivers/core/simple-bus.c
new file mode 100644 (file)
index 0000000..3ea4d82
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014 Google, Inc
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/root.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int simple_bus_post_bind(struct udevice *dev)
+{
+       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+}
+
+UCLASS_DRIVER(simple_bus) = {
+       .id             = UCLASS_SIMPLE_BUS,
+       .name           = "simple_bus",
+       .post_bind      = simple_bus_post_bind,
+};
+
+static const struct udevice_id generic_simple_bus_ids[] = {
+       { .compatible = "simple-bus" },
+       { }
+};
+
+U_BOOT_DRIVER(simple_bus_drv) = {
+       .name   = "generic_simple_bus",
+       .id     = UCLASS_SIMPLE_BUS,
+       .of_match = generic_simple_bus_ids,
+};
index 0ea7a6f09e627a148966e3b4f3c327b4f2d217db..a8944c97d03a9cfc9162a8c6289b21515862386b 100644 (file)
@@ -19,6 +19,7 @@ enum uclass_id {
        UCLASS_TEST_FDT,
        UCLASS_TEST_BUS,
        UCLASS_SPI_EMUL,        /* sandbox SPI device emulator */
+       UCLASS_SIMPLE_BUS,
 
        /* U-Boot uclasses start here */
        UCLASS_GPIO,            /* Bank of general-purpose I/O pins */