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>
38 #include <plat/board.h>
39 #include <plat/common.h>
48 #define GPIO_HUB_POWER 1
49 #define GPIO_HUB_NRESET 62
50 #define GPIO_WIFI_PMENA 43
51 #define GPIO_WIFI_IRQ 53
53 static struct gpio_led gpio_leds[] = {
55 .name = "pandaboard::status1",
56 .default_trigger = "heartbeat",
60 .name = "pandaboard::status2",
61 .default_trigger = "mmc0",
66 static struct gpio_led_platform_data gpio_led_info = {
68 .num_leds = ARRAY_SIZE(gpio_leds),
71 static struct platform_device leds_gpio = {
75 .platform_data = &gpio_led_info,
79 static struct platform_device *panda_devices[] __initdata = {
83 static void __init omap4_panda_init_early(void)
85 omap2_init_common_infrastructure();
86 omap2_init_common_devices(NULL, NULL);
89 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
90 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
91 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
92 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
94 .reset_gpio_port[0] = -EINVAL,
95 .reset_gpio_port[1] = -EINVAL,
96 .reset_gpio_port[2] = -EINVAL
99 static void __init omap4_ehci_init(void)
102 struct clk *phy_ref_clk;
104 /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
105 phy_ref_clk = clk_get(NULL, "auxclk3_ck");
106 if (IS_ERR(phy_ref_clk)) {
107 pr_err("Cannot request auxclk3\n");
110 clk_set_rate(phy_ref_clk, 19200000);
111 clk_enable(phy_ref_clk);
113 /* disable the power to the usb hub prior to init */
114 ret = gpio_request(GPIO_HUB_POWER, "hub_power");
116 pr_err("Cannot request GPIO %d\n", GPIO_HUB_POWER);
119 gpio_export(GPIO_HUB_POWER, 0);
120 gpio_direction_output(GPIO_HUB_POWER, 0);
121 gpio_set_value(GPIO_HUB_POWER, 0);
124 ret = gpio_request(GPIO_HUB_NRESET, "hub_nreset");
126 pr_err("Cannot request GPIO %d\n", GPIO_HUB_NRESET);
129 gpio_export(GPIO_HUB_NRESET, 0);
130 gpio_direction_output(GPIO_HUB_NRESET, 0);
131 gpio_set_value(GPIO_HUB_NRESET, 0);
132 gpio_set_value(GPIO_HUB_NRESET, 1);
134 usb_ehci_init(&ehci_pdata);
136 /* enable power to hub */
137 gpio_set_value(GPIO_HUB_POWER, 1);
141 gpio_free(GPIO_HUB_POWER);
143 pr_err("Unable to initialize EHCI power/reset\n");
148 static struct omap_musb_board_data musb_board_data = {
149 .interface_type = MUSB_INTERFACE_UTMI,
154 static struct twl4030_usb_data omap4_usbphy_data = {
155 .phy_init = omap4430_phy_init,
156 .phy_exit = omap4430_phy_exit,
157 .phy_power = omap4430_phy_power,
158 .phy_set_clock = omap4430_phy_set_clk,
161 static struct omap2_hsmmc_info mmc[] = {
164 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
171 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
174 .ocr_mask = MMC_VDD_165_195,
175 .nonremovable = true,
180 static struct regulator_consumer_supply omap4_panda_vmmc_supply[] = {
183 .dev_name = "mmci-omap-hs.0",
187 static struct regulator_consumer_supply omap4_panda_vmmc5_supply = {
189 .dev_name = "mmci-omap-hs.4",
192 static struct regulator_init_data panda_vmmc5 = {
194 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
196 .num_consumer_supplies = 1,
197 .consumer_supplies = &omap4_panda_vmmc5_supply,
200 static struct fixed_voltage_config panda_vwlan = {
201 .supply_name = "vwl1271",
202 .microvolts = 1800000, /* 1.8V */
203 .gpio = GPIO_WIFI_PMENA,
204 .startup_delay = 70000, /* 70msec */
206 .enabled_at_boot = 0,
207 .init_data = &panda_vmmc5,
210 static struct platform_device omap_vwlan_device = {
211 .name = "reg-fixed-voltage",
214 .platform_data = &panda_vwlan,
218 struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
219 .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
220 /* PANDA ref clock is 38.4 MHz */
221 .board_ref_clock = 2,
224 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
227 struct platform_device *pdev = container_of(dev,
228 struct platform_device, dev);
229 struct omap_mmc_platform_data *pdata = dev->platform_data;
232 dev_err(dev, "%s: NULL platform data\n", __func__);
235 /* Setting MMC1 Card detect Irq */
237 ret = twl6030_mmc_card_detect_config();
239 dev_err(dev, "%s: Error card detect config(%d)\n",
242 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
247 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
249 struct omap_mmc_platform_data *pdata;
251 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
253 pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n");
256 pdata = dev->platform_data;
258 pdata->init = omap4_twl6030_hsmmc_late_init;
261 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
263 struct omap2_hsmmc_info *c;
265 omap2_hsmmc_init(controllers);
266 for (c = controllers; c->mmc; c++)
267 omap4_twl6030_hsmmc_set_late_init(c->dev);
272 static struct regulator_init_data omap4_panda_vaux1 = {
277 .valid_modes_mask = REGULATOR_MODE_NORMAL
278 | REGULATOR_MODE_STANDBY,
279 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
280 | REGULATOR_CHANGE_MODE
281 | REGULATOR_CHANGE_STATUS,
285 static struct regulator_init_data omap4_panda_vaux2 = {
290 .valid_modes_mask = REGULATOR_MODE_NORMAL
291 | REGULATOR_MODE_STANDBY,
292 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
293 | REGULATOR_CHANGE_MODE
294 | REGULATOR_CHANGE_STATUS,
298 static struct regulator_init_data omap4_panda_vaux3 = {
303 .valid_modes_mask = REGULATOR_MODE_NORMAL
304 | REGULATOR_MODE_STANDBY,
305 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
306 | REGULATOR_CHANGE_MODE
307 | REGULATOR_CHANGE_STATUS,
311 /* VMMC1 for MMC1 card */
312 static struct regulator_init_data omap4_panda_vmmc = {
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,
323 .num_consumer_supplies = 1,
324 .consumer_supplies = omap4_panda_vmmc_supply,
327 static struct regulator_init_data omap4_panda_vpp = {
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,
340 static struct regulator_init_data omap4_panda_vusim = {
345 .valid_modes_mask = REGULATOR_MODE_NORMAL
346 | REGULATOR_MODE_STANDBY,
347 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
348 | REGULATOR_CHANGE_MODE
349 | REGULATOR_CHANGE_STATUS,
353 static struct regulator_init_data omap4_panda_vana = {
357 .valid_modes_mask = REGULATOR_MODE_NORMAL
358 | REGULATOR_MODE_STANDBY,
359 .valid_ops_mask = REGULATOR_CHANGE_MODE
360 | REGULATOR_CHANGE_STATUS,
364 static struct regulator_init_data omap4_panda_vcxio = {
368 .valid_modes_mask = REGULATOR_MODE_NORMAL
369 | REGULATOR_MODE_STANDBY,
370 .valid_ops_mask = REGULATOR_CHANGE_MODE
371 | REGULATOR_CHANGE_STATUS,
375 static struct regulator_init_data omap4_panda_vdac = {
379 .valid_modes_mask = REGULATOR_MODE_NORMAL
380 | REGULATOR_MODE_STANDBY,
381 .valid_ops_mask = REGULATOR_CHANGE_MODE
382 | REGULATOR_CHANGE_STATUS,
386 static struct regulator_init_data omap4_panda_vusb = {
391 .valid_modes_mask = REGULATOR_MODE_NORMAL
392 | REGULATOR_MODE_STANDBY,
393 .valid_ops_mask = REGULATOR_CHANGE_MODE
394 | REGULATOR_CHANGE_STATUS,
398 static struct twl4030_platform_data omap4_panda_twldata = {
399 .irq_base = TWL6030_IRQ_BASE,
400 .irq_end = TWL6030_IRQ_END,
403 .vmmc = &omap4_panda_vmmc,
404 .vpp = &omap4_panda_vpp,
405 .vusim = &omap4_panda_vusim,
406 .vana = &omap4_panda_vana,
407 .vcxio = &omap4_panda_vcxio,
408 .vdac = &omap4_panda_vdac,
409 .vusb = &omap4_panda_vusb,
410 .vaux1 = &omap4_panda_vaux1,
411 .vaux2 = &omap4_panda_vaux2,
412 .vaux3 = &omap4_panda_vaux3,
413 .usb = &omap4_usbphy_data,
416 static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = {
418 I2C_BOARD_INFO("twl6030", 0x48),
419 .flags = I2C_CLIENT_WAKE,
420 .irq = OMAP44XX_IRQ_SYS_1N,
421 .platform_data = &omap4_panda_twldata,
424 static int __init omap4_panda_i2c_init(void)
427 * Phoenix Audio IC needs I2C1 to
428 * start with 400 KHz or less
430 omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo,
431 ARRAY_SIZE(omap4_panda_i2c_boardinfo));
432 omap_register_i2c_bus(2, 400, NULL, 0);
433 omap_register_i2c_bus(3, 400, NULL, 0);
434 omap_register_i2c_bus(4, 400, NULL, 0);
438 #ifdef CONFIG_OMAP_MUX
439 static struct omap_board_mux board_mux[] __initdata = {
440 /* WLAN IRQ - GPIO 53 */
441 OMAP4_MUX(GPMC_NCS3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
442 /* WLAN POWER ENABLE - GPIO 43 */
443 OMAP4_MUX(GPMC_A19, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
444 /* WLAN SDIO: MMC5 CMD */
445 OMAP4_MUX(SDMMC5_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
446 /* WLAN SDIO: MMC5 CLK */
447 OMAP4_MUX(SDMMC5_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
448 /* WLAN SDIO: MMC5 DAT[0-3] */
449 OMAP4_MUX(SDMMC5_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
450 OMAP4_MUX(SDMMC5_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
451 OMAP4_MUX(SDMMC5_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
452 OMAP4_MUX(SDMMC5_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
453 { .reg_offset = OMAP_MUX_TERMINATOR },
456 #define board_mux NULL
459 static void __init omap4_panda_init(void)
461 int package = OMAP_PACKAGE_CBS;
463 if (omap_rev() == OMAP4430_REV_ES1_0)
464 package = OMAP_PACKAGE_CBL;
465 omap4_mux_init(board_mux, package);
467 if (wl12xx_set_platform_data(&omap_panda_wlan_data))
468 pr_err("error setting wl12xx data\n");
470 omap4_panda_i2c_init();
471 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
472 platform_device_register(&omap_vwlan_device);
474 omap4_twl6030_hsmmc_init(mmc);
476 usb_musb_init(&musb_board_data);
479 static void __init omap4_panda_map_io(void)
481 omap2_set_globals_443x();
482 omap44xx_map_common_io();
485 MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
486 /* Maintainer: David Anders - Texas Instruments Inc */
487 .boot_params = 0x80000100,
488 .reserve = omap_reserve,
489 .map_io = omap4_panda_map_io,
490 .init_early = omap4_panda_init_early,
491 .init_irq = gic_init_irq,
492 .init_machine = omap4_panda_init,
493 .timer = &omap_timer,