[PATCH 13/19] ARM omap4: Use device register functions in boards

Jan Luebbe jlu at pengutronix.de
Tue Dec 18 09:22:35 EST 2012


From: Sascha Hauer <s.hauer at pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/boards/archosg9/board.c          |   17 +++++------------
 arch/arm/boards/panda/board.c             |   18 ++++--------------
 arch/arm/boards/pcm049/board.c            |   17 ++++-------------
 arch/arm/boards/phycard-a-xl2/pca-a-xl2.c |   16 ++++------------
 4 files changed, 17 insertions(+), 51 deletions(-)

diff --git a/arch/arm/boards/archosg9/board.c b/arch/arm/boards/archosg9/board.c
index dab0a36..5f62748 100644
--- a/arch/arm/boards/archosg9/board.c
+++ b/arch/arm/boards/archosg9/board.c
@@ -16,14 +16,11 @@
 #include <asm/armlinux.h>
 #include <generated/mach-types.h>
 #include <mach/omap4-silicon.h>
+#include <mach/omap4-devices.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,8 +28,7 @@ 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);
+		omap44xx_add_uart1();
 	}
 	return 0;
 }
@@ -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);
+	omap44xx_add_i2c1(NULL);
+	omap44xx_add_mmc1(NULL);
+	omap44xx_add_mmc2(NULL);
 
 	armlinux_set_bootparams((void *)0x80000100);
 	/*
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index 99222d2..5b27f46 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -9,6 +9,7 @@
 #include <linux/stat.h>
 #include <generated/mach-types.h>
 #include <mach/omap4-silicon.h>
+#include <mach/omap4-devices.h>
 #include <mach/sdrc.h>
 #include <mach/sys_info.h>
 #include <mach/syslib.h>
@@ -33,16 +34,9 @@ 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);
+	omap44xx_add_uart3();
 
 	return 0;
 }
@@ -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);
-
+	omap44xx_add_i2c1(NULL);
+	omap44xx_add_mmc1(NULL);
 
-	add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
-			   IORESOURCE_MEM, 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..ca3f906 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -23,6 +23,7 @@
 #include <asm/armlinux.h>
 #include <generated/mach-types.h>
 #include <mach/omap4-silicon.h>
+#include <mach/omap4-devices.h>
 #include <mach/sdrc.h>
 #include <mach/sys_info.h>
 #include <mach/syslib.h>
@@ -38,16 +39,9 @@
 #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);
+	omap44xx_add_uart3();
 
 	return 0;
 }
@@ -99,11 +93,8 @@ 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);
-
-	add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
-			   IORESOURCE_MEM, NULL);
+	omap44xx_add_i2c1(NULL);
+	omap44xx_add_mmc1(NULL);
 
 	gpmc_generic_init(0x10);
 
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..3931f57 100644
--- a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
+++ b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
@@ -37,18 +37,12 @@
 #include <mach/gpmc_nand.h>
 #include <mach/xload.h>
 #include <mach/omap_hsmmc.h>
+#include <mach/omap4-devices.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);
+	omap44xx_add_uart3();
 
 	return 0;
 }
@@ -111,16 +105,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);
+	omap44xx_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);
+	omap44xx_add_mmc1(&mmc_device);
 
 	gpmc_generic_init(0x10);
 
-- 
1.7.10.4




More information about the barebox mailing list