David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Board support file for OMAP4430 based PandaBoard. |
| 3 | * |
| 4 | * Copyright (C) 2010 Texas Instruments |
| 5 | * |
| 6 | * Author: David Anders <x0132446@ti.com> |
| 7 | * |
| 8 | * Based on mach-omap2/board-4430sdp.c |
| 9 | * |
| 10 | * Author: Santosh Shilimkar <santosh.shilimkar@ti.com> |
| 11 | * |
| 12 | * Based on mach-omap2/board-3430sdp.c |
| 13 | * |
| 14 | * This program is free software; you can redistribute it and/or modify |
| 15 | * it under the terms of the GNU General Public License version 2 as |
| 16 | * published by the Free Software Foundation. |
| 17 | */ |
| 18 | |
| 19 | #include <linux/kernel.h> |
| 20 | #include <linux/init.h> |
| 21 | #include <linux/platform_device.h> |
Anand Gadiyar | 1740d48 | 2011-01-10 14:42:15 +0000 | [diff] [blame] | 22 | #include <linux/clk.h> |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 23 | #include <linux/io.h> |
Ricardo Salveti de Araujo | 3da434a | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 24 | #include <linux/leds.h> |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 25 | #include <linux/gpio.h> |
| 26 | #include <linux/usb/otg.h> |
| 27 | #include <linux/i2c/twl.h> |
| 28 | #include <linux/regulator/machine.h> |
Panduranga Mallireddy | edc8406 | 2011-02-15 03:40:34 -0500 | [diff] [blame] | 29 | #include <linux/regulator/fixed.h> |
Panduranga Mallireddy | b17e0979 | 2011-02-15 03:40:35 -0500 | [diff] [blame] | 30 | #include <linux/wl12xx.h> |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 31 | |
| 32 | #include <mach/hardware.h> |
| 33 | #include <mach/omap4-common.h> |
| 34 | #include <asm/mach-types.h> |
| 35 | #include <asm/mach/arch.h> |
| 36 | #include <asm/mach/map.h> |
K, Mythri P | 17c84ef | 2011-03-14 23:57:42 -0500 | [diff] [blame] | 37 | #include <plat/display.h> |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 38 | |
| 39 | #include <plat/board.h> |
| 40 | #include <plat/common.h> |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 41 | #include <plat/usb.h> |
| 42 | #include <plat/mmc.h> |
Murthy, Raghuveer | b295d6e | 2011-03-14 07:52:25 -0500 | [diff] [blame^] | 43 | #include <plat/panel-generic-dpi.h> |
Manjunath Kondaiah G | 04aeae7 | 2010-10-08 09:58:35 -0700 | [diff] [blame] | 44 | #include "timer-gp.h" |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 45 | |
Paul Walmsley | 4814ced | 2010-10-08 11:40:20 -0600 | [diff] [blame] | 46 | #include "hsmmc.h" |
| 47 | #include "control.h" |
sricharan | fc63de82 | 2010-11-08 19:26:11 +0530 | [diff] [blame] | 48 | #include "mux.h" |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 49 | |
David Anders | 4415beb | 2010-10-07 19:36:30 +0000 | [diff] [blame] | 50 | #define GPIO_HUB_POWER 1 |
| 51 | #define GPIO_HUB_NRESET 62 |
Panduranga Mallireddy | edc8406 | 2011-02-15 03:40:34 -0500 | [diff] [blame] | 52 | #define GPIO_WIFI_PMENA 43 |
Panduranga Mallireddy | b17e0979 | 2011-02-15 03:40:35 -0500 | [diff] [blame] | 53 | #define GPIO_WIFI_IRQ 53 |
K, Mythri P | 17c84ef | 2011-03-14 23:57:42 -0500 | [diff] [blame] | 54 | #define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */ |
| 55 | #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ |
David Anders | 4415beb | 2010-10-07 19:36:30 +0000 | [diff] [blame] | 56 | |
Guy Eilam | ec179ea | 2011-02-25 06:52:35 +0000 | [diff] [blame] | 57 | /* wl127x BT, FM, GPS connectivity chip */ |
| 58 | static int wl1271_gpios[] = {46, -1, -1}; |
| 59 | static struct platform_device wl1271_device = { |
| 60 | .name = "kim", |
| 61 | .id = -1, |
| 62 | .dev = { |
| 63 | .platform_data = &wl1271_gpios, |
| 64 | }, |
| 65 | }; |
| 66 | |
Ricardo Salveti de Araujo | 3da434a | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 67 | static struct gpio_led gpio_leds[] = { |
| 68 | { |
| 69 | .name = "pandaboard::status1", |
| 70 | .default_trigger = "heartbeat", |
| 71 | .gpio = 7, |
| 72 | }, |
| 73 | { |
| 74 | .name = "pandaboard::status2", |
| 75 | .default_trigger = "mmc0", |
| 76 | .gpio = 8, |
| 77 | }, |
| 78 | }; |
| 79 | |
| 80 | static struct gpio_led_platform_data gpio_led_info = { |
| 81 | .leds = gpio_leds, |
| 82 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 83 | }; |
| 84 | |
| 85 | static struct platform_device leds_gpio = { |
| 86 | .name = "leds-gpio", |
| 87 | .id = -1, |
| 88 | .dev = { |
| 89 | .platform_data = &gpio_led_info, |
| 90 | }, |
| 91 | }; |
| 92 | |
| 93 | static struct platform_device *panda_devices[] __initdata = { |
| 94 | &leds_gpio, |
Guy Eilam | ec179ea | 2011-02-25 06:52:35 +0000 | [diff] [blame] | 95 | &wl1271_device, |
Ricardo Salveti de Araujo | 3da434a | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 96 | }; |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 97 | |
Russell King - ARM Linux | 3dc3bad | 2011-02-14 15:40:20 -0800 | [diff] [blame] | 98 | static void __init omap4_panda_init_early(void) |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 99 | { |
Paul Walmsley | 4805734 | 2010-12-21 15:25:10 -0700 | [diff] [blame] | 100 | omap2_init_common_infrastructure(); |
| 101 | omap2_init_common_devices(NULL, NULL); |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 102 | } |
| 103 | |
David Anders | 4415beb | 2010-10-07 19:36:30 +0000 | [diff] [blame] | 104 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
| 105 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, |
| 106 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 107 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 108 | .phy_reset = false, |
| 109 | .reset_gpio_port[0] = -EINVAL, |
| 110 | .reset_gpio_port[1] = -EINVAL, |
| 111 | .reset_gpio_port[2] = -EINVAL |
| 112 | }; |
| 113 | |
| 114 | static void __init omap4_ehci_init(void) |
| 115 | { |
| 116 | int ret; |
Anand Gadiyar | 1740d48 | 2011-01-10 14:42:15 +0000 | [diff] [blame] | 117 | struct clk *phy_ref_clk; |
David Anders | 4415beb | 2010-10-07 19:36:30 +0000 | [diff] [blame] | 118 | |
Anand Gadiyar | 1740d48 | 2011-01-10 14:42:15 +0000 | [diff] [blame] | 119 | /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ |
| 120 | phy_ref_clk = clk_get(NULL, "auxclk3_ck"); |
| 121 | if (IS_ERR(phy_ref_clk)) { |
| 122 | pr_err("Cannot request auxclk3\n"); |
| 123 | goto error1; |
| 124 | } |
| 125 | clk_set_rate(phy_ref_clk, 19200000); |
| 126 | clk_enable(phy_ref_clk); |
David Anders | 4415beb | 2010-10-07 19:36:30 +0000 | [diff] [blame] | 127 | |
| 128 | /* disable the power to the usb hub prior to init */ |
| 129 | ret = gpio_request(GPIO_HUB_POWER, "hub_power"); |
| 130 | if (ret) { |
| 131 | pr_err("Cannot request GPIO %d\n", GPIO_HUB_POWER); |
| 132 | goto error1; |
| 133 | } |
| 134 | gpio_export(GPIO_HUB_POWER, 0); |
| 135 | gpio_direction_output(GPIO_HUB_POWER, 0); |
| 136 | gpio_set_value(GPIO_HUB_POWER, 0); |
| 137 | |
| 138 | /* reset phy+hub */ |
| 139 | ret = gpio_request(GPIO_HUB_NRESET, "hub_nreset"); |
| 140 | if (ret) { |
| 141 | pr_err("Cannot request GPIO %d\n", GPIO_HUB_NRESET); |
| 142 | goto error2; |
| 143 | } |
| 144 | gpio_export(GPIO_HUB_NRESET, 0); |
| 145 | gpio_direction_output(GPIO_HUB_NRESET, 0); |
| 146 | gpio_set_value(GPIO_HUB_NRESET, 0); |
| 147 | gpio_set_value(GPIO_HUB_NRESET, 1); |
| 148 | |
| 149 | usb_ehci_init(&ehci_pdata); |
| 150 | |
| 151 | /* enable power to hub */ |
| 152 | gpio_set_value(GPIO_HUB_POWER, 1); |
| 153 | return; |
| 154 | |
| 155 | error2: |
| 156 | gpio_free(GPIO_HUB_POWER); |
| 157 | error1: |
| 158 | pr_err("Unable to initialize EHCI power/reset\n"); |
| 159 | return; |
| 160 | |
| 161 | } |
| 162 | |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 163 | static struct omap_musb_board_data musb_board_data = { |
| 164 | .interface_type = MUSB_INTERFACE_UTMI, |
Hema HK | 09e7200 | 2010-12-10 18:11:42 +0530 | [diff] [blame] | 165 | .mode = MUSB_OTG, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 166 | .power = 100, |
| 167 | }; |
| 168 | |
Hema HK | e70357e | 2010-12-10 18:09:52 +0530 | [diff] [blame] | 169 | static struct twl4030_usb_data omap4_usbphy_data = { |
| 170 | .phy_init = omap4430_phy_init, |
| 171 | .phy_exit = omap4430_phy_exit, |
| 172 | .phy_power = omap4430_phy_power, |
| 173 | .phy_set_clock = omap4430_phy_set_clk, |
| 174 | }; |
| 175 | |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 176 | static struct omap2_hsmmc_info mmc[] = { |
| 177 | { |
| 178 | .mmc = 1, |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 179 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 180 | .gpio_wp = -EINVAL, |
Raghuveer Murthy | 5b59cc2 | 2010-12-21 14:14:34 +0000 | [diff] [blame] | 181 | .gpio_cd = -EINVAL, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 182 | }, |
Panduranga Mallireddy | b17e0979 | 2011-02-15 03:40:35 -0500 | [diff] [blame] | 183 | { |
| 184 | .name = "wl1271", |
| 185 | .mmc = 5, |
| 186 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, |
| 187 | .gpio_wp = -EINVAL, |
| 188 | .gpio_cd = -EINVAL, |
| 189 | .ocr_mask = MMC_VDD_165_195, |
| 190 | .nonremovable = true, |
| 191 | }, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 192 | {} /* Terminator */ |
| 193 | }; |
| 194 | |
| 195 | static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = { |
| 196 | { |
| 197 | .supply = "vmmc", |
Kishore Kadiyala | 0005ae7 | 2011-02-28 20:48:05 +0530 | [diff] [blame] | 198 | .dev_name = "omap_hsmmc.0", |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 199 | }, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 200 | }; |
| 201 | |
Panduranga Mallireddy | edc8406 | 2011-02-15 03:40:34 -0500 | [diff] [blame] | 202 | static struct regulator_consumer_supply omap4_panda_vmmc5_supply = { |
| 203 | .supply = "vmmc", |
Kishore Kadiyala | 0005ae7 | 2011-02-28 20:48:05 +0530 | [diff] [blame] | 204 | .dev_name = "omap_hsmmc.4", |
Panduranga Mallireddy | edc8406 | 2011-02-15 03:40:34 -0500 | [diff] [blame] | 205 | }; |
| 206 | |
| 207 | static struct regulator_init_data panda_vmmc5 = { |
| 208 | .constraints = { |
| 209 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 210 | }, |
| 211 | .num_consumer_supplies = 1, |
| 212 | .consumer_supplies = &omap4_panda_vmmc5_supply, |
| 213 | }; |
| 214 | |
| 215 | static struct fixed_voltage_config panda_vwlan = { |
| 216 | .supply_name = "vwl1271", |
| 217 | .microvolts = 1800000, /* 1.8V */ |
| 218 | .gpio = GPIO_WIFI_PMENA, |
| 219 | .startup_delay = 70000, /* 70msec */ |
| 220 | .enable_high = 1, |
| 221 | .enabled_at_boot = 0, |
| 222 | .init_data = &panda_vmmc5, |
| 223 | }; |
| 224 | |
| 225 | static struct platform_device omap_vwlan_device = { |
| 226 | .name = "reg-fixed-voltage", |
| 227 | .id = 1, |
| 228 | .dev = { |
| 229 | .platform_data = &panda_vwlan, |
| 230 | }, |
| 231 | }; |
| 232 | |
Panduranga Mallireddy | b17e0979 | 2011-02-15 03:40:35 -0500 | [diff] [blame] | 233 | struct wl12xx_platform_data omap_panda_wlan_data __initdata = { |
| 234 | .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ), |
| 235 | /* PANDA ref clock is 38.4 MHz */ |
| 236 | .board_ref_clock = 2, |
| 237 | }; |
| 238 | |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 239 | static int omap4_twl6030_hsmmc_late_init(struct device *dev) |
| 240 | { |
| 241 | int ret = 0; |
| 242 | struct platform_device *pdev = container_of(dev, |
| 243 | struct platform_device, dev); |
| 244 | struct omap_mmc_platform_data *pdata = dev->platform_data; |
| 245 | |
Menon, Nishanth | bf56f0a | 2010-10-19 09:50:25 -0500 | [diff] [blame] | 246 | if (!pdata) { |
| 247 | dev_err(dev, "%s: NULL platform data\n", __func__); |
| 248 | return -EINVAL; |
| 249 | } |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 250 | /* Setting MMC1 Card detect Irq */ |
Menon, Nishanth | bf56f0a | 2010-10-19 09:50:25 -0500 | [diff] [blame] | 251 | if (pdev->id == 0) { |
| 252 | ret = twl6030_mmc_card_detect_config(); |
| 253 | if (ret) |
| 254 | dev_err(dev, "%s: Error card detect config(%d)\n", |
| 255 | __func__, ret); |
| 256 | else |
| 257 | pdata->slots[0].card_detect = twl6030_mmc_card_detect; |
| 258 | } |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 259 | return ret; |
| 260 | } |
| 261 | |
| 262 | static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) |
| 263 | { |
David Anders | b9b5262 | 2010-10-07 19:36:29 +0000 | [diff] [blame] | 264 | struct omap_mmc_platform_data *pdata; |
| 265 | |
| 266 | /* dev can be null if CONFIG_MMC_OMAP_HS is not set */ |
| 267 | if (!dev) { |
| 268 | pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n"); |
| 269 | return; |
| 270 | } |
| 271 | pdata = dev->platform_data; |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 272 | |
| 273 | pdata->init = omap4_twl6030_hsmmc_late_init; |
| 274 | } |
| 275 | |
| 276 | static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) |
| 277 | { |
| 278 | struct omap2_hsmmc_info *c; |
| 279 | |
| 280 | omap2_hsmmc_init(controllers); |
| 281 | for (c = controllers; c->mmc; c++) |
| 282 | omap4_twl6030_hsmmc_set_late_init(c->dev); |
| 283 | |
| 284 | return 0; |
| 285 | } |
| 286 | |
| 287 | static struct regulator_init_data omap4_panda_vaux1 = { |
| 288 | .constraints = { |
| 289 | .min_uV = 1000000, |
| 290 | .max_uV = 3000000, |
| 291 | .apply_uV = true, |
| 292 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 293 | | REGULATOR_MODE_STANDBY, |
| 294 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 295 | | REGULATOR_CHANGE_MODE |
| 296 | | REGULATOR_CHANGE_STATUS, |
| 297 | }, |
| 298 | }; |
| 299 | |
| 300 | static struct regulator_init_data omap4_panda_vaux2 = { |
| 301 | .constraints = { |
| 302 | .min_uV = 1200000, |
| 303 | .max_uV = 2800000, |
| 304 | .apply_uV = true, |
| 305 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 306 | | REGULATOR_MODE_STANDBY, |
| 307 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 308 | | REGULATOR_CHANGE_MODE |
| 309 | | REGULATOR_CHANGE_STATUS, |
| 310 | }, |
| 311 | }; |
| 312 | |
| 313 | static struct regulator_init_data omap4_panda_vaux3 = { |
| 314 | .constraints = { |
| 315 | .min_uV = 1000000, |
| 316 | .max_uV = 3000000, |
| 317 | .apply_uV = true, |
| 318 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 319 | | REGULATOR_MODE_STANDBY, |
| 320 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 321 | | REGULATOR_CHANGE_MODE |
| 322 | | REGULATOR_CHANGE_STATUS, |
| 323 | }, |
| 324 | }; |
| 325 | |
| 326 | /* VMMC1 for MMC1 card */ |
| 327 | static struct regulator_init_data omap4_panda_vmmc = { |
| 328 | .constraints = { |
| 329 | .min_uV = 1200000, |
| 330 | .max_uV = 3000000, |
| 331 | .apply_uV = true, |
| 332 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 333 | | REGULATOR_MODE_STANDBY, |
| 334 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 335 | | REGULATOR_CHANGE_MODE |
| 336 | | REGULATOR_CHANGE_STATUS, |
| 337 | }, |
David Anders | 191183b | 2010-10-07 19:36:28 +0000 | [diff] [blame] | 338 | .num_consumer_supplies = 1, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 339 | .consumer_supplies = omap4_panda_vmmc_supply, |
| 340 | }; |
| 341 | |
| 342 | static struct regulator_init_data omap4_panda_vpp = { |
| 343 | .constraints = { |
| 344 | .min_uV = 1800000, |
| 345 | .max_uV = 2500000, |
| 346 | .apply_uV = true, |
| 347 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 348 | | REGULATOR_MODE_STANDBY, |
| 349 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 350 | | REGULATOR_CHANGE_MODE |
| 351 | | REGULATOR_CHANGE_STATUS, |
| 352 | }, |
| 353 | }; |
| 354 | |
| 355 | static struct regulator_init_data omap4_panda_vusim = { |
| 356 | .constraints = { |
| 357 | .min_uV = 1200000, |
| 358 | .max_uV = 2900000, |
| 359 | .apply_uV = true, |
| 360 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 361 | | REGULATOR_MODE_STANDBY, |
| 362 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 363 | | REGULATOR_CHANGE_MODE |
| 364 | | REGULATOR_CHANGE_STATUS, |
| 365 | }, |
| 366 | }; |
| 367 | |
| 368 | static struct regulator_init_data omap4_panda_vana = { |
| 369 | .constraints = { |
| 370 | .min_uV = 2100000, |
| 371 | .max_uV = 2100000, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 372 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 373 | | REGULATOR_MODE_STANDBY, |
| 374 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 375 | | REGULATOR_CHANGE_STATUS, |
| 376 | }, |
| 377 | }; |
| 378 | |
| 379 | static struct regulator_init_data omap4_panda_vcxio = { |
| 380 | .constraints = { |
| 381 | .min_uV = 1800000, |
| 382 | .max_uV = 1800000, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 383 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 384 | | REGULATOR_MODE_STANDBY, |
| 385 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 386 | | REGULATOR_CHANGE_STATUS, |
| 387 | }, |
| 388 | }; |
| 389 | |
| 390 | static struct regulator_init_data omap4_panda_vdac = { |
| 391 | .constraints = { |
| 392 | .min_uV = 1800000, |
| 393 | .max_uV = 1800000, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 394 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 395 | | REGULATOR_MODE_STANDBY, |
| 396 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 397 | | REGULATOR_CHANGE_STATUS, |
| 398 | }, |
| 399 | }; |
| 400 | |
| 401 | static struct regulator_init_data omap4_panda_vusb = { |
| 402 | .constraints = { |
| 403 | .min_uV = 3300000, |
| 404 | .max_uV = 3300000, |
| 405 | .apply_uV = true, |
| 406 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 407 | | REGULATOR_MODE_STANDBY, |
| 408 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 409 | | REGULATOR_CHANGE_STATUS, |
| 410 | }, |
| 411 | }; |
| 412 | |
| 413 | static struct twl4030_platform_data omap4_panda_twldata = { |
| 414 | .irq_base = TWL6030_IRQ_BASE, |
| 415 | .irq_end = TWL6030_IRQ_END, |
| 416 | |
| 417 | /* Regulators */ |
| 418 | .vmmc = &omap4_panda_vmmc, |
| 419 | .vpp = &omap4_panda_vpp, |
| 420 | .vusim = &omap4_panda_vusim, |
| 421 | .vana = &omap4_panda_vana, |
| 422 | .vcxio = &omap4_panda_vcxio, |
| 423 | .vdac = &omap4_panda_vdac, |
| 424 | .vusb = &omap4_panda_vusb, |
| 425 | .vaux1 = &omap4_panda_vaux1, |
| 426 | .vaux2 = &omap4_panda_vaux2, |
| 427 | .vaux3 = &omap4_panda_vaux3, |
Hema HK | e70357e | 2010-12-10 18:09:52 +0530 | [diff] [blame] | 428 | .usb = &omap4_usbphy_data, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 429 | }; |
| 430 | |
| 431 | static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = { |
| 432 | { |
| 433 | I2C_BOARD_INFO("twl6030", 0x48), |
| 434 | .flags = I2C_CLIENT_WAKE, |
| 435 | .irq = OMAP44XX_IRQ_SYS_1N, |
| 436 | .platform_data = &omap4_panda_twldata, |
| 437 | }, |
| 438 | }; |
Murthy, Raghuveer | b295d6e | 2011-03-14 07:52:25 -0500 | [diff] [blame^] | 439 | |
| 440 | /* |
| 441 | * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM |
| 442 | * is connected as I2C slave device, and can be accessed at address 0x50 |
| 443 | */ |
| 444 | static struct i2c_board_info __initdata panda_i2c_eeprom[] = { |
| 445 | { |
| 446 | I2C_BOARD_INFO("eeprom", 0x50), |
| 447 | }, |
| 448 | }; |
| 449 | |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 450 | static int __init omap4_panda_i2c_init(void) |
| 451 | { |
| 452 | /* |
| 453 | * Phoenix Audio IC needs I2C1 to |
| 454 | * start with 400 KHz or less |
| 455 | */ |
| 456 | omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo, |
| 457 | ARRAY_SIZE(omap4_panda_i2c_boardinfo)); |
| 458 | omap_register_i2c_bus(2, 400, NULL, 0); |
Murthy, Raghuveer | b295d6e | 2011-03-14 07:52:25 -0500 | [diff] [blame^] | 459 | /* |
| 460 | * Bus 3 is attached to the DVI port where devices like the pico DLP |
| 461 | * projector don't work reliably with 400kHz |
| 462 | */ |
| 463 | omap_register_i2c_bus(3, 100, panda_i2c_eeprom, |
| 464 | ARRAY_SIZE(panda_i2c_eeprom)); |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 465 | omap_register_i2c_bus(4, 400, NULL, 0); |
| 466 | return 0; |
| 467 | } |
sricharan | fc63de82 | 2010-11-08 19:26:11 +0530 | [diff] [blame] | 468 | |
| 469 | #ifdef CONFIG_OMAP_MUX |
| 470 | static struct omap_board_mux board_mux[] __initdata = { |
Panduranga Mallireddy | 66e171a | 2011-02-15 03:40:32 -0500 | [diff] [blame] | 471 | /* WLAN IRQ - GPIO 53 */ |
| 472 | OMAP4_MUX(GPMC_NCS3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), |
| 473 | /* WLAN POWER ENABLE - GPIO 43 */ |
| 474 | OMAP4_MUX(GPMC_A19, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT), |
| 475 | /* WLAN SDIO: MMC5 CMD */ |
| 476 | OMAP4_MUX(SDMMC5_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 477 | /* WLAN SDIO: MMC5 CLK */ |
| 478 | OMAP4_MUX(SDMMC5_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 479 | /* WLAN SDIO: MMC5 DAT[0-3] */ |
| 480 | OMAP4_MUX(SDMMC5_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 481 | OMAP4_MUX(SDMMC5_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 482 | OMAP4_MUX(SDMMC5_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 483 | OMAP4_MUX(SDMMC5_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
Murthy, Raghuveer | b295d6e | 2011-03-14 07:52:25 -0500 | [diff] [blame^] | 484 | /* gpio 0 - TFP410 PD */ |
| 485 | OMAP4_MUX(KPD_COL1, OMAP_PIN_OUTPUT | OMAP_MUX_MODE3), |
| 486 | /* dispc2_data23 */ |
| 487 | OMAP4_MUX(USBB2_ULPITLL_STP, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 488 | /* dispc2_data22 */ |
| 489 | OMAP4_MUX(USBB2_ULPITLL_DIR, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 490 | /* dispc2_data21 */ |
| 491 | OMAP4_MUX(USBB2_ULPITLL_NXT, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 492 | /* dispc2_data20 */ |
| 493 | OMAP4_MUX(USBB2_ULPITLL_DAT0, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 494 | /* dispc2_data19 */ |
| 495 | OMAP4_MUX(USBB2_ULPITLL_DAT1, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 496 | /* dispc2_data18 */ |
| 497 | OMAP4_MUX(USBB2_ULPITLL_DAT2, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 498 | /* dispc2_data15 */ |
| 499 | OMAP4_MUX(USBB2_ULPITLL_DAT3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 500 | /* dispc2_data14 */ |
| 501 | OMAP4_MUX(USBB2_ULPITLL_DAT4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 502 | /* dispc2_data13 */ |
| 503 | OMAP4_MUX(USBB2_ULPITLL_DAT5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 504 | /* dispc2_data12 */ |
| 505 | OMAP4_MUX(USBB2_ULPITLL_DAT6, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 506 | /* dispc2_data11 */ |
| 507 | OMAP4_MUX(USBB2_ULPITLL_DAT7, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 508 | /* dispc2_data10 */ |
| 509 | OMAP4_MUX(DPM_EMU3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 510 | /* dispc2_data9 */ |
| 511 | OMAP4_MUX(DPM_EMU4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 512 | /* dispc2_data16 */ |
| 513 | OMAP4_MUX(DPM_EMU5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 514 | /* dispc2_data17 */ |
| 515 | OMAP4_MUX(DPM_EMU6, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 516 | /* dispc2_hsync */ |
| 517 | OMAP4_MUX(DPM_EMU7, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 518 | /* dispc2_pclk */ |
| 519 | OMAP4_MUX(DPM_EMU8, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 520 | /* dispc2_vsync */ |
| 521 | OMAP4_MUX(DPM_EMU9, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 522 | /* dispc2_de */ |
| 523 | OMAP4_MUX(DPM_EMU10, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 524 | /* dispc2_data8 */ |
| 525 | OMAP4_MUX(DPM_EMU11, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 526 | /* dispc2_data7 */ |
| 527 | OMAP4_MUX(DPM_EMU12, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 528 | /* dispc2_data6 */ |
| 529 | OMAP4_MUX(DPM_EMU13, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 530 | /* dispc2_data5 */ |
| 531 | OMAP4_MUX(DPM_EMU14, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 532 | /* dispc2_data4 */ |
| 533 | OMAP4_MUX(DPM_EMU15, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 534 | /* dispc2_data3 */ |
| 535 | OMAP4_MUX(DPM_EMU16, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 536 | /* dispc2_data2 */ |
| 537 | OMAP4_MUX(DPM_EMU17, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 538 | /* dispc2_data1 */ |
| 539 | OMAP4_MUX(DPM_EMU18, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
| 540 | /* dispc2_data0 */ |
| 541 | OMAP4_MUX(DPM_EMU19, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), |
sricharan | fc63de82 | 2010-11-08 19:26:11 +0530 | [diff] [blame] | 542 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 543 | }; |
| 544 | #else |
| 545 | #define board_mux NULL |
| 546 | #endif |
| 547 | |
Murthy, Raghuveer | b295d6e | 2011-03-14 07:52:25 -0500 | [diff] [blame^] | 548 | /* Display DVI */ |
| 549 | #define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0 |
| 550 | |
| 551 | static int omap4_panda_enable_dvi(struct omap_dss_device *dssdev) |
| 552 | { |
| 553 | gpio_set_value(dssdev->reset_gpio, 1); |
| 554 | return 0; |
| 555 | } |
| 556 | |
| 557 | static void omap4_panda_disable_dvi(struct omap_dss_device *dssdev) |
| 558 | { |
| 559 | gpio_set_value(dssdev->reset_gpio, 0); |
| 560 | } |
| 561 | |
| 562 | /* Using generic display panel */ |
| 563 | static struct panel_generic_dpi_data omap4_dvi_panel = { |
| 564 | .name = "generic", |
| 565 | .platform_enable = omap4_panda_enable_dvi, |
| 566 | .platform_disable = omap4_panda_disable_dvi, |
| 567 | }; |
| 568 | |
| 569 | struct omap_dss_device omap4_panda_dvi_device = { |
| 570 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 571 | .name = "dvi", |
| 572 | .driver_name = "generic_dpi_panel", |
| 573 | .data = &omap4_dvi_panel, |
| 574 | .phy.dpi.data_lines = 24, |
| 575 | .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, |
| 576 | .channel = OMAP_DSS_CHANNEL_LCD2, |
| 577 | }; |
| 578 | |
| 579 | int __init omap4_panda_dvi_init(void) |
| 580 | { |
| 581 | int r; |
| 582 | |
| 583 | /* Requesting TFP410 DVI GPIO and disabling it, at bootup */ |
| 584 | r = gpio_request_one(omap4_panda_dvi_device.reset_gpio, |
| 585 | GPIOF_OUT_INIT_LOW, "DVI PD"); |
| 586 | if (r) |
| 587 | pr_err("Failed to get DVI powerdown GPIO\n"); |
| 588 | |
| 589 | return r; |
| 590 | } |
| 591 | |
| 592 | |
K, Mythri P | 17c84ef | 2011-03-14 23:57:42 -0500 | [diff] [blame] | 593 | static void omap4_panda_hdmi_mux_init(void) |
| 594 | { |
| 595 | /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */ |
| 596 | omap_mux_init_signal("hdmi_hpd", |
| 597 | OMAP_PIN_INPUT_PULLUP); |
| 598 | omap_mux_init_signal("hdmi_cec", |
| 599 | OMAP_PIN_INPUT_PULLUP); |
| 600 | /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */ |
| 601 | omap_mux_init_signal("hdmi_ddc_scl", |
| 602 | OMAP_PIN_INPUT_PULLUP); |
| 603 | omap_mux_init_signal("hdmi_ddc_sda", |
| 604 | OMAP_PIN_INPUT_PULLUP); |
| 605 | } |
| 606 | |
| 607 | static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) |
| 608 | { |
| 609 | int status; |
| 610 | |
| 611 | status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, |
| 612 | "hdmi_gpio_hpd"); |
| 613 | if (status) { |
| 614 | pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD); |
| 615 | return status; |
| 616 | } |
| 617 | status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, |
| 618 | "hdmi_gpio_ls_oe"); |
| 619 | if (status) { |
| 620 | pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE); |
| 621 | goto error1; |
| 622 | } |
| 623 | |
| 624 | return 0; |
| 625 | |
| 626 | error1: |
| 627 | gpio_free(HDMI_GPIO_HPD); |
| 628 | |
| 629 | return status; |
| 630 | } |
| 631 | |
| 632 | static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev) |
| 633 | { |
| 634 | gpio_free(HDMI_GPIO_LS_OE); |
| 635 | gpio_free(HDMI_GPIO_HPD); |
| 636 | } |
| 637 | |
| 638 | static struct omap_dss_device omap4_panda_hdmi_device = { |
| 639 | .name = "hdmi", |
| 640 | .driver_name = "hdmi_panel", |
| 641 | .type = OMAP_DISPLAY_TYPE_HDMI, |
| 642 | .platform_enable = omap4_panda_panel_enable_hdmi, |
| 643 | .platform_disable = omap4_panda_panel_disable_hdmi, |
| 644 | .channel = OMAP_DSS_CHANNEL_DIGIT, |
| 645 | }; |
| 646 | |
| 647 | static struct omap_dss_device *omap4_panda_dss_devices[] = { |
Murthy, Raghuveer | b295d6e | 2011-03-14 07:52:25 -0500 | [diff] [blame^] | 648 | &omap4_panda_dvi_device, |
K, Mythri P | 17c84ef | 2011-03-14 23:57:42 -0500 | [diff] [blame] | 649 | &omap4_panda_hdmi_device, |
| 650 | }; |
| 651 | |
| 652 | static struct omap_dss_board_info omap4_panda_dss_data = { |
| 653 | .num_devices = ARRAY_SIZE(omap4_panda_dss_devices), |
| 654 | .devices = omap4_panda_dss_devices, |
Murthy, Raghuveer | b295d6e | 2011-03-14 07:52:25 -0500 | [diff] [blame^] | 655 | .default_device = &omap4_panda_dvi_device, |
K, Mythri P | 17c84ef | 2011-03-14 23:57:42 -0500 | [diff] [blame] | 656 | }; |
| 657 | |
| 658 | void omap4_panda_display_init(void) |
| 659 | { |
Murthy, Raghuveer | b295d6e | 2011-03-14 07:52:25 -0500 | [diff] [blame^] | 660 | int r; |
| 661 | |
| 662 | r = omap4_panda_dvi_init(); |
| 663 | if (r) |
| 664 | pr_err("error initializing panda DVI\n"); |
| 665 | |
K, Mythri P | 17c84ef | 2011-03-14 23:57:42 -0500 | [diff] [blame] | 666 | omap4_panda_hdmi_mux_init(); |
| 667 | omap_display_init(&omap4_panda_dss_data); |
| 668 | } |
| 669 | |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 670 | static void __init omap4_panda_init(void) |
| 671 | { |
sricharan | fc63de82 | 2010-11-08 19:26:11 +0530 | [diff] [blame] | 672 | int package = OMAP_PACKAGE_CBS; |
| 673 | |
| 674 | if (omap_rev() == OMAP4430_REV_ES1_0) |
| 675 | package = OMAP_PACKAGE_CBL; |
| 676 | omap4_mux_init(board_mux, package); |
| 677 | |
Panduranga Mallireddy | b17e0979 | 2011-02-15 03:40:35 -0500 | [diff] [blame] | 678 | if (wl12xx_set_platform_data(&omap_panda_wlan_data)) |
| 679 | pr_err("error setting wl12xx data\n"); |
| 680 | |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 681 | omap4_panda_i2c_init(); |
Ricardo Salveti de Araujo | 3da434a | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 682 | platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); |
Panduranga Mallireddy | edc8406 | 2011-02-15 03:40:34 -0500 | [diff] [blame] | 683 | platform_device_register(&omap_vwlan_device); |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 684 | omap_serial_init(); |
| 685 | omap4_twl6030_hsmmc_init(mmc); |
David Anders | 4415beb | 2010-10-07 19:36:30 +0000 | [diff] [blame] | 686 | omap4_ehci_init(); |
Felipe Balbi | 1ea7f35 | 2010-12-01 13:48:54 +0200 | [diff] [blame] | 687 | usb_musb_init(&musb_board_data); |
K, Mythri P | 17c84ef | 2011-03-14 23:57:42 -0500 | [diff] [blame] | 688 | omap4_panda_display_init(); |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 689 | } |
| 690 | |
| 691 | static void __init omap4_panda_map_io(void) |
| 692 | { |
| 693 | omap2_set_globals_443x(); |
| 694 | omap44xx_map_common_io(); |
| 695 | } |
| 696 | |
| 697 | MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board") |
| 698 | /* Maintainer: David Anders - Texas Instruments Inc */ |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 699 | .boot_params = 0x80000100, |
Raghuveer Murthy | d920e52 | 2010-12-17 18:15:07 -0800 | [diff] [blame] | 700 | .reserve = omap_reserve, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 701 | .map_io = omap4_panda_map_io, |
Russell King - ARM Linux | 3dc3bad | 2011-02-14 15:40:20 -0800 | [diff] [blame] | 702 | .init_early = omap4_panda_init_early, |
| 703 | .init_irq = gic_init_irq, |
David Anders | b075f58 | 2010-08-02 13:18:05 +0300 | [diff] [blame] | 704 | .init_machine = omap4_panda_init, |
| 705 | .timer = &omap_timer, |
| 706 | MACHINE_END |