summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/board/devices.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sandbox/board/devices.c')
-rw-r--r--arch/sandbox/board/devices.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/sandbox/board/devices.c b/arch/sandbox/board/devices.c
new file mode 100644
index 0000000000..dba0d5d893
--- /dev/null
+++ b/arch/sandbox/board/devices.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2 only
+ */
+
+#include <common.h>
+#include <driver.h>
+#include <init.h>
+
+static LIST_HEAD(sandbox_device_list);
+
+int sandbox_add_device(struct device_d *dev)
+{
+ list_add(&dev->list, &sandbox_device_list);
+
+ return 0;
+}
+
+static int sandbox_device_init(void)
+{
+ struct device_d *dev, *tmp;
+
+ list_for_each_entry_safe(dev, tmp, &sandbox_device_list, list) {
+ /* reset the list_head before registering for real */
+ dev->list.prev = NULL;
+ dev->list.next = NULL;
+ register_device(dev);
+ }
+
+ return 0;
+}
+postcore_initcall(sandbox_device_init);