[PATCH 4/4] omap: musb: introduce default baord config

2011-04-24 Thread Mike Rapoport
Most boards use exactly the same configuration for musb initialization.
Create a default that can be shared amount different boards.

Signed-off-by: Mike Rapoport 
---
 arch/arm/mach-omap2/board-2430sdp.c  |7 +--
 arch/arm/mach-omap2/board-3430sdp.c  |8 +---
 arch/arm/mach-omap2/board-cm-t35.c   |8 +---
 arch/arm/mach-omap2/board-devkit8000.c   |8 +---
 arch/arm/mach-omap2/board-igep0020.c |8 +---
 arch/arm/mach-omap2/board-igep0030.c |8 +---
 arch/arm/mach-omap2/board-ldp.c  |8 +---
 arch/arm/mach-omap2/board-omap3beagle.c  |8 +---
 arch/arm/mach-omap2/board-omap3pandora.c |8 +---
 arch/arm/mach-omap2/board-omap3stalker.c |8 +---
 arch/arm/mach-omap2/board-omap3touchbook.c   |8 +---
 arch/arm/mach-omap2/board-overo.c|8 +---
 arch/arm/mach-omap2/board-rm680.c|8 +---
 arch/arm/mach-omap2/board-zoom-peripherals.c |8 +---
 arch/arm/mach-omap2/usb-musb.c   |   14 +-
 15 files changed, 27 insertions(+), 98 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index 99b3f2d..a8810f8 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -208,11 +208,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
{}  /* Terminator */
 };
 
-static struct omap_musb_board_data musb_board_data = {
-   .interface_type = MUSB_INTERFACE_ULPI,
-   .mode   = MUSB_OTG,
-   .power  = 100,
-};
 static struct omap_usb_config sdp2430_usb_config __initdata = {
.otg= 1,
 #ifdef  CONFIG_USB_GADGET_OMAP
@@ -246,7 +241,7 @@ static void __init omap_2430sdp_init(void)
omap2_usbfs_init(&sdp2430_usb_config);
 
omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP);
-   usb_musb_init(&musb_board_data);
+   usb_musb_init(NULL);
 
board_smc91x_init();
 
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index b12400e..951e585 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -810,12 +810,6 @@ static struct flash_partitions sdp_flash_partitions[] = {
},
 };
 
-static struct omap_musb_board_data musb_board_data = {
-   .interface_type = MUSB_INTERFACE_ULPI,
-   .mode   = MUSB_OTG,
-   .power  = 100,
-};
-
 static void __init omap_3430sdp_init(void)
 {
int gpio_pendown;
@@ -832,7 +826,7 @@ static void __init omap_3430sdp_init(void)
gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
omap_ads7846_init(1, gpio_pendown, 310, NULL);
board_serial_init();
-   usb_musb_init(&musb_board_data);
+   usb_musb_init(NULL);
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
sdp3430_display_init();
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index 1a9e6be..286da17 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -651,12 +651,6 @@ static struct omap_board_mux board_mux[] __initdata = {
 };
 #endif
 
-static struct omap_musb_board_data musb_board_data = {
-   .interface_type = MUSB_INTERFACE_ULPI,
-   .mode   = MUSB_OTG,
-   .power  = 100,
-};
-
 static struct omap_board_config_kernel cm_t35_config[] __initdata = {
 };
 
@@ -673,7 +667,7 @@ static void __init cm_t35_init(void)
cm_t35_init_led();
cm_t35_init_display();
 
-   usb_musb_init(&musb_board_data);
+   usb_musb_init(NULL);
usbhs_init(&usbhs_bdata);
 }
 
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index e7dc057..405542a 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -509,12 +509,6 @@ static struct platform_device *devkit8000_devices[] 
__initdata = {
&omap_dm9000_dev,
 };
 
-static struct omap_musb_board_data musb_board_data = {
-   .interface_type = MUSB_INTERFACE_ULPI,
-   .mode   = MUSB_OTG,
-   .power  = 100,
-};
-
 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
@@ -698,7 +692,7 @@ static void __init devkit8000_init(void)
 
omap_ads7846_init(2, OMAP3_DEVKIT_TS_GPIO, 0, NULL);
 
-   usb_musb_init(&musb_board_data);
+   usb_musb_init(NULL);
usbhs_init(&usbhs_bdata);
omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions,
 ARRAY_SIZE(devkit8000_nand_partitions));
diff --git a/arch/arm/mach-omap2/board-igep0020.c 
b/arch/arm/mach-omap2/board-igep0020.c
index a0fd10e..2c9a919 10064

[PATCH 2/4] omap: use common initialization for PMIC i2c bus

2011-04-24 Thread Mike Rapoport
Introduce omap_pmic_init that registers i2c bus and PMIC device on that
bus and add omap2/3/4 wrappers for common cases.

Signed-off-by: Mike Rapoport 
---
 arch/arm/mach-omap2/board-2430sdp.c  |   13 ++---
 arch/arm/mach-omap2/board-3430sdp.c  |   12 +---
 arch/arm/mach-omap2/board-4430sdp.c  |   16 ++--
 arch/arm/mach-omap2/board-cm-t35.c   |   12 +---
 arch/arm/mach-omap2/board-devkit8000.c   |   12 +---
 arch/arm/mach-omap2/board-igep0020.c |   15 ++-
 arch/arm/mach-omap2/board-igep0030.c |   13 ++---
 arch/arm/mach-omap2/board-ldp.c  |   12 +---
 arch/arm/mach-omap2/board-omap3beagle.c  |   13 ++---
 arch/arm/mach-omap2/board-omap3evm.c |   21 +++--
 arch/arm/mach-omap2/board-omap3logic.c   |   13 ++---
 arch/arm/mach-omap2/board-omap3pandora.c |   12 +---
 arch/arm/mach-omap2/board-omap3stalker.c |   21 +++--
 arch/arm/mach-omap2/board-omap3touchbook.c   |   12 +---
 arch/arm/mach-omap2/board-omap4panda.c   |   17 ++---
 arch/arm/mach-omap2/board-overo.c|   12 +---
 arch/arm/mach-omap2/board-rm680.c|   13 ++---
 arch/arm/mach-omap2/board-rx51-peripherals.c |   13 ++---
 arch/arm/mach-omap2/board-zoom-peripherals.c |   13 ++---
 arch/arm/mach-omap2/common-board-devices.c   |   21 +
 arch/arm/mach-omap2/common-board-devices.h   |   24 
 21 files changed, 78 insertions(+), 232 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index 1fa6bb8..99b3f2d 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -41,6 +41,7 @@
 
 #include "mux.h"
 #include "hsmmc.h"
+#include "common-board-devices.h"
 
 #define SDP2430_CS0_BASE   0x0400
 #define SECONDARY_LCD_GPIO 147
@@ -180,15 +181,6 @@ static struct twl4030_platform_data sdp2430_twldata = {
.vmmc1  = &sdp2430_vmmc1,
 };
 
-static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = {
-   {
-   I2C_BOARD_INFO("twl4030", 0x48),
-   .flags = I2C_CLIENT_WAKE,
-   .irq = INT_24XX_SYS_NIRQ,
-   .platform_data = &sdp2430_twldata,
-   },
-};
-
 static struct i2c_board_info __initdata sdp2430_i2c1_boardinfo[] = {
{
I2C_BOARD_INFO("isp1301_omap", 0x2D),
@@ -201,8 +193,7 @@ static int __init omap2430_i2c_init(void)
 {
omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo,
ARRAY_SIZE(sdp2430_i2c1_boardinfo));
-   omap_register_i2c_bus(2, 2600, sdp2430_i2c_boardinfo,
-   ARRAY_SIZE(sdp2430_i2c_boardinfo));
+   omap2_pmic_init("twl4030", &sdp2430_twldata);
return 0;
 }
 
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 3726465..b12400e 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -528,20 +528,10 @@ static struct twl4030_platform_data sdp3430_twldata = {
.vpll2  = &sdp3430_vpll2,
 };
 
-static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
-   {
-   I2C_BOARD_INFO("twl4030", 0x48),
-   .flags = I2C_CLIENT_WAKE,
-   .irq = INT_34XX_SYS_NIRQ,
-   .platform_data = &sdp3430_twldata,
-   },
-};
-
 static int __init omap3430_i2c_init(void)
 {
/* i2c1 for PMIC only */
-   omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo,
-   ARRAY_SIZE(sdp3430_i2c_boardinfo));
+   omap3_pmic_init("twl4030", &sdp3430_twldata);
/* i2c2 on camera connector (for sensor control) and optional isp1301 */
omap_register_i2c_bus(2, 400, NULL, 0);
/* i2c3 on display connector (for DVI, tfp410) */
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 56702c5..7073542 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -42,6 +42,7 @@
 #include "hsmmc.h"
 #include "timer-gp.h"
 #include "control.h"
+#include "common-board-devices.h"
 
 #define ETH_KS8851_IRQ 34
 #define ETH_KS8851_POWER_ON48
@@ -575,14 +576,6 @@ static struct twl4030_platform_data sdp4430_twldata = {
.usb= &omap4_usbphy_data
 };
 
-static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
-   {
-   I2C_BOARD_INFO("twl6030", 0x48),
-   .flags = I2C_CLIENT_WAKE,
-   .irq = OMAP44XX_IRQ_SYS_1N,
-   .platform_data = &sdp4430_twldata,
-   },
-};
 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
{
I2C_BOARD_INFO("tmp105", 0x48),
@@ -598,12 +591,7 @@ static struct i2c_

[PATCH 3/4] omap: move detection of NAND CS to common-board-devices

2011-04-24 Thread Mike Rapoport
and reduce amount of copy/paste

Signed-off-by: Mike Rapoport 
---
 arch/arm/mach-omap2/board-devkit8000.c |   43 +-
 arch/arm/mach-omap2/board-omap3beagle.c|   45 +--
 arch/arm/mach-omap2/board-omap3touchbook.c |   45 +--
 arch/arm/mach-omap2/board-overo.c  |   42 +
 arch/arm/mach-omap2/common-board-devices.c |   42 ++
 arch/arm/mach-omap2/common-board-devices.h |   10 ++
 6 files changed, 60 insertions(+), 167 deletions(-)

diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index 983f44b..e7dc057 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -97,13 +97,6 @@ static struct mtd_partition devkit8000_nand_partitions[] = {
},
 };
 
-static struct omap_nand_platform_data devkit8000_nand_data = {
-   .options= NAND_BUSWIDTH_16,
-   .parts  = devkit8000_nand_partitions,
-   .nr_parts   = ARRAY_SIZE(devkit8000_nand_partitions),
-   .dma_channel= -1,   /* disable DMA in OMAP NAND driver */
-};
-
 static struct omap2_hsmmc_info mmc[] = {
{
.mmc= 1,
@@ -516,39 +509,6 @@ static struct platform_device *devkit8000_devices[] 
__initdata = {
&omap_dm9000_dev,
 };
 
-static void __init devkit8000_flash_init(void)
-{
-   u8 cs = 0;
-   u8 nandcs = GPMC_CS_NUM + 1;
-
-   /* find out the chip-select on which NAND exists */
-   while (cs < GPMC_CS_NUM) {
-   u32 ret = 0;
-   ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
-
-   if ((ret & 0xC00) == 0x800) {
-   printk(KERN_INFO "Found NAND on CS%d\n", cs);
-   if (nandcs > GPMC_CS_NUM)
-   nandcs = cs;
-   }
-   cs++;
-   }
-
-   if (nandcs > GPMC_CS_NUM) {
-   printk(KERN_INFO "NAND: Unable to find configuration "
-"in GPMC\n ");
-   return;
-   }
-
-   if (nandcs < GPMC_CS_NUM) {
-   devkit8000_nand_data.cs = nandcs;
-
-   printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
-   if (gpmc_nand_init(&devkit8000_nand_data) < 0)
-   printk(KERN_ERR "Unable to register NAND device\n");
-   }
-}
-
 static struct omap_musb_board_data musb_board_data = {
.interface_type = MUSB_INTERFACE_ULPI,
.mode   = MUSB_OTG,
@@ -740,7 +700,8 @@ static void __init devkit8000_init(void)
 
usb_musb_init(&musb_board_data);
usbhs_init(&usbhs_bdata);
-   devkit8000_flash_init();
+   omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions,
+ARRAY_SIZE(devkit8000_nand_partitions));
 
/* Ensure SDRC pins are mux'd for self-refresh */
omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index 13a1664..ce3bc2d 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -174,15 +174,6 @@ static struct mtd_partition omap3beagle_nand_partitions[] 
= {
},
 };
 
-static struct omap_nand_platform_data omap3beagle_nand_data = {
-   .options= NAND_BUSWIDTH_16,
-   .parts  = omap3beagle_nand_partitions,
-   .nr_parts   = ARRAY_SIZE(omap3beagle_nand_partitions),
-   .dma_channel= -1,   /* disable DMA in OMAP NAND driver */
-   .nand_setup = NULL,
-   .dev_ready  = NULL,
-};
-
 /* DSS */
 
 static int beagle_enable_dvi(struct omap_dss_device *dssdev)
@@ -542,39 +533,6 @@ static struct platform_device *omap3_beagle_devices[] 
__initdata = {
&keys_gpio,
 };
 
-static void __init omap3beagle_flash_init(void)
-{
-   u8 cs = 0;
-   u8 nandcs = GPMC_CS_NUM + 1;
-
-   /* find out the chip-select on which NAND exists */
-   while (cs < GPMC_CS_NUM) {
-   u32 ret = 0;
-   ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
-
-   if ((ret & 0xC00) == 0x800) {
-   printk(KERN_INFO "Found NAND on CS%d\n", cs);
-   if (nandcs > GPMC_CS_NUM)
-   nandcs = cs;
-   }
-   cs++;
-   }
-
-   if (nandcs > GPMC_CS_NUM) {
-   printk(KERN_INFO "NAND: Unable to find configuration "
-"in GPMC\n ");
-   return;
-   }
-
-   if (nandcs < GPMC_CS_NUM) {
-   omap3beagle_nand_data.cs = nandcs;
-
-   printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
-   if (gpmc_nand_init(&omap3beagle_nand_data) < 0)
-   printk(KERN_ERR "Unable to register NAND device\n"

[PATCH 1/4] omap: consolidate touch screen initialization among different boards

2011-04-24 Thread Mike Rapoport
Add common-board-devices.c that will contain the code for peripheral
devices initializatoin shared between multiple boards.
Start small with touchscreen initialization.

Signed-off-by: Mike Rapoport 
---
 arch/arm/mach-omap2/Makefile   |2 +
 arch/arm/mach-omap2/board-3430sdp.c|   65 ++---
 arch/arm/mach-omap2/board-cm-t35.c |   58 +--
 arch/arm/mach-omap2/board-devkit8000.c |   56 +--
 arch/arm/mach-omap2/board-ldp.c|   57 +--
 arch/arm/mach-omap2/board-omap3evm.c   |   51 +
 arch/arm/mach-omap2/board-omap3pandora.c   |   49 +---
 arch/arm/mach-omap2/board-omap3stalker.c   |   49 +---
 arch/arm/mach-omap2/board-omap3touchbook.c |   36 +---
 arch/arm/mach-omap2/board-overo.c  |   46 +--
 arch/arm/mach-omap2/common-board-devices.c |   85 
 arch/arm/mach-omap2/common-board-devices.h |   18 ++
 12 files changed, 128 insertions(+), 444 deletions(-)
 create mode 100644 arch/arm/mach-omap2/common-board-devices.c
 create mode 100644 arch/arm/mach-omap2/common-board-devices.h

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 512b152..43c5c22 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -270,3 +270,5 @@ obj-$(CONFIG_ARCH_OMAP4)+= hwspinlock.o
 
 disp-$(CONFIG_OMAP2_DSS)   := display.o
 obj-y  += $(disp-m) $(disp-y)
+
+obj-y  += common-board-devices.o
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index 9afd087..3726465 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -19,7 +19,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -48,6 +47,7 @@
 #include "hsmmc.h"
 #include "pm.h"
 #include "control.h"
+#include "common-board-devices.h"
 
 #define CONFIG_DISABLE_HFCLK 1
 
@@ -123,58 +123,6 @@ static struct twl4030_keypad_data sdp3430_kp_data = {
.rep= 1,
 };
 
-static int ts_gpio;/* Needed for ads7846_get_pendown_state */
-
-/**
- * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq
- *
- * @return - void. If request gpio fails then Flag KERN_ERR.
- */
-static void ads7846_dev_init(void)
-{
-   if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) {
-   printk(KERN_ERR "can't get ads746 pen down GPIO\n");
-   return;
-   }
-
-   gpio_direction_input(ts_gpio);
-   gpio_set_debounce(ts_gpio, 310);
-}
-
-static int ads7846_get_pendown_state(void)
-{
-   return !gpio_get_value(ts_gpio);
-}
-
-static struct ads7846_platform_data tsc2046_config __initdata = {
-   .get_pendown_state  = ads7846_get_pendown_state,
-   .keep_vref_on   = 1,
-   .wakeup = true,
-};
-
-
-static struct omap2_mcspi_device_config tsc2046_mcspi_config = {
-   .turbo_mode = 0,
-   .single_channel = 1,/* 0: slave, 1: master */
-};
-
-static struct spi_board_info sdp3430_spi_board_info[] __initdata = {
-   [0] = {
-   /*
-* TSC2046 operates at a max freqency of 2MHz, so
-* operate slightly below at 1.5MHz
-*/
-   .modalias   = "ads7846",
-   .bus_num= 1,
-   .chip_select= 0,
-   .max_speed_hz   = 150,
-   .controller_data= &tsc2046_mcspi_config,
-   .irq= 0,
-   .platform_data  = &tsc2046_config,
-   },
-};
-
-
 #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO   8
 #define SDP3430_LCD_PANEL_ENABLE_GPIO  5
 
@@ -880,6 +828,8 @@ static struct omap_musb_board_data musb_board_data = {
 
 static void __init omap_3430sdp_init(void)
 {
+   int gpio_pendown;
+
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
omap_board_config = sdp3430_config;
omap_board_config_size = ARRAY_SIZE(sdp3430_config);
@@ -887,13 +837,10 @@ static void __init omap_3430sdp_init(void)
omap3430_i2c_init();
omap_display_init(&sdp3430_dss_data);
if (omap_rev() > OMAP3430_REV_ES1_0)
-   ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2;
+   gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2;
else
-   ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV1;
-   sdp3430_spi_board_info[0].irq = gpio_to_irq(ts_gpio);
-   spi_register_board_info(sdp3430_spi_board_info,
-   ARRAY_SIZE(sdp3430_spi_board_info));
-   ads7846_dev_init();
+   gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
+   omap_ads7846_init(1, gpio_pendown, 310, NULL);
board_serial_init();
usb_musb_init(&musb_board_data);
board_smc91x_init();
diff --git a/

[PATCH 0/4] omap: cleanup board files

2011-04-24 Thread Mike Rapoport
Hi Tony,

These patches cleanup some of the common code in the board files. The changes
are basically almost mechanically move the code shared among several boards
into some common place.
There are a lot of places for further improvement, especially DSS and TWL
initialization. I'll try to find some time to sort these out as well.

Special thanks to Igor Grinberg for the original idea :)

Mike Rapoport (4):
  omap: consolidate touch screen initialization among different boards
  omap: use common initialization for PMIC i2c bus
  omap: move detection of NAND CS to common-board-devices
  omap: musb: introduce default baord config

 arch/arm/mach-omap2/Makefile |2 +
 arch/arm/mach-omap2/board-2430sdp.c  |   20 +---
 arch/arm/mach-omap2/board-3430sdp.c  |   85 ++-
 arch/arm/mach-omap2/board-4430sdp.c  |   16 +---
 arch/arm/mach-omap2/board-cm-t35.c   |   78 +-
 arch/arm/mach-omap2/board-devkit8000.c   |  119 +
 arch/arm/mach-omap2/board-igep0020.c |   23 +
 arch/arm/mach-omap2/board-igep0030.c |   21 +---
 arch/arm/mach-omap2/board-ldp.c  |   77 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |   66 +---
 arch/arm/mach-omap2/board-omap3evm.c |   72 +
 arch/arm/mach-omap2/board-omap3logic.c   |   13 +--
 arch/arm/mach-omap2/board-omap3pandora.c |   69 +---
 arch/arm/mach-omap2/board-omap3stalker.c |   78 +-
 arch/arm/mach-omap2/board-omap3touchbook.c   |  101 ++
 arch/arm/mach-omap2/board-omap4panda.c   |   17 +---
 arch/arm/mach-omap2/board-overo.c|  108 +--
 arch/arm/mach-omap2/board-rm680.c|   21 +---
 arch/arm/mach-omap2/board-rx51-peripherals.c |   13 +--
 arch/arm/mach-omap2/board-zoom-peripherals.c |   21 +---
 arch/arm/mach-omap2/common-board-devices.c   |  148 ++
 arch/arm/mach-omap2/common-board-devices.h   |   52 +
 arch/arm/mach-omap2/usb-musb.c   |   14 +++-
 23 files changed, 293 insertions(+), 941 deletions(-)
 create mode 100644 arch/arm/mach-omap2/common-board-devices.c
 create mode 100644 arch/arm/mach-omap2/common-board-devices.h

-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] arm: omap: fix bug with multiple smsc911x devices

2011-04-24 Thread Igor Grinberg
kobject (c06a4250): tried to init an initialized object, something is
seriously wrong.

introduced by commit 66293989:
(omap: convert boards that use SMSC911x to use gpmc-smsc911x)

fixed by allocating struct platform_device dynamically.

Signed-off-by: Igor Grinberg 
---
This has been boot tested with nfs root on cm-t35,
and build tested on all other affected boards.

v2: keep the id field uninitialized (0) on boards with
only one smsc911x controller (thanks Mike)


 arch/arm/mach-omap2/board-cm-t35.c  |2 ++
 arch/arm/mach-omap2/board-overo.c   |2 ++
 arch/arm/mach-omap2/gpmc-smsc911x.c |   16 +---
 arch/arm/plat-omap/include/plat/gpmc-smsc911x.h |1 +
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index b5772c1..7c70f56 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -69,6 +69,7 @@
 #include 
 
 static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg = {
+   .id = 0,
.cs = CM_T35_SMSC911X_CS,
.gpio_irq   = CM_T35_SMSC911X_GPIO,
.gpio_reset = -EINVAL,
@@ -76,6 +77,7 @@ static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg 
= {
 };
 
 static struct omap_smsc911x_platform_data sb_t35_smsc911x_cfg = {
+   .id = 1,
.cs = SB_T35_SMSC911X_CS,
.gpio_irq   = SB_T35_SMSC911X_GPIO,
.gpio_reset = -EINVAL,
diff --git a/arch/arm/mach-omap2/board-overo.c 
b/arch/arm/mach-omap2/board-overo.c
index 4016166..165e1fa 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -149,6 +149,7 @@ static inline void __init overo_ads7846_init(void) { 
return; }
 #include 
 
 static struct omap_smsc911x_platform_data smsc911x_cfg = {
+   .id = 0,
.cs = OVERO_SMSC911X_CS,
.gpio_irq   = OVERO_SMSC911X_GPIO,
.gpio_reset = -EINVAL,
@@ -156,6 +157,7 @@ static struct omap_smsc911x_platform_data smsc911x_cfg = {
 };
 
 static struct omap_smsc911x_platform_data smsc911x2_cfg = {
+   .id = 1,
.cs = OVERO_SMSC911X2_CS,
.gpio_irq   = OVERO_SMSC911X2_GPIO,
.gpio_reset = -EINVAL,
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c 
b/arch/arm/mach-omap2/gpmc-smsc911x.c
index b331f3c..d30293a 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -41,16 +41,6 @@ static struct smsc911x_platform_config gpmc_smsc911x_config 
= {
.flags  = SMSC911X_USE_16BIT,
 };
 
-static struct platform_device gpmc_smsc911x_device = {
-   .name   = "smsc911x",
-   .id = -1,
-   .num_resources  = ARRAY_SIZE(gpmc_smsc911x_resources),
-   .resource   = gpmc_smsc911x_resources,
-   .dev= {
-   .platform_data = &gpmc_smsc911x_config,
-   },
-};
-
 /*
  * Initialize smsc911x device connected to the GPMC. Note that we
  * assume that pin multiplexing is done in the board-*.c file,
@@ -58,6 +48,7 @@ static struct platform_device gpmc_smsc911x_device = {
  */
 void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
 {
+   struct platform_device *pdev;
unsigned long cs_mem_base;
int ret;
 
@@ -97,7 +88,10 @@ void __init gpmc_smsc911x_init(struct 
omap_smsc911x_platform_data *board_data)
if (gpmc_cfg->flags)
gpmc_smsc911x_config.flags = gpmc_cfg->flags;
 
-   if (platform_device_register(&gpmc_smsc911x_device) < 0) {
+   pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id,
+gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources),
+&gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config));
+   if (!pdev) {
printk(KERN_ERR "Unable to register smsc911x device\n");
gpio_free(gpmc_cfg->gpio_reset);
goto free2;
diff --git a/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h 
b/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
index 872de0bf..d3f1579 100644
--- a/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
+++ b/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
@@ -14,6 +14,7 @@
 #ifndef __ASM_ARCH_OMAP_GPMC_SMSC911X_H__
 
 struct omap_smsc911x_platform_data {
+   int id;
int cs;
int gpio_irq;
int gpio_reset;
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html