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 /* wl127x BT, FM, GPS connectivity chip */
54 static int wl1271_gpios
[] = {46, -1, -1};
55 static struct platform_device wl1271_device
= {
59 .platform_data
= &wl1271_gpios
,
63 static struct gpio_led gpio_leds
[] = {
65 .name
= "pandaboard::status1",
66 .default_trigger
= "heartbeat",
70 .name
= "pandaboard::status2",
71 .default_trigger
= "mmc0",
76 static struct gpio_led_platform_data gpio_led_info
= {
78 .num_leds
= ARRAY_SIZE(gpio_leds
),
81 static struct platform_device leds_gpio
= {
85 .platform_data
= &gpio_led_info
,
89 static struct platform_device
*panda_devices
[] __initdata
= {
94 static void __init
omap4_panda_init_early(void)
96 omap2_init_common_infrastructure();
97 omap2_init_common_devices(NULL
, NULL
);
100 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst
= {
101 .port_mode
[0] = EHCI_HCD_OMAP_MODE_PHY
,
102 .port_mode
[1] = EHCI_HCD_OMAP_MODE_UNKNOWN
,
103 .port_mode
[2] = EHCI_HCD_OMAP_MODE_UNKNOWN
,
105 .reset_gpio_port
[0] = -EINVAL
,
106 .reset_gpio_port
[1] = -EINVAL
,
107 .reset_gpio_port
[2] = -EINVAL
110 static void __init
omap4_ehci_init(void)
113 struct clk
*phy_ref_clk
;
115 /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
116 phy_ref_clk
= clk_get(NULL
, "auxclk3_ck");
117 if (IS_ERR(phy_ref_clk
)) {
118 pr_err("Cannot request auxclk3\n");
121 clk_set_rate(phy_ref_clk
, 19200000);
122 clk_enable(phy_ref_clk
);
124 /* disable the power to the usb hub prior to init */
125 ret
= gpio_request(GPIO_HUB_POWER
, "hub_power");
127 pr_err("Cannot request GPIO %d\n", GPIO_HUB_POWER
);
130 gpio_export(GPIO_HUB_POWER
, 0);
131 gpio_direction_output(GPIO_HUB_POWER
, 0);
132 gpio_set_value(GPIO_HUB_POWER
, 0);
135 ret
= gpio_request(GPIO_HUB_NRESET
, "hub_nreset");
137 pr_err("Cannot request GPIO %d\n", GPIO_HUB_NRESET
);
140 gpio_export(GPIO_HUB_NRESET
, 0);
141 gpio_direction_output(GPIO_HUB_NRESET
, 0);
142 gpio_set_value(GPIO_HUB_NRESET
, 0);
143 gpio_set_value(GPIO_HUB_NRESET
, 1);
145 usb_ehci_init(&ehci_pdata
);
147 /* enable power to hub */
148 gpio_set_value(GPIO_HUB_POWER
, 1);
152 gpio_free(GPIO_HUB_POWER
);
154 pr_err("Unable to initialize EHCI power/reset\n");
159 static struct omap_musb_board_data musb_board_data
= {
160 .interface_type
= MUSB_INTERFACE_UTMI
,
165 static struct twl4030_usb_data omap4_usbphy_data
= {
166 .phy_init
= omap4430_phy_init
,
167 .phy_exit
= omap4430_phy_exit
,
168 .phy_power
= omap4430_phy_power
,
169 .phy_set_clock
= omap4430_phy_set_clk
,
172 static struct omap2_hsmmc_info mmc
[] = {
175 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
,
182 .caps
= MMC_CAP_4_BIT_DATA
| MMC_CAP_POWER_OFF_CARD
,
185 .ocr_mask
= MMC_VDD_165_195
,
186 .nonremovable
= true,
191 static struct regulator_consumer_supply omap4_panda_vmmc_supply
[] = {
194 .dev_name
= "mmci-omap-hs.0",
198 static struct regulator_consumer_supply omap4_panda_vmmc5_supply
= {
200 .dev_name
= "mmci-omap-hs.4",
203 static struct regulator_init_data panda_vmmc5
= {
205 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
207 .num_consumer_supplies
= 1,
208 .consumer_supplies
= &omap4_panda_vmmc5_supply
,
211 static struct fixed_voltage_config panda_vwlan
= {
212 .supply_name
= "vwl1271",
213 .microvolts
= 1800000, /* 1.8V */
214 .gpio
= GPIO_WIFI_PMENA
,
215 .startup_delay
= 70000, /* 70msec */
217 .enabled_at_boot
= 0,
218 .init_data
= &panda_vmmc5
,
221 static struct platform_device omap_vwlan_device
= {
222 .name
= "reg-fixed-voltage",
225 .platform_data
= &panda_vwlan
,
229 struct wl12xx_platform_data omap_panda_wlan_data __initdata
= {
230 .irq
= OMAP_GPIO_IRQ(GPIO_WIFI_IRQ
),
231 /* PANDA ref clock is 38.4 MHz */
232 .board_ref_clock
= 2,
235 static int omap4_twl6030_hsmmc_late_init(struct device
*dev
)
238 struct platform_device
*pdev
= container_of(dev
,
239 struct platform_device
, dev
);
240 struct omap_mmc_platform_data
*pdata
= dev
->platform_data
;
243 dev_err(dev
, "%s: NULL platform data\n", __func__
);
246 /* Setting MMC1 Card detect Irq */
248 ret
= twl6030_mmc_card_detect_config();
250 dev_err(dev
, "%s: Error card detect config(%d)\n",
253 pdata
->slots
[0].card_detect
= twl6030_mmc_card_detect
;
258 static __init
void omap4_twl6030_hsmmc_set_late_init(struct device
*dev
)
260 struct omap_mmc_platform_data
*pdata
;
262 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
264 pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n");
267 pdata
= dev
->platform_data
;
269 pdata
->init
= omap4_twl6030_hsmmc_late_init
;
272 static int __init
omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info
*controllers
)
274 struct omap2_hsmmc_info
*c
;
276 omap2_hsmmc_init(controllers
);
277 for (c
= controllers
; c
->mmc
; c
++)
278 omap4_twl6030_hsmmc_set_late_init(c
->dev
);
283 static struct regulator_init_data omap4_panda_vaux1
= {
288 .valid_modes_mask
= REGULATOR_MODE_NORMAL
289 | REGULATOR_MODE_STANDBY
,
290 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
291 | REGULATOR_CHANGE_MODE
292 | REGULATOR_CHANGE_STATUS
,
296 static struct regulator_init_data omap4_panda_vaux2
= {
301 .valid_modes_mask
= REGULATOR_MODE_NORMAL
302 | REGULATOR_MODE_STANDBY
,
303 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
304 | REGULATOR_CHANGE_MODE
305 | REGULATOR_CHANGE_STATUS
,
309 static struct regulator_init_data omap4_panda_vaux3
= {
314 .valid_modes_mask
= REGULATOR_MODE_NORMAL
315 | REGULATOR_MODE_STANDBY
,
316 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
317 | REGULATOR_CHANGE_MODE
318 | REGULATOR_CHANGE_STATUS
,
322 /* VMMC1 for MMC1 card */
323 static struct regulator_init_data omap4_panda_vmmc
= {
328 .valid_modes_mask
= REGULATOR_MODE_NORMAL
329 | REGULATOR_MODE_STANDBY
,
330 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
331 | REGULATOR_CHANGE_MODE
332 | REGULATOR_CHANGE_STATUS
,
334 .num_consumer_supplies
= 1,
335 .consumer_supplies
= omap4_panda_vmmc_supply
,
338 static struct regulator_init_data omap4_panda_vpp
= {
343 .valid_modes_mask
= REGULATOR_MODE_NORMAL
344 | REGULATOR_MODE_STANDBY
,
345 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
346 | REGULATOR_CHANGE_MODE
347 | REGULATOR_CHANGE_STATUS
,
351 static struct regulator_init_data omap4_panda_vusim
= {
356 .valid_modes_mask
= REGULATOR_MODE_NORMAL
357 | REGULATOR_MODE_STANDBY
,
358 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
359 | REGULATOR_CHANGE_MODE
360 | REGULATOR_CHANGE_STATUS
,
364 static struct regulator_init_data omap4_panda_vana
= {
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_vcxio
= {
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_vdac
= {
390 .valid_modes_mask
= REGULATOR_MODE_NORMAL
391 | REGULATOR_MODE_STANDBY
,
392 .valid_ops_mask
= REGULATOR_CHANGE_MODE
393 | REGULATOR_CHANGE_STATUS
,
397 static struct regulator_init_data omap4_panda_vusb
= {
402 .valid_modes_mask
= REGULATOR_MODE_NORMAL
403 | REGULATOR_MODE_STANDBY
,
404 .valid_ops_mask
= REGULATOR_CHANGE_MODE
405 | REGULATOR_CHANGE_STATUS
,
409 static struct twl4030_platform_data omap4_panda_twldata
= {
410 .irq_base
= TWL6030_IRQ_BASE
,
411 .irq_end
= TWL6030_IRQ_END
,
414 .vmmc
= &omap4_panda_vmmc
,
415 .vpp
= &omap4_panda_vpp
,
416 .vusim
= &omap4_panda_vusim
,
417 .vana
= &omap4_panda_vana
,
418 .vcxio
= &omap4_panda_vcxio
,
419 .vdac
= &omap4_panda_vdac
,
420 .vusb
= &omap4_panda_vusb
,
421 .vaux1
= &omap4_panda_vaux1
,
422 .vaux2
= &omap4_panda_vaux2
,
423 .vaux3
= &omap4_panda_vaux3
,
424 .usb
= &omap4_usbphy_data
,
427 static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo
[] = {
429 I2C_BOARD_INFO("twl6030", 0x48),
430 .flags
= I2C_CLIENT_WAKE
,
431 .irq
= OMAP44XX_IRQ_SYS_1N
,
432 .platform_data
= &omap4_panda_twldata
,
435 static int __init
omap4_panda_i2c_init(void)
438 * Phoenix Audio IC needs I2C1 to
439 * start with 400 KHz or less
441 omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo
,
442 ARRAY_SIZE(omap4_panda_i2c_boardinfo
));
443 omap_register_i2c_bus(2, 400, NULL
, 0);
444 omap_register_i2c_bus(3, 400, NULL
, 0);
445 omap_register_i2c_bus(4, 400, NULL
, 0);
449 #ifdef CONFIG_OMAP_MUX
450 static struct omap_board_mux board_mux
[] __initdata
= {
451 /* WLAN IRQ - GPIO 53 */
452 OMAP4_MUX(GPMC_NCS3
, OMAP_MUX_MODE3
| OMAP_PIN_INPUT
),
453 /* WLAN POWER ENABLE - GPIO 43 */
454 OMAP4_MUX(GPMC_A19
, OMAP_MUX_MODE3
| OMAP_PIN_OUTPUT
),
455 /* WLAN SDIO: MMC5 CMD */
456 OMAP4_MUX(SDMMC5_CMD
, OMAP_MUX_MODE0
| OMAP_PIN_INPUT_PULLUP
),
457 /* WLAN SDIO: MMC5 CLK */
458 OMAP4_MUX(SDMMC5_CLK
, OMAP_MUX_MODE0
| OMAP_PIN_INPUT_PULLUP
),
459 /* WLAN SDIO: MMC5 DAT[0-3] */
460 OMAP4_MUX(SDMMC5_DAT0
, OMAP_MUX_MODE0
| OMAP_PIN_INPUT_PULLUP
),
461 OMAP4_MUX(SDMMC5_DAT1
, OMAP_MUX_MODE0
| OMAP_PIN_INPUT_PULLUP
),
462 OMAP4_MUX(SDMMC5_DAT2
, OMAP_MUX_MODE0
| OMAP_PIN_INPUT_PULLUP
),
463 OMAP4_MUX(SDMMC5_DAT3
, OMAP_MUX_MODE0
| OMAP_PIN_INPUT_PULLUP
),
464 { .reg_offset
= OMAP_MUX_TERMINATOR
},
467 #define board_mux NULL
470 static void __init
omap4_panda_init(void)
472 int package
= OMAP_PACKAGE_CBS
;
474 if (omap_rev() == OMAP4430_REV_ES1_0
)
475 package
= OMAP_PACKAGE_CBL
;
476 omap4_mux_init(board_mux
, package
);
478 if (wl12xx_set_platform_data(&omap_panda_wlan_data
))
479 pr_err("error setting wl12xx data\n");
481 omap4_panda_i2c_init();
482 platform_add_devices(panda_devices
, ARRAY_SIZE(panda_devices
));
483 platform_device_register(&omap_vwlan_device
);
485 omap4_twl6030_hsmmc_init(mmc
);
487 usb_musb_init(&musb_board_data
);
490 static void __init
omap4_panda_map_io(void)
492 omap2_set_globals_443x();
493 omap44xx_map_common_io();
496 MACHINE_START(OMAP4_PANDA
, "OMAP4 Panda board")
497 /* Maintainer: David Anders - Texas Instruments Inc */
498 .boot_params
= 0x80000100,
499 .reserve
= omap_reserve
,
500 .map_io
= omap4_panda_map_io
,
501 .init_early
= omap4_panda_init_early
,
502 .init_irq
= gic_init_irq
,
503 .init_machine
= omap4_panda_init
,
504 .timer
= &omap_timer
,