Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind...
[linux-3.10.git] / arch / arm / mach-omap2 / board-omap4panda.c
index ed61c1f..0f4d8a7 100644 (file)
@@ -26,6 +26,8 @@
 #include <linux/usb/otg.h>
 #include <linux/i2c/twl.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/wl12xx.h>
 
 #include <mach/hardware.h>
 #include <mach/omap4-common.h>
 
 #define GPIO_HUB_POWER         1
 #define GPIO_HUB_NRESET                62
+#define GPIO_WIFI_PMENA                43
+#define GPIO_WIFI_IRQ          53
+
+/* wl127x BT, FM, GPS connectivity chip */
+static int wl1271_gpios[] = {46, -1, -1};
+static struct platform_device wl1271_device = {
+       .name   = "kim",
+       .id     = -1,
+       .dev    = {
+               .platform_data  = &wl1271_gpios,
+       },
+};
 
 static struct gpio_led gpio_leds[] = {
        {
@@ -74,13 +88,13 @@ static struct platform_device leds_gpio = {
 
 static struct platform_device *panda_devices[] __initdata = {
        &leds_gpio,
+       &wl1271_device,
 };
 
-static void __init omap4_panda_init_irq(void)
+static void __init omap4_panda_init_early(void)
 {
        omap2_init_common_infrastructure();
        omap2_init_common_devices(NULL, NULL);
-       gic_init_irq();
 }
 
 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
@@ -163,16 +177,62 @@ static struct omap2_hsmmc_info mmc[] = {
                .gpio_wp        = -EINVAL,
                .gpio_cd        = -EINVAL,
        },
+       {
+               .name           = "wl1271",
+               .mmc            = 5,
+               .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
+               .gpio_wp        = -EINVAL,
+               .gpio_cd        = -EINVAL,
+               .ocr_mask       = MMC_VDD_165_195,
+               .nonremovable   = true,
+       },
        {}      /* Terminator */
 };
 
 static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
        {
                .supply = "vmmc",
-               .dev_name = "mmci-omap-hs.0",
+               .dev_name = "omap_hsmmc.0",
        },
 };
 
+static struct regulator_consumer_supply omap4_panda_vmmc5_supply = {
+       .supply = "vmmc",
+       .dev_name = "omap_hsmmc.4",
+};
+
+static struct regulator_init_data panda_vmmc5 = {
+       .constraints = {
+               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+       },
+       .num_consumer_supplies = 1,
+       .consumer_supplies = &omap4_panda_vmmc5_supply,
+};
+
+static struct fixed_voltage_config panda_vwlan = {
+       .supply_name = "vwl1271",
+       .microvolts = 1800000, /* 1.8V */
+       .gpio = GPIO_WIFI_PMENA,
+       .startup_delay = 70000, /* 70msec */
+       .enable_high = 1,
+       .enabled_at_boot = 0,
+       .init_data = &panda_vmmc5,
+};
+
+static struct platform_device omap_vwlan_device = {
+       .name           = "reg-fixed-voltage",
+       .id             = 1,
+       .dev = {
+               .platform_data = &panda_vwlan,
+       },
+};
+
+struct wl12xx_platform_data omap_panda_wlan_data  __initdata = {
+       .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
+       /* PANDA ref clock is 38.4 MHz */
+       .board_ref_clock = 2,
+};
+
 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
 {
        int ret = 0;
@@ -306,7 +366,6 @@ static struct regulator_init_data omap4_panda_vana = {
        .constraints = {
                .min_uV                 = 2100000,
                .max_uV                 = 2100000,
-               .apply_uV               = true,
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
                                        | REGULATOR_MODE_STANDBY,
                .valid_ops_mask  = REGULATOR_CHANGE_MODE
@@ -318,7 +377,6 @@ static struct regulator_init_data omap4_panda_vcxio = {
        .constraints = {
                .min_uV                 = 1800000,
                .max_uV                 = 1800000,
-               .apply_uV               = true,
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
                                        | REGULATOR_MODE_STANDBY,
                .valid_ops_mask  = REGULATOR_CHANGE_MODE
@@ -330,7 +388,6 @@ static struct regulator_init_data omap4_panda_vdac = {
        .constraints = {
                .min_uV                 = 1800000,
                .max_uV                 = 1800000,
-               .apply_uV               = true,
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
                                        | REGULATOR_MODE_STANDBY,
                .valid_ops_mask  = REGULATOR_CHANGE_MODE
@@ -392,10 +449,90 @@ static int __init omap4_panda_i2c_init(void)
 
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
+       /* WLAN IRQ - GPIO 53 */
+       OMAP4_MUX(GPMC_NCS3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
+       /* WLAN POWER ENABLE - GPIO 43 */
+       OMAP4_MUX(GPMC_A19, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
+       /* WLAN SDIO: MMC5 CMD */
+       OMAP4_MUX(SDMMC5_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
+       /* WLAN SDIO: MMC5 CLK */
+       OMAP4_MUX(SDMMC5_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
+       /* WLAN SDIO: MMC5 DAT[0-3] */
+       OMAP4_MUX(SDMMC5_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
+       OMAP4_MUX(SDMMC5_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
+       OMAP4_MUX(SDMMC5_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
+       OMAP4_MUX(SDMMC5_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
        { .reg_offset = OMAP_MUX_TERMINATOR },
 };
+
+static struct omap_device_pad serial2_pads[] __initdata = {
+       OMAP_MUX_STATIC("uart2_cts.uart2_cts",
+                        OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP_MUX_STATIC("uart2_rts.uart2_rts",
+                        OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
+       OMAP_MUX_STATIC("uart2_rx.uart2_rx",
+                        OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP_MUX_STATIC("uart2_tx.uart2_tx",
+                        OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
+};
+
+static struct omap_device_pad serial3_pads[] __initdata = {
+       OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
+                        OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
+       OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
+                        OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
+       OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
+                        OMAP_PIN_INPUT | OMAP_MUX_MODE0),
+       OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
+                        OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
+};
+
+static struct omap_device_pad serial4_pads[] __initdata = {
+       OMAP_MUX_STATIC("uart4_rx.uart4_rx",
+                        OMAP_PIN_INPUT | OMAP_MUX_MODE0),
+       OMAP_MUX_STATIC("uart4_tx.uart4_tx",
+                        OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
+};
+
+static struct omap_board_data serial2_data = {
+       .id             = 1,
+       .pads           = serial2_pads,
+       .pads_cnt       = ARRAY_SIZE(serial2_pads),
+};
+
+static struct omap_board_data serial3_data = {
+       .id             = 2,
+       .pads           = serial3_pads,
+       .pads_cnt       = ARRAY_SIZE(serial3_pads),
+};
+
+static struct omap_board_data serial4_data = {
+       .id             = 3,
+       .pads           = serial4_pads,
+       .pads_cnt       = ARRAY_SIZE(serial4_pads),
+};
+
+static inline void board_serial_init(void)
+{
+       struct omap_board_data bdata;
+       bdata.flags     = 0;
+       bdata.pads      = NULL;
+       bdata.pads_cnt  = 0;
+       bdata.id        = 0;
+       /* pass dummy data for UART1 */
+       omap_serial_init_port(&bdata);
+
+       omap_serial_init_port(&serial2_data);
+       omap_serial_init_port(&serial3_data);
+       omap_serial_init_port(&serial4_data);
+}
 #else
 #define board_mux      NULL
+
+static inline void board_serial_init(void)
+{
+       omap_serial_init();
+}
 #endif
 
 static void __init omap4_panda_init(void)
@@ -406,9 +543,13 @@ static void __init omap4_panda_init(void)
                package = OMAP_PACKAGE_CBL;
        omap4_mux_init(board_mux, package);
 
+       if (wl12xx_set_platform_data(&omap_panda_wlan_data))
+               pr_err("error setting wl12xx data\n");
+
        omap4_panda_i2c_init();
        platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
-       omap_serial_init();
+       platform_device_register(&omap_vwlan_device);
+       board_serial_init();
        omap4_twl6030_hsmmc_init(mmc);
        omap4_ehci_init();
        usb_musb_init(&musb_board_data);
@@ -425,7 +566,8 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
        .boot_params    = 0x80000100,
        .reserve        = omap_reserve,
        .map_io         = omap4_panda_map_io,
-       .init_irq       = omap4_panda_init_irq,
+       .init_early     = omap4_panda_init_early,
+       .init_irq       = gic_init_irq,
        .init_machine   = omap4_panda_init,
        .timer          = &omap_timer,
 MACHINE_END