blob: e2b912f376cce379ac293abdbcdb6cf163e8323e [file] [log] [blame]
David Andersb075f582010-08-02 13:18:05 +03001/*
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 Gadiyar1740d482011-01-10 14:42:15 +000022#include <linux/clk.h>
David Andersb075f582010-08-02 13:18:05 +030023#include <linux/io.h>
Ricardo Salveti de Araujo3da434a2010-09-23 18:22:49 -070024#include <linux/leds.h>
David Andersb075f582010-08-02 13:18:05 +030025#include <linux/gpio.h>
26#include <linux/usb/otg.h>
27#include <linux/i2c/twl.h>
28#include <linux/regulator/machine.h>
Panduranga Mallireddyedc84062011-02-15 03:40:34 -050029#include <linux/regulator/fixed.h>
Panduranga Mallireddyb17e09792011-02-15 03:40:35 -050030#include <linux/wl12xx.h>
David Andersb075f582010-08-02 13:18:05 +030031
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 P17c84ef2011-03-14 23:57:42 -050037#include <plat/display.h>
David Andersb075f582010-08-02 13:18:05 +030038
39#include <plat/board.h>
40#include <plat/common.h>
David Andersb075f582010-08-02 13:18:05 +030041#include <plat/usb.h>
42#include <plat/mmc.h>
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -050043#include <plat/panel-generic-dpi.h>
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070044#include "timer-gp.h"
David Andersb075f582010-08-02 13:18:05 +030045
Paul Walmsley4814ced2010-10-08 11:40:20 -060046#include "hsmmc.h"
47#include "control.h"
sricharanfc63de822010-11-08 19:26:11 +053048#include "mux.h"
David Andersb075f582010-08-02 13:18:05 +030049
David Anders4415beb2010-10-07 19:36:30 +000050#define GPIO_HUB_POWER 1
51#define GPIO_HUB_NRESET 62
Panduranga Mallireddyedc84062011-02-15 03:40:34 -050052#define GPIO_WIFI_PMENA 43
Panduranga Mallireddyb17e09792011-02-15 03:40:35 -050053#define GPIO_WIFI_IRQ 53
K, Mythri P17c84ef2011-03-14 23:57:42 -050054#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
55#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
David Anders4415beb2010-10-07 19:36:30 +000056
Guy Eilamec179ea2011-02-25 06:52:35 +000057/* wl127x BT, FM, GPS connectivity chip */
58static int wl1271_gpios[] = {46, -1, -1};
59static struct platform_device wl1271_device = {
60 .name = "kim",
61 .id = -1,
62 .dev = {
63 .platform_data = &wl1271_gpios,
64 },
65};
66
Ricardo Salveti de Araujo3da434a2010-09-23 18:22:49 -070067static 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
80static struct gpio_led_platform_data gpio_led_info = {
81 .leds = gpio_leds,
82 .num_leds = ARRAY_SIZE(gpio_leds),
83};
84
85static struct platform_device leds_gpio = {
86 .name = "leds-gpio",
87 .id = -1,
88 .dev = {
89 .platform_data = &gpio_led_info,
90 },
91};
92
93static struct platform_device *panda_devices[] __initdata = {
94 &leds_gpio,
Guy Eilamec179ea2011-02-25 06:52:35 +000095 &wl1271_device,
Ricardo Salveti de Araujo3da434a2010-09-23 18:22:49 -070096};
David Andersb075f582010-08-02 13:18:05 +030097
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -080098static void __init omap4_panda_init_early(void)
David Andersb075f582010-08-02 13:18:05 +030099{
Paul Walmsley48057342010-12-21 15:25:10 -0700100 omap2_init_common_infrastructure();
101 omap2_init_common_devices(NULL, NULL);
David Andersb075f582010-08-02 13:18:05 +0300102}
103
David Anders4415beb2010-10-07 19:36:30 +0000104static 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
114static void __init omap4_ehci_init(void)
115{
116 int ret;
Anand Gadiyar1740d482011-01-10 14:42:15 +0000117 struct clk *phy_ref_clk;
David Anders4415beb2010-10-07 19:36:30 +0000118
Anand Gadiyar1740d482011-01-10 14:42:15 +0000119 /* 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 Anders4415beb2010-10-07 19:36:30 +0000127
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
155error2:
156 gpio_free(GPIO_HUB_POWER);
157error1:
158 pr_err("Unable to initialize EHCI power/reset\n");
159 return;
160
161}
162
David Andersb075f582010-08-02 13:18:05 +0300163static struct omap_musb_board_data musb_board_data = {
164 .interface_type = MUSB_INTERFACE_UTMI,
Hema HK09e72002010-12-10 18:11:42 +0530165 .mode = MUSB_OTG,
David Andersb075f582010-08-02 13:18:05 +0300166 .power = 100,
167};
168
Hema HKe70357e2010-12-10 18:09:52 +0530169static 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 Andersb075f582010-08-02 13:18:05 +0300176static struct omap2_hsmmc_info mmc[] = {
177 {
178 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000179 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
David Andersb075f582010-08-02 13:18:05 +0300180 .gpio_wp = -EINVAL,
Raghuveer Murthy5b59cc22010-12-21 14:14:34 +0000181 .gpio_cd = -EINVAL,
David Andersb075f582010-08-02 13:18:05 +0300182 },
Panduranga Mallireddyb17e09792011-02-15 03:40:35 -0500183 {
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 Andersb075f582010-08-02 13:18:05 +0300192 {} /* Terminator */
193};
194
195static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
196 {
197 .supply = "vmmc",
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530198 .dev_name = "omap_hsmmc.0",
David Andersb075f582010-08-02 13:18:05 +0300199 },
David Andersb075f582010-08-02 13:18:05 +0300200};
201
Panduranga Mallireddyedc84062011-02-15 03:40:34 -0500202static struct regulator_consumer_supply omap4_panda_vmmc5_supply = {
203 .supply = "vmmc",
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530204 .dev_name = "omap_hsmmc.4",
Panduranga Mallireddyedc84062011-02-15 03:40:34 -0500205};
206
207static 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
215static 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
225static 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 Mallireddyb17e09792011-02-15 03:40:35 -0500233struct 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 Andersb075f582010-08-02 13:18:05 +0300239static 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, Nishanthbf56f0a2010-10-19 09:50:25 -0500246 if (!pdata) {
247 dev_err(dev, "%s: NULL platform data\n", __func__);
248 return -EINVAL;
249 }
David Andersb075f582010-08-02 13:18:05 +0300250 /* Setting MMC1 Card detect Irq */
Menon, Nishanthbf56f0a2010-10-19 09:50:25 -0500251 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 Andersb075f582010-08-02 13:18:05 +0300259 return ret;
260}
261
262static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
263{
David Andersb9b52622010-10-07 19:36:29 +0000264 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 Andersb075f582010-08-02 13:18:05 +0300272
273 pdata->init = omap4_twl6030_hsmmc_late_init;
274}
275
276static 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
287static 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
300static 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
313static 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 */
327static 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 Anders191183b2010-10-07 19:36:28 +0000338 .num_consumer_supplies = 1,
David Andersb075f582010-08-02 13:18:05 +0300339 .consumer_supplies = omap4_panda_vmmc_supply,
340};
341
342static 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
355static 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
368static struct regulator_init_data omap4_panda_vana = {
369 .constraints = {
370 .min_uV = 2100000,
371 .max_uV = 2100000,
David Andersb075f582010-08-02 13:18:05 +0300372 .valid_modes_mask = REGULATOR_MODE_NORMAL
373 | REGULATOR_MODE_STANDBY,
374 .valid_ops_mask = REGULATOR_CHANGE_MODE
375 | REGULATOR_CHANGE_STATUS,
376 },
377};
378
379static struct regulator_init_data omap4_panda_vcxio = {
380 .constraints = {
381 .min_uV = 1800000,
382 .max_uV = 1800000,
David Andersb075f582010-08-02 13:18:05 +0300383 .valid_modes_mask = REGULATOR_MODE_NORMAL
384 | REGULATOR_MODE_STANDBY,
385 .valid_ops_mask = REGULATOR_CHANGE_MODE
386 | REGULATOR_CHANGE_STATUS,
387 },
388};
389
390static struct regulator_init_data omap4_panda_vdac = {
391 .constraints = {
392 .min_uV = 1800000,
393 .max_uV = 1800000,
David Andersb075f582010-08-02 13:18:05 +0300394 .valid_modes_mask = REGULATOR_MODE_NORMAL
395 | REGULATOR_MODE_STANDBY,
396 .valid_ops_mask = REGULATOR_CHANGE_MODE
397 | REGULATOR_CHANGE_STATUS,
398 },
399};
400
401static 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
413static 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 HKe70357e2010-12-10 18:09:52 +0530428 .usb = &omap4_usbphy_data,
David Andersb075f582010-08-02 13:18:05 +0300429};
430
431static 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, Raghuveerb295d6e2011-03-14 07:52:25 -0500439
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 */
444static struct i2c_board_info __initdata panda_i2c_eeprom[] = {
445 {
446 I2C_BOARD_INFO("eeprom", 0x50),
447 },
448};
449
David Andersb075f582010-08-02 13:18:05 +0300450static 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, Raghuveerb295d6e2011-03-14 07:52:25 -0500459 /*
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 Andersb075f582010-08-02 13:18:05 +0300465 omap_register_i2c_bus(4, 400, NULL, 0);
466 return 0;
467}
sricharanfc63de822010-11-08 19:26:11 +0530468
469#ifdef CONFIG_OMAP_MUX
470static struct omap_board_mux board_mux[] __initdata = {
Panduranga Mallireddy66e171a2011-02-15 03:40:32 -0500471 /* 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, Raghuveerb295d6e2011-03-14 07:52:25 -0500484 /* 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),
sricharanfc63de822010-11-08 19:26:11 +0530542 { .reg_offset = OMAP_MUX_TERMINATOR },
543};
544#else
545#define board_mux NULL
546#endif
547
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -0500548/* Display DVI */
549#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
550
551static int omap4_panda_enable_dvi(struct omap_dss_device *dssdev)
552{
553 gpio_set_value(dssdev->reset_gpio, 1);
554 return 0;
555}
556
557static 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 */
563static 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
569struct 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
579int __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 P17c84ef2011-03-14 23:57:42 -0500593static 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
607static 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
626error1:
627 gpio_free(HDMI_GPIO_HPD);
628
629 return status;
630}
631
632static 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
638static 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
647static struct omap_dss_device *omap4_panda_dss_devices[] = {
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -0500648 &omap4_panda_dvi_device,
K, Mythri P17c84ef2011-03-14 23:57:42 -0500649 &omap4_panda_hdmi_device,
650};
651
652static 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, Raghuveerb295d6e2011-03-14 07:52:25 -0500655 .default_device = &omap4_panda_dvi_device,
K, Mythri P17c84ef2011-03-14 23:57:42 -0500656};
657
658void omap4_panda_display_init(void)
659{
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -0500660 int r;
661
662 r = omap4_panda_dvi_init();
663 if (r)
664 pr_err("error initializing panda DVI\n");
665
K, Mythri P17c84ef2011-03-14 23:57:42 -0500666 omap4_panda_hdmi_mux_init();
667 omap_display_init(&omap4_panda_dss_data);
668}
669
David Andersb075f582010-08-02 13:18:05 +0300670static void __init omap4_panda_init(void)
671{
sricharanfc63de822010-11-08 19:26:11 +0530672 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 Mallireddyb17e09792011-02-15 03:40:35 -0500678 if (wl12xx_set_platform_data(&omap_panda_wlan_data))
679 pr_err("error setting wl12xx data\n");
680
David Andersb075f582010-08-02 13:18:05 +0300681 omap4_panda_i2c_init();
Ricardo Salveti de Araujo3da434a2010-09-23 18:22:49 -0700682 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
Panduranga Mallireddyedc84062011-02-15 03:40:34 -0500683 platform_device_register(&omap_vwlan_device);
David Andersb075f582010-08-02 13:18:05 +0300684 omap_serial_init();
685 omap4_twl6030_hsmmc_init(mmc);
David Anders4415beb2010-10-07 19:36:30 +0000686 omap4_ehci_init();
Felipe Balbi1ea7f352010-12-01 13:48:54 +0200687 usb_musb_init(&musb_board_data);
K, Mythri P17c84ef2011-03-14 23:57:42 -0500688 omap4_panda_display_init();
David Andersb075f582010-08-02 13:18:05 +0300689}
690
691static void __init omap4_panda_map_io(void)
692{
693 omap2_set_globals_443x();
694 omap44xx_map_common_io();
695}
696
697MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
698 /* Maintainer: David Anders - Texas Instruments Inc */
David Andersb075f582010-08-02 13:18:05 +0300699 .boot_params = 0x80000100,
Raghuveer Murthyd920e522010-12-17 18:15:07 -0800700 .reserve = omap_reserve,
David Andersb075f582010-08-02 13:18:05 +0300701 .map_io = omap4_panda_map_io,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800702 .init_early = omap4_panda_init_early,
703 .init_irq = gic_init_irq,
David Andersb075f582010-08-02 13:18:05 +0300704 .init_machine = omap4_panda_init,
705 .timer = &omap_timer,
706MACHINE_END