Merge branch 'for-2.6.40' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/asoc...
[pandora-kernel.git] / arch / arm / mach-omap2 / board-4430sdp.c
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>
20 #include <linux/usb/otg.h>
21 #include <linux/spi/spi.h>
22 #include <linux/i2c/twl.h>
23 #include <linux/gpio_keys.h>
24 #include <linux/regulator/machine.h>
25 #include <linux/leds.h>
26 #include <linux/leds_pwm.h>
27
28 #include <mach/hardware.h>
29 #include <mach/omap4-common.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
33
34 #include <plat/board.h>
35 #include <plat/common.h>
36 #include <plat/usb.h>
37 #include <plat/mmc.h>
38 #include <plat/omap4-keypad.h>
39 #include <plat/display.h>
40
41 #include "mux.h"
42 #include "hsmmc.h"
43 #include "timer-gp.h"
44 #include "control.h"
45
46 #define ETH_KS8851_IRQ                  34
47 #define ETH_KS8851_POWER_ON             48
48 #define ETH_KS8851_QUART                138
49 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO        184
50 #define OMAP4_SFH7741_ENABLE_GPIO               188
51 #define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
52 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
53
54 static 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
128 static struct matrix_keymap_data sdp4430_keymap_data = {
129         .keymap                 = sdp4430_keymap,
130         .keymap_size            = ARRAY_SIZE(sdp4430_keymap),
131 };
132
133 static struct omap4_keypad_platform_data sdp4430_keypad_data = {
134         .keymap_data            = &sdp4430_keymap_data,
135         .rows                   = 8,
136         .cols                   = 8,
137 };
138 static 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
174 static 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
184 static struct gpio_led_platform_data sdp4430_led_data = {
185         .leds   = sdp4430_gpio_leds,
186         .num_leds       = ARRAY_SIZE(sdp4430_gpio_leds),
187 };
188
189 static 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
198 static struct led_pwm_platform_data sdp4430_pwm_data = {
199         .num_leds       = ARRAY_SIZE(sdp4430_pwm_leds),
200         .leds           = sdp4430_pwm_leds,
201 };
202
203 static struct platform_device sdp4430_leds_pwm = {
204         .name   = "leds_pwm",
205         .id     = -1,
206         .dev    = {
207                 .platform_data = &sdp4430_pwm_data,
208         },
209 };
210
211 static int omap_prox_activate(struct device *dev)
212 {
213         gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
214         return 0;
215 }
216
217 static void omap_prox_deactivate(struct device *dev)
218 {
219         gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
220 }
221
222 static 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
229 static 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
237 static struct platform_device sdp4430_leds_gpio = {
238         .name   = "leds-gpio",
239         .id     = -1,
240         .dev    = {
241                 .platform_data = &sdp4430_led_data,
242         },
243 };
244 static 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
254 static 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
300 error3:
301         gpio_free(ETH_KS8851_IRQ);
302 error2:
303         gpio_free(ETH_KS8851_QUART);
304 error1:
305         gpio_free(ETH_KS8851_POWER_ON);
306         return status;
307 }
308
309 static struct platform_device sdp4430_lcd_device = {
310         .name           = "sdp4430_lcd",
311         .id             = -1,
312 };
313
314 static struct platform_device *sdp4430_devices[] __initdata = {
315         &sdp4430_lcd_device,
316         &sdp4430_gpio_keys_device,
317         &sdp4430_leds_gpio,
318         &sdp4430_leds_pwm,
319 };
320
321 static struct omap_lcd_config sdp4430_lcd_config __initdata = {
322         .ctrl_name      = "internal",
323 };
324
325 static struct omap_board_config_kernel sdp4430_config[] __initdata = {
326         { OMAP_TAG_LCD,         &sdp4430_lcd_config },
327 };
328
329 static void __init omap_4430sdp_init_early(void)
330 {
331         omap2_init_common_infrastructure();
332         omap2_init_common_devices(NULL, NULL);
333 #ifdef CONFIG_OMAP_32K_TIMER
334         omap2_gp_clockevent_set_gptimer(1);
335 #endif
336 }
337
338 static struct omap_musb_board_data musb_board_data = {
339         .interface_type         = MUSB_INTERFACE_UTMI,
340         .mode                   = MUSB_OTG,
341         .power                  = 100,
342 };
343
344 static 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         .phy_suspend    = omap4430_phy_suspend,
350 };
351
352 static struct omap2_hsmmc_info mmc[] = {
353         {
354                 .mmc            = 2,
355                 .caps           =  MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
356                 .gpio_cd        = -EINVAL,
357                 .gpio_wp        = -EINVAL,
358                 .nonremovable   = true,
359                 .ocr_mask       = MMC_VDD_29_30,
360         },
361         {
362                 .mmc            = 1,
363                 .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
364                 .gpio_wp        = -EINVAL,
365         },
366         {}      /* Terminator */
367 };
368
369 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
370         {
371                 .supply = "vmmc",
372                 .dev_name = "omap_hsmmc.1",
373         },
374 };
375 static struct regulator_consumer_supply sdp4430_vmmc_supply[] = {
376         {
377                 .supply = "vmmc",
378                 .dev_name = "omap_hsmmc.0",
379         },
380 };
381
382 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
383 {
384         int ret = 0;
385         struct platform_device *pdev = container_of(dev,
386                                 struct platform_device, dev);
387         struct omap_mmc_platform_data *pdata = dev->platform_data;
388
389         /* Setting MMC1 Card detect Irq */
390         if (pdev->id == 0) {
391                 ret = twl6030_mmc_card_detect_config();
392                 if (ret)
393                         pr_err("Failed configuring MMC1 card detect\n");
394                 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
395                                                 MMCDETECT_INTR_OFFSET;
396                 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
397         }
398         return ret;
399 }
400
401 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
402 {
403         struct omap_mmc_platform_data *pdata;
404
405         /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
406         if (!dev) {
407                 pr_err("Failed %s\n", __func__);
408                 return;
409         }
410         pdata = dev->platform_data;
411         pdata->init =   omap4_twl6030_hsmmc_late_init;
412 }
413
414 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
415 {
416         struct omap2_hsmmc_info *c;
417
418         omap2_hsmmc_init(controllers);
419         for (c = controllers; c->mmc; c++)
420                 omap4_twl6030_hsmmc_set_late_init(c->dev);
421
422         return 0;
423 }
424
425 static struct regulator_init_data sdp4430_vaux1 = {
426         .constraints = {
427                 .min_uV                 = 1000000,
428                 .max_uV                 = 3000000,
429                 .apply_uV               = true,
430                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
431                                         | REGULATOR_MODE_STANDBY,
432                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
433                                         | REGULATOR_CHANGE_MODE
434                                         | REGULATOR_CHANGE_STATUS,
435         },
436         .num_consumer_supplies  = 1,
437         .consumer_supplies      = sdp4430_vaux_supply,
438 };
439
440 static struct regulator_init_data sdp4430_vaux2 = {
441         .constraints = {
442                 .min_uV                 = 1200000,
443                 .max_uV                 = 2800000,
444                 .apply_uV               = true,
445                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
446                                         | REGULATOR_MODE_STANDBY,
447                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
448                                         | REGULATOR_CHANGE_MODE
449                                         | REGULATOR_CHANGE_STATUS,
450         },
451 };
452
453 static struct regulator_init_data sdp4430_vaux3 = {
454         .constraints = {
455                 .min_uV                 = 1000000,
456                 .max_uV                 = 3000000,
457                 .apply_uV               = true,
458                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
459                                         | REGULATOR_MODE_STANDBY,
460                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
461                                         | REGULATOR_CHANGE_MODE
462                                         | REGULATOR_CHANGE_STATUS,
463         },
464 };
465
466 /* VMMC1 for MMC1 card */
467 static struct regulator_init_data sdp4430_vmmc = {
468         .constraints = {
469                 .min_uV                 = 1200000,
470                 .max_uV                 = 3000000,
471                 .apply_uV               = true,
472                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
473                                         | REGULATOR_MODE_STANDBY,
474                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
475                                         | REGULATOR_CHANGE_MODE
476                                         | REGULATOR_CHANGE_STATUS,
477         },
478         .num_consumer_supplies  = 1,
479         .consumer_supplies      = sdp4430_vmmc_supply,
480 };
481
482 static struct regulator_init_data sdp4430_vpp = {
483         .constraints = {
484                 .min_uV                 = 1800000,
485                 .max_uV                 = 2500000,
486                 .apply_uV               = true,
487                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
488                                         | REGULATOR_MODE_STANDBY,
489                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
490                                         | REGULATOR_CHANGE_MODE
491                                         | REGULATOR_CHANGE_STATUS,
492         },
493 };
494
495 static struct regulator_init_data sdp4430_vusim = {
496         .constraints = {
497                 .min_uV                 = 1200000,
498                 .max_uV                 = 2900000,
499                 .apply_uV               = true,
500                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
501                                         | REGULATOR_MODE_STANDBY,
502                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
503                                         | REGULATOR_CHANGE_MODE
504                                         | REGULATOR_CHANGE_STATUS,
505         },
506 };
507
508 static struct regulator_init_data sdp4430_vana = {
509         .constraints = {
510                 .min_uV                 = 2100000,
511                 .max_uV                 = 2100000,
512                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
513                                         | REGULATOR_MODE_STANDBY,
514                 .valid_ops_mask  = REGULATOR_CHANGE_MODE
515                                         | REGULATOR_CHANGE_STATUS,
516         },
517 };
518
519 static struct regulator_init_data sdp4430_vcxio = {
520         .constraints = {
521                 .min_uV                 = 1800000,
522                 .max_uV                 = 1800000,
523                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
524                                         | REGULATOR_MODE_STANDBY,
525                 .valid_ops_mask  = REGULATOR_CHANGE_MODE
526                                         | REGULATOR_CHANGE_STATUS,
527         },
528 };
529
530 static struct regulator_init_data sdp4430_vdac = {
531         .constraints = {
532                 .min_uV                 = 1800000,
533                 .max_uV                 = 1800000,
534                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
535                                         | REGULATOR_MODE_STANDBY,
536                 .valid_ops_mask  = REGULATOR_CHANGE_MODE
537                                         | REGULATOR_CHANGE_STATUS,
538         },
539 };
540
541 static struct regulator_init_data sdp4430_vusb = {
542         .constraints = {
543                 .min_uV                 = 3300000,
544                 .max_uV                 = 3300000,
545                 .apply_uV               = true,
546                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
547                                         | REGULATOR_MODE_STANDBY,
548                 .valid_ops_mask  =      REGULATOR_CHANGE_MODE
549                                         | REGULATOR_CHANGE_STATUS,
550         },
551 };
552
553 static struct regulator_init_data sdp4430_clk32kg = {
554         .constraints = {
555                 .valid_ops_mask         = REGULATOR_CHANGE_STATUS,
556         },
557 };
558
559 static struct twl4030_platform_data sdp4430_twldata = {
560         .irq_base       = TWL6030_IRQ_BASE,
561         .irq_end        = TWL6030_IRQ_END,
562
563         /* Regulators */
564         .vmmc           = &sdp4430_vmmc,
565         .vpp            = &sdp4430_vpp,
566         .vusim          = &sdp4430_vusim,
567         .vana           = &sdp4430_vana,
568         .vcxio          = &sdp4430_vcxio,
569         .vdac           = &sdp4430_vdac,
570         .vusb           = &sdp4430_vusb,
571         .vaux1          = &sdp4430_vaux1,
572         .vaux2          = &sdp4430_vaux2,
573         .vaux3          = &sdp4430_vaux3,
574         .clk32kg        = &sdp4430_clk32kg,
575         .usb            = &omap4_usbphy_data
576 };
577
578 static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
579         {
580                 I2C_BOARD_INFO("twl6030", 0x48),
581                 .flags = I2C_CLIENT_WAKE,
582                 .irq = OMAP44XX_IRQ_SYS_1N,
583                 .platform_data = &sdp4430_twldata,
584         },
585 };
586 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
587         {
588                 I2C_BOARD_INFO("tmp105", 0x48),
589         },
590         {
591                 I2C_BOARD_INFO("bh1780", 0x29),
592         },
593 };
594 static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
595         {
596                 I2C_BOARD_INFO("hmc5843", 0x1e),
597         },
598 };
599 static int __init omap4_i2c_init(void)
600 {
601         /*
602          * Phoenix Audio IC needs I2C1 to
603          * start with 400 KHz or less
604          */
605         omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
606                         ARRAY_SIZE(sdp4430_i2c_boardinfo));
607         omap_register_i2c_bus(2, 400, NULL, 0);
608         omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
609                                 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
610         omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
611                                 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
612         return 0;
613 }
614
615 static void __init omap_sfh7741prox_init(void)
616 {
617         int  error;
618
619         error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
620         if (error < 0) {
621                 pr_err("%s:failed to request GPIO %d, error %d\n",
622                         __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
623                 return;
624         }
625
626         error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
627         if (error < 0) {
628                 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
629                          __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
630                 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
631         }
632 }
633
634 static void sdp4430_hdmi_mux_init(void)
635 {
636         /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
637         omap_mux_init_signal("hdmi_hpd",
638                         OMAP_PIN_INPUT_PULLUP);
639         omap_mux_init_signal("hdmi_cec",
640                         OMAP_PIN_INPUT_PULLUP);
641         /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
642         omap_mux_init_signal("hdmi_ddc_scl",
643                         OMAP_PIN_INPUT_PULLUP);
644         omap_mux_init_signal("hdmi_ddc_sda",
645                         OMAP_PIN_INPUT_PULLUP);
646 }
647
648 static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
649 {
650         int status;
651
652         status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH,
653                                                         "hdmi_gpio_hpd");
654         if (status) {
655                 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD);
656                 return status;
657         }
658         status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH,
659                                                         "hdmi_gpio_ls_oe");
660         if (status) {
661                 pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE);
662                 goto error1;
663         }
664
665         return 0;
666
667 error1:
668         gpio_free(HDMI_GPIO_HPD);
669
670         return status;
671 }
672
673 static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
674 {
675         gpio_free(HDMI_GPIO_LS_OE);
676         gpio_free(HDMI_GPIO_HPD);
677 }
678
679 static struct omap_dss_device sdp4430_hdmi_device = {
680         .name = "hdmi",
681         .driver_name = "hdmi_panel",
682         .type = OMAP_DISPLAY_TYPE_HDMI,
683         .platform_enable = sdp4430_panel_enable_hdmi,
684         .platform_disable = sdp4430_panel_disable_hdmi,
685         .channel = OMAP_DSS_CHANNEL_DIGIT,
686 };
687
688 static struct omap_dss_device *sdp4430_dss_devices[] = {
689         &sdp4430_hdmi_device,
690 };
691
692 static struct omap_dss_board_info sdp4430_dss_data = {
693         .num_devices    = ARRAY_SIZE(sdp4430_dss_devices),
694         .devices        = sdp4430_dss_devices,
695         .default_device = &sdp4430_hdmi_device,
696 };
697
698 void omap_4430sdp_display_init(void)
699 {
700         sdp4430_hdmi_mux_init();
701         omap_display_init(&sdp4430_dss_data);
702 }
703
704 #ifdef CONFIG_OMAP_MUX
705 static struct omap_board_mux board_mux[] __initdata = {
706         OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
707         { .reg_offset = OMAP_MUX_TERMINATOR },
708 };
709
710 static struct omap_device_pad serial2_pads[] __initdata = {
711         OMAP_MUX_STATIC("uart2_cts.uart2_cts",
712                          OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
713         OMAP_MUX_STATIC("uart2_rts.uart2_rts",
714                          OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
715         OMAP_MUX_STATIC("uart2_rx.uart2_rx",
716                          OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
717         OMAP_MUX_STATIC("uart2_tx.uart2_tx",
718                          OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
719 };
720
721 static struct omap_device_pad serial3_pads[] __initdata = {
722         OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
723                          OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
724         OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
725                          OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
726         OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
727                          OMAP_PIN_INPUT | OMAP_MUX_MODE0),
728         OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
729                          OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
730 };
731
732 static struct omap_device_pad serial4_pads[] __initdata = {
733         OMAP_MUX_STATIC("uart4_rx.uart4_rx",
734                          OMAP_PIN_INPUT | OMAP_MUX_MODE0),
735         OMAP_MUX_STATIC("uart4_tx.uart4_tx",
736                          OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
737 };
738
739 static struct omap_board_data serial2_data = {
740         .id             = 1,
741         .pads           = serial2_pads,
742         .pads_cnt       = ARRAY_SIZE(serial2_pads),
743 };
744
745 static struct omap_board_data serial3_data = {
746         .id             = 2,
747         .pads           = serial3_pads,
748         .pads_cnt       = ARRAY_SIZE(serial3_pads),
749 };
750
751 static struct omap_board_data serial4_data = {
752         .id             = 3,
753         .pads           = serial4_pads,
754         .pads_cnt       = ARRAY_SIZE(serial4_pads),
755 };
756
757 static inline void board_serial_init(void)
758 {
759         struct omap_board_data bdata;
760         bdata.flags     = 0;
761         bdata.pads      = NULL;
762         bdata.pads_cnt  = 0;
763         bdata.id        = 0;
764         /* pass dummy data for UART1 */
765         omap_serial_init_port(&bdata);
766
767         omap_serial_init_port(&serial2_data);
768         omap_serial_init_port(&serial3_data);
769         omap_serial_init_port(&serial4_data);
770 }
771 #else
772 #define board_mux       NULL
773
774 static inline void board_serial_init(void)
775 {
776         omap_serial_init();
777 }
778  #endif
779
780 static void __init omap_4430sdp_init(void)
781 {
782         int status;
783         int package = OMAP_PACKAGE_CBS;
784
785         if (omap_rev() == OMAP4430_REV_ES1_0)
786                 package = OMAP_PACKAGE_CBL;
787         omap4_mux_init(board_mux, package);
788
789         omap_board_config = sdp4430_config;
790         omap_board_config_size = ARRAY_SIZE(sdp4430_config);
791
792         omap4_i2c_init();
793         omap_sfh7741prox_init();
794         platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
795         board_serial_init();
796         omap4_twl6030_hsmmc_init(mmc);
797
798         usb_musb_init(&musb_board_data);
799
800         status = omap_ethernet_init();
801         if (status) {
802                 pr_err("Ethernet initialization failed: %d\n", status);
803         } else {
804                 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
805                 spi_register_board_info(sdp4430_spi_board_info,
806                                 ARRAY_SIZE(sdp4430_spi_board_info));
807         }
808
809         status = omap4_keyboard_init(&sdp4430_keypad_data);
810         if (status)
811                 pr_err("Keypad initialization failed: %d\n", status);
812
813         omap_4430sdp_display_init();
814 }
815
816 static void __init omap_4430sdp_map_io(void)
817 {
818         omap2_set_globals_443x();
819         omap44xx_map_common_io();
820 }
821
822 MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
823         /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
824         .boot_params    = 0x80000100,
825         .reserve        = omap_reserve,
826         .map_io         = omap_4430sdp_map_io,
827         .init_early     = omap_4430sdp_init_early,
828         .init_irq       = gic_init_irq,
829         .init_machine   = omap_4430sdp_init,
830         .timer          = &omap_timer,
831 MACHINE_END