kill mm argument of vm_munmap()
[~shefty/rdma-dev.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/regulator/fixed.h>
26 #include <linux/leds.h>
27 #include <linux/leds_pwm.h>
28 #include <linux/platform_data/omap4-keypad.h>
29
30 #include <mach/hardware.h>
31 #include <asm/hardware/gic.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
35
36 #include <plat/board.h>
37 #include "common.h"
38 #include <plat/usb.h>
39 #include <plat/mmc.h>
40 #include <plat/omap4-keypad.h>
41 #include <video/omapdss.h>
42 #include <video/omap-panel-nokia-dsi.h>
43 #include <video/omap-panel-picodlp.h>
44 #include <linux/wl12xx.h>
45 #include <linux/platform_data/omap-abe-twl6040.h>
46
47 #include "mux.h"
48 #include "hsmmc.h"
49 #include "control.h"
50 #include "common-board-devices.h"
51
52 #define ETH_KS8851_IRQ                  34
53 #define ETH_KS8851_POWER_ON             48
54 #define ETH_KS8851_QUART                138
55 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO        184
56 #define OMAP4_SFH7741_ENABLE_GPIO               188
57 #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
58 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
59 #define HDMI_GPIO_HPD  63 /* Hotplug detect */
60 #define DISPLAY_SEL_GPIO        59      /* LCD2/PicoDLP switch */
61 #define DLP_POWER_ON_GPIO       40
62
63 #define GPIO_WIFI_PMENA         54
64 #define GPIO_WIFI_IRQ           53
65
66 static const int sdp4430_keymap[] = {
67         KEY(0, 0, KEY_E),
68         KEY(0, 1, KEY_R),
69         KEY(0, 2, KEY_T),
70         KEY(0, 3, KEY_HOME),
71         KEY(0, 4, KEY_F5),
72         KEY(0, 5, KEY_UNKNOWN),
73         KEY(0, 6, KEY_I),
74         KEY(0, 7, KEY_LEFTSHIFT),
75
76         KEY(1, 0, KEY_D),
77         KEY(1, 1, KEY_F),
78         KEY(1, 2, KEY_G),
79         KEY(1, 3, KEY_SEND),
80         KEY(1, 4, KEY_F6),
81         KEY(1, 5, KEY_UNKNOWN),
82         KEY(1, 6, KEY_K),
83         KEY(1, 7, KEY_ENTER),
84
85         KEY(2, 0, KEY_X),
86         KEY(2, 1, KEY_C),
87         KEY(2, 2, KEY_V),
88         KEY(2, 3, KEY_END),
89         KEY(2, 4, KEY_F7),
90         KEY(2, 5, KEY_UNKNOWN),
91         KEY(2, 6, KEY_DOT),
92         KEY(2, 7, KEY_CAPSLOCK),
93
94         KEY(3, 0, KEY_Z),
95         KEY(3, 1, KEY_KPPLUS),
96         KEY(3, 2, KEY_B),
97         KEY(3, 3, KEY_F1),
98         KEY(3, 4, KEY_F8),
99         KEY(3, 5, KEY_UNKNOWN),
100         KEY(3, 6, KEY_O),
101         KEY(3, 7, KEY_SPACE),
102
103         KEY(4, 0, KEY_W),
104         KEY(4, 1, KEY_Y),
105         KEY(4, 2, KEY_U),
106         KEY(4, 3, KEY_F2),
107         KEY(4, 4, KEY_VOLUMEUP),
108         KEY(4, 5, KEY_UNKNOWN),
109         KEY(4, 6, KEY_L),
110         KEY(4, 7, KEY_LEFT),
111
112         KEY(5, 0, KEY_S),
113         KEY(5, 1, KEY_H),
114         KEY(5, 2, KEY_J),
115         KEY(5, 3, KEY_F3),
116         KEY(5, 4, KEY_F9),
117         KEY(5, 5, KEY_VOLUMEDOWN),
118         KEY(5, 6, KEY_M),
119         KEY(5, 7, KEY_RIGHT),
120
121         KEY(6, 0, KEY_Q),
122         KEY(6, 1, KEY_A),
123         KEY(6, 2, KEY_N),
124         KEY(6, 3, KEY_BACK),
125         KEY(6, 4, KEY_BACKSPACE),
126         KEY(6, 5, KEY_UNKNOWN),
127         KEY(6, 6, KEY_P),
128         KEY(6, 7, KEY_UP),
129
130         KEY(7, 0, KEY_PROG1),
131         KEY(7, 1, KEY_PROG2),
132         KEY(7, 2, KEY_PROG3),
133         KEY(7, 3, KEY_PROG4),
134         KEY(7, 4, KEY_F4),
135         KEY(7, 5, KEY_UNKNOWN),
136         KEY(7, 6, KEY_OK),
137         KEY(7, 7, KEY_DOWN),
138 };
139 static struct omap_device_pad keypad_pads[] = {
140         {       .name   = "kpd_col1.kpd_col1",
141                 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
142         },
143         {       .name   = "kpd_col1.kpd_col1",
144                 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
145         },
146         {       .name   = "kpd_col2.kpd_col2",
147                 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
148         },
149         {       .name   = "kpd_col3.kpd_col3",
150                 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
151         },
152         {       .name   = "kpd_col4.kpd_col4",
153                 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
154         },
155         {       .name   = "kpd_col5.kpd_col5",
156                 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
157         },
158         {       .name   = "gpmc_a23.kpd_col7",
159                 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
160         },
161         {       .name   = "gpmc_a22.kpd_col6",
162                 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
163         },
164         {       .name   = "kpd_row0.kpd_row0",
165                 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
166                         OMAP_MUX_MODE1 | OMAP_INPUT_EN,
167         },
168         {       .name   = "kpd_row1.kpd_row1",
169                 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
170                         OMAP_MUX_MODE1 | OMAP_INPUT_EN,
171         },
172         {       .name   = "kpd_row2.kpd_row2",
173                 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
174                         OMAP_MUX_MODE1 | OMAP_INPUT_EN,
175         },
176         {       .name   = "kpd_row3.kpd_row3",
177                 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
178                         OMAP_MUX_MODE1 | OMAP_INPUT_EN,
179         },
180         {       .name   = "kpd_row4.kpd_row4",
181                 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
182                         OMAP_MUX_MODE1 | OMAP_INPUT_EN,
183         },
184         {       .name   = "kpd_row5.kpd_row5",
185                 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
186                         OMAP_MUX_MODE1 | OMAP_INPUT_EN,
187         },
188         {       .name   = "gpmc_a18.kpd_row6",
189                 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
190                         OMAP_MUX_MODE1 | OMAP_INPUT_EN,
191         },
192         {       .name   = "gpmc_a19.kpd_row7",
193                 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
194                         OMAP_MUX_MODE1 | OMAP_INPUT_EN,
195         },
196 };
197
198 static struct matrix_keymap_data sdp4430_keymap_data = {
199         .keymap                 = sdp4430_keymap,
200         .keymap_size            = ARRAY_SIZE(sdp4430_keymap),
201 };
202
203 static struct omap4_keypad_platform_data sdp4430_keypad_data = {
204         .keymap_data            = &sdp4430_keymap_data,
205         .rows                   = 8,
206         .cols                   = 8,
207 };
208
209 static struct omap_board_data keypad_data = {
210         .id                     = 1,
211         .pads                   = keypad_pads,
212         .pads_cnt               = ARRAY_SIZE(keypad_pads),
213 };
214
215 static struct gpio_led sdp4430_gpio_leds[] = {
216         {
217                 .name   = "omap4:green:debug0",
218                 .gpio   = 61,
219         },
220         {
221                 .name   = "omap4:green:debug1",
222                 .gpio   = 30,
223         },
224         {
225                 .name   = "omap4:green:debug2",
226                 .gpio   = 7,
227         },
228         {
229                 .name   = "omap4:green:debug3",
230                 .gpio   = 8,
231         },
232         {
233                 .name   = "omap4:green:debug4",
234                 .gpio   = 50,
235         },
236         {
237                 .name   = "omap4:blue:user",
238                 .gpio   = 169,
239         },
240         {
241                 .name   = "omap4:red:user",
242                 .gpio   = 170,
243         },
244         {
245                 .name   = "omap4:green:user",
246                 .gpio   = 139,
247         },
248
249 };
250
251 static struct gpio_keys_button sdp4430_gpio_keys[] = {
252         {
253                 .desc                   = "Proximity Sensor",
254                 .type                   = EV_SW,
255                 .code                   = SW_FRONT_PROXIMITY,
256                 .gpio                   = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
257                 .active_low             = 0,
258         }
259 };
260
261 static struct gpio_led_platform_data sdp4430_led_data = {
262         .leds   = sdp4430_gpio_leds,
263         .num_leds       = ARRAY_SIZE(sdp4430_gpio_leds),
264 };
265
266 static struct led_pwm sdp4430_pwm_leds[] = {
267         {
268                 .name           = "omap4:green:chrg",
269                 .pwm_id         = 1,
270                 .max_brightness = 255,
271                 .pwm_period_ns  = 7812500,
272         },
273 };
274
275 static struct led_pwm_platform_data sdp4430_pwm_data = {
276         .num_leds       = ARRAY_SIZE(sdp4430_pwm_leds),
277         .leds           = sdp4430_pwm_leds,
278 };
279
280 static struct platform_device sdp4430_leds_pwm = {
281         .name   = "leds_pwm",
282         .id     = -1,
283         .dev    = {
284                 .platform_data = &sdp4430_pwm_data,
285         },
286 };
287
288 static int omap_prox_activate(struct device *dev)
289 {
290         gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
291         return 0;
292 }
293
294 static void omap_prox_deactivate(struct device *dev)
295 {
296         gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
297 }
298
299 static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
300         .buttons        = sdp4430_gpio_keys,
301         .nbuttons       = ARRAY_SIZE(sdp4430_gpio_keys),
302         .enable         = omap_prox_activate,
303         .disable        = omap_prox_deactivate,
304 };
305
306 static struct platform_device sdp4430_gpio_keys_device = {
307         .name   = "gpio-keys",
308         .id     = -1,
309         .dev    = {
310                 .platform_data  = &sdp4430_gpio_keys_data,
311         },
312 };
313
314 static struct platform_device sdp4430_leds_gpio = {
315         .name   = "leds-gpio",
316         .id     = -1,
317         .dev    = {
318                 .platform_data = &sdp4430_led_data,
319         },
320 };
321 static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
322         {
323                 .modalias               = "ks8851",
324                 .bus_num                = 1,
325                 .chip_select            = 0,
326                 .max_speed_hz           = 24000000,
327                 /*
328                  * .irq is set to gpio_to_irq(ETH_KS8851_IRQ)
329                  * in omap_4430sdp_init
330                  */
331         },
332 };
333
334 static struct gpio sdp4430_eth_gpios[] __initdata = {
335         { ETH_KS8851_POWER_ON,  GPIOF_OUT_INIT_HIGH,    "eth_power"     },
336         { ETH_KS8851_QUART,     GPIOF_OUT_INIT_HIGH,    "quart"         },
337         { ETH_KS8851_IRQ,       GPIOF_IN,               "eth_irq"       },
338 };
339
340 static int __init omap_ethernet_init(void)
341 {
342         int status;
343
344         /* Request of GPIO lines */
345         status = gpio_request_array(sdp4430_eth_gpios,
346                                     ARRAY_SIZE(sdp4430_eth_gpios));
347         if (status)
348                 pr_err("Cannot request ETH GPIOs\n");
349
350         return status;
351 }
352
353 static struct regulator_consumer_supply sdp4430_vbat_supply[] = {
354         REGULATOR_SUPPLY("vddvibl", "twl6040-vibra"),
355         REGULATOR_SUPPLY("vddvibr", "twl6040-vibra"),
356 };
357
358 static struct regulator_init_data sdp4430_vbat_data = {
359         .constraints = {
360                 .always_on      = 1,
361         },
362         .num_consumer_supplies  = ARRAY_SIZE(sdp4430_vbat_supply),
363         .consumer_supplies      = sdp4430_vbat_supply,
364 };
365
366 static struct fixed_voltage_config sdp4430_vbat_pdata = {
367         .supply_name    = "VBAT",
368         .microvolts     = 3750000,
369         .init_data      = &sdp4430_vbat_data,
370         .gpio           = -EINVAL,
371 };
372
373 static struct platform_device sdp4430_vbat = {
374         .name           = "reg-fixed-voltage",
375         .id             = -1,
376         .dev = {
377                 .platform_data = &sdp4430_vbat_pdata,
378         },
379 };
380
381 static struct platform_device sdp4430_dmic_codec = {
382         .name   = "dmic-codec",
383         .id     = -1,
384 };
385
386 static struct omap_abe_twl6040_data sdp4430_abe_audio_data = {
387         .card_name = "SDP4430",
388         .has_hs         = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
389         .has_hf         = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
390         .has_ep         = 1,
391         .has_aux        = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
392         .has_vibra      = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
393
394         .has_dmic       = 1,
395         .has_hsmic      = 1,
396         .has_mainmic    = 1,
397         .has_submic     = 1,
398         .has_afm        = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
399
400         .jack_detection = 1,
401         /* MCLK input is 38.4MHz */
402         .mclk_freq      = 38400000,
403 };
404
405 static struct platform_device sdp4430_abe_audio = {
406         .name           = "omap-abe-twl6040",
407         .id             = -1,
408         .dev = {
409                 .platform_data = &sdp4430_abe_audio_data,
410         },
411 };
412
413 static struct platform_device *sdp4430_devices[] __initdata = {
414         &sdp4430_gpio_keys_device,
415         &sdp4430_leds_gpio,
416         &sdp4430_leds_pwm,
417         &sdp4430_vbat,
418         &sdp4430_dmic_codec,
419         &sdp4430_abe_audio,
420 };
421
422 static struct omap_musb_board_data musb_board_data = {
423         .interface_type         = MUSB_INTERFACE_UTMI,
424         .mode                   = MUSB_OTG,
425         .power                  = 100,
426 };
427
428 static struct omap2_hsmmc_info mmc[] = {
429         {
430                 .mmc            = 2,
431                 .caps           =  MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
432                 .gpio_cd        = -EINVAL,
433                 .gpio_wp        = -EINVAL,
434                 .nonremovable   = true,
435                 .ocr_mask       = MMC_VDD_29_30,
436                 .no_off_init    = true,
437         },
438         {
439                 .mmc            = 1,
440                 .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
441                 .gpio_cd        = -EINVAL,
442                 .gpio_wp        = -EINVAL,
443         },
444         {
445                 .mmc            = 5,
446                 .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
447                 .pm_caps        = MMC_PM_KEEP_POWER,
448                 .gpio_cd        = -EINVAL,
449                 .gpio_wp        = -EINVAL,
450                 .ocr_mask       = MMC_VDD_165_195,
451                 .nonremovable   = true,
452         },
453         {}      /* Terminator */
454 };
455
456 static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
457         REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
458 };
459
460 static struct regulator_consumer_supply omap4_sdp4430_vmmc5_supply = {
461         .supply = "vmmc",
462         .dev_name = "omap_hsmmc.4",
463 };
464
465 static struct regulator_init_data sdp4430_vmmc5 = {
466         .constraints = {
467                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
468         },
469         .num_consumer_supplies = 1,
470         .consumer_supplies = &omap4_sdp4430_vmmc5_supply,
471 };
472
473 static struct fixed_voltage_config sdp4430_vwlan = {
474         .supply_name            = "vwl1271",
475         .microvolts             = 1800000, /* 1.8V */
476         .gpio                   = GPIO_WIFI_PMENA,
477         .startup_delay          = 70000, /* 70msec */
478         .enable_high            = 1,
479         .enabled_at_boot        = 0,
480         .init_data              = &sdp4430_vmmc5,
481 };
482
483 static struct platform_device omap_vwlan_device = {
484         .name           = "reg-fixed-voltage",
485         .id             = 1,
486         .dev = {
487                 .platform_data = &sdp4430_vwlan,
488         },
489 };
490
491 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
492 {
493         int irq = 0;
494         struct platform_device *pdev = container_of(dev,
495                                 struct platform_device, dev);
496         struct omap_mmc_platform_data *pdata = dev->platform_data;
497
498         /* Setting MMC1 Card detect Irq */
499         if (pdev->id == 0) {
500                 irq = twl6030_mmc_card_detect_config();
501                 if (irq < 0) {
502                         pr_err("Failed configuring MMC1 card detect\n");
503                         return irq;
504                 }
505                 pdata->slots[0].card_detect_irq = irq;
506                 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
507         }
508         return 0;
509 }
510
511 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
512 {
513         struct omap_mmc_platform_data *pdata;
514
515         /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
516         if (!dev) {
517                 pr_err("Failed %s\n", __func__);
518                 return;
519         }
520         pdata = dev->platform_data;
521         pdata->init =   omap4_twl6030_hsmmc_late_init;
522 }
523
524 static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
525 {
526         struct omap2_hsmmc_info *c;
527
528         omap_hsmmc_init(controllers);
529         for (c = controllers; c->mmc; c++)
530                 omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev);
531
532         return 0;
533 }
534
535 static struct regulator_init_data sdp4430_vaux1 = {
536         .constraints = {
537                 .min_uV                 = 1000000,
538                 .max_uV                 = 3000000,
539                 .apply_uV               = true,
540                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
541                                         | REGULATOR_MODE_STANDBY,
542                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
543                                         | REGULATOR_CHANGE_MODE
544                                         | REGULATOR_CHANGE_STATUS,
545         },
546         .num_consumer_supplies  = ARRAY_SIZE(sdp4430_vaux_supply),
547         .consumer_supplies      = sdp4430_vaux_supply,
548 };
549
550 static struct regulator_init_data sdp4430_vusim = {
551         .constraints = {
552                 .min_uV                 = 1200000,
553                 .max_uV                 = 2900000,
554                 .apply_uV               = true,
555                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
556                                         | REGULATOR_MODE_STANDBY,
557                 .valid_ops_mask  = REGULATOR_CHANGE_VOLTAGE
558                                         | REGULATOR_CHANGE_MODE
559                                         | REGULATOR_CHANGE_STATUS,
560         },
561 };
562
563 static struct twl4030_codec_data twl6040_codec = {
564         /* single-step ramp for headset and handsfree */
565         .hs_left_step   = 0x0f,
566         .hs_right_step  = 0x0f,
567         .hf_left_step   = 0x1d,
568         .hf_right_step  = 0x1d,
569 };
570
571 static struct twl4030_vibra_data twl6040_vibra = {
572         .vibldrv_res = 8,
573         .vibrdrv_res = 3,
574         .viblmotor_res = 10,
575         .vibrmotor_res = 10,
576         .vddvibl_uV = 0,        /* fixed volt supply - VBAT */
577         .vddvibr_uV = 0,        /* fixed volt supply - VBAT */
578 };
579
580 static struct twl4030_audio_data twl6040_audio = {
581         .codec          = &twl6040_codec,
582         .vibra          = &twl6040_vibra,
583         .audpwron_gpio  = 127,
584         .naudint_irq    = OMAP44XX_IRQ_SYS_2N,
585         .irq_base       = TWL6040_CODEC_IRQ_BASE,
586 };
587
588 static struct twl4030_platform_data sdp4430_twldata = {
589         .audio          = &twl6040_audio,
590         /* Regulators */
591         .vusim          = &sdp4430_vusim,
592         .vaux1          = &sdp4430_vaux1,
593 };
594
595 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
596         {
597                 I2C_BOARD_INFO("tmp105", 0x48),
598         },
599         {
600                 I2C_BOARD_INFO("bh1780", 0x29),
601         },
602 };
603 static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
604         {
605                 I2C_BOARD_INFO("hmc5843", 0x1e),
606         },
607 };
608 static int __init omap4_i2c_init(void)
609 {
610         omap4_pmic_get_config(&sdp4430_twldata, TWL_COMMON_PDATA_USB,
611                         TWL_COMMON_REGULATOR_VDAC |
612                         TWL_COMMON_REGULATOR_VAUX2 |
613                         TWL_COMMON_REGULATOR_VAUX3 |
614                         TWL_COMMON_REGULATOR_VMMC |
615                         TWL_COMMON_REGULATOR_VPP |
616                         TWL_COMMON_REGULATOR_VANA |
617                         TWL_COMMON_REGULATOR_VCXIO |
618                         TWL_COMMON_REGULATOR_VUSB |
619                         TWL_COMMON_REGULATOR_CLK32KG);
620         omap4_pmic_init("twl6030", &sdp4430_twldata);
621         omap_register_i2c_bus(2, 400, NULL, 0);
622         omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
623                                 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
624         omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
625                                 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
626         return 0;
627 }
628
629 static void __init omap_sfh7741prox_init(void)
630 {
631         int error;
632
633         error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
634                                  GPIOF_OUT_INIT_LOW, "sfh7741");
635         if (error < 0)
636                 pr_err("%s:failed to request GPIO %d, error %d\n",
637                         __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
638 }
639
640 static struct gpio sdp4430_hdmi_gpios[] = {
641         { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" },
642         { HDMI_GPIO_LS_OE,      GPIOF_OUT_INIT_HIGH,    "hdmi_gpio_ls_oe" },
643         { HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" },
644 };
645
646 static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
647 {
648         int status;
649
650         status = gpio_request_array(sdp4430_hdmi_gpios,
651                                     ARRAY_SIZE(sdp4430_hdmi_gpios));
652         if (status)
653                 pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
654
655         return status;
656 }
657
658 static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
659 {
660         gpio_free_array(sdp4430_hdmi_gpios, ARRAY_SIZE(sdp4430_hdmi_gpios));
661 }
662
663 static struct nokia_dsi_panel_data dsi1_panel = {
664                 .name           = "taal",
665                 .reset_gpio     = 102,
666                 .use_ext_te     = false,
667                 .ext_te_gpio    = 101,
668                 .esd_interval   = 0,
669 };
670
671 static struct omap_dss_device sdp4430_lcd_device = {
672         .name                   = "lcd",
673         .driver_name            = "taal",
674         .type                   = OMAP_DISPLAY_TYPE_DSI,
675         .data                   = &dsi1_panel,
676         .phy.dsi                = {
677                 .clk_lane       = 1,
678                 .clk_pol        = 0,
679                 .data1_lane     = 2,
680                 .data1_pol      = 0,
681                 .data2_lane     = 3,
682                 .data2_pol      = 0,
683
684                 .module         = 0,
685         },
686
687         .clocks = {
688                 .dispc = {
689                         .channel = {
690                                 /* Logic Clock = 172.8 MHz */
691                                 .lck_div        = 1,
692                                 /* Pixel Clock = 34.56 MHz */
693                                 .pck_div        = 5,
694                                 .lcd_clk_src    = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC,
695                         },
696                         .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
697                 },
698
699                 .dsi = {
700                         .regn           = 16,   /* Fint = 2.4 MHz */
701                         .regm           = 180,  /* DDR Clock = 216 MHz */
702                         .regm_dispc     = 5,    /* PLL1_CLK1 = 172.8 MHz */
703                         .regm_dsi       = 5,    /* PLL1_CLK2 = 172.8 MHz */
704
705                         .lp_clk_div     = 10,   /* LP Clock = 8.64 MHz */
706                         .dsi_fclk_src   = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI,
707                 },
708         },
709         .channel                = OMAP_DSS_CHANNEL_LCD,
710 };
711
712 static struct nokia_dsi_panel_data dsi2_panel = {
713                 .name           = "taal",
714                 .reset_gpio     = 104,
715                 .use_ext_te     = false,
716                 .ext_te_gpio    = 103,
717                 .esd_interval   = 0,
718 };
719
720 static struct omap_dss_device sdp4430_lcd2_device = {
721         .name                   = "lcd2",
722         .driver_name            = "taal",
723         .type                   = OMAP_DISPLAY_TYPE_DSI,
724         .data                   = &dsi2_panel,
725         .phy.dsi                = {
726                 .clk_lane       = 1,
727                 .clk_pol        = 0,
728                 .data1_lane     = 2,
729                 .data1_pol      = 0,
730                 .data2_lane     = 3,
731                 .data2_pol      = 0,
732
733                 .module         = 1,
734         },
735
736         .clocks = {
737                 .dispc = {
738                         .channel = {
739                                 /* Logic Clock = 172.8 MHz */
740                                 .lck_div        = 1,
741                                 /* Pixel Clock = 34.56 MHz */
742                                 .pck_div        = 5,
743                                 .lcd_clk_src    = OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC,
744                         },
745                         .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
746                 },
747
748                 .dsi = {
749                         .regn           = 16,   /* Fint = 2.4 MHz */
750                         .regm           = 180,  /* DDR Clock = 216 MHz */
751                         .regm_dispc     = 5,    /* PLL1_CLK1 = 172.8 MHz */
752                         .regm_dsi       = 5,    /* PLL1_CLK2 = 172.8 MHz */
753
754                         .lp_clk_div     = 10,   /* LP Clock = 8.64 MHz */
755                         .dsi_fclk_src   = OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI,
756                 },
757         },
758         .channel                = OMAP_DSS_CHANNEL_LCD2,
759 };
760
761 static void sdp4430_lcd_init(void)
762 {
763         int r;
764
765         r = gpio_request_one(dsi1_panel.reset_gpio, GPIOF_DIR_OUT,
766                 "lcd1_reset_gpio");
767         if (r)
768                 pr_err("%s: Could not get lcd1_reset_gpio\n", __func__);
769
770         r = gpio_request_one(dsi2_panel.reset_gpio, GPIOF_DIR_OUT,
771                 "lcd2_reset_gpio");
772         if (r)
773                 pr_err("%s: Could not get lcd2_reset_gpio\n", __func__);
774 }
775
776 static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
777         .hpd_gpio = HDMI_GPIO_HPD,
778 };
779
780 static struct omap_dss_device sdp4430_hdmi_device = {
781         .name = "hdmi",
782         .driver_name = "hdmi_panel",
783         .type = OMAP_DISPLAY_TYPE_HDMI,
784         .platform_enable = sdp4430_panel_enable_hdmi,
785         .platform_disable = sdp4430_panel_disable_hdmi,
786         .channel = OMAP_DSS_CHANNEL_DIGIT,
787         .data = &sdp4430_hdmi_data,
788 };
789
790 static struct picodlp_panel_data sdp4430_picodlp_pdata = {
791         .picodlp_adapter_id     = 2,
792         .emu_done_gpio          = 44,
793         .pwrgood_gpio           = 45,
794 };
795
796 static void sdp4430_picodlp_init(void)
797 {
798         int r;
799         const struct gpio picodlp_gpios[] = {
800                 {DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW,
801                         "DLP POWER ON"},
802                 {sdp4430_picodlp_pdata.emu_done_gpio, GPIOF_IN,
803                         "DLP EMU DONE"},
804                 {sdp4430_picodlp_pdata.pwrgood_gpio, GPIOF_OUT_INIT_LOW,
805                         "DLP PWRGOOD"},
806         };
807
808         r = gpio_request_array(picodlp_gpios, ARRAY_SIZE(picodlp_gpios));
809         if (r)
810                 pr_err("Cannot request PicoDLP GPIOs, error %d\n", r);
811 }
812
813 static int sdp4430_panel_enable_picodlp(struct omap_dss_device *dssdev)
814 {
815         gpio_set_value(DISPLAY_SEL_GPIO, 0);
816         gpio_set_value(DLP_POWER_ON_GPIO, 1);
817
818         return 0;
819 }
820
821 static void sdp4430_panel_disable_picodlp(struct omap_dss_device *dssdev)
822 {
823         gpio_set_value(DLP_POWER_ON_GPIO, 0);
824         gpio_set_value(DISPLAY_SEL_GPIO, 1);
825 }
826
827 static struct omap_dss_device sdp4430_picodlp_device = {
828         .name                   = "picodlp",
829         .driver_name            = "picodlp_panel",
830         .type                   = OMAP_DISPLAY_TYPE_DPI,
831         .phy.dpi.data_lines     = 24,
832         .channel                = OMAP_DSS_CHANNEL_LCD2,
833         .platform_enable        = sdp4430_panel_enable_picodlp,
834         .platform_disable       = sdp4430_panel_disable_picodlp,
835         .data                   = &sdp4430_picodlp_pdata,
836 };
837
838 static struct omap_dss_device *sdp4430_dss_devices[] = {
839         &sdp4430_lcd_device,
840         &sdp4430_lcd2_device,
841         &sdp4430_hdmi_device,
842         &sdp4430_picodlp_device,
843 };
844
845 static struct omap_dss_board_info sdp4430_dss_data = {
846         .num_devices    = ARRAY_SIZE(sdp4430_dss_devices),
847         .devices        = sdp4430_dss_devices,
848         .default_device = &sdp4430_lcd_device,
849 };
850
851 static void __init omap_4430sdp_display_init(void)
852 {
853         int r;
854
855         /* Enable LCD2 by default (instead of Pico DLP) */
856         r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
857                         "display_sel");
858         if (r)
859                 pr_err("%s: Could not get display_sel GPIO\n", __func__);
860
861         sdp4430_lcd_init();
862         sdp4430_picodlp_init();
863         omap_display_init(&sdp4430_dss_data);
864         /*
865          * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
866          * later have external pull up on the HDMI I2C lines
867          */
868         if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
869                 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
870         else
871                 omap_hdmi_init(0);
872
873         omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
874         omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
875         omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
876 }
877
878 #ifdef CONFIG_OMAP_MUX
879 static struct omap_board_mux board_mux[] __initdata = {
880         OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
881         { .reg_offset = OMAP_MUX_TERMINATOR },
882 };
883
884 #else
885 #define board_mux       NULL
886  #endif
887
888 static void __init omap4_sdp4430_wifi_mux_init(void)
889 {
890         omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT |
891                                 OMAP_PIN_OFF_WAKEUPENABLE);
892         omap_mux_init_gpio(GPIO_WIFI_PMENA, OMAP_PIN_OUTPUT);
893
894         omap_mux_init_signal("sdmmc5_cmd.sdmmc5_cmd",
895                                 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
896         omap_mux_init_signal("sdmmc5_clk.sdmmc5_clk",
897                                 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
898         omap_mux_init_signal("sdmmc5_dat0.sdmmc5_dat0",
899                                 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
900         omap_mux_init_signal("sdmmc5_dat1.sdmmc5_dat1",
901                                 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
902         omap_mux_init_signal("sdmmc5_dat2.sdmmc5_dat2",
903                                 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
904         omap_mux_init_signal("sdmmc5_dat3.sdmmc5_dat3",
905                                 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
906
907 }
908
909 static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
910         .board_ref_clock = WL12XX_REFCLOCK_26,
911         .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
912 };
913
914 static void __init omap4_sdp4430_wifi_init(void)
915 {
916         int ret;
917
918         omap4_sdp4430_wifi_mux_init();
919         omap4_sdp4430_wlan_data.irq = gpio_to_irq(GPIO_WIFI_IRQ);
920         ret = wl12xx_set_platform_data(&omap4_sdp4430_wlan_data);
921         if (ret)
922                 pr_err("Error setting wl12xx data: %d\n", ret);
923         ret = platform_device_register(&omap_vwlan_device);
924         if (ret)
925                 pr_err("Error registering wl12xx device: %d\n", ret);
926 }
927
928 static void __init omap_4430sdp_init(void)
929 {
930         int status;
931         int package = OMAP_PACKAGE_CBS;
932
933         if (omap_rev() == OMAP4430_REV_ES1_0)
934                 package = OMAP_PACKAGE_CBL;
935         omap4_mux_init(board_mux, NULL, package);
936
937         omap4_i2c_init();
938         omap_sfh7741prox_init();
939         platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
940         omap_serial_init();
941         omap_sdrc_init(NULL, NULL);
942         omap4_sdp4430_wifi_init();
943         omap4_twl6030_hsmmc_init(mmc);
944
945         usb_musb_init(&musb_board_data);
946
947         status = omap_ethernet_init();
948         if (status) {
949                 pr_err("Ethernet initialization failed: %d\n", status);
950         } else {
951                 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
952                 spi_register_board_info(sdp4430_spi_board_info,
953                                 ARRAY_SIZE(sdp4430_spi_board_info));
954         }
955
956         status = omap4_keyboard_init(&sdp4430_keypad_data, &keypad_data);
957         if (status)
958                 pr_err("Keypad initialization failed: %d\n", status);
959
960         omap_4430sdp_display_init();
961 }
962
963 MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
964         /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
965         .atag_offset    = 0x100,
966         .reserve        = omap_reserve,
967         .map_io         = omap4_map_io,
968         .init_early     = omap4430_init_early,
969         .init_irq       = gic_init_irq,
970         .handle_irq     = gic_handle_irq,
971         .init_machine   = omap_4430sdp_init,
972         .timer          = &omap4_timer,
973         .restart        = omap_prcm_restart,
974 MACHINE_END