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

Teresa Gámez t.gamez at phytec.de
Tue Dec 18 09:13:23 EST 2012


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 at 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




More information about the barebox mailing list