summaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2009-10-04 01:20:19 +0200
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2009-10-20 15:02:37 +0200
commit7ac38053538f45032f8f52e99d5cd3368c06037c (patch)
treef138e518352520377db458fadc32262cda32b787 /arch/arm
parent81362c2b2a81d63f93e9534aa624c7f265c55947 (diff)
downloadbarebox-7ac38053538f45032f8f52e99d5cd3368c06037c.tar.gz
barebox-7ac38053538f45032f8f52e99d5cd3368c06037c.tar.xz
at91: add cpu devices common api
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-at91/Makefile4
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c86
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c86
3 files changed, 174 insertions, 2 deletions
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 5d57900c33..cec148c2ed 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -1,3 +1,3 @@
obj-y += clocksource.o gpio.o
-obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o
-obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o
+obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam9260_devices.o
+obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam9263_devices.o
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
new file mode 100644
index 0000000000..04f8f4a922
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -0,0 +1,86 @@
+/*
+ * arch/arm/mach-at91/at91sam9260_devices.c
+ *
+ * Copyright (C) 2006 Atmel
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+#include <common.h>
+#include <asm/armlinux.h>
+#include <asm/hardware.h>
+#include <asm/arch/board.h>
+
+static struct memory_platform_data sram_pdata = {
+ .name = "sram0",
+ .flags = DEVFS_RDWR,
+};
+
+static struct device_d sdram_dev = {
+ .name = "mem",
+ .map_base = 0x20000000,
+ .platform_data = &sram_pdata,
+};
+
+void at91_add_device_sdram(u32 size)
+{
+ sdram_dev.size = size;
+ register_device(&sdram_dev);
+ armlinux_add_dram(&sdram_dev);
+}
+
+#if defined(CONFIG_DRIVER_NET_MACB)
+static struct device_d macb_dev = {
+ .name = "macb",
+ .map_base = AT91C_BASE_EMACB,
+ .size = 0x1000,
+};
+
+void at91_add_device_eth(struct at91_ether_platform_data *data)
+{
+ if (!data)
+ return;
+
+ macb_dev.platform_data = data;
+ register_device(&macb_dev);
+}
+#else
+void at91_add_device_eth(struct at91_ether_platform_data *data) {}
+#endif
+
+#if defined(CONFIG_NAND_ATMEL)
+static struct device_d nand_dev = {
+ .name = "atmel_nand",
+ .map_base = 0x40000000,
+ .size = 0x10,
+};
+
+void at91_add_device_nand(struct atmel_nand_data *data)
+{
+ nand_dev.platform_data = data;
+ register_device(&nand_dev);
+}
+#else
+void at91_add_device_nand(struct atmel_nand_data *data) {}
+#endif
+
+static struct device_d dbgu_serial_device = {
+ .name = "atmel_serial",
+ .map_base = AT91C_BASE_DBGU,
+ .size = 4096,
+};
+
+void at91_register_uart(unsigned id)
+{
+ switch (id) {
+ case 0: /* DBGU */
+ register_device(&dbgu_serial_device);
+ break;
+ default:
+ return;
+ }
+
+}
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
new file mode 100644
index 0000000000..4eb71f8482
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -0,0 +1,86 @@
+/*
+ * arch/arm/mach-at91/at91sam9263_devices.c
+ *
+ * Copyright (C) 2006 Atmel
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+#include <common.h>
+#include <asm/armlinux.h>
+#include <asm/hardware.h>
+#include <asm/arch/board.h>
+
+static struct memory_platform_data ram_pdata = {
+ .name = "ram0",
+ .flags = DEVFS_RDWR,
+};
+
+static struct device_d sdram_dev = {
+ .name = "mem",
+ .map_base = 0x20000000,
+ .platform_data = &ram_pdata,
+};
+
+void at91_add_device_sdram(u32 size)
+{
+ sdram_dev.size = size;
+ register_device(&sdram_dev);
+ armlinux_add_dram(&sdram_dev);
+}
+
+#if defined(CONFIG_DRIVER_NET_MACB)
+static struct device_d macb_dev = {
+ .name = "macb",
+ .map_base = AT91C_BASE_MACB,
+ .size = 0x1000,
+};
+
+void at91_add_device_eth(struct at91_ether_platform_data *data)
+{
+ if (!data)
+ return;
+
+ macb_dev.platform_data = data;
+ register_device(&macb_dev);
+}
+#else
+void at91_add_device_eth(struct at91_ether_platform_data *data) {}
+#endif
+
+#if defined(CONFIG_NAND_ATMEL)
+static struct device_d nand_dev = {
+ .name = "atmel_nand",
+ .map_base = 0x40000000,
+ .size = 0x10,
+};
+
+void at91_add_device_nand(struct atmel_nand_data *data)
+{
+ nand_dev.platform_data = data;
+ register_device(&nand_dev);
+}
+#else
+void at91_add_device_nand(struct atmel_nand_data *data) {}
+#endif
+
+static struct device_d dbgu_serial_device = {
+ .name = "atmel_serial",
+ .map_base = AT91C_BASE_DBGU,
+ .size = 4096,
+};
+
+void at91_register_uart(unsigned id)
+{
+ switch (id) {
+ case 0: /* DBGU */
+ register_device(&dbgu_serial_device);
+ break;
+ default:
+ return;
+ }
+
+}