blob: e7d629b3c76aca4c20038863cc78cf3cf6a008aa [file] [log] [blame]
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -07001/*
2 * linux/arch/arm/mach-omap2/board-3430sdp.c
3 *
4 * Copyright (C) 2007 Texas Instruments
5 *
6 * Modified from mach-omap2/board-generic.c
7 *
8 * Initial code: Syed Mohammed Khasim
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/delay.h>
19#include <linux/input.h>
Janusz Krzysztofik61354342009-10-22 14:43:17 -070020#include <linux/input/matrix_keypad.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070021#include <linux/spi/spi.h>
22#include <linux/spi/ads7846.h>
Santosh Shilimkarb07682b2009-12-13 20:05:51 +010023#include <linux/i2c/twl.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070024#include <linux/regulator/machine.h>
25#include <linux/io.h>
26#include <linux/gpio.h>
27
28#include <mach/hardware.h>
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
32
Tony Lindgrence491cf2009-10-20 09:40:47 -070033#include <plat/mcspi.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070034#include <plat/board.h>
35#include <plat/usb.h>
36#include <plat/common.h>
37#include <plat/dma.h>
38#include <plat/gpmc.h>
Tomi Valkeinend9056ce2009-12-09 18:25:18 +020039#include <plat/display.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070040
Tony Lindgrence491cf2009-10-20 09:40:47 -070041#include <plat/control.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070042#include <plat/gpmc-smc91x.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070043
Vimal Singh88c84602010-02-15 10:03:34 -080044#include <mach/board-sdp.h>
45
Tony Lindgrenca5742b2009-12-11 16:16:32 -080046#include "mux.h"
Paul Walmsley17a722c2009-05-28 14:03:59 -070047#include "sdram-qimonda-hyb18m512160af-6.h"
Adrian Hunterd02a900b2010-02-15 10:03:34 -080048#include "hsmmc.h"
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080049#include "pm.h"
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070050
51#define CONFIG_DISABLE_HFCLK 1
52
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070053#define SDP3430_TS_GPIO_IRQ_SDPV1 3
54#define SDP3430_TS_GPIO_IRQ_SDPV2 2
55
56#define ENABLE_VAUX3_DEDICATED 0x03
57#define ENABLE_VAUX3_DEV_GRP 0x20
58
59#define TWL4030_MSECURE_GPIO 22
60
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080061/* FIXME: These values need to be updated based on more profiling on 3430sdp*/
62static struct cpuidle_params omap3_cpuidle_params_table[] = {
63 /* C1 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020064 {1, 2, 2, 5},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080065 /* C2 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020066 {1, 10, 10, 30},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080067 /* C3 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020068 {1, 50, 50, 300},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080069 /* C4 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020070 {1, 1500, 1800, 4000},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080071 /* C5 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020072 {1, 2500, 7500, 12000},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080073 /* C6 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020074 {1, 3000, 8500, 15000},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080075 /* C7 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020076 {1, 10000, 30000, 300000},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080077};
78
Tony Lindgren4f543332009-09-24 16:23:16 -070079static int board_keymap[] = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070080 KEY(0, 0, KEY_LEFT),
81 KEY(0, 1, KEY_RIGHT),
82 KEY(0, 2, KEY_A),
83 KEY(0, 3, KEY_B),
84 KEY(0, 4, KEY_C),
85 KEY(1, 0, KEY_DOWN),
86 KEY(1, 1, KEY_UP),
87 KEY(1, 2, KEY_E),
88 KEY(1, 3, KEY_F),
89 KEY(1, 4, KEY_G),
90 KEY(2, 0, KEY_ENTER),
91 KEY(2, 1, KEY_I),
92 KEY(2, 2, KEY_J),
93 KEY(2, 3, KEY_K),
94 KEY(2, 4, KEY_3),
95 KEY(3, 0, KEY_M),
96 KEY(3, 1, KEY_N),
97 KEY(3, 2, KEY_O),
98 KEY(3, 3, KEY_P),
99 KEY(3, 4, KEY_Q),
100 KEY(4, 0, KEY_R),
101 KEY(4, 1, KEY_4),
102 KEY(4, 2, KEY_T),
103 KEY(4, 3, KEY_U),
104 KEY(4, 4, KEY_D),
105 KEY(5, 0, KEY_V),
106 KEY(5, 1, KEY_W),
107 KEY(5, 2, KEY_L),
108 KEY(5, 3, KEY_S),
109 KEY(5, 4, KEY_H),
110 0
111};
112
Tony Lindgren4f543332009-09-24 16:23:16 -0700113static struct matrix_keymap_data board_map_data = {
114 .keymap = board_keymap,
115 .keymap_size = ARRAY_SIZE(board_keymap),
116};
117
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700118static struct twl4030_keypad_data sdp3430_kp_data = {
Tony Lindgren4f543332009-09-24 16:23:16 -0700119 .keymap_data = &board_map_data,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700120 .rows = 5,
121 .cols = 6,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700122 .rep = 1,
123};
124
125static int ts_gpio; /* Needed for ads7846_get_pendown_state */
126
127/**
128 * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq
129 *
130 * @return - void. If request gpio fails then Flag KERN_ERR.
131 */
132static void ads7846_dev_init(void)
133{
134 if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) {
135 printk(KERN_ERR "can't get ads746 pen down GPIO\n");
136 return;
137 }
138
139 gpio_direction_input(ts_gpio);
140
141 omap_set_gpio_debounce(ts_gpio, 1);
142 omap_set_gpio_debounce_time(ts_gpio, 0xa);
143}
144
145static int ads7846_get_pendown_state(void)
146{
147 return !gpio_get_value(ts_gpio);
148}
149
150static struct ads7846_platform_data tsc2046_config __initdata = {
151 .get_pendown_state = ads7846_get_pendown_state,
152 .keep_vref_on = 1,
Ranjith Lohithakshan7a44ad22010-05-08 12:39:21 +0530153 .wakeup = true,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700154};
155
156
157static struct omap2_mcspi_device_config tsc2046_mcspi_config = {
158 .turbo_mode = 0,
159 .single_channel = 1, /* 0: slave, 1: master */
160};
161
162static struct spi_board_info sdp3430_spi_board_info[] __initdata = {
163 [0] = {
164 /*
165 * TSC2046 operates at a max freqency of 2MHz, so
166 * operate slightly below at 1.5MHz
167 */
168 .modalias = "ads7846",
169 .bus_num = 1,
170 .chip_select = 0,
171 .max_speed_hz = 1500000,
172 .controller_data = &tsc2046_mcspi_config,
173 .irq = 0,
174 .platform_data = &tsc2046_config,
175 },
176};
177
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200178
179#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
180#define SDP3430_LCD_PANEL_ENABLE_GPIO 5
181
182static unsigned backlight_gpio;
183static unsigned enable_gpio;
184static int lcd_enabled;
185static int dvi_enabled;
186
187static void __init sdp3430_display_init(void)
188{
189 int r;
190
191 enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO;
192 backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
193
194 r = gpio_request(enable_gpio, "LCD reset");
195 if (r) {
196 printk(KERN_ERR "failed to get LCD reset GPIO\n");
197 goto err0;
198 }
199
200 r = gpio_request(backlight_gpio, "LCD Backlight");
201 if (r) {
202 printk(KERN_ERR "failed to get LCD backlight GPIO\n");
203 goto err1;
204 }
205
206 gpio_direction_output(enable_gpio, 0);
207 gpio_direction_output(backlight_gpio, 0);
208
209 return;
210err1:
211 gpio_free(enable_gpio);
212err0:
213 return;
214}
215
216static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
217{
218 if (dvi_enabled) {
219 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
220 return -EINVAL;
221 }
222
223 gpio_direction_output(enable_gpio, 1);
224 gpio_direction_output(backlight_gpio, 1);
225
226 lcd_enabled = 1;
227
228 return 0;
229}
230
231static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
232{
233 lcd_enabled = 0;
234
235 gpio_direction_output(enable_gpio, 0);
236 gpio_direction_output(backlight_gpio, 0);
237}
238
239static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
240{
241 if (lcd_enabled) {
242 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
243 return -EINVAL;
244 }
245
246 dvi_enabled = 1;
247
248 return 0;
249}
250
251static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev)
252{
253 dvi_enabled = 0;
254}
255
256static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev)
257{
258 return 0;
259}
260
261static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev)
262{
263}
264
265
266static struct omap_dss_device sdp3430_lcd_device = {
267 .name = "lcd",
268 .driver_name = "sharp_ls_panel",
269 .type = OMAP_DISPLAY_TYPE_DPI,
270 .phy.dpi.data_lines = 16,
271 .platform_enable = sdp3430_panel_enable_lcd,
272 .platform_disable = sdp3430_panel_disable_lcd,
273};
274
275static struct omap_dss_device sdp3430_dvi_device = {
276 .name = "dvi",
277 .driver_name = "generic_panel",
278 .type = OMAP_DISPLAY_TYPE_DPI,
279 .phy.dpi.data_lines = 24,
280 .platform_enable = sdp3430_panel_enable_dvi,
281 .platform_disable = sdp3430_panel_disable_dvi,
282};
283
284static struct omap_dss_device sdp3430_tv_device = {
285 .name = "tv",
286 .driver_name = "venc",
287 .type = OMAP_DISPLAY_TYPE_VENC,
288 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
289 .platform_enable = sdp3430_panel_enable_tv,
290 .platform_disable = sdp3430_panel_disable_tv,
291};
292
293
294static struct omap_dss_device *sdp3430_dss_devices[] = {
295 &sdp3430_lcd_device,
296 &sdp3430_dvi_device,
297 &sdp3430_tv_device,
298};
299
300static struct omap_dss_board_info sdp3430_dss_data = {
301 .num_devices = ARRAY_SIZE(sdp3430_dss_devices),
302 .devices = sdp3430_dss_devices,
303 .default_device = &sdp3430_lcd_device,
304};
305
306static struct platform_device sdp3430_dss_device = {
307 .name = "omapdss",
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700308 .id = -1,
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200309 .dev = {
310 .platform_data = &sdp3430_dss_data,
311 },
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700312};
313
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200314static struct regulator_consumer_supply sdp3430_vdda_dac_supply = {
315 .supply = "vdda_dac",
316 .dev = &sdp3430_dss_device.dev,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700317};
318
319static struct platform_device *sdp3430_devices[] __initdata = {
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200320 &sdp3430_dss_device,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700321};
322
323static struct omap_board_config_kernel sdp3430_config[] __initdata = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700324};
325
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300326static void __init omap_3430sdp_init_irq(void)
327{
328 omap_board_config = sdp3430_config;
329 omap_board_config_size = ARRAY_SIZE(sdp3430_config);
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -0800330 omap3_pm_init_cpuidle(omap3_cpuidle_params_table);
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300331 omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL);
332 omap_init_irq();
333 omap_gpio_init();
334}
335
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700336static int sdp3430_batt_table[] = {
337/* 0 C*/
33830800, 29500, 28300, 27100,
33926000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
34017200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
34111600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
3428020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
3435640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
3444040, 3910, 3790, 3670, 3550
345};
346
347static struct twl4030_bci_platform_data sdp3430_bci_data = {
348 .battery_tmp_tbl = sdp3430_batt_table,
349 .tblsize = ARRAY_SIZE(sdp3430_batt_table),
350};
351
Adrian Hunter68ff0422010-02-15 10:03:34 -0800352static struct omap2_hsmmc_info mmc[] = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700353 {
354 .mmc = 1,
355 /* 8 bits (default) requires S6.3 == ON,
356 * so the SIM card isn't used; else 4 bits.
357 */
358 .wires = 8,
359 .gpio_wp = 4,
360 },
361 {
362 .mmc = 2,
363 .wires = 8,
364 .gpio_wp = 7,
365 },
366 {} /* Terminator */
367};
368
369static struct regulator_consumer_supply sdp3430_vmmc1_supply = {
370 .supply = "vmmc",
371};
372
373static struct regulator_consumer_supply sdp3430_vsim_supply = {
374 .supply = "vmmc_aux",
375};
376
377static struct regulator_consumer_supply sdp3430_vmmc2_supply = {
378 .supply = "vmmc",
379};
380
381static int sdp3430_twl_gpio_setup(struct device *dev,
382 unsigned gpio, unsigned ngpio)
383{
384 /* gpio + 0 is "mmc0_cd" (input/IRQ),
385 * gpio + 1 is "mmc1_cd" (input/IRQ)
386 */
387 mmc[0].gpio_cd = gpio + 0;
388 mmc[1].gpio_cd = gpio + 1;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800389 omap2_hsmmc_init(mmc);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700390
391 /* link regulators to MMC adapters ... we "know" the
392 * regulators will be set up only *after* we return.
393 */
394 sdp3430_vmmc1_supply.dev = mmc[0].dev;
395 sdp3430_vsim_supply.dev = mmc[0].dev;
396 sdp3430_vmmc2_supply.dev = mmc[1].dev;
397
398 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
399 gpio_request(gpio + 7, "sub_lcd_en_bkl");
400 gpio_direction_output(gpio + 7, 0);
401
402 /* gpio + 15 is "sub_lcd_nRST" (output) */
403 gpio_request(gpio + 15, "sub_lcd_nRST");
404 gpio_direction_output(gpio + 15, 0);
405
406 return 0;
407}
408
409static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
410 .gpio_base = OMAP_MAX_GPIO_LINES,
411 .irq_base = TWL4030_GPIO_IRQ_BASE,
412 .irq_end = TWL4030_GPIO_IRQ_END,
413 .pulldowns = BIT(2) | BIT(6) | BIT(8) | BIT(13)
414 | BIT(16) | BIT(17),
415 .setup = sdp3430_twl_gpio_setup,
416};
417
418static struct twl4030_usb_data sdp3430_usb_data = {
419 .usb_mode = T2_USB_MODE_ULPI,
420};
421
422static struct twl4030_madc_platform_data sdp3430_madc_data = {
423 .irq_line = 1,
424};
425
426/*
427 * Apply all the fixed voltages since most versions of U-Boot
428 * don't bother with that initialization.
429 */
430
431/* VAUX1 for mainboard (irda and sub-lcd) */
432static struct regulator_init_data sdp3430_vaux1 = {
433 .constraints = {
434 .min_uV = 2800000,
435 .max_uV = 2800000,
436 .apply_uV = true,
437 .valid_modes_mask = REGULATOR_MODE_NORMAL
438 | REGULATOR_MODE_STANDBY,
439 .valid_ops_mask = REGULATOR_CHANGE_MODE
440 | REGULATOR_CHANGE_STATUS,
441 },
442};
443
444/* VAUX2 for camera module */
445static struct regulator_init_data sdp3430_vaux2 = {
446 .constraints = {
447 .min_uV = 2800000,
448 .max_uV = 2800000,
449 .apply_uV = true,
450 .valid_modes_mask = REGULATOR_MODE_NORMAL
451 | REGULATOR_MODE_STANDBY,
452 .valid_ops_mask = REGULATOR_CHANGE_MODE
453 | REGULATOR_CHANGE_STATUS,
454 },
455};
456
457/* VAUX3 for LCD board */
458static struct regulator_init_data sdp3430_vaux3 = {
459 .constraints = {
460 .min_uV = 2800000,
461 .max_uV = 2800000,
462 .apply_uV = true,
463 .valid_modes_mask = REGULATOR_MODE_NORMAL
464 | REGULATOR_MODE_STANDBY,
465 .valid_ops_mask = REGULATOR_CHANGE_MODE
466 | REGULATOR_CHANGE_STATUS,
467 },
468};
469
470/* VAUX4 for OMAP VDD_CSI2 (camera) */
471static struct regulator_init_data sdp3430_vaux4 = {
472 .constraints = {
473 .min_uV = 1800000,
474 .max_uV = 1800000,
475 .apply_uV = true,
476 .valid_modes_mask = REGULATOR_MODE_NORMAL
477 | REGULATOR_MODE_STANDBY,
478 .valid_ops_mask = REGULATOR_CHANGE_MODE
479 | REGULATOR_CHANGE_STATUS,
480 },
481};
482
483/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
484static struct regulator_init_data sdp3430_vmmc1 = {
485 .constraints = {
486 .min_uV = 1850000,
487 .max_uV = 3150000,
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 .num_consumer_supplies = 1,
495 .consumer_supplies = &sdp3430_vmmc1_supply,
496};
497
498/* VMMC2 for MMC2 card */
499static struct regulator_init_data sdp3430_vmmc2 = {
500 .constraints = {
501 .min_uV = 1850000,
502 .max_uV = 1850000,
503 .apply_uV = true,
504 .valid_modes_mask = REGULATOR_MODE_NORMAL
505 | REGULATOR_MODE_STANDBY,
506 .valid_ops_mask = REGULATOR_CHANGE_MODE
507 | REGULATOR_CHANGE_STATUS,
508 },
509 .num_consumer_supplies = 1,
510 .consumer_supplies = &sdp3430_vmmc2_supply,
511};
512
513/* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
514static struct regulator_init_data sdp3430_vsim = {
515 .constraints = {
516 .min_uV = 1800000,
517 .max_uV = 3000000,
518 .valid_modes_mask = REGULATOR_MODE_NORMAL
519 | REGULATOR_MODE_STANDBY,
520 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
521 | REGULATOR_CHANGE_MODE
522 | REGULATOR_CHANGE_STATUS,
523 },
524 .num_consumer_supplies = 1,
525 .consumer_supplies = &sdp3430_vsim_supply,
526};
527
528/* VDAC for DSS driving S-Video */
529static struct regulator_init_data sdp3430_vdac = {
530 .constraints = {
531 .min_uV = 1800000,
532 .max_uV = 1800000,
533 .apply_uV = true,
534 .valid_modes_mask = REGULATOR_MODE_NORMAL
535 | REGULATOR_MODE_STANDBY,
536 .valid_ops_mask = REGULATOR_CHANGE_MODE
537 | REGULATOR_CHANGE_STATUS,
538 },
539 .num_consumer_supplies = 1,
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200540 .consumer_supplies = &sdp3430_vdda_dac_supply,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700541};
542
543/* VPLL2 for digital video outputs */
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200544static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
545 {
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200546 .supply = "vdds_dsi",
547 .dev = &sdp3430_dss_device.dev,
548 }
549};
550
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700551static struct regulator_init_data sdp3430_vpll2 = {
552 .constraints = {
553 .name = "VDVI",
554 .min_uV = 1800000,
555 .max_uV = 1800000,
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200556 .apply_uV = true,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700557 .valid_modes_mask = REGULATOR_MODE_NORMAL
558 | REGULATOR_MODE_STANDBY,
559 .valid_ops_mask = REGULATOR_CHANGE_MODE
560 | REGULATOR_CHANGE_STATUS,
561 },
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200562 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vpll2_supplies),
563 .consumer_supplies = sdp3430_vpll2_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700564};
565
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300566static struct twl4030_codec_audio_data sdp3430_audio = {
567 .audio_mclk = 26000000,
568};
569
570static struct twl4030_codec_data sdp3430_codec = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200571 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300572 .audio = &sdp3430_audio,
573};
574
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700575static struct twl4030_platform_data sdp3430_twldata = {
576 .irq_base = TWL4030_IRQ_BASE,
577 .irq_end = TWL4030_IRQ_END,
578
579 /* platform_data for children goes here */
580 .bci = &sdp3430_bci_data,
581 .gpio = &sdp3430_gpio_data,
582 .madc = &sdp3430_madc_data,
583 .keypad = &sdp3430_kp_data,
584 .usb = &sdp3430_usb_data,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300585 .codec = &sdp3430_codec,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700586
587 .vaux1 = &sdp3430_vaux1,
588 .vaux2 = &sdp3430_vaux2,
589 .vaux3 = &sdp3430_vaux3,
590 .vaux4 = &sdp3430_vaux4,
591 .vmmc1 = &sdp3430_vmmc1,
592 .vmmc2 = &sdp3430_vmmc2,
593 .vsim = &sdp3430_vsim,
594 .vdac = &sdp3430_vdac,
595 .vpll2 = &sdp3430_vpll2,
596};
597
598static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
599 {
600 I2C_BOARD_INFO("twl4030", 0x48),
601 .flags = I2C_CLIENT_WAKE,
602 .irq = INT_34XX_SYS_NIRQ,
603 .platform_data = &sdp3430_twldata,
604 },
605};
606
607static int __init omap3430_i2c_init(void)
608{
609 /* i2c1 for PMIC only */
610 omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo,
611 ARRAY_SIZE(sdp3430_i2c_boardinfo));
612 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
613 omap_register_i2c_bus(2, 400, NULL, 0);
614 /* i2c3 on display connector (for DVI, tfp410) */
615 omap_register_i2c_bus(3, 400, NULL, 0);
616 return 0;
617}
618
Tony Lindgren1a48e152009-05-28 13:23:52 -0700619#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
620
621static struct omap_smc91x_platform_data board_smc91x_data = {
622 .cs = 3,
623 .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
624 IORESOURCE_IRQ_LOWLEVEL,
625};
626
627static void __init board_smc91x_init(void)
628{
629 if (omap_rev() > OMAP3430_REV_ES1_0)
630 board_smc91x_data.gpio_irq = 6;
631 else
632 board_smc91x_data.gpio_irq = 29;
633
634 gpmc_smc91x_init(&board_smc91x_data);
635}
636
637#else
638
639static inline void board_smc91x_init(void)
640{
641}
642
643#endif
644
Reddy, Teerth5110b292009-08-24 11:58:59 +0530645static void enable_board_wakeup_source(void)
646{
Tony Lindgren4896e392009-12-11 16:16:32 -0800647 /* T2 interrupt line (keypad) */
648 omap_mux_init_signal("sys_nirq",
649 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
Reddy, Teerth5110b292009-08-24 11:58:59 +0530650}
651
Felipe Balbi6f69a182010-03-04 09:45:53 +0200652static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
Felipe Balbi58a54912009-11-22 10:11:01 -0800653
654 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
655 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
656 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
657
658 .phy_reset = true,
659 .reset_gpio_port[0] = 57,
660 .reset_gpio_port[1] = 61,
661 .reset_gpio_port[2] = -EINVAL
662};
663
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800664#ifdef CONFIG_OMAP_MUX
665static struct omap_board_mux board_mux[] __initdata = {
666 { .reg_offset = OMAP_MUX_TERMINATOR },
667};
668#else
669#define board_mux NULL
670#endif
671
Vimal Singh88c84602010-02-15 10:03:34 -0800672static struct mtd_partition sdp_nor_partitions[] = {
673 /* bootloader (U-Boot, etc) in first sector */
674 {
675 .name = "Bootloader-NOR",
676 .offset = 0,
677 .size = SZ_256K,
678 .mask_flags = MTD_WRITEABLE, /* force read-only */
679 },
680 /* bootloader params in the next sector */
681 {
682 .name = "Params-NOR",
683 .offset = MTDPART_OFS_APPEND,
684 .size = SZ_256K,
685 .mask_flags = 0,
686 },
687 /* kernel */
688 {
689 .name = "Kernel-NOR",
690 .offset = MTDPART_OFS_APPEND,
691 .size = SZ_2M,
692 .mask_flags = 0
693 },
694 /* file system */
695 {
696 .name = "Filesystem-NOR",
697 .offset = MTDPART_OFS_APPEND,
698 .size = MTDPART_SIZ_FULL,
699 .mask_flags = 0
700 }
701};
702
703static struct mtd_partition sdp_onenand_partitions[] = {
704 {
705 .name = "X-Loader-OneNAND",
706 .offset = 0,
707 .size = 4 * (64 * 2048),
708 .mask_flags = MTD_WRITEABLE /* force read-only */
709 },
710 {
711 .name = "U-Boot-OneNAND",
712 .offset = MTDPART_OFS_APPEND,
713 .size = 2 * (64 * 2048),
714 .mask_flags = MTD_WRITEABLE /* force read-only */
715 },
716 {
717 .name = "U-Boot Environment-OneNAND",
718 .offset = MTDPART_OFS_APPEND,
719 .size = 1 * (64 * 2048),
720 },
721 {
722 .name = "Kernel-OneNAND",
723 .offset = MTDPART_OFS_APPEND,
724 .size = 16 * (64 * 2048),
725 },
726 {
727 .name = "File System-OneNAND",
728 .offset = MTDPART_OFS_APPEND,
729 .size = MTDPART_SIZ_FULL,
730 },
731};
732
733static struct mtd_partition sdp_nand_partitions[] = {
734 /* All the partition sizes are listed in terms of NAND block size */
735 {
736 .name = "X-Loader-NAND",
737 .offset = 0,
738 .size = 4 * (64 * 2048),
739 .mask_flags = MTD_WRITEABLE, /* force read-only */
740 },
741 {
742 .name = "U-Boot-NAND",
743 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
744 .size = 10 * (64 * 2048),
745 .mask_flags = MTD_WRITEABLE, /* force read-only */
746 },
747 {
748 .name = "Boot Env-NAND",
749
750 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
751 .size = 6 * (64 * 2048),
752 },
753 {
754 .name = "Kernel-NAND",
755 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
756 .size = 40 * (64 * 2048),
757 },
758 {
759 .name = "File System - NAND",
760 .size = MTDPART_SIZ_FULL,
761 .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
762 },
763};
764
765static struct flash_partitions sdp_flash_partitions[] = {
766 {
767 .parts = sdp_nor_partitions,
768 .nr_parts = ARRAY_SIZE(sdp_nor_partitions),
769 },
770 {
771 .parts = sdp_onenand_partitions,
772 .nr_parts = ARRAY_SIZE(sdp_onenand_partitions),
773 },
774 {
775 .parts = sdp_nand_partitions,
776 .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
777 },
778};
779
Maulik Mankad884b8362010-02-17 14:09:30 -0800780static struct omap_musb_board_data musb_board_data = {
781 .interface_type = MUSB_INTERFACE_ULPI,
782 .mode = MUSB_OTG,
783 .power = 100,
784};
785
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700786static void __init omap_3430sdp_init(void)
787{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800788 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700789 omap3430_i2c_init();
790 platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices));
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700791 if (omap_rev() > OMAP3430_REV_ES1_0)
792 ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2;
793 else
794 ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV1;
795 sdp3430_spi_board_info[0].irq = gpio_to_irq(ts_gpio);
796 spi_register_board_info(sdp3430_spi_board_info,
797 ARRAY_SIZE(sdp3430_spi_board_info));
798 ads7846_dev_init();
799 omap_serial_init();
Maulik Mankad884b8362010-02-17 14:09:30 -0800800 usb_musb_init(&musb_board_data);
Tony Lindgren1a48e152009-05-28 13:23:52 -0700801 board_smc91x_init();
Vimal Singh88c84602010-02-15 10:03:34 -0800802 sdp_flash_init(sdp_flash_partitions);
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200803 sdp3430_display_init();
Reddy, Teerth5110b292009-08-24 11:58:59 +0530804 enable_board_wakeup_source();
Felipe Balbi58a54912009-11-22 10:11:01 -0800805 usb_ehci_init(&ehci_pdata);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700806}
807
808static void __init omap_3430sdp_map_io(void)
809{
810 omap2_set_globals_343x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800811 omap34xx_map_common_io();
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700812}
813
814MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
815 /* Maintainer: Syed Khasim - Texas Instruments Inc */
816 .phys_io = 0x48000000,
Santosh Shilimkarb4224b22009-10-19 17:25:55 -0700817 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700818 .boot_params = 0x80000100,
819 .map_io = omap_3430sdp_map_io,
820 .init_irq = omap_3430sdp_init_irq,
821 .init_machine = omap_3430sdp_init,
822 .timer = &omap_timer,
823MACHINE_END