blob: f988a1d5a66f7350b63f848821fe43eb39a50101 [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>
Tomi Valkeinena0b38cc2011-05-11 14:05:07 +030037#include <video/omapdss.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>
Tomi Valkeinenf8ae2f02011-05-10 19:48:10 +030043#include <video/omap-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"
Mike Rapoportfbd80712011-04-25 01:09:06 +030049#include "common-board-devices.h"
David Andersb075f582010-08-02 13:18:05 +030050
David Anders4415beb2010-10-07 19:36:30 +000051#define GPIO_HUB_POWER 1
52#define GPIO_HUB_NRESET 62
Panduranga Mallireddyedc84062011-02-15 03:40:34 -050053#define GPIO_WIFI_PMENA 43
Panduranga Mallireddyb17e09792011-02-15 03:40:35 -050054#define GPIO_WIFI_IRQ 53
K, Mythri P17c84ef2011-03-14 23:57:42 -050055#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
56#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
David Anders4415beb2010-10-07 19:36:30 +000057
Guy Eilamec179ea2011-02-25 06:52:35 +000058/* wl127x BT, FM, GPS connectivity chip */
59static int wl1271_gpios[] = {46, -1, -1};
60static struct platform_device wl1271_device = {
61 .name = "kim",
62 .id = -1,
63 .dev = {
64 .platform_data = &wl1271_gpios,
65 },
66};
David Andersb075f582010-08-02 13:18:05 +030067
Ricardo Salveti de Araujo3da434a2010-09-23 18:22:49 -070068static struct gpio_led gpio_leds[] = {
69 {
70 .name = "pandaboard::status1",
71 .default_trigger = "heartbeat",
72 .gpio = 7,
73 },
74 {
75 .name = "pandaboard::status2",
76 .default_trigger = "mmc0",
77 .gpio = 8,
78 },
79};
80
81static struct gpio_led_platform_data gpio_led_info = {
82 .leds = gpio_leds,
83 .num_leds = ARRAY_SIZE(gpio_leds),
84};
85
86static struct platform_device leds_gpio = {
87 .name = "leds-gpio",
88 .id = -1,
89 .dev = {
90 .platform_data = &gpio_led_info,
91 },
92};
93
94static struct platform_device *panda_devices[] __initdata = {
95 &leds_gpio,
Guy Eilamec179ea2011-02-25 06:52:35 +000096 &wl1271_device,
Ricardo Salveti de Araujo3da434a2010-09-23 18:22:49 -070097};
David Andersb075f582010-08-02 13:18:05 +030098
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -080099static void __init omap4_panda_init_early(void)
David Andersb075f582010-08-02 13:18:05 +0300100{
Paul Walmsley48057342010-12-21 15:25:10 -0700101 omap2_init_common_infrastructure();
102 omap2_init_common_devices(NULL, NULL);
David Andersb075f582010-08-02 13:18:05 +0300103}
104
Keshava Munegowda181b2502011-03-01 20:08:16 +0530105static 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,
David Anders4415beb2010-10-07 19:36:30 +0000109 .phy_reset = false,
110 .reset_gpio_port[0] = -EINVAL,
111 .reset_gpio_port[1] = -EINVAL,
112 .reset_gpio_port[2] = -EINVAL
113};
114
Igor Grinbergbc593f52011-05-03 18:22:09 +0300115static 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" },
118};
119
David Anders4415beb2010-10-07 19:36:30 +0000120static void __init omap4_ehci_init(void)
121{
122 int ret;
Anand Gadiyar1740d482011-01-10 14:42:15 +0000123 struct clk *phy_ref_clk;
David Anders4415beb2010-10-07 19:36:30 +0000124
Anand Gadiyar1740d482011-01-10 14:42:15 +0000125 /* 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");
Igor Grinbergbc593f52011-05-03 18:22:09 +0300129 return;
Anand Gadiyar1740d482011-01-10 14:42:15 +0000130 }
131 clk_set_rate(phy_ref_clk, 19200000);
132 clk_enable(phy_ref_clk);
David Anders4415beb2010-10-07 19:36:30 +0000133
Igor Grinbergbc593f52011-05-03 18:22:09 +0300134 /* 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));
David Anders4415beb2010-10-07 19:36:30 +0000137 if (ret) {
Igor Grinbergbc593f52011-05-03 18:22:09 +0300138 pr_err("Unable to initialize EHCI power/reset\n");
139 return;
David Anders4415beb2010-10-07 19:36:30 +0000140 }
David Anders4415beb2010-10-07 19:36:30 +0000141
Igor Grinbergbc593f52011-05-03 18:22:09 +0300142 gpio_export(GPIO_HUB_POWER, 0);
David Anders4415beb2010-10-07 19:36:30 +0000143 gpio_export(GPIO_HUB_NRESET, 0);
David Anders4415beb2010-10-07 19:36:30 +0000144 gpio_set_value(GPIO_HUB_NRESET, 1);
145
Keshava Munegowda9e64bb12011-03-01 20:08:19 +0530146 usbhs_init(&usbhs_bdata);
David Anders4415beb2010-10-07 19:36:30 +0000147
148 /* enable power to hub */
149 gpio_set_value(GPIO_HUB_POWER, 1);
David Anders4415beb2010-10-07 19:36:30 +0000150}
151
David Andersb075f582010-08-02 13:18:05 +0300152static struct omap_musb_board_data musb_board_data = {
153 .interface_type = MUSB_INTERFACE_UTMI,
Hema HK09e72002010-12-10 18:11:42 +0530154 .mode = MUSB_OTG,
David Andersb075f582010-08-02 13:18:05 +0300155 .power = 100,
156};
157
158static struct omap2_hsmmc_info mmc[] = {
159 {
160 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000161 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
David Andersb075f582010-08-02 13:18:05 +0300162 .gpio_wp = -EINVAL,
Raghuveer Murthy5b59cc22010-12-21 14:14:34 +0000163 .gpio_cd = -EINVAL,
David Andersb075f582010-08-02 13:18:05 +0300164 },
Panduranga Mallireddyb17e09792011-02-15 03:40:35 -0500165 {
166 .name = "wl1271",
167 .mmc = 5,
168 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
169 .gpio_wp = -EINVAL,
170 .gpio_cd = -EINVAL,
171 .ocr_mask = MMC_VDD_165_195,
172 .nonremovable = true,
173 },
David Andersb075f582010-08-02 13:18:05 +0300174 {} /* Terminator */
175};
176
Panduranga Mallireddyedc84062011-02-15 03:40:34 -0500177static struct regulator_consumer_supply omap4_panda_vmmc5_supply = {
178 .supply = "vmmc",
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530179 .dev_name = "omap_hsmmc.4",
Panduranga Mallireddyedc84062011-02-15 03:40:34 -0500180};
181
182static struct regulator_init_data panda_vmmc5 = {
183 .constraints = {
184 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
185 },
186 .num_consumer_supplies = 1,
187 .consumer_supplies = &omap4_panda_vmmc5_supply,
188};
189
190static struct fixed_voltage_config panda_vwlan = {
191 .supply_name = "vwl1271",
192 .microvolts = 1800000, /* 1.8V */
193 .gpio = GPIO_WIFI_PMENA,
194 .startup_delay = 70000, /* 70msec */
195 .enable_high = 1,
196 .enabled_at_boot = 0,
197 .init_data = &panda_vmmc5,
198};
199
200static struct platform_device omap_vwlan_device = {
201 .name = "reg-fixed-voltage",
202 .id = 1,
203 .dev = {
204 .platform_data = &panda_vwlan,
205 },
206};
207
Panduranga Mallireddyb17e09792011-02-15 03:40:35 -0500208struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
209 .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
210 /* PANDA ref clock is 38.4 MHz */
211 .board_ref_clock = 2,
212};
213
David Andersb075f582010-08-02 13:18:05 +0300214static int omap4_twl6030_hsmmc_late_init(struct device *dev)
215{
216 int ret = 0;
217 struct platform_device *pdev = container_of(dev,
218 struct platform_device, dev);
219 struct omap_mmc_platform_data *pdata = dev->platform_data;
220
Menon, Nishanthbf56f0a2010-10-19 09:50:25 -0500221 if (!pdata) {
222 dev_err(dev, "%s: NULL platform data\n", __func__);
223 return -EINVAL;
224 }
David Andersb075f582010-08-02 13:18:05 +0300225 /* Setting MMC1 Card detect Irq */
Menon, Nishanthbf56f0a2010-10-19 09:50:25 -0500226 if (pdev->id == 0) {
227 ret = twl6030_mmc_card_detect_config();
228 if (ret)
229 dev_err(dev, "%s: Error card detect config(%d)\n",
230 __func__, ret);
231 else
232 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
233 }
David Andersb075f582010-08-02 13:18:05 +0300234 return ret;
235}
236
237static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
238{
David Andersb9b52622010-10-07 19:36:29 +0000239 struct omap_mmc_platform_data *pdata;
240
241 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
242 if (!dev) {
243 pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n");
244 return;
245 }
246 pdata = dev->platform_data;
David Andersb075f582010-08-02 13:18:05 +0300247
248 pdata->init = omap4_twl6030_hsmmc_late_init;
249}
250
251static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
252{
253 struct omap2_hsmmc_info *c;
254
255 omap2_hsmmc_init(controllers);
256 for (c = controllers; c->mmc; c++)
257 omap4_twl6030_hsmmc_set_late_init(c->dev);
258
259 return 0;
260}
261
Peter Ujfalusi1e0f9cd2011-06-07 10:26:46 +0300262/* Use the common PMIC configuration for Panda */
263static struct twl4030_platform_data omap4_panda_twldata;
David Andersb075f582010-08-02 13:18:05 +0300264
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -0500265/*
266 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
267 * is connected as I2C slave device, and can be accessed at address 0x50
268 */
269static struct i2c_board_info __initdata panda_i2c_eeprom[] = {
270 {
271 I2C_BOARD_INFO("eeprom", 0x50),
272 },
273};
274
David Andersb075f582010-08-02 13:18:05 +0300275static int __init omap4_panda_i2c_init(void)
276{
Peter Ujfalusi1e0f9cd2011-06-07 10:26:46 +0300277 omap4_pmic_get_config(&omap4_panda_twldata, TWL_COMMON_PDATA_USB,
278 TWL_COMMON_REGULATOR_VDAC |
279 TWL_COMMON_REGULATOR_VAUX2 |
280 TWL_COMMON_REGULATOR_VAUX3 |
281 TWL_COMMON_REGULATOR_VMMC |
282 TWL_COMMON_REGULATOR_VPP |
283 TWL_COMMON_REGULATOR_VANA |
284 TWL_COMMON_REGULATOR_VCXIO |
285 TWL_COMMON_REGULATOR_VUSB |
286 TWL_COMMON_REGULATOR_CLK32KG);
Mike Rapoportfbd80712011-04-25 01:09:06 +0300287 omap4_pmic_init("twl6030", &omap4_panda_twldata);
David Andersb075f582010-08-02 13:18:05 +0300288 omap_register_i2c_bus(2, 400, NULL, 0);
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -0500289 /*
290 * Bus 3 is attached to the DVI port where devices like the pico DLP
291 * projector don't work reliably with 400kHz
292 */
293 omap_register_i2c_bus(3, 100, panda_i2c_eeprom,
294 ARRAY_SIZE(panda_i2c_eeprom));
David Andersb075f582010-08-02 13:18:05 +0300295 omap_register_i2c_bus(4, 400, NULL, 0);
296 return 0;
297}
sricharanfc63de822010-11-08 19:26:11 +0530298
299#ifdef CONFIG_OMAP_MUX
300static struct omap_board_mux board_mux[] __initdata = {
Panduranga Mallireddy66e171a2011-02-15 03:40:32 -0500301 /* WLAN IRQ - GPIO 53 */
302 OMAP4_MUX(GPMC_NCS3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
303 /* WLAN POWER ENABLE - GPIO 43 */
304 OMAP4_MUX(GPMC_A19, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
305 /* WLAN SDIO: MMC5 CMD */
306 OMAP4_MUX(SDMMC5_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
307 /* WLAN SDIO: MMC5 CLK */
308 OMAP4_MUX(SDMMC5_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
309 /* WLAN SDIO: MMC5 DAT[0-3] */
310 OMAP4_MUX(SDMMC5_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
311 OMAP4_MUX(SDMMC5_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
312 OMAP4_MUX(SDMMC5_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
313 OMAP4_MUX(SDMMC5_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -0500314 /* gpio 0 - TFP410 PD */
315 OMAP4_MUX(KPD_COL1, OMAP_PIN_OUTPUT | OMAP_MUX_MODE3),
316 /* dispc2_data23 */
317 OMAP4_MUX(USBB2_ULPITLL_STP, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
318 /* dispc2_data22 */
319 OMAP4_MUX(USBB2_ULPITLL_DIR, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
320 /* dispc2_data21 */
321 OMAP4_MUX(USBB2_ULPITLL_NXT, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
322 /* dispc2_data20 */
323 OMAP4_MUX(USBB2_ULPITLL_DAT0, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
324 /* dispc2_data19 */
325 OMAP4_MUX(USBB2_ULPITLL_DAT1, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
326 /* dispc2_data18 */
327 OMAP4_MUX(USBB2_ULPITLL_DAT2, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
328 /* dispc2_data15 */
329 OMAP4_MUX(USBB2_ULPITLL_DAT3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
330 /* dispc2_data14 */
331 OMAP4_MUX(USBB2_ULPITLL_DAT4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
332 /* dispc2_data13 */
333 OMAP4_MUX(USBB2_ULPITLL_DAT5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
334 /* dispc2_data12 */
335 OMAP4_MUX(USBB2_ULPITLL_DAT6, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
336 /* dispc2_data11 */
337 OMAP4_MUX(USBB2_ULPITLL_DAT7, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
338 /* dispc2_data10 */
339 OMAP4_MUX(DPM_EMU3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
340 /* dispc2_data9 */
341 OMAP4_MUX(DPM_EMU4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
342 /* dispc2_data16 */
343 OMAP4_MUX(DPM_EMU5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
344 /* dispc2_data17 */
345 OMAP4_MUX(DPM_EMU6, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
346 /* dispc2_hsync */
347 OMAP4_MUX(DPM_EMU7, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
348 /* dispc2_pclk */
349 OMAP4_MUX(DPM_EMU8, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
350 /* dispc2_vsync */
351 OMAP4_MUX(DPM_EMU9, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
352 /* dispc2_de */
353 OMAP4_MUX(DPM_EMU10, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
354 /* dispc2_data8 */
355 OMAP4_MUX(DPM_EMU11, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
356 /* dispc2_data7 */
357 OMAP4_MUX(DPM_EMU12, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
358 /* dispc2_data6 */
359 OMAP4_MUX(DPM_EMU13, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
360 /* dispc2_data5 */
361 OMAP4_MUX(DPM_EMU14, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
362 /* dispc2_data4 */
363 OMAP4_MUX(DPM_EMU15, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
364 /* dispc2_data3 */
365 OMAP4_MUX(DPM_EMU16, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
366 /* dispc2_data2 */
367 OMAP4_MUX(DPM_EMU17, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
368 /* dispc2_data1 */
369 OMAP4_MUX(DPM_EMU18, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
370 /* dispc2_data0 */
371 OMAP4_MUX(DPM_EMU19, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
sricharanfc63de822010-11-08 19:26:11 +0530372 { .reg_offset = OMAP_MUX_TERMINATOR },
373};
R Sricharan573efc22011-03-11 06:04:46 +0000374
375static struct omap_device_pad serial2_pads[] __initdata = {
376 OMAP_MUX_STATIC("uart2_cts.uart2_cts",
377 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
378 OMAP_MUX_STATIC("uart2_rts.uart2_rts",
379 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
380 OMAP_MUX_STATIC("uart2_rx.uart2_rx",
381 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
382 OMAP_MUX_STATIC("uart2_tx.uart2_tx",
383 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
384};
385
386static struct omap_device_pad serial3_pads[] __initdata = {
387 OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
388 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
389 OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
390 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
391 OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
392 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
393 OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
394 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
395};
396
397static struct omap_device_pad serial4_pads[] __initdata = {
398 OMAP_MUX_STATIC("uart4_rx.uart4_rx",
399 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
400 OMAP_MUX_STATIC("uart4_tx.uart4_tx",
401 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
402};
403
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700404static struct omap_board_data serial2_data __initdata = {
R Sricharan573efc22011-03-11 06:04:46 +0000405 .id = 1,
406 .pads = serial2_pads,
407 .pads_cnt = ARRAY_SIZE(serial2_pads),
408};
409
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700410static struct omap_board_data serial3_data __initdata = {
R Sricharan573efc22011-03-11 06:04:46 +0000411 .id = 2,
412 .pads = serial3_pads,
413 .pads_cnt = ARRAY_SIZE(serial3_pads),
414};
415
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700416static struct omap_board_data serial4_data __initdata = {
R Sricharan573efc22011-03-11 06:04:46 +0000417 .id = 3,
418 .pads = serial4_pads,
419 .pads_cnt = ARRAY_SIZE(serial4_pads),
420};
421
422static inline void board_serial_init(void)
423{
424 struct omap_board_data bdata;
425 bdata.flags = 0;
426 bdata.pads = NULL;
427 bdata.pads_cnt = 0;
428 bdata.id = 0;
429 /* pass dummy data for UART1 */
430 omap_serial_init_port(&bdata);
431
432 omap_serial_init_port(&serial2_data);
433 omap_serial_init_port(&serial3_data);
434 omap_serial_init_port(&serial4_data);
435}
sricharanfc63de822010-11-08 19:26:11 +0530436#else
437#define board_mux NULL
R Sricharan573efc22011-03-11 06:04:46 +0000438
439static inline void board_serial_init(void)
440{
441 omap_serial_init();
442}
sricharanfc63de822010-11-08 19:26:11 +0530443#endif
444
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -0500445/* Display DVI */
446#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
447
448static int omap4_panda_enable_dvi(struct omap_dss_device *dssdev)
449{
450 gpio_set_value(dssdev->reset_gpio, 1);
451 return 0;
452}
453
454static void omap4_panda_disable_dvi(struct omap_dss_device *dssdev)
455{
456 gpio_set_value(dssdev->reset_gpio, 0);
457}
458
459/* Using generic display panel */
460static struct panel_generic_dpi_data omap4_dvi_panel = {
461 .name = "generic",
462 .platform_enable = omap4_panda_enable_dvi,
463 .platform_disable = omap4_panda_disable_dvi,
464};
465
466struct omap_dss_device omap4_panda_dvi_device = {
467 .type = OMAP_DISPLAY_TYPE_DPI,
468 .name = "dvi",
469 .driver_name = "generic_dpi_panel",
470 .data = &omap4_dvi_panel,
471 .phy.dpi.data_lines = 24,
472 .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
473 .channel = OMAP_DSS_CHANNEL_LCD2,
474};
475
476int __init omap4_panda_dvi_init(void)
477{
478 int r;
479
480 /* Requesting TFP410 DVI GPIO and disabling it, at bootup */
481 r = gpio_request_one(omap4_panda_dvi_device.reset_gpio,
482 GPIOF_OUT_INIT_LOW, "DVI PD");
483 if (r)
484 pr_err("Failed to get DVI powerdown GPIO\n");
485
486 return r;
487}
488
489
K, Mythri P17c84ef2011-03-14 23:57:42 -0500490static void omap4_panda_hdmi_mux_init(void)
491{
492 /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
493 omap_mux_init_signal("hdmi_hpd",
494 OMAP_PIN_INPUT_PULLUP);
495 omap_mux_init_signal("hdmi_cec",
496 OMAP_PIN_INPUT_PULLUP);
497 /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
498 omap_mux_init_signal("hdmi_ddc_scl",
499 OMAP_PIN_INPUT_PULLUP);
500 omap_mux_init_signal("hdmi_ddc_sda",
501 OMAP_PIN_INPUT_PULLUP);
502}
503
Igor Grinbergbc593f52011-05-03 18:22:09 +0300504static struct gpio panda_hdmi_gpios[] = {
505 { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" },
506 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
507};
508
K, Mythri P17c84ef2011-03-14 23:57:42 -0500509static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
510{
511 int status;
512
Igor Grinbergbc593f52011-05-03 18:22:09 +0300513 status = gpio_request_array(panda_hdmi_gpios,
514 ARRAY_SIZE(panda_hdmi_gpios));
515 if (status)
516 pr_err("Cannot request HDMI GPIOs\n");
K, Mythri P17c84ef2011-03-14 23:57:42 -0500517
518 return status;
519}
520
521static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev)
522{
523 gpio_free(HDMI_GPIO_LS_OE);
524 gpio_free(HDMI_GPIO_HPD);
525}
526
527static struct omap_dss_device omap4_panda_hdmi_device = {
528 .name = "hdmi",
529 .driver_name = "hdmi_panel",
530 .type = OMAP_DISPLAY_TYPE_HDMI,
531 .platform_enable = omap4_panda_panel_enable_hdmi,
532 .platform_disable = omap4_panda_panel_disable_hdmi,
533 .channel = OMAP_DSS_CHANNEL_DIGIT,
534};
535
536static struct omap_dss_device *omap4_panda_dss_devices[] = {
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -0500537 &omap4_panda_dvi_device,
K, Mythri P17c84ef2011-03-14 23:57:42 -0500538 &omap4_panda_hdmi_device,
539};
540
541static struct omap_dss_board_info omap4_panda_dss_data = {
542 .num_devices = ARRAY_SIZE(omap4_panda_dss_devices),
543 .devices = omap4_panda_dss_devices,
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -0500544 .default_device = &omap4_panda_dvi_device,
K, Mythri P17c84ef2011-03-14 23:57:42 -0500545};
546
547void omap4_panda_display_init(void)
548{
Murthy, Raghuveerb295d6e2011-03-14 07:52:25 -0500549 int r;
550
551 r = omap4_panda_dvi_init();
552 if (r)
553 pr_err("error initializing panda DVI\n");
554
K, Mythri P17c84ef2011-03-14 23:57:42 -0500555 omap4_panda_hdmi_mux_init();
556 omap_display_init(&omap4_panda_dss_data);
557}
558
David Andersb075f582010-08-02 13:18:05 +0300559static void __init omap4_panda_init(void)
560{
sricharanfc63de822010-11-08 19:26:11 +0530561 int package = OMAP_PACKAGE_CBS;
562
563 if (omap_rev() == OMAP4430_REV_ES1_0)
564 package = OMAP_PACKAGE_CBL;
Colin Cross21a42c92011-05-04 14:57:57 -0700565 omap4_mux_init(board_mux, NULL, package);
sricharanfc63de822010-11-08 19:26:11 +0530566
Panduranga Mallireddyb17e09792011-02-15 03:40:35 -0500567 if (wl12xx_set_platform_data(&omap_panda_wlan_data))
568 pr_err("error setting wl12xx data\n");
569
David Andersb075f582010-08-02 13:18:05 +0300570 omap4_panda_i2c_init();
Ricardo Salveti de Araujo3da434a2010-09-23 18:22:49 -0700571 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
Panduranga Mallireddyedc84062011-02-15 03:40:34 -0500572 platform_device_register(&omap_vwlan_device);
R Sricharan573efc22011-03-11 06:04:46 +0000573 board_serial_init();
David Andersb075f582010-08-02 13:18:05 +0300574 omap4_twl6030_hsmmc_init(mmc);
David Anders4415beb2010-10-07 19:36:30 +0000575 omap4_ehci_init();
Felipe Balbi1ea7f352010-12-01 13:48:54 +0200576 usb_musb_init(&musb_board_data);
K, Mythri P17c84ef2011-03-14 23:57:42 -0500577 omap4_panda_display_init();
David Andersb075f582010-08-02 13:18:05 +0300578}
579
580static void __init omap4_panda_map_io(void)
581{
582 omap2_set_globals_443x();
583 omap44xx_map_common_io();
584}
585
586MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
587 /* Maintainer: David Anders - Texas Instruments Inc */
David Andersb075f582010-08-02 13:18:05 +0300588 .boot_params = 0x80000100,
Raghuveer Murthyd920e522010-12-17 18:15:07 -0800589 .reserve = omap_reserve,
David Andersb075f582010-08-02 13:18:05 +0300590 .map_io = omap4_panda_map_io,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800591 .init_early = omap4_panda_init_early,
592 .init_irq = gic_init_irq,
David Andersb075f582010-08-02 13:18:05 +0300593 .init_machine = omap4_panda_init,
594 .timer = &omap_timer,
595MACHINE_END