OMAP2/3 board-*.c files: read bootloader configuration earlier
authorPaul Walmsley <paul@pwsan.com>
Thu, 3 Sep 2009 17:14:02 +0000 (20:14 +0300)
committerpaul <paul@twilight.(none)>
Thu, 3 Sep 2009 17:14:02 +0000 (20:14 +0300)
Most board-*.c files read configuration data from the bootloader in
their .init_machine() function.  This needs to happen earlier, at some
point before omap2_init_common_hw() is called.  This is because a
future patch will use the bootloader serial console port information
to enable the UART clocks earlier, immediately after omap2_clk_init().
This is in turn necessary since otherwise clock tree usecounts on
clocks like dpll4_m2x2_ck will be bogus, which can cause the
currently-active console UART clock to be disabled during boot.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
15 files changed:
arch/arm/mach-omap2/board-2430sdp.c
arch/arm/mach-omap2/board-3430sdp.c
arch/arm/mach-omap2/board-apollon.c
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/board-h4.c
arch/arm/mach-omap2/board-ldp.c
arch/arm/mach-omap2/board-omap3beagle.c
arch/arm/mach-omap2/board-omap3evm.c
arch/arm/mach-omap2/board-omap3pandora.c
arch/arm/mach-omap2/board-overo.c
arch/arm/mach-omap2/board-rx51.c
arch/arm/mach-omap2/board-zoom2.c
arch/arm/mach-omap2/io.c
arch/arm/mach-omap2/serial.c
arch/arm/plat-omap/include/mach/serial.h

index 7f5a74d59243cb3d2d3e9f61da8c7a7b65e9ab4d..42217b32f83562ea8706b06426ed257e9b132f05 100644 (file)
@@ -139,18 +139,19 @@ static inline void board_smc91x_init(void)
 
 #endif
 
+static struct omap_board_config_kernel sdp2430_config[] = {
+       {OMAP_TAG_LCD, &sdp2430_lcd_config},
+};
+
 static void __init omap_2430sdp_init_irq(void)
 {
+       omap_board_config = sdp2430_config;
+       omap_board_config_size = ARRAY_SIZE(sdp2430_config);
        omap2_init_common_hw(NULL, NULL);
        omap_init_irq();
        omap_gpio_init();
 }
 
-static struct omap_board_config_kernel sdp2430_config[] = {
-       {OMAP_TAG_LCD, &sdp2430_lcd_config},
-};
-
-
 static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
        .gpio_base      = OMAP_MAX_GPIO_LINES,
        .irq_base       = TWL4030_GPIO_IRQ_BASE,
@@ -200,8 +201,6 @@ static void __init omap_2430sdp_init(void)
        omap2430_i2c_init();
 
        platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
-       omap_board_config = sdp2430_config;
-       omap_board_config_size = ARRAY_SIZE(sdp2430_config);
        omap_serial_init();
        twl4030_mmc_init(mmc);
        usb_musb_init();
index 7e9b76cc7675da7720b7cd0bf2248d19443634bf..4500e7f674d737cfa033ac86525d6a57b678c8c9 100644 (file)
@@ -167,13 +167,6 @@ static struct platform_device *sdp3430_devices[] __initdata = {
        &sdp3430_lcd_device,
 };
 
-static void __init omap_3430sdp_init_irq(void)
-{
-       omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL);
-       omap_init_irq();
-       omap_gpio_init();
-}
-
 static struct omap_lcd_config sdp3430_lcd_config __initdata = {
        .ctrl_name      = "internal",
 };
@@ -182,6 +175,15 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = {
        { OMAP_TAG_LCD,         &sdp3430_lcd_config },
 };
 
+static void __init omap_3430sdp_init_irq(void)
+{
+       omap_board_config = sdp3430_config;
+       omap_board_config_size = ARRAY_SIZE(sdp3430_config);
+       omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL);
+       omap_init_irq();
+       omap_gpio_init();
+}
+
 static int sdp3430_batt_table[] = {
 /* 0 C*/
 30800, 29500, 28300, 27100,
@@ -477,8 +479,6 @@ static void __init omap_3430sdp_init(void)
 {
        omap3430_i2c_init();
        platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices));
-       omap_board_config = sdp3430_config;
-       omap_board_config_size = ARRAY_SIZE(sdp3430_config);
        if (omap_rev() > OMAP3430_REV_ES1_0)
                ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2;
        else
index 615f21d1eb2311880df91672faf7302c1bff36fc..7a2b54c7291acb6b910d3dfed15f54811b8c7df5 100644 (file)
@@ -248,14 +248,6 @@ out:
        clk_put(gpmc_fck);
 }
 
-static void __init omap_apollon_init_irq(void)
-{
-       omap2_init_common_hw(NULL, NULL);
-       omap_init_irq();
-       omap_gpio_init();
-       apollon_init_smc91x();
-}
-
 static struct omap_usb_config apollon_usb_config __initdata = {
        .register_dev   = 1,
        .hmc_mode       = 0x14, /* 0:dev 1:host1 2:disable */
@@ -271,6 +263,16 @@ static struct omap_board_config_kernel apollon_config[] = {
        { OMAP_TAG_LCD,         &apollon_lcd_config },
 };
 
+static void __init omap_apollon_init_irq(void)
+{
+       omap_board_config = apollon_config;
+       omap_board_config_size = ARRAY_SIZE(apollon_config);
+       omap2_init_common_hw(NULL, NULL);
+       omap_init_irq();
+       omap_gpio_init();
+       apollon_init_smc91x();
+}
+
 static void __init apollon_led_init(void)
 {
        /* LED0 - AA10 */
@@ -319,8 +321,6 @@ static void __init omap_apollon_init(void)
         * if not needed.
         */
        platform_add_devices(apollon_devices, ARRAY_SIZE(apollon_devices));
-       omap_board_config = apollon_config;
-       omap_board_config_size = ARRAY_SIZE(apollon_config);
        omap_serial_init();
 }
 
index 3e401c5b6e4115f67385627b208909a9400ff2c0..2e09a1c444cb7bfb04b1737fa554f5a04f6f9760 100644 (file)
 #include <mach/board.h>
 #include <mach/common.h>
 
+static struct omap_board_config_kernel generic_config[] = {
+};
+
 static void __init omap_generic_init_irq(void)
 {
+       omap_board_config = generic_config;
+       omap_board_config_size = ARRAY_SIZE(generic_config);
        omap2_init_common_hw(NULL, NULL);
        omap_init_irq();
 }
 
-static struct omap_board_config_kernel generic_config[] = {
-};
-
 static void __init omap_generic_init(void)
 {
-       omap_board_config = generic_config;
-       omap_board_config_size = ARRAY_SIZE(generic_config);
        omap_serial_init();
 }
 
index b6501d241c1096d57a39c2053d20e546f2fe5f43..eaa02d012c5cc0b7e1d2b7d621e84703e831f38c 100644 (file)
@@ -268,14 +268,6 @@ static void __init h4_init_flash(void)
        h4_flash_resource.end   = base + SZ_64M - 1;
 }
 
-static void __init omap_h4_init_irq(void)
-{
-       omap2_init_common_hw(NULL, NULL);
-       omap_init_irq();
-       omap_gpio_init();
-       h4_init_flash();
-}
-
 static struct omap_lcd_config h4_lcd_config __initdata = {
        .ctrl_name      = "internal",
 };
@@ -317,6 +309,16 @@ static struct omap_board_config_kernel h4_config[] = {
        { OMAP_TAG_LCD,         &h4_lcd_config },
 };
 
+static void __init omap_h4_init_irq(void)
+{
+       omap_board_config = h4_config;
+       omap_board_config_size = ARRAY_SIZE(h4_config);
+       omap2_init_common_hw(NULL, NULL);
+       omap_init_irq();
+       omap_gpio_init();
+       h4_init_flash();
+}
+
 static struct at24_platform_data m24c01 = {
        .byte_len       = SZ_1K / 8,
        .page_size      = 16,
@@ -361,8 +363,6 @@ static void __init omap_h4_init(void)
                        ARRAY_SIZE(h4_i2c_board_info));
 
        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 2dd6806a1e8e6ebb29c7640243f3b4e1ec431c4a..ec6854cbdd9fcb968c5bbdb3ec3e4da0361b1f47 100644 (file)
@@ -268,14 +268,6 @@ static inline void __init ldp_init_smsc911x(void)
        gpio_direction_input(eth_gpio);
 }
 
-static void __init omap_ldp_init_irq(void)
-{
-       omap2_init_common_hw(NULL, NULL);
-       omap_init_irq();
-       omap_gpio_init();
-       ldp_init_smsc911x();
-}
-
 static struct platform_device ldp_lcd_device = {
        .name           = "ldp_lcd",
        .id             = -1,
@@ -289,6 +281,16 @@ static struct omap_board_config_kernel ldp_config[] __initdata = {
        { OMAP_TAG_LCD,         &ldp_lcd_config },
 };
 
+static void __init omap_ldp_init_irq(void)
+{
+       omap_board_config = ldp_config;
+       omap_board_config_size = ARRAY_SIZE(ldp_config);
+       omap2_init_common_hw(NULL, NULL);
+       omap_init_irq();
+       omap_gpio_init();
+       ldp_init_smsc911x();
+}
+
 static struct twl4030_usb_data ldp_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
 };
@@ -372,8 +374,6 @@ static void __init omap_ldp_init(void)
 {
        omap_i2c_init();
        platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
-       omap_board_config = ldp_config;
-       omap_board_config_size = ARRAY_SIZE(ldp_config);
        ts_gpio = 54;
        ldp_spi_board_info[0].irq = gpio_to_irq(ts_gpio);
        spi_register_board_info(ldp_spi_board_info,
index d79ea8da6270bece88230ff556e6a10a68f5d629..500c9956876de8c71fcaddd39d1dc2258719c6ca 100644 (file)
@@ -281,17 +281,6 @@ static int __init omap3_beagle_i2c_init(void)
        return 0;
 }
 
-static void __init omap3_beagle_init_irq(void)
-{
-       omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
-                            mt46h32m32lf6_sdrc_params);
-       omap_init_irq();
-#ifdef CONFIG_OMAP_32K_TIMER
-       omap2_gp_clockevent_set_gptimer(12);
-#endif
-       omap_gpio_init();
-}
-
 static struct gpio_led gpio_leds[] = {
        {
                .name                   = "beagleboard::usr0",
@@ -349,6 +338,19 @@ static struct omap_board_config_kernel omap3_beagle_config[] __initdata = {
        { OMAP_TAG_LCD,         &omap3_beagle_lcd_config },
 };
 
+static void __init omap3_beagle_init_irq(void)
+{
+       omap_board_config = omap3_beagle_config;
+       omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
+       omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+                            mt46h32m32lf6_sdrc_params);
+       omap_init_irq();
+#ifdef CONFIG_OMAP_32K_TIMER
+       omap2_gp_clockevent_set_gptimer(12);
+#endif
+       omap_gpio_init();
+}
+
 static struct platform_device *omap3_beagle_devices[] __initdata = {
        &omap3_beagle_lcd_device,
        &leds_gpio,
@@ -398,8 +400,6 @@ static void __init omap3_beagle_init(void)
        omap3_beagle_i2c_init();
        platform_add_devices(omap3_beagle_devices,
                        ARRAY_SIZE(omap3_beagle_devices));
-       omap_board_config = omap3_beagle_config;
-       omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
        omap_serial_init();
 
        omap_cfg_reg(J25_34XX_GPIO170);
index 3e0435371ce6684ac42444ba1664a982a716758c..d50b9be905802ce5e88bcef03d6dd44100b3ab50 100644 (file)
@@ -274,18 +274,20 @@ struct spi_board_info omap3evm_spi_board_info[] = {
        },
 };
 
+static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
+       { OMAP_TAG_LCD,         &omap3_evm_lcd_config },
+};
+
 static void __init omap3_evm_init_irq(void)
 {
+       omap_board_config = omap3_evm_config;
+       omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
        omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
        omap_init_irq();
        omap_gpio_init();
        omap3evm_init_smc911x();
 }
 
-static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
-       { OMAP_TAG_LCD,         &omap3_evm_lcd_config },
-};
-
 static struct platform_device *omap3_evm_devices[] __initdata = {
        &omap3_evm_lcd_device,
        &omap3evm_smc911x_device,
@@ -296,8 +298,6 @@ static void __init omap3_evm_init(void)
        omap3_evm_i2c_init();
 
        platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
-       omap_board_config = omap3_evm_config;
-       omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
 
        spi_register_board_info(omap3evm_spi_board_info,
                                ARRAY_SIZE(omap3evm_spi_board_info));
index 8236708c36270f40d9c0680af66f3648c2dcabeb..b43f6e36b6d9d256768169b5760ab927a462cf5f 100644 (file)
@@ -305,14 +305,6 @@ static int __init omap3pandora_i2c_init(void)
        return 0;
 }
 
-static void __init omap3pandora_init_irq(void)
-{
-       omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
-                            mt46h32m32lf6_sdrc_params);
-       omap_init_irq();
-       omap_gpio_init();
-}
-
 static void __init omap3pandora_ads7846_init(void)
 {
        int gpio = OMAP3_PANDORA_TS_GPIO;
@@ -375,6 +367,16 @@ static struct omap_board_config_kernel omap3pandora_config[] __initdata = {
        { OMAP_TAG_LCD,         &omap3pandora_lcd_config },
 };
 
+static void __init omap3pandora_init_irq(void)
+{
+       omap_board_config = omap3pandora_config;
+       omap_board_config_size = ARRAY_SIZE(omap3pandora_config);
+       omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+                            mt46h32m32lf6_sdrc_params);
+       omap_init_irq();
+       omap_gpio_init();
+}
+
 static struct platform_device *omap3pandora_devices[] __initdata = {
        &omap3pandora_lcd_device,
        &pandora_leds_gpio,
@@ -386,8 +388,6 @@ static void __init omap3pandora_init(void)
        omap3pandora_i2c_init();
        platform_add_devices(omap3pandora_devices,
                        ARRAY_SIZE(omap3pandora_devices));
-       omap_board_config = omap3pandora_config;
-       omap_board_config_size = ARRAY_SIZE(omap3pandora_config);
        omap_serial_init();
        spi_register_board_info(omap3pandora_spi_board_info,
                        ARRAY_SIZE(omap3pandora_spi_board_info));
index eb78e6eab4f4c23c076e2ed97931a1043fd414d7..9917d2fddc2f6093025ffa9979e31d8aa1d4ac21 100644 (file)
@@ -357,14 +357,6 @@ static int __init overo_i2c_init(void)
        return 0;
 }
 
-static void __init overo_init_irq(void)
-{
-       omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
-                            mt46h32m32lf6_sdrc_params);
-       omap_init_irq();
-       omap_gpio_init();
-}
-
 static struct platform_device overo_lcd_device = {
        .name           = "overo_lcd",
        .id             = -1,
@@ -378,6 +370,16 @@ static struct omap_board_config_kernel overo_config[] __initdata = {
        { OMAP_TAG_LCD,         &overo_lcd_config },
 };
 
+static void __init overo_init_irq(void)
+{
+       omap_board_config = overo_config;
+       omap_board_config_size = ARRAY_SIZE(overo_config);
+       omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
+                            mt46h32m32lf6_sdrc_params);
+       omap_init_irq();
+       omap_gpio_init();
+}
+
 static struct platform_device *overo_devices[] __initdata = {
        &overo_lcd_device,
 };
@@ -386,8 +388,6 @@ static void __init overo_init(void)
 {
        overo_i2c_init();
        platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices));
-       omap_board_config = overo_config;
-       omap_board_config_size = ARRAY_SIZE(overo_config);
        omap_serial_init();
        overo_flash_init();
        usb_musb_init();
index c0d13401425fc4e03ef96d1f84e2fcf8a9e566c6..f9196c3b1a7bd1677351c467ba5bc23666783db3 100644 (file)
@@ -56,6 +56,8 @@ static struct omap_board_config_kernel rx51_config[] = {
 
 static void __init rx51_init_irq(void)
 {
+       omap_board_config = rx51_config;
+       omap_board_config_size = ARRAY_SIZE(rx51_config);
        omap2_init_common_hw(NULL, NULL);
        omap_init_irq();
        omap_gpio_init();
@@ -65,8 +67,6 @@ extern void __init rx51_peripherals_init(void);
 
 static void __init rx51_init(void)
 {
-       omap_board_config = rx51_config;
-       omap_board_config_size = ARRAY_SIZE(rx51_config);
        omap_serial_init();
        usb_musb_init();
        rx51_peripherals_init();
index dabba2720a9bbc93e70a082e163eb5753dc728ee..324009edbd53c7e711aad3ac4cbfc3df1ffb087a 100644 (file)
@@ -90,13 +90,6 @@ static struct twl4030_keypad_data zoom2_kp_twl4030_data = {
        .rep            = 1,
 };
 
-static void __init omap_zoom2_init_irq(void)
-{
-       omap2_init_common_hw(NULL, NULL);
-       omap_init_irq();
-       omap_gpio_init();
-}
-
 static struct omap_board_config_kernel zoom2_config[] __initdata = {
 };
 
@@ -212,6 +205,15 @@ static struct twl4030_usb_data zoom2_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
 };
 
+static void __init omap_zoom2_init_irq(void)
+{
+       omap_board_config = zoom2_config;
+       omap_board_config_size = ARRAY_SIZE(zoom2_config);
+       omap2_init_common_hw(NULL, NULL);
+       omap_init_irq();
+       omap_gpio_init();
+}
+
 static struct twl4030_gpio_platform_data zoom2_gpio_data = {
        .gpio_base      = OMAP_MAX_GPIO_LINES,
        .irq_base       = TWL4030_GPIO_IRQ_BASE,
@@ -262,8 +264,6 @@ extern int __init omap_zoom2_debugboard_init(void);
 static void __init omap_zoom2_init(void)
 {
        omap_i2c_init();
-       omap_board_config = zoom2_config;
-       omap_board_config_size = ARRAY_SIZE(zoom2_config);
        omap_serial_init();
        omap_zoom2_debugboard_init();
        usb_musb_init();
index 4bfe873e1b83d36d7a11ecc140d53737cd4f1902..470b1d10c4e596e97222fe88b4a67c3e00d48b82 100644 (file)
@@ -32,6 +32,7 @@
 #include <mach/sram.h>
 #include <mach/sdrc.h>
 #include <mach/gpmc.h>
+#include <mach/serial.h>
 
 #ifndef CONFIG_ARCH_OMAP4      /* FIXME: Remove this once clkdev is ready */
 #include "clock.h"
@@ -287,6 +288,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
        pwrdm_init(powerdomains_omap);
        clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
        omap2_clk_init();
+       omap_serial_early_init();
        omap_pm_if_init();
        omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
        _omap2_init_reprogram_sdrc();
index dd3c735b55881340c8eda6b061f9589c849265dc..ca28424f2fbda8accdd2ee66f48a54956e6ffea1 100644 (file)
@@ -552,7 +552,7 @@ static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = {
        },
 };
 
-void __init omap_serial_init(void)
+void __init omap_serial_early_init(void)
 {
        int i;
        char name[16];
@@ -595,6 +595,18 @@ void __init omap_serial_init(void)
                        p->irq += 32;
 
                omap_uart_enable_clocks(uart);
+       }
+}
+
+void __init omap_serial_init(void)
+{
+       int i;
+
+       for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
+               struct omap_uart_state *uart = &omap_uart[i];
+               struct platform_device *pdev = &uart->pdev;
+               struct device *dev = &pdev->dev;
+
                omap_uart_reset(uart);
                omap_uart_idle_init(uart);
 
index def0529c75eb8ccc764657ee1bec2aa237ed9b62..e249186d26e2b824d1017e31fdc1d309e5e31e17 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef __ASM_ARCH_SERIAL_H
 #define __ASM_ARCH_SERIAL_H
 
+#include <linux/init.h>
+
 #if defined(CONFIG_ARCH_OMAP1)
 /* OMAP1 serial ports */
 #define OMAP_UART1_BASE                0xfffb0000
@@ -53,6 +55,7 @@
                        })
 
 #ifndef __ASSEMBLER__
+extern void __init omap_serial_early_init(void);
 extern void omap_serial_init(void);
 extern int omap_uart_can_sleep(void);
 extern void omap_uart_check_wakeup(void);