ARM: OMAP: get rid of OMAP_TAG_USB, v2
authorFelipe Balbi <felipe.balbi@nokia.com>
Tue, 24 Mar 2009 01:07:49 +0000 (18:07 -0700)
committerTony Lindgren <tony@atomide.com>
Tue, 24 Mar 2009 01:51:20 +0000 (18:51 -0700)
OMAP_TAGS should vanish soon since they're not generic arm tags.
Most of them can be converted to a platform_data or parsed
from a command line like e.g. serial tag.

For OMAP_TAG_USB we just let boards call omap_usb_init()
passing a pointer to omap_usb_config.

Patch updated by Tony for mainline, basically make
n770 and h4 compile. Also folded in a fix for OSK
by David Brownell <dbrownell@users.sourceforge.net>.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
17 files changed:
arch/arm/mach-omap1/board-ams-delta.c
arch/arm/mach-omap1/board-generic.c
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3.c
arch/arm/mach-omap1/board-innovator.c
arch/arm/mach-omap1/board-nokia770.c
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-omap1/board-palmte.c
arch/arm/mach-omap1/board-palmtt.c
arch/arm/mach-omap1/board-palmz71.c
arch/arm/mach-omap1/board-sx1.c
arch/arm/mach-omap1/board-voiceblue.c
arch/arm/mach-omap2/board-apollon.c
arch/arm/mach-omap2/board-h4.c
arch/arm/plat-omap/include/mach/board.h
arch/arm/plat-omap/include/mach/usb.h
arch/arm/plat-omap/usb.c

index 2e618391cc51b88be86d46dbb5f31816a2d1fd18..8b40aace9db414d9a8bb71202c5c85657053d160 100644 (file)
@@ -175,7 +175,6 @@ static struct omap_usb_config ams_delta_usb_config __initdata = {
 static struct omap_board_config_kernel ams_delta_config[] = {
        { OMAP_TAG_LCD,         &ams_delta_lcd_config },
        { OMAP_TAG_UART,        &ams_delta_uart_config },
-       { OMAP_TAG_USB,         &ams_delta_usb_config },
 };
 
 static struct resource ams_delta_kp_resources[] = {
@@ -232,6 +231,7 @@ static void __init ams_delta_init(void)
        /* Clear latch2 (NAND, LCD, modem enable) */
        ams_delta_latch2_write(~0, 0);
 
+       omap_usb_init(&ams_delta_usb_config);
        platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
 }
 
index 7d26702053739003e08f086261e37bf7db17dcb1..e724940e86f2342732c0bd7730ae6363a91a361a 100644 (file)
@@ -62,7 +62,6 @@ static struct omap_uart_config generic_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel generic_config[] __initdata = {
-       { OMAP_TAG_USB,         NULL },
        { OMAP_TAG_UART,        &generic_uart_config },
 };
 
@@ -70,12 +69,12 @@ static void __init omap_generic_init(void)
 {
 #ifdef CONFIG_ARCH_OMAP15XX
        if (cpu_is_omap15xx()) {
-               generic_config[0].data = &generic1510_usb_config;
+               omap_usb_init(&generic1510_usb_config);
        }
 #endif
 #if defined(CONFIG_ARCH_OMAP16XX)
        if (!cpu_is_omap1510()) {
-               generic_config[0].data = &generic1610_usb_config;
+               omap_usb_init(&generic1610_usb_config);
        }
 #endif
 
index b31b6d9b2e3f732a933bd9c17569e53bda9bfee6..f695aa053ac88bbaaf1961844ee1ed4109f3a94a 100644 (file)
@@ -369,7 +369,6 @@ static struct omap_lcd_config h2_lcd_config __initdata = {
 };
 
 static struct omap_board_config_kernel h2_config[] __initdata = {
-       { OMAP_TAG_USB,         &h2_usb_config },
        { OMAP_TAG_UART,        &h2_uart_config },
        { OMAP_TAG_LCD,         &h2_lcd_config },
 };
@@ -418,6 +417,7 @@ static void __init h2_init(void)
        omap_serial_init();
        omap_register_i2c_bus(1, 100, h2_i2c_board_info,
                              ARRAY_SIZE(h2_i2c_board_info));
+       omap_usb_init(&h2_usb_config);
        h2_mmc_init();
 }
 
index 4b872f3822b5b9211f67434101318bd7107f6b0a..4695965114c4e67e86456439fa4435149e0cf374 100644 (file)
@@ -423,7 +423,6 @@ static struct omap_lcd_config h3_lcd_config __initdata = {
 };
 
 static struct omap_board_config_kernel h3_config[] __initdata = {
-       { OMAP_TAG_USB,         &h3_usb_config },
        { OMAP_TAG_UART,        &h3_uart_config },
        { OMAP_TAG_LCD,         &h3_lcd_config },
 };
@@ -477,6 +476,7 @@ static void __init h3_init(void)
        omap_serial_init();
        omap_register_i2c_bus(1, 100, h3_i2c_board_info,
                              ARRAY_SIZE(h3_i2c_board_info));
+       omap_usb_init(&h3_usb_config);
        h3_mmc_init();
 }
 
index 714a08f79e9023ae3d5c3b3895cd25922dcd1d9a..2fd98260ea49d19dfbcd548f51693cb9368f597a 100644 (file)
@@ -373,7 +373,6 @@ static struct omap_uart_config innovator_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel innovator_config[] = {
-       { OMAP_TAG_USB,         NULL },
        { OMAP_TAG_LCD,         NULL },
        { OMAP_TAG_UART,        &innovator_uart_config },
 };
@@ -395,13 +394,13 @@ static void __init innovator_init(void)
 
 #ifdef CONFIG_ARCH_OMAP15XX
        if (cpu_is_omap1510()) {
-               innovator_config[0].data = &innovator1510_usb_config;
+               omap_usb_init(&innovator1510_usb_config);
                innovator_config[1].data = &innovator1510_lcd_config;
        }
 #endif
 #ifdef CONFIG_ARCH_OMAP16XX
        if (cpu_is_omap1610()) {
-               innovator_config[0].data = &h2_usb_config;
+               omap_usb_init(&h2_usb_config);
                innovator_config[1].data = &innovator1610_lcd_config;
        }
 #endif
index af51e0b180f2867ed2947f09508057bcb550d718..7bc7a3cb9c510459953bb45012f9c70653e55a6c 100644 (file)
@@ -233,10 +233,6 @@ static inline void nokia770_mmc_init(void)
 }
 #endif
 
-static struct omap_board_config_kernel nokia770_config[] __initdata = {
-       { OMAP_TAG_USB,         NULL },
-};
-
 #if    defined(CONFIG_OMAP_DSP)
 /*
  * audio power control
@@ -371,19 +367,16 @@ static __init int omap_dsp_init(void)
 
 static void __init omap_nokia770_init(void)
 {
-       nokia770_config[0].data = &nokia770_usb_config;
-
        platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
        spi_register_board_info(nokia770_spi_board_info,
                                ARRAY_SIZE(nokia770_spi_board_info));
-       omap_board_config = nokia770_config;
-       omap_board_config_size = ARRAY_SIZE(nokia770_config);
        omap_gpio_init();
        omap_serial_init();
        omap_register_i2c_bus(1, 100, NULL, 0);
        omap_dsp_init();
        ads7846_dev_init();
        mipid_dev_init();
+       omap_usb_init(&nokia770_usb_config);
        nokia770_mmc_init();
 }
 
index 9c4cac274cc0ddc69526e1c36687fe3c27124fd0..cf3247b15f874dcea9b14908781c963c405dd87b 100644 (file)
@@ -304,7 +304,6 @@ static struct omap_lcd_config osk_lcd_config __initdata = {
 #endif
 
 static struct omap_board_config_kernel osk_config[] __initdata = {
-       { OMAP_TAG_USB,           &osk_usb_config },
        { OMAP_TAG_UART,                &osk_uart_config },
 #ifdef CONFIG_OMAP_OSK_MISTRAL
        { OMAP_TAG_LCD,                 &osk_lcd_config },
@@ -555,6 +554,8 @@ static void __init osk_init(void)
        l |= (3 << 1);
        omap_writel(l, USB_TRANSCEIVER_CTRL);
 
+       omap_usb_init(&osk_usb_config);
+
        /* irq for tps65010 chip */
        /* bootloader effectively does:  omap_cfg_reg(U19_1610_MPUIO1); */
        if (gpio_request(OMAP_MPUIO(1), "tps65010") == 0)
index 55d524b78e2a3dacbe92d41b7e2696daea808634..886b4c0569bddb0958a5766273da6b600c3268d8 100644 (file)
@@ -301,7 +301,6 @@ static void palmte_get_power_status(struct apm_power_info *info, int *battery)
 #endif
 
 static struct omap_board_config_kernel palmte_config[] __initdata = {
-       { OMAP_TAG_USB,         &palmte_usb_config },
        { OMAP_TAG_LCD,         &palmte_lcd_config },
        { OMAP_TAG_UART,        &palmte_uart_config },
 };
@@ -356,6 +355,7 @@ static void __init omap_palmte_init(void)
        spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
        palmte_misc_gpio_setup();
        omap_serial_init();
+       omap_usb_init(&palmte_usb_config);
        omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
index 9dc9d7931b55fb131b5901dec7fb7723685f50cc..4f1b44831d373c207e82a0736e12f64d25197e6e 100644 (file)
@@ -279,7 +279,6 @@ static struct omap_uart_config palmtt_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel palmtt_config[] __initdata = {
-       { OMAP_TAG_USB,         &palmtt_usb_config      },
        { OMAP_TAG_LCD,         &palmtt_lcd_config      },
        { OMAP_TAG_UART,        &palmtt_uart_config     },
 };
@@ -304,6 +303,7 @@ static void __init omap_palmtt_init(void)
 
        spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
        omap_serial_init();
+       omap_usb_init(&palmtt_usb_config);
        omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
index a2f99a46e7b40e9279a92ad0058ba9452b9b6d17..9a55c3c582184bc09cbb4dba0ed48fe615d23755 100644 (file)
@@ -249,7 +249,6 @@ static struct omap_uart_config palmz71_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel palmz71_config[] __initdata = {
-       {OMAP_TAG_USB,  &palmz71_usb_config},
        {OMAP_TAG_LCD,  &palmz71_lcd_config},
        {OMAP_TAG_UART, &palmz71_uart_config},
 };
@@ -323,6 +322,7 @@ omap_palmz71_init(void)
 
        spi_register_board_info(palmz71_boardinfo,
                                ARRAY_SIZE(palmz71_boardinfo));
+       omap_usb_init(&palmz71_usb_config);
        omap_serial_init();
        omap_register_i2c_bus(1, 100, NULL, 0);
        palmz71_gpio_setup(0);
index ab277d42f30213729dda622a3036e0f022fa30e5..c096577695fee7da13998202c244128f4f9f2285 100644 (file)
@@ -374,7 +374,6 @@ static struct omap_uart_config sx1_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel sx1_config[] __initdata = {
-       { OMAP_TAG_USB, &sx1_usb_config },
        { OMAP_TAG_LCD, &sx1_lcd_config },
        { OMAP_TAG_UART,        &sx1_uart_config },
 };
@@ -389,6 +388,7 @@ static void __init omap_sx1_init(void)
        omap_board_config_size = ARRAY_SIZE(sx1_config);
        omap_serial_init();
        omap_register_i2c_bus(1, 100, NULL, 0);
+       omap_usb_init(&sx1_usb_config);
        sx1_mmc_init();
 
        /* turn on USB power */
index a7653542a2b0ae871bf29bab830d0adc1f6af489..98275e03dad1633b74358e9e2b29aa7b794182c3 100644 (file)
@@ -145,7 +145,6 @@ static struct omap_uart_config voiceblue_uart_config __initdata = {
 };
 
 static struct omap_board_config_kernel voiceblue_config[] = {
-       { OMAP_TAG_USB,  &voiceblue_usb_config },
        { OMAP_TAG_UART, &voiceblue_uart_config },
 };
 
@@ -185,6 +184,7 @@ static void __init voiceblue_init(void)
        omap_board_config = voiceblue_config;
        omap_board_config_size = ARRAY_SIZE(voiceblue_config);
        omap_serial_init();
+       omap_usb_init(&voiceblue_usb_config);
        omap_register_i2c_bus(1, 100, NULL, 0);
 
        /* There is a good chance board is going up, so enable power LED
index 64561247d93a53fab8ee209270ea47dcc96ae041..41823538d36ab3a787fbb117c859fce5c7896b5f 100644 (file)
@@ -273,7 +273,6 @@ static struct omap_lcd_config apollon_lcd_config __initdata = {
 
 static struct omap_board_config_kernel apollon_config[] = {
        { OMAP_TAG_UART,        &apollon_uart_config },
-       { OMAP_TAG_USB,         &apollon_usb_config },
        { OMAP_TAG_LCD,         &apollon_lcd_config },
 };
 
@@ -300,6 +299,7 @@ static void __init apollon_usb_init(void)
        omap_cfg_reg(P21_242X_GPIO12);
        gpio_request(12, "USB suspend");
        gpio_direction_output(12, 0);
+       omap_usb_init(&apollon_usb_config);
 }
 
 static void __init omap_apollon_init(void)
index 71226973eee7c3ebc7d4d3644004d85a52f00451..1343cebd19a1c21c2d8f76e110c0d0c45bb6b074 100644 (file)
@@ -379,6 +379,39 @@ static struct omap_lcd_config h4_lcd_config __initdata = {
        .ctrl_name      = "internal",
 };
 
+static struct omap_usb_config h4_usb_config __initdata = {
+#ifdef CONFIG_MACH_OMAP2_H4_USB1
+       /* NOTE:  usb1 could also be used with 3 wire signaling */
+       .pins[1]        = 4,
+#endif
+
+#ifdef CONFIG_MACH_OMAP_H4_OTG
+       /* S1.10 ON -- USB OTG port
+        * usb0 switched to Mini-AB port and isp1301 transceiver;
+        * S2.POS3 = OFF, S2.POS4 = ON ... to allow battery charging
+        */
+       .otg            = 1,
+       .pins[0]        = 4,
+#ifdef CONFIG_USB_GADGET_OMAP
+       /* use OTG cable, or standard A-to-MiniB */
+       .hmc_mode       = 0x14, /* 0:dev/otg 1:host 2:disable */
+#elif  defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
+       /* use OTG cable, or NONSTANDARD (B-to-MiniB) */
+       .hmc_mode       = 0x11, /* 0:host 1:host 2:disable */
+#endif /* XX */
+
+#else
+       /* S1.10 OFF -- usb "download port"
+        * usb0 switched to Mini-B port and isp1105 transceiver;
+        * S2.POS3 = ON, S2.POS4 = OFF ... to enable battery charging
+        */
+       .register_dev   = 1,
+       .pins[0]        = 3,
+/*     .hmc_mode       = 0x14,*/       /* 0:dev 1:host 2:disable */
+       .hmc_mode       = 0x00,         /* 0:dev|otg 1:disable 2:disable */
+#endif
+};
+
 static struct omap_board_config_kernel h4_config[] = {
        { OMAP_TAG_UART,        &h4_uart_config },
        { OMAP_TAG_LCD,         &h4_lcd_config },
@@ -430,6 +463,7 @@ static void __init omap_h4_init(void)
        platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
        omap_board_config = h4_config;
        omap_board_config_size = ARRAY_SIZE(h4_config);
+       omap_usb_init(&h4_usb_config);
        omap_serial_init();
 }
 
index 4a0afd2366e8fbc541ddd9b99a0c5ebe60350bf8..50ea79a0efa258b807b793c6cf58733fcb1b236c 100644 (file)
@@ -17,7 +17,6 @@
 /* Different peripheral ids */
 #define OMAP_TAG_CLOCK         0x4f01
 #define OMAP_TAG_SERIAL_CONSOLE 0x4f03
-#define OMAP_TAG_USB           0x4f04
 #define OMAP_TAG_LCD           0x4f05
 #define OMAP_TAG_GPIO_SWITCH   0x4f06
 #define OMAP_TAG_UART          0x4f07
index a56a610950c239e38e35b7f7d963084237f12fb4..e033e51d4bad0594fb1800ff46cbbb322f749af2 100644 (file)
@@ -29,6 +29,8 @@
 
 #endif
 
+void omap_usb_init(struct omap_usb_config *pdata);
+
 /*-------------------------------------------------------------------------*/
 
 /*
index e278de6862aec86bf07c3ddc4280c73681e355df..509f2ed99e21aa1f996881e1924f93ed0e5a5604 100644 (file)
@@ -729,30 +729,13 @@ static inline void omap_1510_usb_init(struct omap_usb_config *config) {}
 
 /*-------------------------------------------------------------------------*/
 
-static struct omap_usb_config platform_data;
-
-static int __init
-omap_usb_init(void)
+void __init omap_usb_init(struct omap_usb_config *pdata)
 {
-       const struct omap_usb_config *config;
-
-       config = omap_get_config(OMAP_TAG_USB, struct omap_usb_config);
-       if (config == NULL) {
-               printk(KERN_ERR "USB: No board-specific "
-                               "platform config found\n");
-               return -ENODEV;
-       }
-       platform_data = *config;
-
        if (cpu_is_omap730() || cpu_is_omap16xx() || cpu_is_omap24xx())
-               omap_otg_init(&platform_data);
+               omap_otg_init(pdata);
        else if (cpu_is_omap15xx())
-               omap_1510_usb_init(&platform_data);
-       else {
+               omap_1510_usb_init(pdata);
+       else
                printk(KERN_ERR "USB: No init for your chip yet\n");
-               return -ENODEV;
-       }
-       return 0;
 }
 
-subsys_initcall(omap_usb_init);