cleanup regulator supply definitions in mach-omap2
[linux-2.6/btrfs-unstable.git] / arch / arm / mach-omap2 / board-omap4panda.c
blob6d2372b98e465440cf3f5371f2f7026f14b27f15
1 /*
2 * Board support file for OMAP4430 based PandaBoard.
4 * Copyright (C) 2010 Texas Instruments
6 * Author: David Anders <x0132446@ti.com>
8 * Based on mach-omap2/board-4430sdp.c
10 * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
12 * Based on mach-omap2/board-3430sdp.c
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.
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/platform_device.h>
22 #include <linux/clk.h>
23 #include <linux/io.h>
24 #include <linux/leds.h>
25 #include <linux/gpio.h>
26 #include <linux/usb/otg.h>
27 #include <linux/i2c/twl.h>
28 #include <linux/regulator/machine.h>
29 #include <linux/regulator/fixed.h>
30 #include <linux/wl12xx.h>
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>
37 #include <video/omapdss.h>
39 #include <plat/board.h>
40 #include <plat/common.h>
41 #include <plat/usb.h>
42 #include <plat/mmc.h>
43 #include <video/omap-panel-generic-dpi.h>
44 #include "timer-gp.h"
46 #include "hsmmc.h"
47 #include "control.h"
48 #include "mux.h"
49 #include "common-board-devices.h"
51 #define GPIO_HUB_POWER 1
52 #define GPIO_HUB_NRESET 62
53 #define GPIO_WIFI_PMENA 43
54 #define GPIO_WIFI_IRQ 53
55 #define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
56 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
58 /* wl127x BT, FM, GPS connectivity chip */
59 static int wl1271_gpios[] = {46, -1, -1};
60 static struct platform_device wl1271_device = {
61 .name = "kim",
62 .id = -1,
63 .dev = {
64 .platform_data = &wl1271_gpios,
68 static struct gpio_led gpio_leds[] = {
70 .name = "pandaboard::status1",
71 .default_trigger = "heartbeat",
72 .gpio = 7,
75 .name = "pandaboard::status2",
76 .default_trigger = "mmc0",
77 .gpio = 8,
81 static struct gpio_led_platform_data gpio_led_info = {
82 .leds = gpio_leds,
83 .num_leds = ARRAY_SIZE(gpio_leds),
86 static struct platform_device leds_gpio = {
87 .name = "leds-gpio",
88 .id = -1,
89 .dev = {
90 .platform_data = &gpio_led_info,
94 static struct platform_device *panda_devices[] __initdata = {
95 &leds_gpio,
96 &wl1271_device,
99 static void __init omap4_panda_init_early(void)
101 omap2_init_common_infrastructure();
102 omap2_init_common_devices(NULL, NULL);
105 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
106 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
107 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
108 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
109 .phy_reset = false,
110 .reset_gpio_port[0] = -EINVAL,
111 .reset_gpio_port[1] = -EINVAL,
112 .reset_gpio_port[2] = -EINVAL
115 static struct gpio panda_ehci_gpios[] __initdata = {
116 { GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" },
117 { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" },
120 static void __init omap4_ehci_init(void)
122 int ret;
123 struct clk *phy_ref_clk;
125 /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
126 phy_ref_clk = clk_get(NULL, "auxclk3_ck");
127 if (IS_ERR(phy_ref_clk)) {
128 pr_err("Cannot request auxclk3\n");
129 return;
131 clk_set_rate(phy_ref_clk, 19200000);
132 clk_enable(phy_ref_clk);
134 /* disable the power to the usb hub prior to init and reset phy+hub */
135 ret = gpio_request_array(panda_ehci_gpios,
136 ARRAY_SIZE(panda_ehci_gpios));
137 if (ret) {
138 pr_err("Unable to initialize EHCI power/reset\n");
139 return;
142 gpio_export(GPIO_HUB_POWER, 0);
143 gpio_export(GPIO_HUB_NRESET, 0);
144 gpio_set_value(GPIO_HUB_NRESET, 1);
146 usbhs_init(&usbhs_bdata);
148 /* enable power to hub */
149 gpio_set_value(GPIO_HUB_POWER, 1);
152 static struct omap_musb_board_data musb_board_data = {
153 .interface_type = MUSB_INTERFACE_UTMI,
154 .mode = MUSB_OTG,
155 .power = 100,
158 static struct twl4030_usb_data omap4_usbphy_data = {
159 .phy_init = omap4430_phy_init,
160 .phy_exit = omap4430_phy_exit,
161 .phy_power = omap4430_phy_power,
162 .phy_set_clock = omap4430_phy_set_clk,
163 .phy_suspend = omap4430_phy_suspend,
166 static struct omap2_hsmmc_info mmc[] = {
168 .mmc = 1,
169 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
170 .gpio_wp = -EINVAL,
171 .gpio_cd = -EINVAL,
174 .name = "wl1271",
175 .mmc = 5,
176 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
177 .gpio_wp = -EINVAL,
178 .gpio_cd = -EINVAL,
179 .ocr_mask = MMC_VDD_165_195,
180 .nonremovable = true,
182 {} /* Terminator */
185 static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
186 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
189 static struct regulator_consumer_supply omap4_panda_vmmc5_supply[] = {
190 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.4"),
193 static struct regulator_init_data panda_vmmc5 = {
194 .constraints = {
195 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
197 .num_consumer_supplies = ARRAY_SIZE(omap4_panda_vmmc5_supply),
198 .consumer_supplies = omap4_panda_vmmc5_supply,
201 static struct fixed_voltage_config panda_vwlan = {
202 .supply_name = "vwl1271",
203 .microvolts = 1800000, /* 1.8V */
204 .gpio = GPIO_WIFI_PMENA,
205 .startup_delay = 70000, /* 70msec */
206 .enable_high = 1,
207 .enabled_at_boot = 0,
208 .init_data = &panda_vmmc5,
211 static struct platform_device omap_vwlan_device = {
212 .name = "reg-fixed-voltage",
213 .id = 1,
214 .dev = {
215 .platform_data = &panda_vwlan,
219 struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
220 .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
221 /* PANDA ref clock is 38.4 MHz */
222 .board_ref_clock = 2,
225 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
227 int ret = 0;
228 struct platform_device *pdev = container_of(dev,
229 struct platform_device, dev);
230 struct omap_mmc_platform_data *pdata = dev->platform_data;
232 if (!pdata) {
233 dev_err(dev, "%s: NULL platform data\n", __func__);
234 return -EINVAL;
236 /* Setting MMC1 Card detect Irq */
237 if (pdev->id == 0) {
238 ret = twl6030_mmc_card_detect_config();
239 if (ret)
240 dev_err(dev, "%s: Error card detect config(%d)\n",
241 __func__, ret);
242 else
243 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
245 return ret;
248 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
250 struct omap_mmc_platform_data *pdata;
252 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
253 if (!dev) {
254 pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n");
255 return;
257 pdata = dev->platform_data;
259 pdata->init = omap4_twl6030_hsmmc_late_init;
262 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
264 struct omap2_hsmmc_info *c;
266 omap2_hsmmc_init(controllers);
267 for (c = controllers; c->mmc; c++)
268 omap4_twl6030_hsmmc_set_late_init(c->dev);
270 return 0;
273 static struct regulator_init_data omap4_panda_vaux2 = {
274 .constraints = {
275 .min_uV = 1200000,
276 .max_uV = 2800000,
277 .apply_uV = true,
278 .valid_modes_mask = REGULATOR_MODE_NORMAL
279 | REGULATOR_MODE_STANDBY,
280 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
281 | REGULATOR_CHANGE_MODE
282 | REGULATOR_CHANGE_STATUS,
286 static struct regulator_init_data omap4_panda_vaux3 = {
287 .constraints = {
288 .min_uV = 1000000,
289 .max_uV = 3000000,
290 .apply_uV = true,
291 .valid_modes_mask = REGULATOR_MODE_NORMAL
292 | REGULATOR_MODE_STANDBY,
293 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
294 | REGULATOR_CHANGE_MODE
295 | REGULATOR_CHANGE_STATUS,
299 /* VMMC1 for MMC1 card */
300 static struct regulator_init_data omap4_panda_vmmc = {
301 .constraints = {
302 .min_uV = 1200000,
303 .max_uV = 3000000,
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,
311 .num_consumer_supplies = ARRAY_SIZE(omap4_panda_vmmc_supply),
312 .consumer_supplies = omap4_panda_vmmc_supply,
315 static struct regulator_init_data omap4_panda_vpp = {
316 .constraints = {
317 .min_uV = 1800000,
318 .max_uV = 2500000,
319 .apply_uV = true,
320 .valid_modes_mask = REGULATOR_MODE_NORMAL
321 | REGULATOR_MODE_STANDBY,
322 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
323 | REGULATOR_CHANGE_MODE
324 | REGULATOR_CHANGE_STATUS,
328 static struct regulator_init_data omap4_panda_vana = {
329 .constraints = {
330 .min_uV = 2100000,
331 .max_uV = 2100000,
332 .valid_modes_mask = REGULATOR_MODE_NORMAL
333 | REGULATOR_MODE_STANDBY,
334 .valid_ops_mask = REGULATOR_CHANGE_MODE
335 | REGULATOR_CHANGE_STATUS,
339 static struct regulator_init_data omap4_panda_vcxio = {
340 .constraints = {
341 .min_uV = 1800000,
342 .max_uV = 1800000,
343 .valid_modes_mask = REGULATOR_MODE_NORMAL
344 | REGULATOR_MODE_STANDBY,
345 .valid_ops_mask = REGULATOR_CHANGE_MODE
346 | REGULATOR_CHANGE_STATUS,
350 static struct regulator_init_data omap4_panda_vdac = {
351 .constraints = {
352 .min_uV = 1800000,
353 .max_uV = 1800000,
354 .valid_modes_mask = REGULATOR_MODE_NORMAL
355 | REGULATOR_MODE_STANDBY,
356 .valid_ops_mask = REGULATOR_CHANGE_MODE
357 | REGULATOR_CHANGE_STATUS,
361 static struct regulator_init_data omap4_panda_vusb = {
362 .constraints = {
363 .min_uV = 3300000,
364 .max_uV = 3300000,
365 .apply_uV = true,
366 .valid_modes_mask = REGULATOR_MODE_NORMAL
367 | REGULATOR_MODE_STANDBY,
368 .valid_ops_mask = REGULATOR_CHANGE_MODE
369 | REGULATOR_CHANGE_STATUS,
373 static struct regulator_init_data omap4_panda_clk32kg = {
374 .constraints = {
375 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
379 static struct twl4030_platform_data omap4_panda_twldata = {
380 .irq_base = TWL6030_IRQ_BASE,
381 .irq_end = TWL6030_IRQ_END,
383 /* Regulators */
384 .vmmc = &omap4_panda_vmmc,
385 .vpp = &omap4_panda_vpp,
386 .vana = &omap4_panda_vana,
387 .vcxio = &omap4_panda_vcxio,
388 .vdac = &omap4_panda_vdac,
389 .vusb = &omap4_panda_vusb,
390 .vaux2 = &omap4_panda_vaux2,
391 .vaux3 = &omap4_panda_vaux3,
392 .clk32kg = &omap4_panda_clk32kg,
393 .usb = &omap4_usbphy_data,
397 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
398 * is connected as I2C slave device, and can be accessed at address 0x50
400 static struct i2c_board_info __initdata panda_i2c_eeprom[] = {
402 I2C_BOARD_INFO("eeprom", 0x50),
406 static int __init omap4_panda_i2c_init(void)
408 omap4_pmic_init("twl6030", &omap4_panda_twldata);
409 omap_register_i2c_bus(2, 400, NULL, 0);
411 * Bus 3 is attached to the DVI port where devices like the pico DLP
412 * projector don't work reliably with 400kHz
414 omap_register_i2c_bus(3, 100, panda_i2c_eeprom,
415 ARRAY_SIZE(panda_i2c_eeprom));
416 omap_register_i2c_bus(4, 400, NULL, 0);
417 return 0;
420 #ifdef CONFIG_OMAP_MUX
421 static struct omap_board_mux board_mux[] __initdata = {
422 /* WLAN IRQ - GPIO 53 */
423 OMAP4_MUX(GPMC_NCS3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
424 /* WLAN POWER ENABLE - GPIO 43 */
425 OMAP4_MUX(GPMC_A19, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
426 /* WLAN SDIO: MMC5 CMD */
427 OMAP4_MUX(SDMMC5_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
428 /* WLAN SDIO: MMC5 CLK */
429 OMAP4_MUX(SDMMC5_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
430 /* WLAN SDIO: MMC5 DAT[0-3] */
431 OMAP4_MUX(SDMMC5_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
432 OMAP4_MUX(SDMMC5_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
433 OMAP4_MUX(SDMMC5_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
434 OMAP4_MUX(SDMMC5_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
435 /* gpio 0 - TFP410 PD */
436 OMAP4_MUX(KPD_COL1, OMAP_PIN_OUTPUT | OMAP_MUX_MODE3),
437 /* dispc2_data23 */
438 OMAP4_MUX(USBB2_ULPITLL_STP, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
439 /* dispc2_data22 */
440 OMAP4_MUX(USBB2_ULPITLL_DIR, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
441 /* dispc2_data21 */
442 OMAP4_MUX(USBB2_ULPITLL_NXT, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
443 /* dispc2_data20 */
444 OMAP4_MUX(USBB2_ULPITLL_DAT0, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
445 /* dispc2_data19 */
446 OMAP4_MUX(USBB2_ULPITLL_DAT1, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
447 /* dispc2_data18 */
448 OMAP4_MUX(USBB2_ULPITLL_DAT2, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
449 /* dispc2_data15 */
450 OMAP4_MUX(USBB2_ULPITLL_DAT3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
451 /* dispc2_data14 */
452 OMAP4_MUX(USBB2_ULPITLL_DAT4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
453 /* dispc2_data13 */
454 OMAP4_MUX(USBB2_ULPITLL_DAT5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
455 /* dispc2_data12 */
456 OMAP4_MUX(USBB2_ULPITLL_DAT6, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
457 /* dispc2_data11 */
458 OMAP4_MUX(USBB2_ULPITLL_DAT7, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
459 /* dispc2_data10 */
460 OMAP4_MUX(DPM_EMU3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
461 /* dispc2_data9 */
462 OMAP4_MUX(DPM_EMU4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
463 /* dispc2_data16 */
464 OMAP4_MUX(DPM_EMU5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
465 /* dispc2_data17 */
466 OMAP4_MUX(DPM_EMU6, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
467 /* dispc2_hsync */
468 OMAP4_MUX(DPM_EMU7, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
469 /* dispc2_pclk */
470 OMAP4_MUX(DPM_EMU8, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
471 /* dispc2_vsync */
472 OMAP4_MUX(DPM_EMU9, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
473 /* dispc2_de */
474 OMAP4_MUX(DPM_EMU10, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
475 /* dispc2_data8 */
476 OMAP4_MUX(DPM_EMU11, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
477 /* dispc2_data7 */
478 OMAP4_MUX(DPM_EMU12, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
479 /* dispc2_data6 */
480 OMAP4_MUX(DPM_EMU13, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
481 /* dispc2_data5 */
482 OMAP4_MUX(DPM_EMU14, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
483 /* dispc2_data4 */
484 OMAP4_MUX(DPM_EMU15, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
485 /* dispc2_data3 */
486 OMAP4_MUX(DPM_EMU16, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
487 /* dispc2_data2 */
488 OMAP4_MUX(DPM_EMU17, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
489 /* dispc2_data1 */
490 OMAP4_MUX(DPM_EMU18, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
491 /* dispc2_data0 */
492 OMAP4_MUX(DPM_EMU19, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
493 { .reg_offset = OMAP_MUX_TERMINATOR },
496 static struct omap_device_pad serial2_pads[] __initdata = {
497 OMAP_MUX_STATIC("uart2_cts.uart2_cts",
498 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
499 OMAP_MUX_STATIC("uart2_rts.uart2_rts",
500 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
501 OMAP_MUX_STATIC("uart2_rx.uart2_rx",
502 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
503 OMAP_MUX_STATIC("uart2_tx.uart2_tx",
504 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
507 static struct omap_device_pad serial3_pads[] __initdata = {
508 OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
509 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
510 OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
511 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
512 OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
513 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
514 OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
515 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
518 static struct omap_device_pad serial4_pads[] __initdata = {
519 OMAP_MUX_STATIC("uart4_rx.uart4_rx",
520 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
521 OMAP_MUX_STATIC("uart4_tx.uart4_tx",
522 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
525 static struct omap_board_data serial2_data __initdata = {
526 .id = 1,
527 .pads = serial2_pads,
528 .pads_cnt = ARRAY_SIZE(serial2_pads),
531 static struct omap_board_data serial3_data __initdata = {
532 .id = 2,
533 .pads = serial3_pads,
534 .pads_cnt = ARRAY_SIZE(serial3_pads),
537 static struct omap_board_data serial4_data __initdata = {
538 .id = 3,
539 .pads = serial4_pads,
540 .pads_cnt = ARRAY_SIZE(serial4_pads),
543 static inline void board_serial_init(void)
545 struct omap_board_data bdata;
546 bdata.flags = 0;
547 bdata.pads = NULL;
548 bdata.pads_cnt = 0;
549 bdata.id = 0;
550 /* pass dummy data for UART1 */
551 omap_serial_init_port(&bdata);
553 omap_serial_init_port(&serial2_data);
554 omap_serial_init_port(&serial3_data);
555 omap_serial_init_port(&serial4_data);
557 #else
558 #define board_mux NULL
560 static inline void board_serial_init(void)
562 omap_serial_init();
564 #endif
566 /* Display DVI */
567 #define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
569 static int omap4_panda_enable_dvi(struct omap_dss_device *dssdev)
571 gpio_set_value(dssdev->reset_gpio, 1);
572 return 0;
575 static void omap4_panda_disable_dvi(struct omap_dss_device *dssdev)
577 gpio_set_value(dssdev->reset_gpio, 0);
580 /* Using generic display panel */
581 static struct panel_generic_dpi_data omap4_dvi_panel = {
582 .name = "generic",
583 .platform_enable = omap4_panda_enable_dvi,
584 .platform_disable = omap4_panda_disable_dvi,
587 struct omap_dss_device omap4_panda_dvi_device = {
588 .type = OMAP_DISPLAY_TYPE_DPI,
589 .name = "dvi",
590 .driver_name = "generic_dpi_panel",
591 .data = &omap4_dvi_panel,
592 .phy.dpi.data_lines = 24,
593 .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
594 .channel = OMAP_DSS_CHANNEL_LCD2,
597 int __init omap4_panda_dvi_init(void)
599 int r;
601 /* Requesting TFP410 DVI GPIO and disabling it, at bootup */
602 r = gpio_request_one(omap4_panda_dvi_device.reset_gpio,
603 GPIOF_OUT_INIT_LOW, "DVI PD");
604 if (r)
605 pr_err("Failed to get DVI powerdown GPIO\n");
607 return r;
611 static void omap4_panda_hdmi_mux_init(void)
613 /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
614 omap_mux_init_signal("hdmi_hpd",
615 OMAP_PIN_INPUT_PULLUP);
616 omap_mux_init_signal("hdmi_cec",
617 OMAP_PIN_INPUT_PULLUP);
618 /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
619 omap_mux_init_signal("hdmi_ddc_scl",
620 OMAP_PIN_INPUT_PULLUP);
621 omap_mux_init_signal("hdmi_ddc_sda",
622 OMAP_PIN_INPUT_PULLUP);
625 static struct gpio panda_hdmi_gpios[] = {
626 { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" },
627 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
630 static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
632 int status;
634 status = gpio_request_array(panda_hdmi_gpios,
635 ARRAY_SIZE(panda_hdmi_gpios));
636 if (status)
637 pr_err("Cannot request HDMI GPIOs\n");
639 return status;
642 static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev)
644 gpio_free(HDMI_GPIO_LS_OE);
645 gpio_free(HDMI_GPIO_HPD);
648 static struct omap_dss_device omap4_panda_hdmi_device = {
649 .name = "hdmi",
650 .driver_name = "hdmi_panel",
651 .type = OMAP_DISPLAY_TYPE_HDMI,
652 .platform_enable = omap4_panda_panel_enable_hdmi,
653 .platform_disable = omap4_panda_panel_disable_hdmi,
654 .channel = OMAP_DSS_CHANNEL_DIGIT,
657 static struct omap_dss_device *omap4_panda_dss_devices[] = {
658 &omap4_panda_dvi_device,
659 &omap4_panda_hdmi_device,
662 static struct omap_dss_board_info omap4_panda_dss_data = {
663 .num_devices = ARRAY_SIZE(omap4_panda_dss_devices),
664 .devices = omap4_panda_dss_devices,
665 .default_device = &omap4_panda_dvi_device,
668 void omap4_panda_display_init(void)
670 int r;
672 r = omap4_panda_dvi_init();
673 if (r)
674 pr_err("error initializing panda DVI\n");
676 omap4_panda_hdmi_mux_init();
677 omap_display_init(&omap4_panda_dss_data);
680 static void __init omap4_panda_init(void)
682 int package = OMAP_PACKAGE_CBS;
684 if (omap_rev() == OMAP4430_REV_ES1_0)
685 package = OMAP_PACKAGE_CBL;
686 omap4_mux_init(board_mux, NULL, package);
688 if (wl12xx_set_platform_data(&omap_panda_wlan_data))
689 pr_err("error setting wl12xx data\n");
691 omap4_panda_i2c_init();
692 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
693 platform_device_register(&omap_vwlan_device);
694 board_serial_init();
695 omap4_twl6030_hsmmc_init(mmc);
696 omap4_ehci_init();
697 usb_musb_init(&musb_board_data);
698 omap4_panda_display_init();
701 static void __init omap4_panda_map_io(void)
703 omap2_set_globals_443x();
704 omap44xx_map_common_io();
707 MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
708 /* Maintainer: David Anders - Texas Instruments Inc */
709 .boot_params = 0x80000100,
710 .reserve = omap_reserve,
711 .map_io = omap4_panda_map_io,
712 .init_early = omap4_panda_init_early,
713 .init_irq = gic_init_irq,
714 .init_machine = omap4_panda_init,
715 .timer = &omap_timer,
716 MACHINE_END