* [PATCH 4/7] ARM OMAP: Create device file
2012-12-18 14:13 [PATCH 0/7] Adding pcm051 support Teresa Gámez
` (2 preceding siblings ...)
2012-12-18 14:13 ` [PATCH 3/7] ARM AM33XX: Add MMC Bases Teresa Gámez
@ 2012-12-18 14:13 ` Teresa Gámez
2012-12-18 17:29 ` Jean-Christophe PLAGNIOL-VILLARD
2012-12-18 14:13 ` [PATCH 5/7] ARM OMAP: Use wrapper in board files Teresa Gámez
` (2 subsequent siblings)
6 siblings, 1 reply; 9+ messages in thread
From: Teresa Gámez @ 2012-12-18 14:13 UTC (permalink / raw)
To: barebox
Created wrapper to add omap devices.
Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
---
arch/arm/mach-omap/Makefile | 4 +-
arch/arm/mach-omap/devices.c | 69 +++++++++++++++++++
arch/arm/mach-omap/include/mach/am33xx-devices.h | 36 ++++++++++
arch/arm/mach-omap/include/mach/devices.h | 27 ++++++++
arch/arm/mach-omap/include/mach/omap3-devices.h | 60 ++++++++++++++++-
arch/arm/mach-omap/include/mach/omap4-devices.h | 77 ++++++++++++++++++++++
6 files changed, 269 insertions(+), 4 deletions(-)
create mode 100644 arch/arm/mach-omap/devices.c
create mode 100644 arch/arm/mach-omap/include/mach/am33xx-devices.h
create mode 100644 arch/arm/mach-omap/include/mach/devices.h
create mode 100644 arch/arm/mach-omap/include/mach/omap4-devices.h
diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index 1536744..494da4e 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -15,8 +15,8 @@
# GNU General Public License for more details.
#
#
-obj-$(CONFIG_ARCH_OMAP) += syslib.o
-pbl-$(CONFIG_ARCH_OMAP) += syslib.o
+obj-$(CONFIG_ARCH_OMAP) += syslib.o devices.o
+pbl-$(CONFIG_ARCH_OMAP) += syslib.o devices.o
obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
obj-$(CONFIG_OMAP_CLOCK_SOURCE_DMTIMER0) += dmtimer0.o
obj-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o
diff --git a/arch/arm/mach-omap/devices.c b/arch/arm/mach-omap/devices.c
new file mode 100644
index 0000000..011db5a
--- /dev/null
+++ b/arch/arm/mach-omap/devices.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2012 Teresa Gámez, Phytec Messtechnik GmbH
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * 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>
+#include <driver.h>
+#include <sizes.h>
+#include <ns16550.h>
+#include <asm/armlinux.h>
+#include <mach/devices.h>
+
+static inline struct device_d *omap_add_device(char *name, resource_size_t base,
+ resource_size_t size, void *pdata)
+{
+ return add_generic_device(name, DEVICE_ID_DYNAMIC, NULL,
+ base, size, IORESOURCE_MEM, pdata);
+}
+
+void omap_add_ram0(resource_size_t size)
+{
+ arm_add_mem_device("ram0", 0x80000000, size);
+}
+
+void omap_add_sram0(resource_size_t base, resource_size_t size)
+{
+ add_mem_device("sram0", base, size, IORESOURCE_MEM_WRITEABLE);
+}
+
+static struct NS16550_plat serial_plat = {
+ .clock = 48000000, /* 48MHz (APLL96/2) */
+ .shift = 2,
+};
+
+struct device_d *omap_add_ns16550(resource_size_t base)
+{
+ return add_ns16550_device(DEVICE_ID_DYNAMIC, base, SZ_1K,
+ IORESOURCE_MEM_8BIT, &serial_plat);
+}
+
+struct device_d *omap_add_mmc(resource_size_t base, void *pdata)
+{
+ return omap_add_device("omap-hsmmc", base, SZ_4K, pdata);
+}
+
+struct device_d *omap_add_i2c(resource_size_t base, void *pdata)
+{
+ return omap_add_device("i2c-omap", base, SZ_4K, pdata);
+}
+
+struct device_d *omap_add_spi(int id, resource_size_t base, void *pdata)
+{
+ return add_generic_device("omap3_spi", id, NULL,
+ base, SZ_4K, IORESOURCE_MEM, pdata);
+}
diff --git a/arch/arm/mach-omap/include/mach/am33xx-devices.h b/arch/arm/mach-omap/include/mach/am33xx-devices.h
new file mode 100644
index 0000000..40ce854
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/am33xx-devices.h
@@ -0,0 +1,36 @@
+#include <driver.h>
+#include <sizes.h>
+
+#include <mach/devices.h>
+#include <mach/mcspi.h>
+#include <mach/am33xx-silicon.h>
+
+static inline struct device_d *am33xx_add_ns16550_uart0(void)
+{
+ return omap_add_ns16550(AM33XX_UART0_BASE);
+}
+
+static inline struct device_d *am33xx_add_ns16550_uart1(void)
+{
+ return omap_add_ns16550(AM33XX_UART1_BASE);
+}
+
+static inline struct device_d *am33xx_add_ns16550_uart2(void)
+{
+ return omap_add_ns16550(AM33XX_UART2_BASE);
+}
+
+static inline struct device_d *am33xx_add_mmc0(void *pdata)
+{
+ return omap_add_mmc(AM33XX_MMCHS0_BASE + 0x100, pdata);
+}
+
+static inline struct device_d *am33xx_add_mmc1(void *pdata)
+{
+ return omap_add_mmc(AM33XX_MMC1_BASE + 0x100, pdata);
+}
+
+static inline struct device_d *am33xx_add_mmc2(void *pdata)
+{
+ return omap_add_mmc(AM33XX_MMCHS2_BASE + 0x100, pdata);
+}
diff --git a/arch/arm/mach-omap/include/mach/devices.h b/arch/arm/mach-omap/include/mach/devices.h
new file mode 100644
index 0000000..3841558
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/devices.h
@@ -0,0 +1,27 @@
+/*
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __ASM_ARCH_OMAP_DEVICES_H
+#define __ASM_ARCH_OMAP_DEVICES_H
+
+void omap_add_ram0(resource_size_t size);
+void omap_add_sram0(resource_size_t base, resource_size_t size);
+struct device_d *omap_add_ns16550(resource_size_t base);
+struct device_d *omap_add_mmc(resource_size_t base, void *pdata);
+struct device_d *omap_add_i2c(resource_size_t base, void *pdata);
+struct device_d *omap_add_spi(int id, resource_size_t base, void *pdata);
+
+#endif
diff --git a/arch/arm/mach-omap/include/mach/omap3-devices.h b/arch/arm/mach-omap/include/mach/omap3-devices.h
index 8a6b324..35ee51c 100644
--- a/arch/arm/mach-omap/include/mach/omap3-devices.h
+++ b/arch/arm/mach-omap/include/mach/omap3-devices.h
@@ -1,14 +1,70 @@
#include <driver.h>
#include <sizes.h>
+#include <mach/devices.h>
#include <mach/mcspi.h>
+#include <mach/omap3-silicon.h>
+
+static inline void omap3_add_sram0(void)
+{
+ return omap_add_sram0(OMAP_SRAM_BASE, 64 * SZ_1K);
+}
+
+static inline struct device_d *omap3_add_ns16550_uart1(void)
+{
+ return omap_add_ns16550(OMAP_UART1_BASE);
+}
+
+static inline struct device_d *omap3_add_ns16550_uart2(void)
+{
+ return omap_add_ns16550(OMAP_UART2_BASE);
+}
+
+static inline struct device_d *omap3_add_ns16550_uart3(void)
+{
+ return omap_add_ns16550(OMAP_UART3_BASE);
+}
+static inline struct device_d *omap3_add_i2c1(void *pdata)
+{
+ return omap_add_i2c(OMAP_I2C1_BASE, pdata);
+}
+
+static inline struct device_d *omap3_add_i2c2(void *pdata)
+{
+ return omap_add_i2c(OMAP_I2C2_BASE, pdata);
+}
+
+static inline struct device_d *omap3_add_i2c3(void *pdata)
+{
+ return omap_add_i2c(OMAP_I2C3_BASE, pdata);
+}
+
+static inline struct device_d *omap3_add_mmc1(void *pdata)
+{
+ return omap_add_mmc(OMAP_MMC1_BASE, pdata);
+}
+
+static inline struct device_d *omap3_add_mmc2(void *pdata)
+{
+ return omap_add_mmc(OMAP_MMC2_BASE, pdata);
+}
+
+static inline struct device_d *omap3_add_mmc3(void *pdata)
+{
+ return omap_add_mmc(OMAP_MMC3_BASE, pdata);
+}
+
+static inline struct device_d *omap3_add_ehci(void *pdata)
+{
+ return add_usb_ehci_device(DEVICE_ID_DYNAMIC, OMAP_EHCI_BASE,
+ OMAP_EHCI_BASE + 0x10, pdata);
+}
/* the device numbering is the same as in the device tree */
static inline struct device_d *omap3_add_spi(int id, resource_size_t start)
{
- return add_generic_device("omap3_spi", id, NULL, start, SZ_4K,
- IORESOURCE_MEM, NULL);
+ return omap_add_spi(id, start, NULL);
}
static inline struct device_d *omap3_add_spi1(void)
diff --git a/arch/arm/mach-omap/include/mach/omap4-devices.h b/arch/arm/mach-omap/include/mach/omap4-devices.h
new file mode 100644
index 0000000..0f58cc9
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/omap4-devices.h
@@ -0,0 +1,77 @@
+#include <driver.h>
+#include <sizes.h>
+
+#include <mach/devices.h>
+#include <mach/omap4-silicon.h>
+
+static inline void omap4_add_sram0(void)
+{
+ return omap_add_sram0(OMAP44XX_SRAM_BASE, 48 * SZ_1K);
+}
+
+static inline struct device_d *omap4_add_ns16550_uart1(void)
+{
+ return omap_add_ns16550(OMAP44XX_UART1_BASE);
+}
+
+static inline struct device_d *omap4_add_ns16550_uart2(void)
+{
+ return omap_add_ns16550(OMAP44XX_UART2_BASE);
+}
+
+static inline struct device_d *omap4_add_ns16550_uart3(void)
+{
+ return omap_add_ns16550(OMAP44XX_UART3_BASE);
+}
+
+static inline struct device_d *omap4_add_i2c1(void *pdata)
+{
+ return omap_add_i2c(OMAP44XX_I2C1_BASE, pdata);
+}
+
+static inline struct device_d *omap4_add_i2c2(void *pdata)
+{
+ return omap_add_i2c(OMAP44XX_I2C2_BASE, pdata);
+}
+
+static inline struct device_d *omap4_add_i2c3(void *pdata)
+{
+ return omap_add_i2c(OMAP44XX_I2C3_BASE, pdata);
+}
+
+static inline struct device_d *omap4_add_i2c4(void *pdata)
+{
+ return omap_add_i2c(OMAP44XX_I2C4_BASE, pdata);
+}
+
+static inline struct device_d *omap4_add_mmc1(void *pdata)
+{
+ return omap_add_mmc(OMAP44XX_MMC1_BASE, pdata);
+}
+
+static inline struct device_d *omap4_add_mmc2(void *pdata)
+{
+ return omap_add_mmc(OMAP44XX_MMC2_BASE, pdata);
+}
+
+static inline struct device_d *omap4_add_mmc3(void *pdata)
+{
+ return omap_add_mmc(OMAP44XX_MMC3_BASE, pdata);
+}
+
+static inline struct device_d *omap4_add_mmc4(void *pdata)
+{
+ return omap_add_mmc(OMAP44XX_MMC4_BASE, pdata);
+}
+
+static inline struct device_d *omap4_add_mmc5(void *pdata)
+{
+ return omap_add_mmc(OMAP44XX_MMC5_BASE, pdata);
+}
+
+static inline struct device_d *omap4_add_ehci(void *pdata)
+{
+ return add_usb_ehci_device(DEVICE_ID_DYNAMIC, OMAP44XX_EHCI_BASE,
+ OMAP44XX_EHCI_BASE + 0x10, pdata);
+}
+
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5/7] ARM OMAP: Use wrapper in board files
2012-12-18 14:13 [PATCH 0/7] Adding pcm051 support Teresa Gámez
` (3 preceding siblings ...)
2012-12-18 14:13 ` [PATCH 4/7] ARM OMAP: Create device file Teresa Gámez
@ 2012-12-18 14:13 ` Teresa Gámez
2012-12-18 14:13 ` [PATCH 6/7] ARM AM33XX: Add mmc0 pin mux function Teresa Gámez
2012-12-18 14:13 ` [PATCH 7/7] pcm051: Add inital support Teresa Gámez
6 siblings, 0 replies; 9+ messages in thread
From: Teresa Gámez @ 2012-12-18 14:13 UTC (permalink / raw)
To: barebox
Use the omap wrappers in board files instead of the add_generic_device().
Compile Tested every board.
Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
---
arch/arm/boards/archosg9/board.c | 19 ++++++-------------
arch/arm/boards/beagle/board.c | 20 ++++++--------------
arch/arm/boards/beaglebone/board.c | 17 ++++-------------
arch/arm/boards/omap343xdsp/board.c | 12 ++++--------
arch/arm/boards/omap3evm/board.c | 20 +++++---------------
arch/arm/boards/panda/board.c | 22 ++++++----------------
arch/arm/boards/pcm049/board.c | 21 +++++++--------------
arch/arm/boards/phycard-a-l1/pca-a-l1.c | 20 +++++---------------
arch/arm/boards/phycard-a-xl2/pca-a-xl2.c | 21 +++++++--------------
9 files changed, 50 insertions(+), 122 deletions(-)
diff --git a/arch/arm/boards/archosg9/board.c b/arch/arm/boards/archosg9/board.c
index dab0a36..57cfc4f 100644
--- a/arch/arm/boards/archosg9/board.c
+++ b/arch/arm/boards/archosg9/board.c
@@ -15,15 +15,12 @@
#include <ns16550.h>
#include <asm/armlinux.h>
#include <generated/mach-types.h>
+#include <mach/omap4-devices.h>
#include <mach/omap4-silicon.h>
#include <sizes.h>
#include <i2c/i2c.h>
#include <gpio.h>
-static struct NS16550_plat serial_plat = {
- .clock = 48000000, /* 48MHz (APLL96/2) */
- .shift = 2,
-};
static int archosg9_console_init(void){
if (IS_ENABLED(CONFIG_DRIVER_SERIAL_OMAP4_USBBOOT))
add_generic_device("serial_omap4_usbboot", DEVICE_ID_DYNAMIC
@@ -31,15 +28,14 @@ static int archosg9_console_init(void){
if (IS_ENABLED(CONFIG_DRIVER_SERIAL_NS16550)) {
gpio_direction_output(41, 0); /* gps_disable */
gpio_direction_output(34, 1); /* 1v8_pwron */
- add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP44XX_UART1_BASE, 1024,
- IORESOURCE_MEM_8BIT, &serial_plat);
+ omap4_add_ns16550_uart1();
}
return 0;
}
console_initcall(archosg9_console_init);
static int archosg9_mem_init(void){
- arm_add_mem_device("ram0", 0x80000000, SZ_1G);
+ omap_add_ram0(SZ_1G);
return 0;
}
mem_initcall(archosg9_mem_init);
@@ -50,12 +46,9 @@ static struct i2c_board_info i2c_devices[] = {
static int archosg9_devices_init(void){
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
- add_generic_device("i2c-omap" , DEVICE_ID_DYNAMIC, NULL,
- OMAP44XX_I2C1_BASE, 0x100, IORESOURCE_MEM, NULL);
- add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL,
- OMAP44XX_MMC1_BASE, SZ_4K, IORESOURCE_MEM, NULL);
- add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL,
- OMAP44XX_MMC2_BASE, SZ_4K, IORESOURCE_MEM, NULL);
+ omap4_add_i2c1(NULL);
+ omap4_add_mmc1(NULL);
+ omap4_add_mmc2(NULL);
armlinux_set_bootparams((void *)0x80000100);
/*
diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index f6d9d3f..897de48 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -60,6 +60,7 @@
#include <mach/sys_info.h>
#include <mach/syslib.h>
#include <mach/control.h>
+#include <mach/omap3-devices.h>
#include <mach/omap3-mux.h>
#include <mach/gpmc.h>
#include <mach/gpmc_nand.h>
@@ -234,11 +235,6 @@ pure_initcall(beagle_board_init);
#ifdef CONFIG_DRIVER_SERIAL_NS16550
-static struct NS16550_plat serial_plat = {
- .clock = 48000000, /* 48MHz (APLL96/2) */
- .shift = 2,
-};
-
/**
* @brief UART serial port initialization - remember to enable COM clocks in
* arch
@@ -248,8 +244,7 @@ static struct NS16550_plat serial_plat = {
static int beagle_console_init(void)
{
/* Register the serial port */
- add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
- &serial_plat);
+ omap3_add_ns16550_uart3();
return 0;
}
@@ -286,7 +281,7 @@ static struct gpmc_nand_platform_data nand_plat = {
static int beagle_mem_init(void)
{
- arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024);
+ omap_add_ram0(SZ_128M);
return 0;
}
@@ -295,13 +290,11 @@ mem_initcall(beagle_mem_init);
static int beagle_devices_init(void)
{
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
- add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, OMAP_I2C1_BASE, SZ_4K,
- IORESOURCE_MEM, NULL);
+ omap3_add_i2c1(NULL);
#ifdef CONFIG_USB_EHCI_OMAP
if (ehci_omap_init(&omap_ehci_pdata) >= 0)
- add_usb_ehci_device(DEVICE_ID_DYNAMIC, OMAP_EHCI_BASE,
- OMAP_EHCI_BASE + 0x10, &ehci_pdata);
+ omap3_add_ehci(&ehci_pdata);
#endif /* CONFIG_USB_EHCI_OMAP */
#ifdef CONFIG_OMAP_GPMC
/* WP is made high and WAIT1 active Low */
@@ -309,8 +302,7 @@ static int beagle_devices_init(void)
#endif
omap_add_gpmc_nand_device(&nand_plat);
- add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, OMAP_MMC1_BASE, SZ_4K,
- IORESOURCE_MEM, NULL);
+ omap3_add_mmc1(NULL);
armlinux_set_bootparams((void *)0x80000100);
armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
diff --git a/arch/arm/boards/beaglebone/board.c b/arch/arm/boards/beaglebone/board.c
index fd30dd9..5215ec2 100644
--- a/arch/arm/boards/beaglebone/board.c
+++ b/arch/arm/boards/beaglebone/board.c
@@ -33,6 +33,7 @@
#include <ns16550.h>
#include <asm/armlinux.h>
#include <generated/mach-types.h>
+#include <mach/am33xx-devices.h>
#include <mach/am33xx-silicon.h>
#include <mach/am33xx-clock.h>
#include <mach/sdrc.h>
@@ -288,11 +289,6 @@ pure_initcall(beaglebone_board_init);
#ifdef CONFIG_DRIVER_SERIAL_NS16550
-static struct NS16550_plat serial_plat = {
- .clock = 48000000, /* 48MHz (APLL96/2) */
- .shift = 2,
-};
-
/**
* @brief UART serial port initialization - remember to enable COM clocks in
* arch
@@ -302,9 +298,7 @@ static struct NS16550_plat serial_plat = {
static int beaglebone_console_init(void)
{
/* Register the serial port */
- add_ns16550_device(-1, AM33XX_UART0_BASE, SZ_1K, IORESOURCE_MEM_8BIT,
- &serial_plat);
-
+ am33xx_add_ns16550_uart0();
return 0;
}
console_initcall(beaglebone_console_init);
@@ -312,7 +306,7 @@ console_initcall(beaglebone_console_init);
static int beaglebone_mem_init(void)
{
- arm_add_mem_device("ram0", 0x80000000, 256 * 1024 * 1024);
+ omap_add_ram0(256 * 1024 * 1024);
return 0;
}
@@ -320,10 +314,7 @@ mem_initcall(beaglebone_mem_init);
static int beaglebone_devices_init(void)
{
- add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL,
- AM33XX_MMCHS0_BASE+0x100, SZ_4K,
- IORESOURCE_MEM, NULL);
-
+ am33xx_add_mmc0(NULL);
enable_i2c0_pin_mux();
armlinux_set_bootparams((void *)0x80000100);
diff --git a/arch/arm/boards/omap343xdsp/board.c b/arch/arm/boards/omap343xdsp/board.c
index fc50eb1..3298d64 100644
--- a/arch/arm/boards/omap343xdsp/board.c
+++ b/arch/arm/boards/omap343xdsp/board.c
@@ -43,11 +43,13 @@
#include <common.h>
#include <console.h>
+#include <sizes.h>
#include <init.h>
#include <driver.h>
#include <io.h>
#include <ns16550.h>
#include <asm/armlinux.h>
+#include <mach/omap3-devices.h>
#include <mach/omap3-silicon.h>
#include <mach/sdrc.h>
#include <mach/sys_info.h>
@@ -603,11 +605,6 @@ static void mux_config(void)
#ifdef CONFIG_DRIVER_SERIAL_NS16550
-static struct NS16550_plat serial_plat = {
- .clock = 48000000, /* 48MHz (APLL96/2) */
- .shift = 2,
-};
-
/**
* @brief UART serial port initialization - remember to enable COM clocks in arch
*
@@ -616,8 +613,7 @@ static struct NS16550_plat serial_plat = {
static int sdp3430_console_init(void)
{
/* Register the serial port */
- add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
- &serial_plat);
+ omap3_add_ns16550_uart3();
return 0;
}
@@ -627,7 +623,7 @@ console_initcall(sdp3430_console_init);
static int sdp3430_mem_init(void)
{
- arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024);
+ omap_add_ram0(SZ_128M);
return 0;
}
diff --git a/arch/arm/boards/omap3evm/board.c b/arch/arm/boards/omap3evm/board.c
index a5faf56..f39c448 100644
--- a/arch/arm/boards/omap3evm/board.c
+++ b/arch/arm/boards/omap3evm/board.c
@@ -37,7 +37,6 @@
*
*/
-
#include <common.h>
#include <console.h>
#include <init.h>
@@ -46,6 +45,7 @@
#include <sizes.h>
#include <ns16550.h>
#include <asm/armlinux.h>
+#include <mach/omap3-devices.h>
#include <mach/omap3-silicon.h>
#include <mach/sdrc.h>
#include <mach/sys_info.h>
@@ -56,7 +56,6 @@
#include <errno.h>
#include <generated/mach-types.h>
-
/*
* Boot-time initialization(s)
*/
@@ -212,11 +211,6 @@ pure_initcall(omap3_evm_board_init);
#ifdef CONFIG_DRIVER_SERIAL_NS16550
-static struct NS16550_plat serial_plat = {
- .clock = 48000000, /* 48MHz (APLL96/2) */
- .shift = 2,
-};
-
/**
* @brief Initialize the serial port to be used as console.
*
@@ -224,14 +218,11 @@ static struct NS16550_plat serial_plat = {
*/
static int omap3evm_init_console(void)
{
- add_ns16550_device(DEVICE_ID_DYNAMIC,
#if defined(CONFIG_OMAP3EVM_UART1)
- OMAP_UART1_BASE,
+ omap3_add_ns16550_uart1();
#elif defined(CONFIG_OMAP3EVM_UART3)
- OMAP_UART3_BASE,
+ omap3_add_ns16550_uart3();
#endif
- 1024, IORESOURCE_MEM_8BIT, &serial_plat);
-
return 0;
}
console_initcall(omap3evm_init_console);
@@ -239,7 +230,7 @@ console_initcall(omap3evm_init_console);
static int omap3evm_mem_init(void)
{
- arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024);
+ omap_add_ram0(SZ_128M);
return 0;
}
@@ -254,8 +245,7 @@ static int omap3evm_init_devices(void)
gpmc_generic_init(0x10);
#endif
#ifdef CONFIG_MCI_OMAP_HSMMC
- add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, OMAP_MMC1_BASE, SZ_4K,
- IORESOURCE_MEM, NULL);
+ omap3_add_mmc1(NULL);
#endif
armlinux_set_bootparams((void *)0x80000100);
armlinux_set_architecture(MACH_TYPE_OMAP3EVM);
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index 99222d2..c89a3a0 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -19,6 +19,7 @@
#include <asm/mmu.h>
#include <mach/gpio.h>
#include <environment.h>
+#include <mach/omap4-devices.h>
#include <mach/xload.h>
#include <i2c/i2c.h>
#include <gpio.h>
@@ -33,16 +34,10 @@ static int board_revision;
#define GPIO_BOARD_ID1 101
#define GPIO_BOARD_ID2 171
-static struct NS16550_plat serial_plat = {
- .clock = 48000000, /* 48MHz (APLL96/2) */
- .shift = 2,
-};
-
static int panda_console_init(void)
{
/* Register the serial port */
- add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP44XX_UART3_BASE, 1024,
- IORESOURCE_MEM_8BIT, &serial_plat);
+ omap4_add_ns16550_uart3();
return 0;
}
@@ -50,7 +45,7 @@ console_initcall(panda_console_init);
static int panda_mem_init(void)
{
- arm_add_mem_device("ram0", 0x80000000, SZ_1G);
+ omap_add_ram0(SZ_1G);
return 0;
}
@@ -92,8 +87,7 @@ static void panda_ehci_init(void)
/* enable power to hub */
gpio_set_value(GPIO_HUB_POWER, 1);
- add_usb_ehci_device(DEVICE_ID_DYNAMIC, 0x4a064c00,
- 0x4a064c00 + 0x10, &ehci_pdata);
+ omap4_add_ehci(&ehci_pdata);
}
#else
static void panda_ehci_init(void)
@@ -160,13 +154,9 @@ static int panda_devices_init(void)
}
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
- add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC,
- NULL, 0x48070000, 0x1000,
- IORESOURCE_MEM, NULL);
-
+ omap4_add_i2c1(NULL);
- add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
- IORESOURCE_MEM, NULL);
+ omap4_add_mmc1(NULL);
panda_ehci_init();
panda_led_init();
diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c
index 859ce3b..045e259 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -32,22 +32,17 @@
#include <partition.h>
#include <nand.h>
#include <asm/mmu.h>
+#include <mach/omap4-devices.h>
#include <mach/gpio.h>
#include <mach/gpmc.h>
#include <mach/gpmc_nand.h>
#include <mach/xload.h>
#include <i2c/i2c.h>
-static struct NS16550_plat serial_plat = {
- .clock = 48000000, /* 48MHz (APLL96/2) */
- .shift = 2,
-};
-
static int pcm049_console_init(void)
{
/* Register the serial port */
- add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP44XX_UART3_BASE, 1024,
- IORESOURCE_MEM_8BIT, &serial_plat);
+ omap4_add_ns16550_uart3();
return 0;
}
@@ -55,10 +50,10 @@ console_initcall(pcm049_console_init);
static int pcm049_mem_init(void)
{
- arm_add_mem_device("ram0", 0x80000000, SZ_512M);
+ omap_add_ram0(SZ_512M);
+
+ omap4_add_sram0();
- add_mem_device("sram0", 0x40300000, 48 * 1024,
- IORESOURCE_MEM_WRITEABLE);
return 0;
}
mem_initcall(pcm049_mem_init);
@@ -99,11 +94,9 @@ static struct gpmc_nand_platform_data nand_plat = {
static int pcm049_devices_init(void)
{
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
- add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, 0x48070000, 0x1000,
- IORESOURCE_MEM, NULL);
+ omap4_add_i2c1(NULL);
- add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
- IORESOURCE_MEM, NULL);
+ omap4_add_mmc1(NULL);
gpmc_generic_init(0x10);
diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
index c6a7e60..d69a501 100644
--- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
+++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
@@ -52,6 +52,7 @@
#include <generated/mach-types.h>
#include <linux/err.h>
#include <mach/control.h>
+#include <mach/omap3-devices.h>
#include <mach/gpmc.h>
#include <mach/gpmc_nand.h>
#include <mach/omap_hsmmc.h>
@@ -304,14 +305,6 @@ static int pcaal1_board_init(void)
}
pure_initcall(pcaal1_board_init);
-/*
- * Run-time initialization(s)
- */
-static struct NS16550_plat serial_plat = {
- .clock = 48000000, /* 48MHz (APLL96/2) */
- .shift = 2,
-};
-
/**
* @brief Initialize the serial port to be used as console.
*
@@ -319,8 +312,7 @@ static struct NS16550_plat serial_plat = {
*/
static int pcaal1_init_console(void)
{
- add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
- &serial_plat);
+ omap3_add_ns16550_uart3();
return 0;
}
@@ -362,10 +354,9 @@ static int pcaal1_mem_init(void)
*/
gpmc_generic_init(0x10);
#endif
- add_mem_device("sram0", OMAP_SRAM_BASE, 60 * SZ_1K,
- IORESOURCE_MEM_WRITEABLE);
+ omap3_add_sram0();
- arm_add_mem_device("ram0", OMAP_SDRC_CS0, get_sdr_cs_size(SDRC_CS0_OSET));
+ omap_add_ram0(get_sdr_cs_size(SDRC_CS0_OSET));
printf("found %s at SDCS0\n", size_human_readable(get_sdr_cs_size(SDRC_CS0_OSET)));
if ((get_sdr_cs_size(SDRC_CS1_OSET) != 0) && (get_sdr_cs1_base() != OMAP_SDRC_CS0)) {
@@ -394,8 +385,7 @@ static int pcaal1_init_devices(void)
omap_add_gpmc_nand_device(&nand_plat);
#ifdef CONFIG_MCI_OMAP_HSMMC
- add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, OMAP_MMC1_BASE, SZ_4K,
- IORESOURCE_MEM, &pcaal1_hsmmc_plat);
+ omap3_add_mmc1(&pcaal1_hsmmc_plat);
#endif
#ifdef CONFIG_DRIVER_NET_SMC911X
diff --git a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
index 26b31dd..2cf1ace 100644
--- a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
+++ b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
@@ -32,6 +32,7 @@
#include <partition.h>
#include <nand.h>
#include <asm/mmu.h>
+#include <mach/omap4-devices.h>
#include <mach/gpio.h>
#include <mach/gpmc.h>
#include <mach/gpmc_nand.h>
@@ -39,16 +40,10 @@
#include <mach/omap_hsmmc.h>
#include <i2c/i2c.h>
-static struct NS16550_plat serial_plat = {
- .clock = 48000000, /* 48MHz (APLL96/2) */
- .shift = 2,
-};
-
static int pcaaxl2_console_init(void)
{
/* Register the serial port */
- add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP44XX_UART3_BASE, 1024,
- IORESOURCE_MEM_8BIT, &serial_plat);
+ omap4_add_ns16550_uart3();
return 0;
}
@@ -56,10 +51,10 @@ console_initcall(pcaaxl2_console_init);
static int pcaaxl2_mem_init(void)
{
- arm_add_mem_device("ram0", 0x80000000, SZ_512M);
+ omap_add_ram0(SZ_512M);
+
+ omap4_add_sram0();
- add_mem_device("sram0", 0x40300000, 48 * 1024,
- IORESOURCE_MEM_WRITEABLE);
return 0;
}
mem_initcall(pcaaxl2_mem_init);
@@ -111,16 +106,14 @@ static int pcaaxl2_devices_init(void)
u32 value;
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
- add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, 0x48070000, 0x1000,
- IORESOURCE_MEM, NULL);
+ omap4_add_i2c1(NULL);
value = readl(OMAP4_CONTROL_PBIASLITE);
value &= ~OMAP4_MMC1_PBIASLITE_VMODE;
value |= (OMAP4_MMC1_PBIASLITE_PWRDNZ | OMAP4_MMC1_PWRDNZ);
writel(value, OMAP4_CONTROL_PBIASLITE);
- add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
- IORESOURCE_MEM, &mmc_device);
+ omap4_add_mmc1(&mmc_device);
gpmc_generic_init(0x10);
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread