Commit | Line | Data |
---|---|---|
46ba0abf SS |
1 | /* |
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> | |
bce06683 | 20 | #include <linux/usb/otg.h> |
b2aa5e57 | 21 | #include <linux/spi/spi.h> |
6e30a7db | 22 | #include <linux/i2c/twl.h> |
94ce7a66 | 23 | #include <linux/gpio_keys.h> |
6e30a7db | 24 | #include <linux/regulator/machine.h> |
509b6d93 | 25 | #include <linux/leds.h> |
f389f4cb | 26 | #include <linux/leds_pwm.h> |
46ba0abf SS |
27 | |
28 | #include <mach/hardware.h> | |
fbc9be10 | 29 | #include <mach/omap4-common.h> |
46ba0abf SS |
30 | #include <asm/mach-types.h> |
31 | #include <asm/mach/arch.h> | |
32 | #include <asm/mach/map.h> | |
33 | ||
ce491cf8 TL |
34 | #include <plat/board.h> |
35 | #include <plat/common.h> | |
bce06683 | 36 | #include <plat/usb.h> |
717c1fbf | 37 | #include <plat/mmc.h> |
59556765 | 38 | #include <plat/omap4-keypad.h> |
0425b48b | 39 | #include <plat/display.h> |
04aeae77 | 40 | |
fb6bf632 | 41 | #include "mux.h" |
717c1fbf | 42 | #include "hsmmc.h" |
04aeae77 | 43 | #include "timer-gp.h" |
4814ced5 | 44 | #include "control.h" |
fbd8071c | 45 | #include "common-board-devices.h" |
46ba0abf | 46 | |
b2aa5e57 AA |
47 | #define ETH_KS8851_IRQ 34 |
48 | #define ETH_KS8851_POWER_ON 48 | |
49 | #define ETH_KS8851_QUART 138 | |
94ce7a66 SD |
50 | #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 |
51 | #define OMAP4_SFH7741_ENABLE_GPIO 188 | |
0425b48b M |
52 | #define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */ |
53 | #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ | |
b2aa5e57 | 54 | |
59556765 SR |
55 | static const int sdp4430_keymap[] = { |
56 | KEY(0, 0, KEY_E), | |
57 | KEY(0, 1, KEY_R), | |
58 | KEY(0, 2, KEY_T), | |
59 | KEY(0, 3, KEY_HOME), | |
60 | KEY(0, 4, KEY_F5), | |
61 | KEY(0, 5, KEY_UNKNOWN), | |
62 | KEY(0, 6, KEY_I), | |
63 | KEY(0, 7, KEY_LEFTSHIFT), | |
64 | ||
65 | KEY(1, 0, KEY_D), | |
66 | KEY(1, 1, KEY_F), | |
67 | KEY(1, 2, KEY_G), | |
68 | KEY(1, 3, KEY_SEND), | |
69 | KEY(1, 4, KEY_F6), | |
70 | KEY(1, 5, KEY_UNKNOWN), | |
71 | KEY(1, 6, KEY_K), | |
72 | KEY(1, 7, KEY_ENTER), | |
73 | ||
74 | KEY(2, 0, KEY_X), | |
75 | KEY(2, 1, KEY_C), | |
76 | KEY(2, 2, KEY_V), | |
77 | KEY(2, 3, KEY_END), | |
78 | KEY(2, 4, KEY_F7), | |
79 | KEY(2, 5, KEY_UNKNOWN), | |
80 | KEY(2, 6, KEY_DOT), | |
81 | KEY(2, 7, KEY_CAPSLOCK), | |
82 | ||
83 | KEY(3, 0, KEY_Z), | |
84 | KEY(3, 1, KEY_KPPLUS), | |
85 | KEY(3, 2, KEY_B), | |
86 | KEY(3, 3, KEY_F1), | |
87 | KEY(3, 4, KEY_F8), | |
88 | KEY(3, 5, KEY_UNKNOWN), | |
89 | KEY(3, 6, KEY_O), | |
90 | KEY(3, 7, KEY_SPACE), | |
91 | ||
92 | KEY(4, 0, KEY_W), | |
93 | KEY(4, 1, KEY_Y), | |
94 | KEY(4, 2, KEY_U), | |
95 | KEY(4, 3, KEY_F2), | |
96 | KEY(4, 4, KEY_VOLUMEUP), | |
97 | KEY(4, 5, KEY_UNKNOWN), | |
98 | KEY(4, 6, KEY_L), | |
99 | KEY(4, 7, KEY_LEFT), | |
100 | ||
101 | KEY(5, 0, KEY_S), | |
102 | KEY(5, 1, KEY_H), | |
103 | KEY(5, 2, KEY_J), | |
104 | KEY(5, 3, KEY_F3), | |
105 | KEY(5, 4, KEY_F9), | |
106 | KEY(5, 5, KEY_VOLUMEDOWN), | |
107 | KEY(5, 6, KEY_M), | |
108 | KEY(5, 7, KEY_RIGHT), | |
109 | ||
110 | KEY(6, 0, KEY_Q), | |
111 | KEY(6, 1, KEY_A), | |
112 | KEY(6, 2, KEY_N), | |
113 | KEY(6, 3, KEY_BACK), | |
114 | KEY(6, 4, KEY_BACKSPACE), | |
115 | KEY(6, 5, KEY_UNKNOWN), | |
116 | KEY(6, 6, KEY_P), | |
117 | KEY(6, 7, KEY_UP), | |
118 | ||
119 | KEY(7, 0, KEY_PROG1), | |
120 | KEY(7, 1, KEY_PROG2), | |
121 | KEY(7, 2, KEY_PROG3), | |
122 | KEY(7, 3, KEY_PROG4), | |
123 | KEY(7, 4, KEY_F4), | |
124 | KEY(7, 5, KEY_UNKNOWN), | |
125 | KEY(7, 6, KEY_OK), | |
126 | KEY(7, 7, KEY_DOWN), | |
127 | }; | |
128 | ||
129 | static struct matrix_keymap_data sdp4430_keymap_data = { | |
130 | .keymap = sdp4430_keymap, | |
131 | .keymap_size = ARRAY_SIZE(sdp4430_keymap), | |
132 | }; | |
133 | ||
134 | static struct omap4_keypad_platform_data sdp4430_keypad_data = { | |
135 | .keymap_data = &sdp4430_keymap_data, | |
136 | .rows = 8, | |
137 | .cols = 8, | |
138 | }; | |
509b6d93 H |
139 | static struct gpio_led sdp4430_gpio_leds[] = { |
140 | { | |
141 | .name = "omap4:green:debug0", | |
142 | .gpio = 61, | |
143 | }, | |
144 | { | |
145 | .name = "omap4:green:debug1", | |
146 | .gpio = 30, | |
147 | }, | |
148 | { | |
149 | .name = "omap4:green:debug2", | |
150 | .gpio = 7, | |
151 | }, | |
152 | { | |
153 | .name = "omap4:green:debug3", | |
154 | .gpio = 8, | |
155 | }, | |
156 | { | |
157 | .name = "omap4:green:debug4", | |
158 | .gpio = 50, | |
159 | }, | |
160 | { | |
161 | .name = "omap4:blue:user", | |
162 | .gpio = 169, | |
163 | }, | |
164 | { | |
165 | .name = "omap4:red:user", | |
166 | .gpio = 170, | |
167 | }, | |
168 | { | |
169 | .name = "omap4:green:user", | |
170 | .gpio = 139, | |
171 | }, | |
172 | ||
173 | }; | |
174 | ||
94ce7a66 SD |
175 | static struct gpio_keys_button sdp4430_gpio_keys[] = { |
176 | { | |
177 | .desc = "Proximity Sensor", | |
178 | .type = EV_SW, | |
179 | .code = SW_FRONT_PROXIMITY, | |
180 | .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO, | |
181 | .active_low = 0, | |
182 | } | |
183 | }; | |
184 | ||
509b6d93 H |
185 | static struct gpio_led_platform_data sdp4430_led_data = { |
186 | .leds = sdp4430_gpio_leds, | |
187 | .num_leds = ARRAY_SIZE(sdp4430_gpio_leds), | |
188 | }; | |
189 | ||
f389f4cb H |
190 | static struct led_pwm sdp4430_pwm_leds[] = { |
191 | { | |
192 | .name = "omap4:green:chrg", | |
193 | .pwm_id = 1, | |
194 | .max_brightness = 255, | |
195 | .pwm_period_ns = 7812500, | |
196 | }, | |
197 | }; | |
198 | ||
199 | static struct led_pwm_platform_data sdp4430_pwm_data = { | |
200 | .num_leds = ARRAY_SIZE(sdp4430_pwm_leds), | |
201 | .leds = sdp4430_pwm_leds, | |
202 | }; | |
203 | ||
204 | static struct platform_device sdp4430_leds_pwm = { | |
205 | .name = "leds_pwm", | |
206 | .id = -1, | |
207 | .dev = { | |
208 | .platform_data = &sdp4430_pwm_data, | |
209 | }, | |
210 | }; | |
211 | ||
94ce7a66 SD |
212 | static int omap_prox_activate(struct device *dev) |
213 | { | |
214 | gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1); | |
215 | return 0; | |
216 | } | |
217 | ||
218 | static void omap_prox_deactivate(struct device *dev) | |
219 | { | |
220 | gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0); | |
221 | } | |
222 | ||
223 | static struct gpio_keys_platform_data sdp4430_gpio_keys_data = { | |
224 | .buttons = sdp4430_gpio_keys, | |
225 | .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys), | |
226 | .enable = omap_prox_activate, | |
227 | .disable = omap_prox_deactivate, | |
228 | }; | |
229 | ||
230 | static struct platform_device sdp4430_gpio_keys_device = { | |
231 | .name = "gpio-keys", | |
232 | .id = -1, | |
233 | .dev = { | |
234 | .platform_data = &sdp4430_gpio_keys_data, | |
235 | }, | |
236 | }; | |
237 | ||
509b6d93 H |
238 | static struct platform_device sdp4430_leds_gpio = { |
239 | .name = "leds-gpio", | |
240 | .id = -1, | |
241 | .dev = { | |
242 | .platform_data = &sdp4430_led_data, | |
243 | }, | |
244 | }; | |
b2aa5e57 AA |
245 | static struct spi_board_info sdp4430_spi_board_info[] __initdata = { |
246 | { | |
247 | .modalias = "ks8851", | |
248 | .bus_num = 1, | |
249 | .chip_select = 0, | |
250 | .max_speed_hz = 24000000, | |
251 | .irq = ETH_KS8851_IRQ, | |
252 | }, | |
253 | }; | |
254 | ||
255 | static int omap_ethernet_init(void) | |
256 | { | |
257 | int status; | |
258 | ||
259 | /* Request of GPIO lines */ | |
260 | ||
261 | status = gpio_request(ETH_KS8851_POWER_ON, "eth_power"); | |
262 | if (status) { | |
263 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON); | |
264 | return status; | |
265 | } | |
266 | ||
267 | status = gpio_request(ETH_KS8851_QUART, "quart"); | |
268 | if (status) { | |
269 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART); | |
270 | goto error1; | |
271 | } | |
272 | ||
273 | status = gpio_request(ETH_KS8851_IRQ, "eth_irq"); | |
274 | if (status) { | |
275 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ); | |
276 | goto error2; | |
277 | } | |
278 | ||
279 | /* Configuration of requested GPIO lines */ | |
280 | ||
281 | status = gpio_direction_output(ETH_KS8851_POWER_ON, 1); | |
282 | if (status) { | |
283 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ); | |
284 | goto error3; | |
285 | } | |
286 | ||
287 | status = gpio_direction_output(ETH_KS8851_QUART, 1); | |
288 | if (status) { | |
289 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART); | |
290 | goto error3; | |
291 | } | |
292 | ||
293 | status = gpio_direction_input(ETH_KS8851_IRQ); | |
294 | if (status) { | |
295 | pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ); | |
296 | goto error3; | |
297 | } | |
298 | ||
299 | return 0; | |
300 | ||
301 | error3: | |
302 | gpio_free(ETH_KS8851_IRQ); | |
303 | error2: | |
304 | gpio_free(ETH_KS8851_QUART); | |
305 | error1: | |
306 | gpio_free(ETH_KS8851_POWER_ON); | |
307 | return status; | |
308 | } | |
309 | ||
46ba0abf SS |
310 | static struct platform_device sdp4430_lcd_device = { |
311 | .name = "sdp4430_lcd", | |
312 | .id = -1, | |
313 | }; | |
314 | ||
315 | static struct platform_device *sdp4430_devices[] __initdata = { | |
316 | &sdp4430_lcd_device, | |
94ce7a66 | 317 | &sdp4430_gpio_keys_device, |
509b6d93 | 318 | &sdp4430_leds_gpio, |
f389f4cb | 319 | &sdp4430_leds_pwm, |
46ba0abf SS |
320 | }; |
321 | ||
46ba0abf SS |
322 | static struct omap_lcd_config sdp4430_lcd_config __initdata = { |
323 | .ctrl_name = "internal", | |
324 | }; | |
325 | ||
326 | static struct omap_board_config_kernel sdp4430_config[] __initdata = { | |
46ba0abf SS |
327 | { OMAP_TAG_LCD, &sdp4430_lcd_config }, |
328 | }; | |
329 | ||
3dc3bad6 | 330 | static void __init omap_4430sdp_init_early(void) |
46ba0abf | 331 | { |
4805734b PW |
332 | omap2_init_common_infrastructure(); |
333 | omap2_init_common_devices(NULL, NULL); | |
46ba0abf SS |
334 | #ifdef CONFIG_OMAP_32K_TIMER |
335 | omap2_gp_clockevent_set_gptimer(1); | |
336 | #endif | |
46ba0abf SS |
337 | } |
338 | ||
bce06683 MM |
339 | static struct omap_musb_board_data musb_board_data = { |
340 | .interface_type = MUSB_INTERFACE_UTMI, | |
09e72002 | 341 | .mode = MUSB_OTG, |
bce06683 MM |
342 | .power = 100, |
343 | }; | |
717c1fbf | 344 | |
e70357e3 HH |
345 | static struct twl4030_usb_data omap4_usbphy_data = { |
346 | .phy_init = omap4430_phy_init, | |
347 | .phy_exit = omap4430_phy_exit, | |
348 | .phy_power = omap4430_phy_power, | |
349 | .phy_set_clock = omap4430_phy_set_clk, | |
ee896e34 | 350 | .phy_suspend = omap4430_phy_suspend, |
e70357e3 HH |
351 | }; |
352 | ||
717c1fbf | 353 | static struct omap2_hsmmc_info mmc[] = { |
6e30a7db | 354 | { |
717c1fbf | 355 | .mmc = 2, |
3a63833e | 356 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
717c1fbf | 357 | .gpio_cd = -EINVAL, |
358 | .gpio_wp = -EINVAL, | |
359 | .nonremovable = true, | |
64be9782 | 360 | .ocr_mask = MMC_VDD_29_30, |
6e30a7db | 361 | }, |
0005ae73 KK |
362 | { |
363 | .mmc = 1, | |
364 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, | |
365 | .gpio_wp = -EINVAL, | |
366 | }, | |
717c1fbf | 367 | {} /* Terminator */ |
368 | }; | |
369 | ||
5026391c | 370 | static struct regulator_consumer_supply sdp4430_vaux_supply[] = { |
6e30a7db B |
371 | { |
372 | .supply = "vmmc", | |
0005ae73 | 373 | .dev_name = "omap_hsmmc.1", |
6e30a7db | 374 | }, |
5026391c SS |
375 | }; |
376 | static struct regulator_consumer_supply sdp4430_vmmc_supply[] = { | |
6e30a7db B |
377 | { |
378 | .supply = "vmmc", | |
0005ae73 | 379 | .dev_name = "omap_hsmmc.0", |
6e30a7db B |
380 | }, |
381 | }; | |
382 | ||
717c1fbf | 383 | static int omap4_twl6030_hsmmc_late_init(struct device *dev) |
384 | { | |
385 | int ret = 0; | |
386 | struct platform_device *pdev = container_of(dev, | |
387 | struct platform_device, dev); | |
388 | struct omap_mmc_platform_data *pdata = dev->platform_data; | |
389 | ||
390 | /* Setting MMC1 Card detect Irq */ | |
72f2e2c7 | 391 | if (pdev->id == 0) { |
392 | ret = twl6030_mmc_card_detect_config(); | |
393 | if (ret) | |
394 | pr_err("Failed configuring MMC1 card detect\n"); | |
717c1fbf | 395 | pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE + |
396 | MMCDETECT_INTR_OFFSET; | |
72f2e2c7 | 397 | pdata->slots[0].card_detect = twl6030_mmc_card_detect; |
398 | } | |
717c1fbf | 399 | return ret; |
400 | } | |
401 | ||
402 | static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) | |
403 | { | |
531c21ba | 404 | struct omap_mmc_platform_data *pdata; |
717c1fbf | 405 | |
531c21ba BC |
406 | /* dev can be null if CONFIG_MMC_OMAP_HS is not set */ |
407 | if (!dev) { | |
408 | pr_err("Failed %s\n", __func__); | |
409 | return; | |
410 | } | |
411 | pdata = dev->platform_data; | |
717c1fbf | 412 | pdata->init = omap4_twl6030_hsmmc_late_init; |
413 | } | |
414 | ||
415 | static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) | |
416 | { | |
417 | struct omap2_hsmmc_info *c; | |
418 | ||
419 | omap2_hsmmc_init(controllers); | |
420 | for (c = controllers; c->mmc; c++) | |
421 | omap4_twl6030_hsmmc_set_late_init(c->dev); | |
422 | ||
423 | return 0; | |
424 | } | |
425 | ||
6e30a7db B |
426 | static struct regulator_init_data sdp4430_vaux1 = { |
427 | .constraints = { | |
428 | .min_uV = 1000000, | |
429 | .max_uV = 3000000, | |
430 | .apply_uV = true, | |
431 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
432 | | REGULATOR_MODE_STANDBY, | |
433 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
434 | | REGULATOR_CHANGE_MODE | |
435 | | REGULATOR_CHANGE_STATUS, | |
436 | }, | |
5026391c SS |
437 | .num_consumer_supplies = 1, |
438 | .consumer_supplies = sdp4430_vaux_supply, | |
6e30a7db B |
439 | }; |
440 | ||
441 | static struct regulator_init_data sdp4430_vaux2 = { | |
442 | .constraints = { | |
443 | .min_uV = 1200000, | |
444 | .max_uV = 2800000, | |
445 | .apply_uV = true, | |
446 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
447 | | REGULATOR_MODE_STANDBY, | |
448 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
449 | | REGULATOR_CHANGE_MODE | |
450 | | REGULATOR_CHANGE_STATUS, | |
451 | }, | |
452 | }; | |
453 | ||
454 | static struct regulator_init_data sdp4430_vaux3 = { | |
455 | .constraints = { | |
456 | .min_uV = 1000000, | |
457 | .max_uV = 3000000, | |
458 | .apply_uV = true, | |
459 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
460 | | REGULATOR_MODE_STANDBY, | |
461 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
462 | | REGULATOR_CHANGE_MODE | |
463 | | REGULATOR_CHANGE_STATUS, | |
464 | }, | |
465 | }; | |
466 | ||
467 | /* VMMC1 for MMC1 card */ | |
468 | static struct regulator_init_data sdp4430_vmmc = { | |
469 | .constraints = { | |
470 | .min_uV = 1200000, | |
471 | .max_uV = 3000000, | |
472 | .apply_uV = true, | |
473 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
474 | | REGULATOR_MODE_STANDBY, | |
475 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
476 | | REGULATOR_CHANGE_MODE | |
477 | | REGULATOR_CHANGE_STATUS, | |
478 | }, | |
5026391c | 479 | .num_consumer_supplies = 1, |
6e30a7db B |
480 | .consumer_supplies = sdp4430_vmmc_supply, |
481 | }; | |
482 | ||
483 | static struct regulator_init_data sdp4430_vpp = { | |
484 | .constraints = { | |
485 | .min_uV = 1800000, | |
486 | .max_uV = 2500000, | |
487 | .apply_uV = true, | |
488 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
489 | | REGULATOR_MODE_STANDBY, | |
490 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
491 | | REGULATOR_CHANGE_MODE | |
492 | | REGULATOR_CHANGE_STATUS, | |
493 | }, | |
494 | }; | |
495 | ||
496 | static struct regulator_init_data sdp4430_vusim = { | |
497 | .constraints = { | |
498 | .min_uV = 1200000, | |
499 | .max_uV = 2900000, | |
500 | .apply_uV = true, | |
501 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
502 | | REGULATOR_MODE_STANDBY, | |
503 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
504 | | REGULATOR_CHANGE_MODE | |
505 | | REGULATOR_CHANGE_STATUS, | |
506 | }, | |
507 | }; | |
508 | ||
509 | static struct regulator_init_data sdp4430_vana = { | |
510 | .constraints = { | |
511 | .min_uV = 2100000, | |
512 | .max_uV = 2100000, | |
6e30a7db B |
513 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
514 | | REGULATOR_MODE_STANDBY, | |
515 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
516 | | REGULATOR_CHANGE_STATUS, | |
517 | }, | |
518 | }; | |
519 | ||
520 | static struct regulator_init_data sdp4430_vcxio = { | |
521 | .constraints = { | |
522 | .min_uV = 1800000, | |
523 | .max_uV = 1800000, | |
6e30a7db B |
524 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
525 | | REGULATOR_MODE_STANDBY, | |
526 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
527 | | REGULATOR_CHANGE_STATUS, | |
528 | }, | |
529 | }; | |
530 | ||
531 | static struct regulator_init_data sdp4430_vdac = { | |
532 | .constraints = { | |
533 | .min_uV = 1800000, | |
534 | .max_uV = 1800000, | |
6e30a7db B |
535 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
536 | | REGULATOR_MODE_STANDBY, | |
537 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
538 | | REGULATOR_CHANGE_STATUS, | |
539 | }, | |
540 | }; | |
541 | ||
542 | static struct regulator_init_data sdp4430_vusb = { | |
543 | .constraints = { | |
544 | .min_uV = 3300000, | |
545 | .max_uV = 3300000, | |
546 | .apply_uV = true, | |
547 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
548 | | REGULATOR_MODE_STANDBY, | |
549 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
550 | | REGULATOR_CHANGE_STATUS, | |
551 | }, | |
552 | }; | |
553 | ||
8af1b0d7 B |
554 | static struct regulator_init_data sdp4430_clk32kg = { |
555 | .constraints = { | |
556 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
557 | }, | |
558 | }; | |
559 | ||
6e30a7db B |
560 | static struct twl4030_platform_data sdp4430_twldata = { |
561 | .irq_base = TWL6030_IRQ_BASE, | |
562 | .irq_end = TWL6030_IRQ_END, | |
563 | ||
564 | /* Regulators */ | |
565 | .vmmc = &sdp4430_vmmc, | |
566 | .vpp = &sdp4430_vpp, | |
567 | .vusim = &sdp4430_vusim, | |
568 | .vana = &sdp4430_vana, | |
569 | .vcxio = &sdp4430_vcxio, | |
570 | .vdac = &sdp4430_vdac, | |
571 | .vusb = &sdp4430_vusb, | |
572 | .vaux1 = &sdp4430_vaux1, | |
573 | .vaux2 = &sdp4430_vaux2, | |
574 | .vaux3 = &sdp4430_vaux3, | |
8af1b0d7 | 575 | .clk32kg = &sdp4430_clk32kg, |
e70357e3 | 576 | .usb = &omap4_usbphy_data |
6e30a7db B |
577 | }; |
578 | ||
83078f9b SD |
579 | static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { |
580 | { | |
581 | I2C_BOARD_INFO("tmp105", 0x48), | |
582 | }, | |
d048aca2 H |
583 | { |
584 | I2C_BOARD_INFO("bh1780", 0x29), | |
585 | }, | |
83078f9b | 586 | }; |
0df891bb SD |
587 | static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = { |
588 | { | |
589 | I2C_BOARD_INFO("hmc5843", 0x1e), | |
590 | }, | |
591 | }; | |
baeb73e8 SS |
592 | static int __init omap4_i2c_init(void) |
593 | { | |
fbd8071c | 594 | omap4_pmic_init("twl6030", &sdp4430_twldata); |
baeb73e8 | 595 | omap_register_i2c_bus(2, 400, NULL, 0); |
83078f9b SD |
596 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, |
597 | ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); | |
0df891bb SD |
598 | omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo, |
599 | ARRAY_SIZE(sdp4430_i2c_4_boardinfo)); | |
baeb73e8 SS |
600 | return 0; |
601 | } | |
94ce7a66 SD |
602 | |
603 | static void __init omap_sfh7741prox_init(void) | |
604 | { | |
605 | int error; | |
606 | ||
607 | error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741"); | |
608 | if (error < 0) { | |
609 | pr_err("%s:failed to request GPIO %d, error %d\n", | |
610 | __func__, OMAP4_SFH7741_ENABLE_GPIO, error); | |
611 | return; | |
612 | } | |
613 | ||
614 | error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0); | |
615 | if (error < 0) { | |
616 | pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n", | |
617 | __func__, OMAP4_SFH7741_ENABLE_GPIO, error); | |
618 | gpio_free(OMAP4_SFH7741_ENABLE_GPIO); | |
619 | } | |
620 | } | |
621 | ||
0425b48b M |
622 | static void sdp4430_hdmi_mux_init(void) |
623 | { | |
624 | /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */ | |
625 | omap_mux_init_signal("hdmi_hpd", | |
626 | OMAP_PIN_INPUT_PULLUP); | |
627 | omap_mux_init_signal("hdmi_cec", | |
628 | OMAP_PIN_INPUT_PULLUP); | |
629 | /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */ | |
630 | omap_mux_init_signal("hdmi_ddc_scl", | |
631 | OMAP_PIN_INPUT_PULLUP); | |
632 | omap_mux_init_signal("hdmi_ddc_sda", | |
633 | OMAP_PIN_INPUT_PULLUP); | |
634 | } | |
635 | ||
636 | static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev) | |
637 | { | |
638 | int status; | |
639 | ||
640 | status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, | |
641 | "hdmi_gpio_hpd"); | |
642 | if (status) { | |
643 | pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD); | |
644 | return status; | |
645 | } | |
646 | status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, | |
647 | "hdmi_gpio_ls_oe"); | |
648 | if (status) { | |
649 | pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE); | |
650 | goto error1; | |
651 | } | |
652 | ||
653 | return 0; | |
654 | ||
655 | error1: | |
656 | gpio_free(HDMI_GPIO_HPD); | |
657 | ||
658 | return status; | |
659 | } | |
660 | ||
661 | static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev) | |
662 | { | |
663 | gpio_free(HDMI_GPIO_LS_OE); | |
664 | gpio_free(HDMI_GPIO_HPD); | |
665 | } | |
666 | ||
667 | static struct omap_dss_device sdp4430_hdmi_device = { | |
668 | .name = "hdmi", | |
669 | .driver_name = "hdmi_panel", | |
670 | .type = OMAP_DISPLAY_TYPE_HDMI, | |
671 | .platform_enable = sdp4430_panel_enable_hdmi, | |
672 | .platform_disable = sdp4430_panel_disable_hdmi, | |
673 | .channel = OMAP_DSS_CHANNEL_DIGIT, | |
674 | }; | |
675 | ||
676 | static struct omap_dss_device *sdp4430_dss_devices[] = { | |
677 | &sdp4430_hdmi_device, | |
678 | }; | |
679 | ||
680 | static struct omap_dss_board_info sdp4430_dss_data = { | |
681 | .num_devices = ARRAY_SIZE(sdp4430_dss_devices), | |
682 | .devices = sdp4430_dss_devices, | |
683 | .default_device = &sdp4430_hdmi_device, | |
684 | }; | |
685 | ||
686 | void omap_4430sdp_display_init(void) | |
687 | { | |
688 | sdp4430_hdmi_mux_init(); | |
689 | omap_display_init(&sdp4430_dss_data); | |
690 | } | |
691 | ||
fb6bf632 BC |
692 | #ifdef CONFIG_OMAP_MUX |
693 | static struct omap_board_mux board_mux[] __initdata = { | |
7d4ca85a | 694 | OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), |
fb6bf632 BC |
695 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
696 | }; | |
dae33526 S |
697 | |
698 | static struct omap_device_pad serial2_pads[] __initdata = { | |
699 | OMAP_MUX_STATIC("uart2_cts.uart2_cts", | |
700 | OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), | |
701 | OMAP_MUX_STATIC("uart2_rts.uart2_rts", | |
702 | OMAP_PIN_OUTPUT | OMAP_MUX_MODE0), | |
703 | OMAP_MUX_STATIC("uart2_rx.uart2_rx", | |
704 | OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), | |
705 | OMAP_MUX_STATIC("uart2_tx.uart2_tx", | |
706 | OMAP_PIN_OUTPUT | OMAP_MUX_MODE0), | |
707 | }; | |
708 | ||
709 | static struct omap_device_pad serial3_pads[] __initdata = { | |
710 | OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx", | |
711 | OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), | |
712 | OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd", | |
713 | OMAP_PIN_OUTPUT | OMAP_MUX_MODE0), | |
714 | OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx", | |
715 | OMAP_PIN_INPUT | OMAP_MUX_MODE0), | |
716 | OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx", | |
717 | OMAP_PIN_OUTPUT | OMAP_MUX_MODE0), | |
718 | }; | |
719 | ||
720 | static struct omap_device_pad serial4_pads[] __initdata = { | |
721 | OMAP_MUX_STATIC("uart4_rx.uart4_rx", | |
722 | OMAP_PIN_INPUT | OMAP_MUX_MODE0), | |
723 | OMAP_MUX_STATIC("uart4_tx.uart4_tx", | |
724 | OMAP_PIN_OUTPUT | OMAP_MUX_MODE0), | |
725 | }; | |
726 | ||
727 | static struct omap_board_data serial2_data = { | |
728 | .id = 1, | |
729 | .pads = serial2_pads, | |
730 | .pads_cnt = ARRAY_SIZE(serial2_pads), | |
731 | }; | |
732 | ||
733 | static struct omap_board_data serial3_data = { | |
734 | .id = 2, | |
735 | .pads = serial3_pads, | |
736 | .pads_cnt = ARRAY_SIZE(serial3_pads), | |
737 | }; | |
738 | ||
739 | static struct omap_board_data serial4_data = { | |
740 | .id = 3, | |
741 | .pads = serial4_pads, | |
742 | .pads_cnt = ARRAY_SIZE(serial4_pads), | |
743 | }; | |
744 | ||
745 | static inline void board_serial_init(void) | |
746 | { | |
747 | struct omap_board_data bdata; | |
748 | bdata.flags = 0; | |
749 | bdata.pads = NULL; | |
750 | bdata.pads_cnt = 0; | |
751 | bdata.id = 0; | |
752 | /* pass dummy data for UART1 */ | |
753 | omap_serial_init_port(&bdata); | |
754 | ||
755 | omap_serial_init_port(&serial2_data); | |
756 | omap_serial_init_port(&serial3_data); | |
757 | omap_serial_init_port(&serial4_data); | |
758 | } | |
fb6bf632 BC |
759 | #else |
760 | #define board_mux NULL | |
dae33526 S |
761 | |
762 | static inline void board_serial_init(void) | |
763 | { | |
764 | omap_serial_init(); | |
765 | } | |
766 | #endif | |
fb6bf632 | 767 | |
46ba0abf SS |
768 | static void __init omap_4430sdp_init(void) |
769 | { | |
b2aa5e57 | 770 | int status; |
6fea7b0a BC |
771 | int package = OMAP_PACKAGE_CBS; |
772 | ||
773 | if (omap_rev() == OMAP4430_REV_ES1_0) | |
774 | package = OMAP_PACKAGE_CBL; | |
775 | omap4_mux_init(board_mux, package); | |
b2aa5e57 | 776 | |
e41cccfe TL |
777 | omap_board_config = sdp4430_config; |
778 | omap_board_config_size = ARRAY_SIZE(sdp4430_config); | |
779 | ||
baeb73e8 | 780 | omap4_i2c_init(); |
94ce7a66 | 781 | omap_sfh7741prox_init(); |
46ba0abf | 782 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); |
dae33526 | 783 | board_serial_init(); |
717c1fbf | 784 | omap4_twl6030_hsmmc_init(mmc); |
6aa85a5a | 785 | |
46960847 | 786 | usb_musb_init(&musb_board_data); |
b2aa5e57 AA |
787 | |
788 | status = omap_ethernet_init(); | |
789 | if (status) { | |
790 | pr_err("Ethernet initialization failed: %d\n", status); | |
791 | } else { | |
792 | sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ); | |
793 | spi_register_board_info(sdp4430_spi_board_info, | |
794 | ARRAY_SIZE(sdp4430_spi_board_info)); | |
795 | } | |
59556765 SR |
796 | |
797 | status = omap4_keyboard_init(&sdp4430_keypad_data); | |
798 | if (status) | |
799 | pr_err("Keypad initialization failed: %d\n", status); | |
0425b48b M |
800 | |
801 | omap_4430sdp_display_init(); | |
46ba0abf SS |
802 | } |
803 | ||
804 | static void __init omap_4430sdp_map_io(void) | |
805 | { | |
806 | omap2_set_globals_443x(); | |
6fbd55d0 | 807 | omap44xx_map_common_io(); |
46ba0abf SS |
808 | } |
809 | ||
810 | MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board") | |
811 | /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */ | |
46ba0abf | 812 | .boot_params = 0x80000100, |
71ee7dad | 813 | .reserve = omap_reserve, |
3dc3bad6 RKAL |
814 | .map_io = omap_4430sdp_map_io, |
815 | .init_early = omap_4430sdp_init_early, | |
816 | .init_irq = gic_init_irq, | |
46ba0abf SS |
817 | .init_machine = omap_4430sdp_init, |
818 | .timer = &omap_timer, | |
819 | MACHINE_END |