summaryrefslogtreecommitdiffstats
path: root/arch/sandbox
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sandbox')
-rw-r--r--arch/sandbox/board/Makefile1
-rw-r--r--arch/sandbox/board/board.c3
-rw-r--r--arch/sandbox/board/clock.c3
-rw-r--r--arch/sandbox/board/console.c5
-rw-r--r--arch/sandbox/board/devices.c33
-rw-r--r--arch/sandbox/board/hostfile.c22
-rw-r--r--arch/sandbox/include/asm/processor.h4
-rw-r--r--arch/sandbox/mach-sandbox/include/mach/linux.h4
-rw-r--r--arch/sandbox/os/common.c15
-rw-r--r--arch/sandbox/os/tap.c3
10 files changed, 57 insertions, 36 deletions
diff --git a/arch/sandbox/board/Makefile b/arch/sandbox/board/Makefile
index 266c3a3cec..5104f5cb26 100644
--- a/arch/sandbox/board/Makefile
+++ b/arch/sandbox/board/Makefile
@@ -2,5 +2,6 @@ obj-y += board.o
obj-y += clock.o
obj-y += hostfile.o
obj-y += console.o
+obj-y += devices.o
extra-y += barebox.lds
diff --git a/arch/sandbox/board/board.c b/arch/sandbox/board/board.c
index 71efcc49e5..91fe9bdbc5 100644
--- a/arch/sandbox/board/board.c
+++ b/arch/sandbox/board/board.c
@@ -15,9 +15,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <common.h>
diff --git a/arch/sandbox/board/clock.c b/arch/sandbox/board/clock.c
index 3afbc8d681..137e20b303 100644
--- a/arch/sandbox/board/clock.c
+++ b/arch/sandbox/board/clock.c
@@ -15,9 +15,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <common.h>
diff --git a/arch/sandbox/board/console.c b/arch/sandbox/board/console.c
index 2959e85c7a..b0afa54d95 100644
--- a/arch/sandbox/board/console.c
+++ b/arch/sandbox/board/console.c
@@ -15,9 +15,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <common.h>
@@ -47,6 +44,6 @@ int barebox_register_console(char *name, int stdinfd, int stdoutfd)
data->stdoutfd = stdoutfd;
data->stdinfd = stdinfd;
- return register_device(dev);
+ return sandbox_add_device(dev);
}
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);
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index 96fa100011..2cc7c1fbde 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -15,9 +15,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <common.h>
@@ -102,7 +99,22 @@ device_initcall(hf_init);
int barebox_register_filedev(struct hf_platform_data *hf)
{
- return !add_generic_device("hostfile", DEVICE_ID_DYNAMIC, NULL, hf->base, hf->size,
- IORESOURCE_MEM, hf);
+ struct device_d *dev;
+ struct resource *res;
+
+ dev = xzalloc(sizeof(*dev));
+ strcpy(dev->name, "hostfile");
+ dev->id = DEVICE_ID_DYNAMIC;
+ dev->platform_data = hf;
+
+ res = xzalloc(sizeof(struct resource));
+ res[0].start = hf->base;
+ res[0].end = hf->base + hf->size - 1;
+ res[0].flags = IORESOURCE_MEM;
+
+ dev->resource = res;
+ dev->num_resources = 1;
+
+ return sandbox_add_device(dev);
}
diff --git a/arch/sandbox/include/asm/processor.h b/arch/sandbox/include/asm/processor.h
index 5dedba82ca..075ec74daf 100644
--- a/arch/sandbox/include/asm/processor.h
+++ b/arch/sandbox/include/asm/processor.h
@@ -15,10 +15,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
*/
#ifndef __ASM_PROCESSOR_H_
diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h
index 81f4946ab1..50d2721f77 100644
--- a/arch/sandbox/mach-sandbox/include/mach/linux.h
+++ b/arch/sandbox/mach-sandbox/include/mach/linux.h
@@ -1,6 +1,10 @@
#ifndef __ASM_ARCH_LINUX_H
#define __ASM_ARCH_LINUX_H
+struct device_d;
+
+int sandbox_add_device(struct device_d *dev);
+
struct fb_bitfield;
int linux_register_device(const char *name, void *start, void *end);
diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index a73f400676..0dedfe19f4 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -16,9 +16,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
@@ -372,10 +369,6 @@ int main(int argc, char *argv[])
break;
switch (opt) {
- case 'h':
- break;
- case 'm':
- break;
case 'i':
sprintf(str, "fd%d", fdno);
ret = add_image(optarg, str);
@@ -383,14 +376,8 @@ int main(int argc, char *argv[])
exit(1);
fdno++;
break;
- case 'e':
- break;
- case 'O':
- break;
- case 'I':
- break;
default:
- exit(1);
+ break;
}
}
diff --git a/arch/sandbox/os/tap.c b/arch/sandbox/os/tap.c
index ebd828b2b2..0e29e8e8ad 100644
--- a/arch/sandbox/os/tap.c
+++ b/arch/sandbox/os/tap.c
@@ -15,9 +15,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>