[PATCH 2/2] ARM OMAP: Use wrapper in board files

Teresa Gámez t.gamez at phytec.de
Thu Oct 11 03:25:35 EDT 2012


Use the omap wrappers in board files instead of add_generic_device().
Compile tested every affected board. Tested on pcm049.

Signed-off-by: Teresa Gámez <t.gamez at phytec.de>
---
 arch/arm/boards/beagle/board.c            |   17 +++++------------
 arch/arm/boards/omap343xdsp/board.c       |   12 ++++--------
 arch/arm/boards/omap3evm/board.c          |   18 +++++-------------
 arch/arm/boards/panda/board.c             |   19 +++++--------------
 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 +++++++--------------
 7 files changed, 38 insertions(+), 90 deletions(-)

diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index 19bf740..bab11c8 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -62,6 +62,7 @@
 #include <mach/sys_info.h>
 #include <mach/syslib.h>
 #include <mach/control.h>
+#include <mach/devices.h>
 #include <mach/omap3-mux.h>
 #include <mach/gpmc.h>
 #include <mach/gpmc_nand.h>
@@ -235,11 +236,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
@@ -249,8 +245,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);
+	omap_add_ns16550(OMAP_UART3_BASE);
 
 	return 0;
 }
@@ -287,7 +282,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;
 }
@@ -296,8 +291,7 @@ 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);
+	omap_add_i2c(OMAP_I2C1_BASE, NULL);
 
 #ifdef CONFIG_USB_EHCI_OMAP
 	if (ehci_omap_init(&omap_ehci_pdata) >= 0)
@@ -310,8 +304,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);
+	omap_add_mmc(OMAP_MMC1_BASE, NULL);
 
 	armlinux_set_bootparams((void *)0x80000100);
 	armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
diff --git a/arch/arm/boards/omap343xdsp/board.c b/arch/arm/boards/omap343xdsp/board.c
index 2343dc0..08211c3 100644
--- a/arch/arm/boards/omap343xdsp/board.c
+++ b/arch/arm/boards/omap343xdsp/board.c
@@ -45,11 +45,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/devices.h>
 #include <mach/silicon.h>
 #include <mach/sdrc.h>
 #include <mach/sys_info.h>
@@ -604,11 +606,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
  *
@@ -617,8 +614,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);
+	omap_add_ns16550(OMAP_UART3_BASE);
 
 	return 0;
 }
@@ -628,7 +624,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 7d4a87f..dbaa63c 100644
--- a/arch/arm/boards/omap3evm/board.c
+++ b/arch/arm/boards/omap3evm/board.c
@@ -48,6 +48,7 @@
 #include <sizes.h>
 #include <ns16550.h>
 #include <asm/armlinux.h>
+#include <mach/devices.h>
 #include <mach/silicon.h>
 #include <mach/sdrc.h>
 #include <mach/sys_info.h>
@@ -214,11 +215,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.
  *
@@ -226,14 +222,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,
+	omap_add_ns16550(OMAP_UART1_BASE);
 #elif defined(CONFIG_OMAP3EVM_UART3)
-			OMAP_UART3_BASE,
+	omap_add_ns16550(OMAP_UART3_BASE);
 #endif
-			1024, IORESOURCE_MEM_8BIT, &serial_plat);
-
 	return 0;
 }
 console_initcall(omap3evm_init_console);
@@ -241,7 +234,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;
 }
@@ -256,8 +249,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);
+	omap_add_mmc(OMAP_MMC1_BASE, 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 98c05b2..7f3f430 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/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);
+	omap_add_ns16550(OMAP44XX_UART3_BASE);
 
 	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;
 }
@@ -160,13 +155,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);
-
+	omap_add_i2c(0x48070000, NULL);
 
-	add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
-			   IORESOURCE_MEM, NULL);
+	omap_add_mmc(0x4809C100, NULL);
 	panda_ehci_init();
 
 	panda_led_init();
diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c
index 3159457..aa20ff1 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/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);
+	omap_add_ns16550(OMAP44XX_UART3_BASE);
 
 	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);
+
+	omap_add_sram0(0x40300000, 48 * SZ_1K);
 
-	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);
+	omap_add_i2c(0x48070000, NULL);
 
-	add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
-			   IORESOURCE_MEM, NULL);
+	omap_add_mmc(0x4809C100, 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 f2d10f2..a934057 100644
--- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
+++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
@@ -57,6 +57,7 @@
 #include <generated/mach-types.h>
 #include <linux/err.h>
 #include <mach/control.h>
+#include <mach/devices.h>
 #include <mach/gpmc.h>
 #include <mach/gpmc_nand.h>
 #include <mach/omap_hsmmc.h>
@@ -308,14 +309,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.
  *
@@ -323,8 +316,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);
+	omap_add_ns16550(OMAP_UART3_BASE);
 
 	return 0;
 }
@@ -366,10 +358,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);
+	omap_add_sram0(OMAP_SRAM_BASE, 60 * SZ_1K);
 
-	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)) {
@@ -398,8 +389,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);
+	omap_add_mmc(OMAP_MMC1_BASE, &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 64e6d94..12d118b 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/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);
+	omap_add_ns16550(OMAP44XX_UART3_BASE);
 
 	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);
+
+	omap_add_sram0(0x40300000, 48 * SZ_1K);
 
-	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);
+	omap_add_i2c(0x48070000, 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);
+	omap_add_mmc(0x4809C100, &mmc_device);
 
 	gpmc_generic_init(0x10);
 
-- 
1.7.0.4




More information about the barebox mailing list