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>
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 <plat/display.h>
39 #include <plat/board.h>
40 #include <plat/common.h>
49 #define GPIO_HUB_POWER 1
50 #define GPIO_HUB_NRESET 62
51 #define GPIO_WIFI_PMENA 43
52 #define GPIO_WIFI_IRQ 53
53 #define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
54 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
56 /* wl127x BT, FM, GPS connectivity chip */
57 static int wl1271_gpios[] = {46, -1, -1};
58 static struct platform_device wl1271_device = {
62 .platform_data = &wl1271_gpios,
66 static struct gpio_led gpio_leds[] = {
68 .name = "pandaboard::status1",
69 .default_trigger = "heartbeat",
73 .name = "pandaboard::status2",
74 .default_trigger = "mmc0",
79 static struct gpio_led_platform_data gpio_led_info = {
81 .num_leds = ARRAY_SIZE(gpio_leds),
84 static struct platform_device leds_gpio = {
88 .platform_data = &gpio_led_info,
92 static struct platform_device *panda_devices[] __initdata = {
97 static void __init omap4_panda_init_early(void)
99 omap2_init_common_infrastructure();
100 omap2_init_common_devices(NULL, NULL);
103 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
104 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
105 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
106 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
108 .reset_gpio_port[0] = -EINVAL,
109 .reset_gpio_port[1] = -EINVAL,
110 .reset_gpio_port[2] = -EINVAL
113 static void __init omap4_ehci_init(void)
116 struct clk *phy_ref_clk;
118 /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
119 phy_ref_clk = clk_get(NULL, "auxclk3_ck");
120 if (IS_ERR(phy_ref_clk)) {
121 pr_err("Cannot request auxclk3\n");
124 clk_set_rate(phy_ref_clk, 19200000);
125 clk_enable(phy_ref_clk);
127 /* disable the power to the usb hub prior to init */
128 ret = gpio_request(GPIO_HUB_POWER, "hub_power");
130 pr_err("Cannot request GPIO %d\n", GPIO_HUB_POWER);
133 gpio_export(GPIO_HUB_POWER, 0);
134 gpio_direction_output(GPIO_HUB_POWER, 0);
135 gpio_set_value(GPIO_HUB_POWER, 0);
138 ret = gpio_request(GPIO_HUB_NRESET, "hub_nreset");
140 pr_err("Cannot request GPIO %d\n", GPIO_HUB_NRESET);
143 gpio_export(GPIO_HUB_NRESET, 0);
144 gpio_direction_output(GPIO_HUB_NRESET, 0);
145 gpio_set_value(GPIO_HUB_NRESET, 0);
146 gpio_set_value(GPIO_HUB_NRESET, 1);
148 usb_ehci_init(&ehci_pdata);
150 /* enable power to hub */
151 gpio_set_value(GPIO_HUB_POWER, 1);
155 gpio_free(GPIO_HUB_POWER);
157 pr_err("Unable to initialize EHCI power/reset\n");
162 static struct omap_musb_board_data musb_board_data = {
163 .interface_type = MUSB_INTERFACE_UTMI,
168 static struct twl4030_usb_data omap4_usbphy_data = {
169 .phy_init = omap4430_phy_init,
170 .phy_exit = omap4430_phy_exit,
171 .phy_power = omap4430_phy_power,
172 .phy_set_clock = omap4430_phy_set_clk,
175 static struct omap2_hsmmc_info mmc[] = {
178 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
185 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
188 .ocr_mask = MMC_VDD_165_195,
189 .nonremovable = true,
194 static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
197 .dev_name = "omap_hsmmc.0",
201 static struct regulator_consumer_supply omap4_panda_vmmc5_supply = {
203 .dev_name = "omap_hsmmc.4",
206 static struct regulator_init_data panda_vmmc5 = {
208 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
210 .num_consumer_supplies = 1,
211 .consumer_supplies = &omap4_panda_vmmc5_supply,
214 static struct fixed_voltage_config panda_vwlan = {
215 .supply_name = "vwl1271",
216 .microvolts = 1800000, /* 1.8V */
217 .gpio = GPIO_WIFI_PMENA,
218 .startup_delay = 70000, /* 70msec */
220 .enabled_at_boot = 0,
221 .init_data = &panda_vmmc5,
224 static struct platform_device omap_vwlan_device = {
225 .name = "reg-fixed-voltage",
228 .platform_data = &panda_vwlan,
232 struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
233 .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
234 /* PANDA ref clock is 38.4 MHz */
235 .board_ref_clock = 2,
238 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
241 struct platform_device *pdev = container_of(dev,
242 struct platform_device, dev);
243 struct omap_mmc_platform_data *pdata = dev->platform_data;
246 dev_err(dev, "%s: NULL platform data\n", __func__);
249 /* Setting MMC1 Card detect Irq */
251 ret = twl6030_mmc_card_detect_config();
253 dev_err(dev, "%s: Error card detect config(%d)\n",
256 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
261 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
263 struct omap_mmc_platform_data *pdata;
265 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
267 pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n");
270 pdata = dev->platform_data;
272 pdata->init = omap4_twl6030_hsmmc_late_init;
275 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
277 struct omap2_hsmmc_info *c;
279 omap2_hsmmc_init(controllers);
280 for (c = controllers; c->mmc; c++)
281 omap4_twl6030_hsmmc_set_late_init(c->dev);
286 static struct regulator_init_data omap4_panda_vaux1 = {
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 static struct regulator_init_data omap4_panda_vaux2 = {
304 .valid_modes_mask = REGULATOR_MODE_NORMAL
305 | REGULATOR_MODE_STANDBY,
306 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
307 | REGULATOR_CHANGE_MODE
308 | REGULATOR_CHANGE_STATUS,
312 static struct regulator_init_data omap4_panda_vaux3 = {
317 .valid_modes_mask = REGULATOR_MODE_NORMAL
318 | REGULATOR_MODE_STANDBY,
319 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
320 | REGULATOR_CHANGE_MODE
321 | REGULATOR_CHANGE_STATUS,
325 /* VMMC1 for MMC1 card */
326 static struct regulator_init_data omap4_panda_vmmc = {
331 .valid_modes_mask = REGULATOR_MODE_NORMAL
332 | REGULATOR_MODE_STANDBY,
333 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
334 | REGULATOR_CHANGE_MODE
335 | REGULATOR_CHANGE_STATUS,
337 .num_consumer_supplies = 1,
338 .consumer_supplies = omap4_panda_vmmc_supply,
341 static struct regulator_init_data omap4_panda_vpp = {
346 .valid_modes_mask = REGULATOR_MODE_NORMAL
347 | REGULATOR_MODE_STANDBY,
348 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
349 | REGULATOR_CHANGE_MODE
350 | REGULATOR_CHANGE_STATUS,
354 static struct regulator_init_data omap4_panda_vusim = {
359 .valid_modes_mask = REGULATOR_MODE_NORMAL
360 | REGULATOR_MODE_STANDBY,
361 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
362 | REGULATOR_CHANGE_MODE
363 | REGULATOR_CHANGE_STATUS,
367 static struct regulator_init_data omap4_panda_vana = {
371 .valid_modes_mask = REGULATOR_MODE_NORMAL
372 | REGULATOR_MODE_STANDBY,
373 .valid_ops_mask = REGULATOR_CHANGE_MODE
374 | REGULATOR_CHANGE_STATUS,
378 static struct regulator_init_data omap4_panda_vcxio = {
382 .valid_modes_mask = REGULATOR_MODE_NORMAL
383 | REGULATOR_MODE_STANDBY,
384 .valid_ops_mask = REGULATOR_CHANGE_MODE
385 | REGULATOR_CHANGE_STATUS,
389 static struct regulator_init_data omap4_panda_vdac = {
393 .valid_modes_mask = REGULATOR_MODE_NORMAL
394 | REGULATOR_MODE_STANDBY,
395 .valid_ops_mask = REGULATOR_CHANGE_MODE
396 | REGULATOR_CHANGE_STATUS,
400 static struct regulator_init_data omap4_panda_vusb = {
405 .valid_modes_mask = REGULATOR_MODE_NORMAL
406 | REGULATOR_MODE_STANDBY,
407 .valid_ops_mask = REGULATOR_CHANGE_MODE
408 | REGULATOR_CHANGE_STATUS,
412 static struct twl4030_platform_data omap4_panda_twldata = {
413 .irq_base = TWL6030_IRQ_BASE,
414 .irq_end = TWL6030_IRQ_END,
417 .vmmc = &omap4_panda_vmmc,
418 .vpp = &omap4_panda_vpp,
419 .vusim = &omap4_panda_vusim,
420 .vana = &omap4_panda_vana,
421 .vcxio = &omap4_panda_vcxio,
422 .vdac = &omap4_panda_vdac,
423 .vusb = &omap4_panda_vusb,
424 .vaux1 = &omap4_panda_vaux1,
425 .vaux2 = &omap4_panda_vaux2,
426 .vaux3 = &omap4_panda_vaux3,
427 .usb = &omap4_usbphy_data,
430 static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
432 I2C_BOARD_INFO("twl6030", 0x48),
433 .flags = I2C_CLIENT_WAKE,
434 .irq = OMAP44XX_IRQ_SYS_1N,
435 .platform_data = &omap4_panda_twldata,
438 static int __init omap4_panda_i2c_init(void)
441 * Phoenix Audio IC needs I2C1 to
442 * start with 400 KHz or less
444 omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
445 ARRAY_SIZE(omap4_panda_i2c_boardinfo));
446 omap_register_i2c_bus(2, 400, NULL, 0);
447 omap_register_i2c_bus(3, 400, NULL, 0);
448 omap_register_i2c_bus(4, 400, NULL, 0);
452 #ifdef CONFIG_OMAP_MUX
453 static struct omap_board_mux board_mux[] __initdata = {
454 /* WLAN IRQ - GPIO 53 */
455 OMAP4_MUX(GPMC_NCS3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
456 /* WLAN POWER ENABLE - GPIO 43 */
457 OMAP4_MUX(GPMC_A19, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
458 /* WLAN SDIO: MMC5 CMD */
459 OMAP4_MUX(SDMMC5_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
460 /* WLAN SDIO: MMC5 CLK */
461 OMAP4_MUX(SDMMC5_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
462 /* WLAN SDIO: MMC5 DAT[0-3] */
463 OMAP4_MUX(SDMMC5_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
464 OMAP4_MUX(SDMMC5_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
465 OMAP4_MUX(SDMMC5_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
466 OMAP4_MUX(SDMMC5_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
467 { .reg_offset = OMAP_MUX_TERMINATOR },
470 #define board_mux NULL
473 static void omap4_panda_hdmi_mux_init(void)
475 /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
476 omap_mux_init_signal("hdmi_hpd",
477 OMAP_PIN_INPUT_PULLUP);
478 omap_mux_init_signal("hdmi_cec",
479 OMAP_PIN_INPUT_PULLUP);
480 /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
481 omap_mux_init_signal("hdmi_ddc_scl",
482 OMAP_PIN_INPUT_PULLUP);
483 omap_mux_init_signal("hdmi_ddc_sda",
484 OMAP_PIN_INPUT_PULLUP);
487 static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
491 status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH,
494 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD);
497 status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH,
500 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE);
507 gpio_free(HDMI_GPIO_HPD);
512 static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev)
514 gpio_free(HDMI_GPIO_LS_OE);
515 gpio_free(HDMI_GPIO_HPD);
518 static struct omap_dss_device omap4_panda_hdmi_device = {
520 .driver_name = "hdmi_panel",
521 .type = OMAP_DISPLAY_TYPE_HDMI,
522 .platform_enable = omap4_panda_panel_enable_hdmi,
523 .platform_disable = omap4_panda_panel_disable_hdmi,
524 .channel = OMAP_DSS_CHANNEL_DIGIT,
527 static struct omap_dss_device *omap4_panda_dss_devices[] = {
528 &omap4_panda_hdmi_device,
531 static struct omap_dss_board_info omap4_panda_dss_data = {
532 .num_devices = ARRAY_SIZE(omap4_panda_dss_devices),
533 .devices = omap4_panda_dss_devices,
534 .default_device = &omap4_panda_hdmi_device,
537 void omap4_panda_display_init(void)
539 omap4_panda_hdmi_mux_init();
540 omap_display_init(&omap4_panda_dss_data);
543 static void __init omap4_panda_init(void)
545 int package = OMAP_PACKAGE_CBS;
547 if (omap_rev() == OMAP4430_REV_ES1_0)
548 package = OMAP_PACKAGE_CBL;
549 omap4_mux_init(board_mux, package);
551 if (wl12xx_set_platform_data(&omap_panda_wlan_data))
552 pr_err("error setting wl12xx data\n");
554 omap4_panda_i2c_init();
555 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
556 platform_device_register(&omap_vwlan_device);
558 omap4_twl6030_hsmmc_init(mmc);
560 usb_musb_init(&musb_board_data);
561 omap4_panda_display_init();
564 static void __init omap4_panda_map_io(void)
566 omap2_set_globals_443x();
567 omap44xx_map_common_io();
570 MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
571 /* Maintainer: David Anders - Texas Instruments Inc */
572 .boot_params = 0x80000100,
573 .reserve = omap_reserve,
574 .map_io = omap4_panda_map_io,
575 .init_early = omap4_panda_init_early,
576 .init_irq = gic_init_irq,
577 .init_machine = omap4_panda_init,
578 .timer = &omap_timer,