blob: f5fcc5f2258da5dd5a0fdc3033bd54b9c2415ec0 [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>
Hemanth V509b6d92010-08-02 13:18:04 +030025#include <linux/leds.h>
Hemanth Vf389f4c2010-12-17 18:15:08 -080026#include <linux/leds_pwm.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070027
28#include <mach/hardware.h>
Santosh Shilimkarfbc9be12010-05-14 12:05:26 -070029#include <mach/omap4-common.h>
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070030#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33
Tony Lindgrence491cf2009-10-20 09:40:47 -070034#include <plat/board.h>
35#include <plat/common.h>
Maulik Mankadbce06682010-02-17 14:09:32 -080036#include <plat/usb.h>
kishore kadiyala717c1fb2010-05-15 18:21:06 +000037#include <plat/mmc.h>
Syed Rafiuddin59556762010-12-27 05:51:45 +000038#include <plat/omap4-keypad.h>
Mythri P K0425b482011-03-08 18:50:09 +053039#include <plat/display.h>
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070040
Benoit Coussonfb6bf632010-08-10 17:43:15 +020041#include "mux.h"
kishore kadiyala717c1fb2010-05-15 18:21:06 +000042#include "hsmmc.h"
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070043#include "timer-gp.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060044#include "control.h"
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -070045
Abraham Arceb2aa5e52010-05-14 12:05:26 -070046#define ETH_KS8851_IRQ 34
47#define ETH_KS8851_POWER_ON 48
48#define ETH_KS8851_QUART 138
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -070049#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
50#define OMAP4_SFH7741_ENABLE_GPIO 188
Mythri P K0425b482011-03-08 18:50:09 +053051#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
52#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
Abraham Arceb2aa5e52010-05-14 12:05:26 -070053
Syed Rafiuddin59556762010-12-27 05:51:45 +000054static const int sdp4430_keymap[] = {
55 KEY(0, 0, KEY_E),
56 KEY(0, 1, KEY_R),
57 KEY(0, 2, KEY_T),
58 KEY(0, 3, KEY_HOME),
59 KEY(0, 4, KEY_F5),
60 KEY(0, 5, KEY_UNKNOWN),
61 KEY(0, 6, KEY_I),
62 KEY(0, 7, KEY_LEFTSHIFT),
63
64 KEY(1, 0, KEY_D),
65 KEY(1, 1, KEY_F),
66 KEY(1, 2, KEY_G),
67 KEY(1, 3, KEY_SEND),
68 KEY(1, 4, KEY_F6),
69 KEY(1, 5, KEY_UNKNOWN),
70 KEY(1, 6, KEY_K),
71 KEY(1, 7, KEY_ENTER),
72
73 KEY(2, 0, KEY_X),
74 KEY(2, 1, KEY_C),
75 KEY(2, 2, KEY_V),
76 KEY(2, 3, KEY_END),
77 KEY(2, 4, KEY_F7),
78 KEY(2, 5, KEY_UNKNOWN),
79 KEY(2, 6, KEY_DOT),
80 KEY(2, 7, KEY_CAPSLOCK),
81
82 KEY(3, 0, KEY_Z),
83 KEY(3, 1, KEY_KPPLUS),
84 KEY(3, 2, KEY_B),
85 KEY(3, 3, KEY_F1),
86 KEY(3, 4, KEY_F8),
87 KEY(3, 5, KEY_UNKNOWN),
88 KEY(3, 6, KEY_O),
89 KEY(3, 7, KEY_SPACE),
90
91 KEY(4, 0, KEY_W),
92 KEY(4, 1, KEY_Y),
93 KEY(4, 2, KEY_U),
94 KEY(4, 3, KEY_F2),
95 KEY(4, 4, KEY_VOLUMEUP),
96 KEY(4, 5, KEY_UNKNOWN),
97 KEY(4, 6, KEY_L),
98 KEY(4, 7, KEY_LEFT),
99
100 KEY(5, 0, KEY_S),
101 KEY(5, 1, KEY_H),
102 KEY(5, 2, KEY_J),
103 KEY(5, 3, KEY_F3),
104 KEY(5, 4, KEY_F9),
105 KEY(5, 5, KEY_VOLUMEDOWN),
106 KEY(5, 6, KEY_M),
107 KEY(5, 7, KEY_RIGHT),
108
109 KEY(6, 0, KEY_Q),
110 KEY(6, 1, KEY_A),
111 KEY(6, 2, KEY_N),
112 KEY(6, 3, KEY_BACK),
113 KEY(6, 4, KEY_BACKSPACE),
114 KEY(6, 5, KEY_UNKNOWN),
115 KEY(6, 6, KEY_P),
116 KEY(6, 7, KEY_UP),
117
118 KEY(7, 0, KEY_PROG1),
119 KEY(7, 1, KEY_PROG2),
120 KEY(7, 2, KEY_PROG3),
121 KEY(7, 3, KEY_PROG4),
122 KEY(7, 4, KEY_F4),
123 KEY(7, 5, KEY_UNKNOWN),
124 KEY(7, 6, KEY_OK),
125 KEY(7, 7, KEY_DOWN),
126};
127
128static struct matrix_keymap_data sdp4430_keymap_data = {
129 .keymap = sdp4430_keymap,
130 .keymap_size = ARRAY_SIZE(sdp4430_keymap),
131};
132
133static struct omap4_keypad_platform_data sdp4430_keypad_data = {
134 .keymap_data = &sdp4430_keymap_data,
135 .rows = 8,
136 .cols = 8,
137};
Hemanth V509b6d92010-08-02 13:18:04 +0300138static struct gpio_led sdp4430_gpio_leds[] = {
139 {
140 .name = "omap4:green:debug0",
141 .gpio = 61,
142 },
143 {
144 .name = "omap4:green:debug1",
145 .gpio = 30,
146 },
147 {
148 .name = "omap4:green:debug2",
149 .gpio = 7,
150 },
151 {
152 .name = "omap4:green:debug3",
153 .gpio = 8,
154 },
155 {
156 .name = "omap4:green:debug4",
157 .gpio = 50,
158 },
159 {
160 .name = "omap4:blue:user",
161 .gpio = 169,
162 },
163 {
164 .name = "omap4:red:user",
165 .gpio = 170,
166 },
167 {
168 .name = "omap4:green:user",
169 .gpio = 139,
170 },
171
172};
173
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700174static struct gpio_keys_button sdp4430_gpio_keys[] = {
175 {
176 .desc = "Proximity Sensor",
177 .type = EV_SW,
178 .code = SW_FRONT_PROXIMITY,
179 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
180 .active_low = 0,
181 }
182};
183
Hemanth V509b6d92010-08-02 13:18:04 +0300184static struct gpio_led_platform_data sdp4430_led_data = {
185 .leds = sdp4430_gpio_leds,
186 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
187};
188
Hemanth Vf389f4c2010-12-17 18:15:08 -0800189static struct led_pwm sdp4430_pwm_leds[] = {
190 {
191 .name = "omap4:green:chrg",
192 .pwm_id = 1,
193 .max_brightness = 255,
194 .pwm_period_ns = 7812500,
195 },
196};
197
198static struct led_pwm_platform_data sdp4430_pwm_data = {
199 .num_leds = ARRAY_SIZE(sdp4430_pwm_leds),
200 .leds = sdp4430_pwm_leds,
201};
202
203static struct platform_device sdp4430_leds_pwm = {
204 .name = "leds_pwm",
205 .id = -1,
206 .dev = {
207 .platform_data = &sdp4430_pwm_data,
208 },
209};
210
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700211static int omap_prox_activate(struct device *dev)
212{
213 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
214 return 0;
215}
216
217static void omap_prox_deactivate(struct device *dev)
218{
219 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
220}
221
222static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
223 .buttons = sdp4430_gpio_keys,
224 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
225 .enable = omap_prox_activate,
226 .disable = omap_prox_deactivate,
227};
228
229static struct platform_device sdp4430_gpio_keys_device = {
230 .name = "gpio-keys",
231 .id = -1,
232 .dev = {
233 .platform_data = &sdp4430_gpio_keys_data,
234 },
235};
236
Hemanth V509b6d92010-08-02 13:18:04 +0300237static struct platform_device sdp4430_leds_gpio = {
238 .name = "leds-gpio",
239 .id = -1,
240 .dev = {
241 .platform_data = &sdp4430_led_data,
242 },
243};
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700244static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
245 {
246 .modalias = "ks8851",
247 .bus_num = 1,
248 .chip_select = 0,
249 .max_speed_hz = 24000000,
250 .irq = ETH_KS8851_IRQ,
251 },
252};
253
254static int omap_ethernet_init(void)
255{
256 int status;
257
258 /* Request of GPIO lines */
259
260 status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
261 if (status) {
262 pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
263 return status;
264 }
265
266 status = gpio_request(ETH_KS8851_QUART, "quart");
267 if (status) {
268 pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
269 goto error1;
270 }
271
272 status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
273 if (status) {
274 pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
275 goto error2;
276 }
277
278 /* Configuration of requested GPIO lines */
279
280 status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
281 if (status) {
282 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
283 goto error3;
284 }
285
286 status = gpio_direction_output(ETH_KS8851_QUART, 1);
287 if (status) {
288 pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
289 goto error3;
290 }
291
292 status = gpio_direction_input(ETH_KS8851_IRQ);
293 if (status) {
294 pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
295 goto error3;
296 }
297
298 return 0;
299
300error3:
301 gpio_free(ETH_KS8851_IRQ);
302error2:
303 gpio_free(ETH_KS8851_QUART);
304error1:
305 gpio_free(ETH_KS8851_POWER_ON);
306 return status;
307}
308
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700309static struct platform_device sdp4430_lcd_device = {
310 .name = "sdp4430_lcd",
311 .id = -1,
312};
313
314static struct platform_device *sdp4430_devices[] __initdata = {
315 &sdp4430_lcd_device,
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700316 &sdp4430_gpio_keys_device,
Hemanth V509b6d92010-08-02 13:18:04 +0300317 &sdp4430_leds_gpio,
Hemanth Vf389f4c2010-12-17 18:15:08 -0800318 &sdp4430_leds_pwm,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700319};
320
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700321static struct omap_lcd_config sdp4430_lcd_config __initdata = {
322 .ctrl_name = "internal",
323};
324
325static struct omap_board_config_kernel sdp4430_config[] __initdata = {
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700326 { OMAP_TAG_LCD, &sdp4430_lcd_config },
327};
328
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800329static void __init omap_4430sdp_init_early(void)
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700330{
Paul Walmsley48057342010-12-21 15:25:10 -0700331 omap2_init_common_infrastructure();
332 omap2_init_common_devices(NULL, NULL);
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700333#ifdef CONFIG_OMAP_32K_TIMER
334 omap2_gp_clockevent_set_gptimer(1);
335#endif
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700336}
337
Maulik Mankadbce06682010-02-17 14:09:32 -0800338static struct omap_musb_board_data musb_board_data = {
339 .interface_type = MUSB_INTERFACE_UTMI,
Hema HK09e72002010-12-10 18:11:42 +0530340 .mode = MUSB_OTG,
Maulik Mankadbce06682010-02-17 14:09:32 -0800341 .power = 100,
342};
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000343
Hema HKe70357e2010-12-10 18:09:52 +0530344static struct twl4030_usb_data omap4_usbphy_data = {
345 .phy_init = omap4430_phy_init,
346 .phy_exit = omap4430_phy_exit,
347 .phy_power = omap4430_phy_power,
348 .phy_set_clock = omap4430_phy_set_clk,
349};
350
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000351static struct omap2_hsmmc_info mmc[] = {
352 {
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000353 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000354 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000355 .gpio_cd = -EINVAL,
356 .gpio_wp = -EINVAL,
357 .nonremovable = true,
kishore kadiyala64be9782010-10-01 16:35:28 -0700358 .ocr_mask = MMC_VDD_29_30,
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000359 },
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530360 {
361 .mmc = 1,
362 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
363 .gpio_wp = -EINVAL,
364 },
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000365 {} /* Terminator */
366};
367
Santosh Shilimkar50263912010-08-02 13:18:03 +0300368static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
369 {
370 .supply = "vmmc",
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530371 .dev_name = "omap_hsmmc.1",
Santosh Shilimkar50263912010-08-02 13:18:03 +0300372 },
373};
Balaji T K6e30a7d2010-05-12 08:27:30 +0000374static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
375 {
376 .supply = "vmmc",
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530377 .dev_name = "omap_hsmmc.0",
Balaji T K6e30a7d2010-05-12 08:27:30 +0000378 },
Balaji T K6e30a7d2010-05-12 08:27:30 +0000379};
380
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000381static int omap4_twl6030_hsmmc_late_init(struct device *dev)
382{
383 int ret = 0;
384 struct platform_device *pdev = container_of(dev,
385 struct platform_device, dev);
386 struct omap_mmc_platform_data *pdata = dev->platform_data;
387
388 /* Setting MMC1 Card detect Irq */
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000389 if (pdev->id == 0) {
390 ret = twl6030_mmc_card_detect_config();
391 if (ret)
392 pr_err("Failed configuring MMC1 card detect\n");
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000393 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
394 MMCDETECT_INTR_OFFSET;
kishore kadiyala72f2e2c2010-09-24 17:13:20 +0000395 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
396 }
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000397 return ret;
398}
399
400static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
401{
Benoit Cousson531c21b2010-10-01 16:35:26 -0700402 struct omap_mmc_platform_data *pdata;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000403
Benoit Cousson531c21b2010-10-01 16:35:26 -0700404 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
405 if (!dev) {
406 pr_err("Failed %s\n", __func__);
407 return;
408 }
409 pdata = dev->platform_data;
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000410 pdata->init = omap4_twl6030_hsmmc_late_init;
411}
412
413static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
414{
415 struct omap2_hsmmc_info *c;
416
417 omap2_hsmmc_init(controllers);
418 for (c = controllers; c->mmc; c++)
419 omap4_twl6030_hsmmc_set_late_init(c->dev);
420
421 return 0;
422}
423
Balaji T K6e30a7d2010-05-12 08:27:30 +0000424static struct regulator_init_data sdp4430_vaux1 = {
425 .constraints = {
426 .min_uV = 1000000,
427 .max_uV = 3000000,
428 .apply_uV = true,
429 .valid_modes_mask = REGULATOR_MODE_NORMAL
430 | REGULATOR_MODE_STANDBY,
431 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
432 | REGULATOR_CHANGE_MODE
433 | REGULATOR_CHANGE_STATUS,
434 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300435 .num_consumer_supplies = 1,
436 .consumer_supplies = sdp4430_vaux_supply,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000437};
438
439static struct regulator_init_data sdp4430_vaux2 = {
440 .constraints = {
441 .min_uV = 1200000,
442 .max_uV = 2800000,
443 .apply_uV = true,
444 .valid_modes_mask = REGULATOR_MODE_NORMAL
445 | REGULATOR_MODE_STANDBY,
446 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
447 | REGULATOR_CHANGE_MODE
448 | REGULATOR_CHANGE_STATUS,
449 },
450};
451
452static struct regulator_init_data sdp4430_vaux3 = {
453 .constraints = {
454 .min_uV = 1000000,
455 .max_uV = 3000000,
456 .apply_uV = true,
457 .valid_modes_mask = REGULATOR_MODE_NORMAL
458 | REGULATOR_MODE_STANDBY,
459 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
460 | REGULATOR_CHANGE_MODE
461 | REGULATOR_CHANGE_STATUS,
462 },
463};
464
465/* VMMC1 for MMC1 card */
466static struct regulator_init_data sdp4430_vmmc = {
467 .constraints = {
468 .min_uV = 1200000,
469 .max_uV = 3000000,
470 .apply_uV = true,
471 .valid_modes_mask = REGULATOR_MODE_NORMAL
472 | REGULATOR_MODE_STANDBY,
473 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
474 | REGULATOR_CHANGE_MODE
475 | REGULATOR_CHANGE_STATUS,
476 },
Santosh Shilimkar50263912010-08-02 13:18:03 +0300477 .num_consumer_supplies = 1,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000478 .consumer_supplies = sdp4430_vmmc_supply,
479};
480
481static struct regulator_init_data sdp4430_vpp = {
482 .constraints = {
483 .min_uV = 1800000,
484 .max_uV = 2500000,
485 .apply_uV = true,
486 .valid_modes_mask = REGULATOR_MODE_NORMAL
487 | REGULATOR_MODE_STANDBY,
488 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
489 | REGULATOR_CHANGE_MODE
490 | REGULATOR_CHANGE_STATUS,
491 },
492};
493
494static struct regulator_init_data sdp4430_vusim = {
495 .constraints = {
496 .min_uV = 1200000,
497 .max_uV = 2900000,
498 .apply_uV = true,
499 .valid_modes_mask = REGULATOR_MODE_NORMAL
500 | REGULATOR_MODE_STANDBY,
501 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
502 | REGULATOR_CHANGE_MODE
503 | REGULATOR_CHANGE_STATUS,
504 },
505};
506
507static struct regulator_init_data sdp4430_vana = {
508 .constraints = {
509 .min_uV = 2100000,
510 .max_uV = 2100000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000511 .valid_modes_mask = REGULATOR_MODE_NORMAL
512 | REGULATOR_MODE_STANDBY,
513 .valid_ops_mask = REGULATOR_CHANGE_MODE
514 | REGULATOR_CHANGE_STATUS,
515 },
516};
517
518static struct regulator_init_data sdp4430_vcxio = {
519 .constraints = {
520 .min_uV = 1800000,
521 .max_uV = 1800000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000522 .valid_modes_mask = REGULATOR_MODE_NORMAL
523 | REGULATOR_MODE_STANDBY,
524 .valid_ops_mask = REGULATOR_CHANGE_MODE
525 | REGULATOR_CHANGE_STATUS,
526 },
527};
528
529static struct regulator_init_data sdp4430_vdac = {
530 .constraints = {
531 .min_uV = 1800000,
532 .max_uV = 1800000,
Balaji T K6e30a7d2010-05-12 08:27:30 +0000533 .valid_modes_mask = REGULATOR_MODE_NORMAL
534 | REGULATOR_MODE_STANDBY,
535 .valid_ops_mask = REGULATOR_CHANGE_MODE
536 | REGULATOR_CHANGE_STATUS,
537 },
538};
539
540static struct regulator_init_data sdp4430_vusb = {
541 .constraints = {
542 .min_uV = 3300000,
543 .max_uV = 3300000,
544 .apply_uV = true,
545 .valid_modes_mask = REGULATOR_MODE_NORMAL
546 | REGULATOR_MODE_STANDBY,
547 .valid_ops_mask = REGULATOR_CHANGE_MODE
548 | REGULATOR_CHANGE_STATUS,
549 },
550};
551
552static struct twl4030_platform_data sdp4430_twldata = {
553 .irq_base = TWL6030_IRQ_BASE,
554 .irq_end = TWL6030_IRQ_END,
555
556 /* Regulators */
557 .vmmc = &sdp4430_vmmc,
558 .vpp = &sdp4430_vpp,
559 .vusim = &sdp4430_vusim,
560 .vana = &sdp4430_vana,
561 .vcxio = &sdp4430_vcxio,
562 .vdac = &sdp4430_vdac,
563 .vusb = &sdp4430_vusb,
564 .vaux1 = &sdp4430_vaux1,
565 .vaux2 = &sdp4430_vaux2,
566 .vaux3 = &sdp4430_vaux3,
Hema HKe70357e2010-12-10 18:09:52 +0530567 .usb = &omap4_usbphy_data
Balaji T K6e30a7d2010-05-12 08:27:30 +0000568};
569
570static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
571 {
572 I2C_BOARD_INFO("twl6030", 0x48),
573 .flags = I2C_CLIENT_WAKE,
574 .irq = OMAP44XX_IRQ_SYS_1N,
575 .platform_data = &sdp4430_twldata,
576 },
577};
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300578static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
579 {
580 I2C_BOARD_INFO("tmp105", 0x48),
581 },
Hemanth Vd048aca2010-12-17 18:15:08 -0800582 {
583 I2C_BOARD_INFO("bh1780", 0x29),
584 },
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300585};
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700586static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
587 {
588 I2C_BOARD_INFO("hmc5843", 0x1e),
589 },
590};
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000591static int __init omap4_i2c_init(void)
592{
593 /*
594 * Phoenix Audio IC needs I2C1 to
595 * start with 400 KHz or less
596 */
Balaji T K6e30a7d2010-05-12 08:27:30 +0000597 omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
598 ARRAY_SIZE(sdp4430_i2c_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000599 omap_register_i2c_bus(2, 400, NULL, 0);
Shubhrajyoti Datta83078f92010-08-02 13:18:04 +0300600 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
601 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
Shubhrajyoti Datta0df891b2010-09-23 18:22:47 -0700602 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
603 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000604 return 0;
605}
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700606
607static void __init omap_sfh7741prox_init(void)
608{
609 int error;
610
611 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
612 if (error < 0) {
613 pr_err("%s:failed to request GPIO %d, error %d\n",
614 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
615 return;
616 }
617
618 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
619 if (error < 0) {
620 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
621 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
622 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
623 }
624}
625
Mythri P K0425b482011-03-08 18:50:09 +0530626static void sdp4430_hdmi_mux_init(void)
627{
628 /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
629 omap_mux_init_signal("hdmi_hpd",
630 OMAP_PIN_INPUT_PULLUP);
631 omap_mux_init_signal("hdmi_cec",
632 OMAP_PIN_INPUT_PULLUP);
633 /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
634 omap_mux_init_signal("hdmi_ddc_scl",
635 OMAP_PIN_INPUT_PULLUP);
636 omap_mux_init_signal("hdmi_ddc_sda",
637 OMAP_PIN_INPUT_PULLUP);
638}
639
640static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
641{
642 int status;
643
644 status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH,
645 "hdmi_gpio_hpd");
646 if (status) {
647 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD);
648 return status;
649 }
650 status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH,
651 "hdmi_gpio_ls_oe");
652 if (status) {
653 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE);
654 goto error1;
655 }
656
657 return 0;
658
659error1:
660 gpio_free(HDMI_GPIO_HPD);
661
662 return status;
663}
664
665static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
666{
667 gpio_free(HDMI_GPIO_LS_OE);
668 gpio_free(HDMI_GPIO_HPD);
669}
670
671static struct omap_dss_device sdp4430_hdmi_device = {
672 .name = "hdmi",
673 .driver_name = "hdmi_panel",
674 .type = OMAP_DISPLAY_TYPE_HDMI,
675 .platform_enable = sdp4430_panel_enable_hdmi,
676 .platform_disable = sdp4430_panel_disable_hdmi,
677 .channel = OMAP_DSS_CHANNEL_DIGIT,
678};
679
680static struct omap_dss_device *sdp4430_dss_devices[] = {
681 &sdp4430_hdmi_device,
682};
683
684static struct omap_dss_board_info sdp4430_dss_data = {
685 .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
686 .devices = sdp4430_dss_devices,
687 .default_device = &sdp4430_hdmi_device,
688};
689
690void omap_4430sdp_display_init(void)
691{
692 sdp4430_hdmi_mux_init();
693 omap_display_init(&sdp4430_dss_data);
694}
695
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200696#ifdef CONFIG_OMAP_MUX
697static struct omap_board_mux board_mux[] __initdata = {
Tony Lindgren7d4ca852011-01-11 15:31:45 -0800698 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
Benoit Coussonfb6bf632010-08-10 17:43:15 +0200699 { .reg_offset = OMAP_MUX_TERMINATOR },
700};
701#else
702#define board_mux NULL
703#endif
704
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700705static void __init omap_4430sdp_init(void)
706{
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700707 int status;
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200708 int package = OMAP_PACKAGE_CBS;
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700709
Benoit Cousson6fea7b02010-09-27 10:50:33 +0200710 if (omap_rev() == OMAP4430_REV_ES1_0)
711 package = OMAP_PACKAGE_CBL;
712 omap4_mux_init(board_mux, package);
713
Tony Lindgrene41cccf2011-02-24 14:36:03 -0800714 omap_board_config = sdp4430_config;
715 omap_board_config_size = ARRAY_SIZE(sdp4430_config);
716
Santosh Shilimkarbaeb73e2010-05-12 08:27:29 +0000717 omap4_i2c_init();
Shubhrajyoti Datta94ce7a62010-09-23 18:22:49 -0700718 omap_sfh7741prox_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700719 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700720 omap_serial_init();
kishore kadiyala717c1fb2010-05-15 18:21:06 +0000721 omap4_twl6030_hsmmc_init(mmc);
Keshava Munegowda6aa85a52010-11-21 23:23:42 +0530722
Felipe Balbi46960842010-12-07 09:57:59 +0200723 usb_musb_init(&musb_board_data);
Abraham Arceb2aa5e52010-05-14 12:05:26 -0700724
725 status = omap_ethernet_init();
726 if (status) {
727 pr_err("Ethernet initialization failed: %d\n", status);
728 } else {
729 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
730 spi_register_board_info(sdp4430_spi_board_info,
731 ARRAY_SIZE(sdp4430_spi_board_info));
732 }
Syed Rafiuddin59556762010-12-27 05:51:45 +0000733
734 status = omap4_keyboard_init(&sdp4430_keypad_data);
735 if (status)
736 pr_err("Keypad initialization failed: %d\n", status);
Mythri P K0425b482011-03-08 18:50:09 +0530737
738 omap_4430sdp_display_init();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700739}
740
741static void __init omap_4430sdp_map_io(void)
742{
743 omap2_set_globals_443x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800744 omap44xx_map_common_io();
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700745}
746
747MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
748 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700749 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100750 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800751 .map_io = omap_4430sdp_map_io,
752 .init_early = omap_4430sdp_init_early,
753 .init_irq = gic_init_irq,
Santosh Shilimkar46ba0ab2009-05-28 14:16:05 -0700754 .init_machine = omap_4430sdp_init,
755 .timer = &omap_timer,
756MACHINE_END