blob: e5e8bbb003590c89ebce8591ad79c215f76da4a1 [file] [log] [blame]
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -07001/*
2 * Board support file for OMAP4430 SDP.
3 *
4 * Copyright (C) 2009 Texas Instruments
5 *
6 * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
7 *
8 * Based on mach-omap2/board-3430sdp.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/io.h>
19#include <linux/gpio.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080020#include <linux/usb/otg.h>
Abraham Arceb2aa5e52010-05-14 12:05:26 -070021#include <linux/spi/spi.h>
Balaji T K6e30a7d2010-05-12 08:27:30 +000022#include <linux/i2c/twl.h>
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -070023#include <linux/gpio_keys.h>
Balaji T K6e30a7d2010-05-12 08:27:30 +000024#include <linux/regulator/machine.h>
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -070025#include <linux/regulator/fixed.h>
Hemanth V509b6d92010-08-02 13:18:04 +030026#include <linux/leds.h>
Hemanth Vf389f4c2010-12-17 18:15:08 -080027#include <linux/leds_pwm.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070028
29#include <mach/hardware.h>
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070030#include <mach/omap4-common.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070031#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34
Tony Lindgrence491cf2009-10-20 09:40:47 -070035#include <plat/board.h>
36#include <plat/common.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080037#include <plat/usb.h>
kishore kadiyala717c1fb2010-05-15 18:21:06 +000038#include <plat/mmc.h>
Syed Rafiuddin59556762010-12-27 05:51:45 +000039#include <plat/omap4-keypad.h>
Tomi Valkeinena0b38cc2011-05-11 14:05:07 +030040#include <video/omapdss.h>
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -070041#include <linux/wl12xx.h>
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070042
Benoit Coussonfb6bf632010-08-10 17:43:15 +020043#include "mux.h"
kishore kadiyala717c1fb2010-05-15 18:21:06 +000044#include "hsmmc.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060045#include "control.h"
Mike Rapoportfbd80712011-04-25 01:09:06 +030046#include "common-board-devices.h"
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070047
Abraham Arceb2aa5e52010-05-14 12:05:26 -070048#define ETH_KS8851_IRQ 34
49#define ETH_KS8851_POWER_ON 48
50#define ETH_KS8851_QUART 138
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -070051#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
52#define OMAP4_SFH7741_ENABLE_GPIO 188
Mythri P K0425b482011-03-08 18:50:09 +053053#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
54#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
Abraham Arceb2aa5e52010-05-14 12:05:26 -070055
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -070056#define GPIO_WIFI_PMENA 54
57#define GPIO_WIFI_IRQ 53
58
Syed Rafiuddin59556762010-12-27 05:51:45 +000059static const int sdp4430_keymap[] = {
60 KEY(0, 0, KEY_E),
61 KEY(0, 1, KEY_R),
62 KEY(0, 2, KEY_T),
63 KEY(0, 3, KEY_HOME),
64 KEY(0, 4, KEY_F5),
65 KEY(0, 5, KEY_UNKNOWN),
66 KEY(0, 6, KEY_I),
67 KEY(0, 7, KEY_LEFTSHIFT),
68
69 KEY(1, 0, KEY_D),
70 KEY(1, 1, KEY_F),
71 KEY(1, 2, KEY_G),
72 KEY(1, 3, KEY_SEND),
73 KEY(1, 4, KEY_F6),
74 KEY(1, 5, KEY_UNKNOWN),
75 KEY(1, 6, KEY_K),
76 KEY(1, 7, KEY_ENTER),
77
78 KEY(2, 0, KEY_X),
79 KEY(2, 1, KEY_C),
80 KEY(2, 2, KEY_V),
81 KEY(2, 3, KEY_END),
82 KEY(2, 4, KEY_F7),
83 KEY(2, 5, KEY_UNKNOWN),
84 KEY(2, 6, KEY_DOT),
85 KEY(2, 7, KEY_CAPSLOCK),
86
87 KEY(3, 0, KEY_Z),
88 KEY(3, 1, KEY_KPPLUS),
89 KEY(3, 2, KEY_B),
90 KEY(3, 3, KEY_F1),
91 KEY(3, 4, KEY_F8),
92 KEY(3, 5, KEY_UNKNOWN),
93 KEY(3, 6, KEY_O),
94 KEY(3, 7, KEY_SPACE),
95
96 KEY(4, 0, KEY_W),
97 KEY(4, 1, KEY_Y),
98 KEY(4, 2, KEY_U),
99 KEY(4, 3, KEY_F2),
100 KEY(4, 4, KEY_VOLUMEUP),
101 KEY(4, 5, KEY_UNKNOWN),
102 KEY(4, 6, KEY_L),
103 KEY(4, 7, KEY_LEFT),
104
105 KEY(5, 0, KEY_S),
106 KEY(5, 1, KEY_H),
107 KEY(5, 2, KEY_J),
108 KEY(5, 3, KEY_F3),
109 KEY(5, 4, KEY_F9),
110 KEY(5, 5, KEY_VOLUMEDOWN),
111 KEY(5, 6, KEY_M),
112 KEY(5, 7, KEY_RIGHT),
113
114 KEY(6, 0, KEY_Q),
115 KEY(6, 1, KEY_A),
116 KEY(6, 2, KEY_N),
117 KEY(6, 3, KEY_BACK),
118 KEY(6, 4, KEY_BACKSPACE),
119 KEY(6, 5, KEY_UNKNOWN),
120 KEY(6, 6, KEY_P),
121 KEY(6, 7, KEY_UP),
122
123 KEY(7, 0, KEY_PROG1),
124 KEY(7, 1, KEY_PROG2),
125 KEY(7, 2, KEY_PROG3),
126 KEY(7, 3, KEY_PROG4),
127 KEY(7, 4, KEY_F4),
128 KEY(7, 5, KEY_UNKNOWN),
129 KEY(7, 6, KEY_OK),
130 KEY(7, 7, KEY_DOWN),
131};
132
133static struct matrix_keymap_data sdp4430_keymap_data = {
134 .keymap = sdp4430_keymap,
135 .keymap_size = ARRAY_SIZE(sdp4430_keymap),
136};
137
138static struct omap4_keypad_platform_data sdp4430_keypad_data = {
139 .keymap_data = &sdp4430_keymap_data,
140 .rows = 8,
141 .cols = 8,
142};
Hemanth V509b6d92010-08-02 13:18:04 +0300143static struct gpio_led sdp4430_gpio_leds[] = {
144 {
145 .name = "omap4:green:debug0",
146 .gpio = 61,
147 },
148 {
149 .name = "omap4:green:debug1",
150 .gpio = 30,
151 },
152 {
153 .name = "omap4:green:debug2",
154 .gpio = 7,
155 },
156 {
157 .name = "omap4:green:debug3",
158 .gpio = 8,
159 },
160 {
161 .name = "omap4:green:debug4",
162 .gpio = 50,
163 },
164 {
165 .name = "omap4:blue:user",
166 .gpio = 169,
167 },
168 {
169 .name = "omap4:red:user",
170 .gpio = 170,
171 },
172 {
173 .name = "omap4:green:user",
174 .gpio = 139,
175 },
176
177};
178
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700179static struct gpio_keys_button sdp4430_gpio_keys[] = {
180 {
181 .desc = "Proximity Sensor",
182 .type = EV_SW,
183 .code = SW_FRONT_PROXIMITY,
184 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
185 .active_low = 0,
186 }
187};
188
Hemanth V509b6d92010-08-02 13:18:04 +0300189static struct gpio_led_platform_data sdp4430_led_data = {
190 .leds = sdp4430_gpio_leds,
191 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
192};
193
Hemanth Vf389f4c2010-12-17 18:15:08 -0800194static struct led_pwm sdp4430_pwm_leds[] = {
195 {
196 .name = "omap4:green:chrg",
197 .pwm_id = 1,
198 .max_brightness = 255,
199 .pwm_period_ns = 7812500,
200 },
201};
202
203static struct led_pwm_platform_data sdp4430_pwm_data = {
204 .num_leds = ARRAY_SIZE(sdp4430_pwm_leds),
205 .leds = sdp4430_pwm_leds,
206};
207
208static struct platform_device sdp4430_leds_pwm = {
209 .name = "leds_pwm",
210 .id = -1,
211 .dev = {
212 .platform_data = &sdp4430_pwm_data,
213 },
214};
215
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700216static int omap_prox_activate(struct device *dev)
217{
218 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
219 return 0;
220}
221
222static void omap_prox_deactivate(struct device *dev)
223{
224 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
225}
226
227static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
228 .buttons = sdp4430_gpio_keys,
229 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
230 .enable = omap_prox_activate,
231 .disable = omap_prox_deactivate,
232};
233
234static struct platform_device sdp4430_gpio_keys_device = {
235 .name = "gpio-keys",
236 .id = -1,
237 .dev = {
238 .platform_data = &sdp4430_gpio_keys_data,
239 },
240};
241
Hemanth V509b6d92010-08-02 13:18:04 +0300242static struct platform_device sdp4430_leds_gpio = {
243 .name = "leds-gpio",
244 .id = -1,
245 .dev = {
246 .platform_data = &sdp4430_led_data,
247 },
248};
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700249static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
250 {
251 .modalias = "ks8851",
252 .bus_num = 1,
253 .chip_select = 0,
254 .max_speed_hz = 24000000,
255 .irq = ETH_KS8851_IRQ,
256 },
257};
258
Igor Grinbergbc593f52011-05-03 18:22:09 +0300259static struct gpio sdp4430_eth_gpios[] __initdata = {
260 { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" },
261 { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" },
262 { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" },
263};
264
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700265static int __init omap_ethernet_init(void)
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700266{
267 int status;
268
269 /* Request of GPIO lines */
Igor Grinbergbc593f52011-05-03 18:22:09 +0300270 status = gpio_request_array(sdp4430_eth_gpios,
271 ARRAY_SIZE(sdp4430_eth_gpios));
272 if (status)
273 pr_err("Cannot request ETH GPIOs\n");
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700274
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700275 return status;
276}
277
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700278static struct platform_device sdp4430_lcd_device = {
279 .name = "sdp4430_lcd",
280 .id = -1,
281};
282
283static struct platform_device *sdp4430_devices[] __initdata = {
284 &sdp4430_lcd_device,
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700285 &sdp4430_gpio_keys_device,
Hemanth V509b6d92010-08-02 13:18:04 +0300286 &sdp4430_leds_gpio,
Hemanth Vf389f4c2010-12-17 18:15:08 -0800287 &sdp4430_leds_pwm,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700288};
289
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700290static struct omap_lcd_config sdp4430_lcd_config __initdata = {
291 .ctrl_name = "internal",
292};
293
294static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700295 { OMAP_TAG_LCD, &sdp4430_lcd_config },
296};
297
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800298static void __init omap_4430sdp_init_early(void)
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700299{
Paul Walmsley48057342010-12-21 15:25:10 -0700300 omap2_init_common_infrastructure();
301 omap2_init_common_devices(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700302}
303
Maulik Mankadbce06682010-02-17 14:09:32 -0800304static struct omap_musb_board_data musb_board_data = {
305 .interface_type = MUSB_INTERFACE_UTMI,
Hema HK09e72002010-12-10 18:11:42 +0530306 .mode = MUSB_OTG,
Maulik Mankadbce06682010-02-17 14:09:32 -0800307 .power = 100,
308};
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000309
Hema HKe70357e2010-12-10 18:09:52 +0530310static struct twl4030_usb_data omap4_usbphy_data = {
311 .phy_init = omap4430_phy_init,
312 .phy_exit = omap4430_phy_exit,
313 .phy_power = omap4430_phy_power,
314 .phy_set_clock = omap4430_phy_set_clk,
Hema HKee896e32011-02-17 12:06:07 +0530315 .phy_suspend = omap4430_phy_suspend,
Hema HKe70357e2010-12-10 18:09:52 +0530316};
317
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000318static struct omap2_hsmmc_info mmc[] = {
319 {
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000320 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000321 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000322 .gpio_cd = -EINVAL,
323 .gpio_wp = -EINVAL,
324 .nonremovable = true,
kishore kadiyala64be9782010-10-01 16:35:28 -0700325 .ocr_mask = MMC_VDD_29_30,
Balaji T Kb1c1df72011-05-30 19:55:34 +0530326 .no_off_init = true,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000327 },
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530328 {
329 .mmc = 1,
330 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Silesh C V27a69d72011-07-05 03:38:23 -0700331 .gpio_cd = -EINVAL,
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530332 .gpio_wp = -EINVAL,
333 },
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -0700334 {
335 .mmc = 5,
336 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
337 .gpio_cd = -EINVAL,
338 .gpio_wp = -EINVAL,
339 .ocr_mask = MMC_VDD_165_195,
340 .nonremovable = true,
341 },
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000342 {} /* Terminator */
343};
344
Santosh Shilimkar50263912010-08-02 13:18:03 +0300345static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
Oleg Drokin786b01a2011-06-06 18:57:07 +0000346 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
Santosh Shilimkar50263912010-08-02 13:18:03 +0300347};
Oleg Drokin786b01a2011-06-06 18:57:07 +0000348
Balaji T K6e30a7d2010-05-12 08:27:30 +0000349static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
Oleg Drokin786b01a2011-06-06 18:57:07 +0000350 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
Balaji T K6e30a7d2010-05-12 08:27:30 +0000351};
352
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -0700353static struct regulator_consumer_supply omap4_sdp4430_vmmc5_supply = {
354 .supply = "vmmc",
355 .dev_name = "omap_hsmmc.4",
356};
357
358static struct regulator_init_data sdp4430_vmmc5 = {
359 .constraints = {
360 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
361 },
362 .num_consumer_supplies = 1,
363 .consumer_supplies = &omap4_sdp4430_vmmc5_supply,
364};
365
366static struct fixed_voltage_config sdp4430_vwlan = {
367 .supply_name = "vwl1271",
368 .microvolts = 1800000, /* 1.8V */
369 .gpio = GPIO_WIFI_PMENA,
370 .startup_delay = 70000, /* 70msec */
371 .enable_high = 1,
372 .enabled_at_boot = 0,
373 .init_data = &sdp4430_vmmc5,
374};
375
376static struct platform_device omap_vwlan_device = {
377 .name = "reg-fixed-voltage",
378 .id = 1,
379 .dev = {
380 .platform_data = &sdp4430_vwlan,
381 },
382};
383
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000384static int omap4_twl6030_hsmmc_late_init(struct device *dev)
385{
386 int ret = 0;
387 struct platform_device *pdev = container_of(dev,
388 struct platform_device, dev);
389 struct omap_mmc_platform_data *pdata = dev->platform_data;
390
391 /* Setting MMC1 Card detect Irq */
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000392 if (pdev->id == 0) {
393 ret = twl6030_mmc_card_detect_config();
394 if (ret)
395 pr_err("Failed configuring MMC1 card detect\n");
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000396 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
397 MMCDETECT_INTR_OFFSET;
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000398 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
399 }
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000400 return ret;
401}
402
403static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
404{
Benoit Cousson531c21b2010-10-01 16:35:26 -0700405 struct omap_mmc_platform_data *pdata;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000406
Benoit Cousson531c21b2010-10-01 16:35:26 -0700407 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
408 if (!dev) {
409 pr_err("Failed %s\n", __func__);
410 return;
411 }
412 pdata = dev->platform_data;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000413 pdata->init = omap4_twl6030_hsmmc_late_init;
414}
415
416static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
417{
418 struct omap2_hsmmc_info *c;
419
420 omap2_hsmmc_init(controllers);
421 for (c = controllers; c->mmc; c++)
422 omap4_twl6030_hsmmc_set_late_init(c->dev);
423
424 return 0;
425}
426
Balaji T K6e30a7d2010-05-12 08:27:30 +0000427static struct regulator_init_data sdp4430_vaux1 = {
428 .constraints = {
429 .min_uV = 1000000,
430 .max_uV = 3000000,
431 .apply_uV = true,
432 .valid_modes_mask = REGULATOR_MODE_NORMAL
433 | REGULATOR_MODE_STANDBY,
434 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
435 | REGULATOR_CHANGE_MODE
436 | REGULATOR_CHANGE_STATUS,
437 },
Oleg Drokin786b01a2011-06-06 18:57:07 +0000438 .num_consumer_supplies = ARRAY_SIZE(sdp4430_vaux_supply),
Santosh Shilimkar50263912010-08-02 13:18:03 +0300439 .consumer_supplies = sdp4430_vaux_supply,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000440};
441
442static struct regulator_init_data sdp4430_vaux2 = {
443 .constraints = {
444 .min_uV = 1200000,
445 .max_uV = 2800000,
446 .apply_uV = true,
447 .valid_modes_mask = REGULATOR_MODE_NORMAL
448 | REGULATOR_MODE_STANDBY,
449 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
450 | REGULATOR_CHANGE_MODE
451 | REGULATOR_CHANGE_STATUS,
452 },
453};
454
455static struct regulator_init_data sdp4430_vaux3 = {
456 .constraints = {
457 .min_uV = 1000000,
458 .max_uV = 3000000,
459 .apply_uV = true,
460 .valid_modes_mask = REGULATOR_MODE_NORMAL
461 | REGULATOR_MODE_STANDBY,
462 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
463 | REGULATOR_CHANGE_MODE
464 | REGULATOR_CHANGE_STATUS,
465 },
466};
467
468/* VMMC1 for MMC1 card */
469static struct regulator_init_data sdp4430_vmmc = {
470 .constraints = {
471 .min_uV = 1200000,
472 .max_uV = 3000000,
473 .apply_uV = true,
474 .valid_modes_mask = REGULATOR_MODE_NORMAL
475 | REGULATOR_MODE_STANDBY,
476 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
477 | REGULATOR_CHANGE_MODE
478 | REGULATOR_CHANGE_STATUS,
479 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300480 .num_consumer_supplies = 1,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000481 .consumer_supplies = sdp4430_vmmc_supply,
482};
483
484static struct regulator_init_data sdp4430_vpp = {
485 .constraints = {
486 .min_uV = 1800000,
487 .max_uV = 2500000,
488 .apply_uV = true,
489 .valid_modes_mask = REGULATOR_MODE_NORMAL
490 | REGULATOR_MODE_STANDBY,
491 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
492 | REGULATOR_CHANGE_MODE
493 | REGULATOR_CHANGE_STATUS,
494 },
495};
496
497static struct regulator_init_data sdp4430_vusim = {
498 .constraints = {
499 .min_uV = 1200000,
500 .max_uV = 2900000,
501 .apply_uV = true,
502 .valid_modes_mask = REGULATOR_MODE_NORMAL
503 | REGULATOR_MODE_STANDBY,
504 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
505 | REGULATOR_CHANGE_MODE
506 | REGULATOR_CHANGE_STATUS,
507 },
508};
509
510static struct regulator_init_data sdp4430_vana = {
511 .constraints = {
512 .min_uV = 2100000,
513 .max_uV = 2100000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000514 .valid_modes_mask = REGULATOR_MODE_NORMAL
515 | REGULATOR_MODE_STANDBY,
516 .valid_ops_mask = REGULATOR_CHANGE_MODE
517 | REGULATOR_CHANGE_STATUS,
518 },
519};
520
521static struct regulator_init_data sdp4430_vcxio = {
522 .constraints = {
523 .min_uV = 1800000,
524 .max_uV = 1800000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000525 .valid_modes_mask = REGULATOR_MODE_NORMAL
526 | REGULATOR_MODE_STANDBY,
527 .valid_ops_mask = REGULATOR_CHANGE_MODE
528 | REGULATOR_CHANGE_STATUS,
529 },
530};
531
532static struct regulator_init_data sdp4430_vdac = {
533 .constraints = {
534 .min_uV = 1800000,
535 .max_uV = 1800000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000536 .valid_modes_mask = REGULATOR_MODE_NORMAL
537 | REGULATOR_MODE_STANDBY,
538 .valid_ops_mask = REGULATOR_CHANGE_MODE
539 | REGULATOR_CHANGE_STATUS,
540 },
541};
542
543static struct regulator_init_data sdp4430_vusb = {
544 .constraints = {
545 .min_uV = 3300000,
546 .max_uV = 3300000,
547 .apply_uV = true,
548 .valid_modes_mask = REGULATOR_MODE_NORMAL
549 | REGULATOR_MODE_STANDBY,
550 .valid_ops_mask = REGULATOR_CHANGE_MODE
551 | REGULATOR_CHANGE_STATUS,
552 },
553};
554
Balaji T K8af1b0d2011-02-10 18:45:26 +0530555static struct regulator_init_data sdp4430_clk32kg = {
556 .constraints = {
557 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -0700558 .always_on = true,
Balaji T K8af1b0d2011-02-10 18:45:26 +0530559 },
560};
561
Balaji T K6e30a7d2010-05-12 08:27:30 +0000562static struct twl4030_platform_data sdp4430_twldata = {
563 .irq_base = TWL6030_IRQ_BASE,
564 .irq_end = TWL6030_IRQ_END,
565
566 /* Regulators */
567 .vmmc = &sdp4430_vmmc,
568 .vpp = &sdp4430_vpp,
569 .vusim = &sdp4430_vusim,
570 .vana = &sdp4430_vana,
571 .vcxio = &sdp4430_vcxio,
572 .vdac = &sdp4430_vdac,
573 .vusb = &sdp4430_vusb,
574 .vaux1 = &sdp4430_vaux1,
575 .vaux2 = &sdp4430_vaux2,
576 .vaux3 = &sdp4430_vaux3,
Balaji T K8af1b0d2011-02-10 18:45:26 +0530577 .clk32kg = &sdp4430_clk32kg,
Hema HKe70357e2010-12-10 18:09:52 +0530578 .usb = &omap4_usbphy_data
Balaji T K6e30a7d2010-05-12 08:27:30 +0000579};
580
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300581static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
582 {
583 I2C_BOARD_INFO("tmp105", 0x48),
584 },
Hemanth Vd048aca2010-12-17 18:15:08 -0800585 {
586 I2C_BOARD_INFO("bh1780", 0x29),
587 },
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300588};
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700589static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
590 {
591 I2C_BOARD_INFO("hmc5843", 0x1e),
592 },
593};
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000594static int __init omap4_i2c_init(void)
595{
Mike Rapoportfbd80712011-04-25 01:09:06 +0300596 omap4_pmic_init("twl6030", &sdp4430_twldata);
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000597 omap_register_i2c_bus(2, 400, NULL, 0);
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300598 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
599 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700600 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
601 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000602 return 0;
603}
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700604
605static void __init omap_sfh7741prox_init(void)
606{
Igor Grinbergbc593f52011-05-03 18:22:09 +0300607 int error;
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700608
Igor Grinbergbc593f52011-05-03 18:22:09 +0300609 error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
610 GPIOF_OUT_INIT_LOW, "sfh7741");
611 if (error < 0)
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700612 pr_err("%s:failed to request GPIO %d, error %d\n",
613 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700614}
615
Mythri P K0425b482011-03-08 18:50:09 +0530616static void sdp4430_hdmi_mux_init(void)
617{
618 /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
619 omap_mux_init_signal("hdmi_hpd",
620 OMAP_PIN_INPUT_PULLUP);
621 omap_mux_init_signal("hdmi_cec",
622 OMAP_PIN_INPUT_PULLUP);
623 /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
624 omap_mux_init_signal("hdmi_ddc_scl",
625 OMAP_PIN_INPUT_PULLUP);
626 omap_mux_init_signal("hdmi_ddc_sda",
627 OMAP_PIN_INPUT_PULLUP);
628}
629
Igor Grinbergbc593f52011-05-03 18:22:09 +0300630static struct gpio sdp4430_hdmi_gpios[] = {
631 { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" },
632 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
633};
634
Mythri P K0425b482011-03-08 18:50:09 +0530635static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
636{
637 int status;
638
Igor Grinbergbc593f52011-05-03 18:22:09 +0300639 status = gpio_request_array(sdp4430_hdmi_gpios,
640 ARRAY_SIZE(sdp4430_hdmi_gpios));
641 if (status)
642 pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
Mythri P K0425b482011-03-08 18:50:09 +0530643
644 return status;
645}
646
647static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
648{
649 gpio_free(HDMI_GPIO_LS_OE);
650 gpio_free(HDMI_GPIO_HPD);
651}
652
653static struct omap_dss_device sdp4430_hdmi_device = {
654 .name = "hdmi",
655 .driver_name = "hdmi_panel",
656 .type = OMAP_DISPLAY_TYPE_HDMI,
Archit Taneja6cb07b22011-04-12 13:52:25 +0530657 .clocks = {
658 .dispc = {
659 .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
660 },
661 .hdmi = {
662 .regn = 15,
663 .regm2 = 1,
664 },
665 },
Mythri P K0425b482011-03-08 18:50:09 +0530666 .platform_enable = sdp4430_panel_enable_hdmi,
667 .platform_disable = sdp4430_panel_disable_hdmi,
668 .channel = OMAP_DSS_CHANNEL_DIGIT,
669};
670
671static struct omap_dss_device *sdp4430_dss_devices[] = {
672 &sdp4430_hdmi_device,
673};
674
675static struct omap_dss_board_info sdp4430_dss_data = {
676 .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
677 .devices = sdp4430_dss_devices,
678 .default_device = &sdp4430_hdmi_device,
679};
680
681void omap_4430sdp_display_init(void)
682{
683 sdp4430_hdmi_mux_init();
684 omap_display_init(&sdp4430_dss_data);
685}
686
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200687#ifdef CONFIG_OMAP_MUX
688static struct omap_board_mux board_mux[] __initdata = {
Tony Lindgren7d4ca852011-01-11 15:31:45 -0800689 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200690 { .reg_offset = OMAP_MUX_TERMINATOR },
691};
R Sricharandae33522011-03-11 06:04:44 +0000692
693static struct omap_device_pad serial2_pads[] __initdata = {
694 OMAP_MUX_STATIC("uart2_cts.uart2_cts",
695 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
696 OMAP_MUX_STATIC("uart2_rts.uart2_rts",
697 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
698 OMAP_MUX_STATIC("uart2_rx.uart2_rx",
699 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
700 OMAP_MUX_STATIC("uart2_tx.uart2_tx",
701 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
702};
703
704static struct omap_device_pad serial3_pads[] __initdata = {
705 OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
706 OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
707 OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
708 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
709 OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
710 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
711 OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
712 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
713};
714
715static struct omap_device_pad serial4_pads[] __initdata = {
716 OMAP_MUX_STATIC("uart4_rx.uart4_rx",
717 OMAP_PIN_INPUT | OMAP_MUX_MODE0),
718 OMAP_MUX_STATIC("uart4_tx.uart4_tx",
719 OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
720};
721
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700722static struct omap_board_data serial2_data __initdata = {
R Sricharandae33522011-03-11 06:04:44 +0000723 .id = 1,
724 .pads = serial2_pads,
725 .pads_cnt = ARRAY_SIZE(serial2_pads),
726};
727
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700728static struct omap_board_data serial3_data __initdata = {
R Sricharandae33522011-03-11 06:04:44 +0000729 .id = 2,
730 .pads = serial3_pads,
731 .pads_cnt = ARRAY_SIZE(serial3_pads),
732};
733
Santosh Shilimkar89c47052011-05-30 00:11:45 -0700734static struct omap_board_data serial4_data __initdata = {
R Sricharandae33522011-03-11 06:04:44 +0000735 .id = 3,
736 .pads = serial4_pads,
737 .pads_cnt = ARRAY_SIZE(serial4_pads),
738};
739
740static inline void board_serial_init(void)
741{
742 struct omap_board_data bdata;
743 bdata.flags = 0;
744 bdata.pads = NULL;
745 bdata.pads_cnt = 0;
746 bdata.id = 0;
747 /* pass dummy data for UART1 */
748 omap_serial_init_port(&bdata);
749
750 omap_serial_init_port(&serial2_data);
751 omap_serial_init_port(&serial3_data);
752 omap_serial_init_port(&serial4_data);
753}
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200754#else
755#define board_mux NULL
R Sricharandae33522011-03-11 06:04:44 +0000756
757static inline void board_serial_init(void)
758{
759 omap_serial_init();
760}
761 #endif
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200762
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -0700763static void omap4_sdp4430_wifi_mux_init(void)
764{
765 omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT |
766 OMAP_PIN_OFF_WAKEUPENABLE);
767 omap_mux_init_gpio(GPIO_WIFI_PMENA, OMAP_PIN_OUTPUT);
768
769 omap_mux_init_signal("sdmmc5_cmd.sdmmc5_cmd",
770 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
771 omap_mux_init_signal("sdmmc5_clk.sdmmc5_clk",
772 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
773 omap_mux_init_signal("sdmmc5_dat0.sdmmc5_dat0",
774 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
775 omap_mux_init_signal("sdmmc5_dat1.sdmmc5_dat1",
776 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
777 omap_mux_init_signal("sdmmc5_dat2.sdmmc5_dat2",
778 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
779 omap_mux_init_signal("sdmmc5_dat3.sdmmc5_dat3",
780 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
781
782}
783
784static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
785 .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
786 .board_ref_clock = WL12XX_REFCLOCK_26,
787 .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
788};
789
790static void omap4_sdp4430_wifi_init(void)
791{
792 omap4_sdp4430_wifi_mux_init();
793 if (wl12xx_set_platform_data(&omap4_sdp4430_wlan_data))
794 pr_err("Error setting wl12xx data\n");
795 platform_device_register(&omap_vwlan_device);
796}
797
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700798static void __init omap_4430sdp_init(void)
799{
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700800 int status;
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200801 int package = OMAP_PACKAGE_CBS;
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700802
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200803 if (omap_rev() == OMAP4430_REV_ES1_0)
804 package = OMAP_PACKAGE_CBL;
Colin Cross21a42c92011-05-04 14:57:57 -0700805 omap4_mux_init(board_mux, NULL, package);
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200806
Tony Lindgrene41cccf2011-02-24 14:36:03 -0800807 omap_board_config = sdp4430_config;
808 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
809
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000810 omap4_i2c_init();
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700811 omap_sfh7741prox_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700812 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
R Sricharandae33522011-03-11 06:04:44 +0000813 board_serial_init();
Vishal Mahaveer6de8bae2011-07-05 03:38:23 -0700814 omap4_sdp4430_wifi_init();
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000815 omap4_twl6030_hsmmc_init(mmc);
Keshava Munegowda6aa85a52010-11-21 23:23:42 +0530816
Felipe Balbi46960842010-12-07 09:57:59 +0200817 usb_musb_init(&musb_board_data);
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700818
819 status = omap_ethernet_init();
820 if (status) {
821 pr_err("Ethernet initialization failed: %d\n", status);
822 } else {
823 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
824 spi_register_board_info(sdp4430_spi_board_info,
825 ARRAY_SIZE(sdp4430_spi_board_info));
826 }
Syed Rafiuddin59556762010-12-27 05:51:45 +0000827
828 status = omap4_keyboard_init(&sdp4430_keypad_data);
829 if (status)
830 pr_err("Keypad initialization failed: %d\n", status);
Mythri P K0425b482011-03-08 18:50:09 +0530831
832 omap_4430sdp_display_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700833}
834
835static void __init omap_4430sdp_map_io(void)
836{
837 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800838 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700839}
840
841MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
842 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700843 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100844 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800845 .map_io = omap_4430sdp_map_io,
846 .init_early = omap_4430sdp_init_early,
847 .init_irq = gic_init_irq,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700848 .init_machine = omap_4430sdp_init,
Tony Lindgrene74984e2011-03-29 15:54:48 -0700849 .timer = &omap4_timer,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700850MACHINE_END