blob: 7ffad7bfb820f006f6e190012fb58c7ef5170770 [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>
Sukumar Ghorai3a638332010-09-15 14:49:23 +000027#include <linux/mmc/host.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070028
29#include <mach/hardware.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33
Tony Lindgrence491cf2009-10-20 09:40:47 -070034#include <plat/mcspi.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070035#include <plat/board.h>
36#include <plat/usb.h>
37#include <plat/common.h>
38#include <plat/dma.h>
39#include <plat/gpmc.h>
Tomi Valkeinend9056ce2009-12-09 18:25:18 +020040#include <plat/display.h>
Bryan Wu89747c92010-11-17 13:34:34 +000041#include <plat/panel-generic-dpi.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070042
Tony Lindgrence491cf2009-10-20 09:40:47 -070043#include <plat/gpmc-smc91x.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070044
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070045#include "board-flash.h"
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 Hunterd02a9002010-02-15 10:03:34 -080048#include "hsmmc.h"
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080049#include "pm.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060050#include "control.h"
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070051
52#define CONFIG_DISABLE_HFCLK 1
53
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070054#define SDP3430_TS_GPIO_IRQ_SDPV1 3
55#define SDP3430_TS_GPIO_IRQ_SDPV2 2
56
57#define ENABLE_VAUX3_DEDICATED 0x03
58#define ENABLE_VAUX3_DEV_GRP 0x20
59
60#define TWL4030_MSECURE_GPIO 22
61
Manjunath Kondaiah Gbead4372010-10-08 10:01:13 -070062static uint32_t board_keymap[] = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070063 KEY(0, 0, KEY_LEFT),
64 KEY(0, 1, KEY_RIGHT),
65 KEY(0, 2, KEY_A),
66 KEY(0, 3, KEY_B),
67 KEY(0, 4, KEY_C),
68 KEY(1, 0, KEY_DOWN),
69 KEY(1, 1, KEY_UP),
70 KEY(1, 2, KEY_E),
71 KEY(1, 3, KEY_F),
72 KEY(1, 4, KEY_G),
73 KEY(2, 0, KEY_ENTER),
74 KEY(2, 1, KEY_I),
75 KEY(2, 2, KEY_J),
76 KEY(2, 3, KEY_K),
77 KEY(2, 4, KEY_3),
78 KEY(3, 0, KEY_M),
79 KEY(3, 1, KEY_N),
80 KEY(3, 2, KEY_O),
81 KEY(3, 3, KEY_P),
82 KEY(3, 4, KEY_Q),
83 KEY(4, 0, KEY_R),
84 KEY(4, 1, KEY_4),
85 KEY(4, 2, KEY_T),
86 KEY(4, 3, KEY_U),
87 KEY(4, 4, KEY_D),
88 KEY(5, 0, KEY_V),
89 KEY(5, 1, KEY_W),
90 KEY(5, 2, KEY_L),
91 KEY(5, 3, KEY_S),
92 KEY(5, 4, KEY_H),
93 0
94};
95
Tony Lindgren4f543332009-09-24 16:23:16 -070096static struct matrix_keymap_data board_map_data = {
97 .keymap = board_keymap,
98 .keymap_size = ARRAY_SIZE(board_keymap),
99};
100
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700101static struct twl4030_keypad_data sdp3430_kp_data = {
Tony Lindgren4f543332009-09-24 16:23:16 -0700102 .keymap_data = &board_map_data,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700103 .rows = 5,
104 .cols = 6,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700105 .rep = 1,
106};
107
108static int ts_gpio; /* Needed for ads7846_get_pendown_state */
109
110/**
111 * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq
112 *
113 * @return - void. If request gpio fails then Flag KERN_ERR.
114 */
115static void ads7846_dev_init(void)
116{
117 if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) {
118 printk(KERN_ERR "can't get ads746 pen down GPIO\n");
119 return;
120 }
121
122 gpio_direction_input(ts_gpio);
Felipe Balbi48feb332010-05-26 14:42:24 -0700123 gpio_set_debounce(ts_gpio, 310);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700124}
125
126static int ads7846_get_pendown_state(void)
127{
128 return !gpio_get_value(ts_gpio);
129}
130
131static struct ads7846_platform_data tsc2046_config __initdata = {
132 .get_pendown_state = ads7846_get_pendown_state,
133 .keep_vref_on = 1,
Ranjith Lohithakshan7a44ad22010-05-08 12:39:21 +0530134 .wakeup = true,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700135};
136
137
138static struct omap2_mcspi_device_config tsc2046_mcspi_config = {
139 .turbo_mode = 0,
140 .single_channel = 1, /* 0: slave, 1: master */
141};
142
143static struct spi_board_info sdp3430_spi_board_info[] __initdata = {
144 [0] = {
145 /*
146 * TSC2046 operates at a max freqency of 2MHz, so
147 * operate slightly below at 1.5MHz
148 */
149 .modalias = "ads7846",
150 .bus_num = 1,
151 .chip_select = 0,
152 .max_speed_hz = 1500000,
153 .controller_data = &tsc2046_mcspi_config,
154 .irq = 0,
155 .platform_data = &tsc2046_config,
156 },
157};
158
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200159
160#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
161#define SDP3430_LCD_PANEL_ENABLE_GPIO 5
162
163static unsigned backlight_gpio;
164static unsigned enable_gpio;
165static int lcd_enabled;
166static int dvi_enabled;
167
168static void __init sdp3430_display_init(void)
169{
170 int r;
171
172 enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO;
173 backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
174
175 r = gpio_request(enable_gpio, "LCD reset");
176 if (r) {
177 printk(KERN_ERR "failed to get LCD reset GPIO\n");
178 goto err0;
179 }
180
181 r = gpio_request(backlight_gpio, "LCD Backlight");
182 if (r) {
183 printk(KERN_ERR "failed to get LCD backlight GPIO\n");
184 goto err1;
185 }
186
187 gpio_direction_output(enable_gpio, 0);
188 gpio_direction_output(backlight_gpio, 0);
189
190 return;
191err1:
192 gpio_free(enable_gpio);
193err0:
194 return;
195}
196
197static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
198{
199 if (dvi_enabled) {
200 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
201 return -EINVAL;
202 }
203
204 gpio_direction_output(enable_gpio, 1);
205 gpio_direction_output(backlight_gpio, 1);
206
207 lcd_enabled = 1;
208
209 return 0;
210}
211
212static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
213{
214 lcd_enabled = 0;
215
216 gpio_direction_output(enable_gpio, 0);
217 gpio_direction_output(backlight_gpio, 0);
218}
219
220static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
221{
222 if (lcd_enabled) {
223 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
224 return -EINVAL;
225 }
226
227 dvi_enabled = 1;
228
229 return 0;
230}
231
232static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev)
233{
234 dvi_enabled = 0;
235}
236
237static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev)
238{
239 return 0;
240}
241
242static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev)
243{
244}
245
246
247static struct omap_dss_device sdp3430_lcd_device = {
248 .name = "lcd",
249 .driver_name = "sharp_ls_panel",
250 .type = OMAP_DISPLAY_TYPE_DPI,
251 .phy.dpi.data_lines = 16,
252 .platform_enable = sdp3430_panel_enable_lcd,
253 .platform_disable = sdp3430_panel_disable_lcd,
254};
255
Bryan Wu89747c92010-11-17 13:34:34 +0000256static struct panel_generic_dpi_data dvi_panel = {
257 .name = "generic",
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200258 .platform_enable = sdp3430_panel_enable_dvi,
259 .platform_disable = sdp3430_panel_disable_dvi,
260};
261
Bryan Wu89747c92010-11-17 13:34:34 +0000262static struct omap_dss_device sdp3430_dvi_device = {
263 .name = "dvi",
264 .type = OMAP_DISPLAY_TYPE_DPI,
265 .driver_name = "generic_dpi_panel",
266 .data = &dvi_panel,
267 .phy.dpi.data_lines = 24,
268};
269
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200270static struct omap_dss_device sdp3430_tv_device = {
271 .name = "tv",
272 .driver_name = "venc",
273 .type = OMAP_DISPLAY_TYPE_VENC,
274 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
275 .platform_enable = sdp3430_panel_enable_tv,
276 .platform_disable = sdp3430_panel_disable_tv,
277};
278
279
280static struct omap_dss_device *sdp3430_dss_devices[] = {
281 &sdp3430_lcd_device,
282 &sdp3430_dvi_device,
283 &sdp3430_tv_device,
284};
285
286static struct omap_dss_board_info sdp3430_dss_data = {
287 .num_devices = ARRAY_SIZE(sdp3430_dss_devices),
288 .devices = sdp3430_dss_devices,
289 .default_device = &sdp3430_lcd_device,
290};
291
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700292static struct omap_board_config_kernel sdp3430_config[] __initdata = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700293};
294
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800295static void __init omap_3430sdp_init_early(void)
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300296{
Paul Walmsley48057342010-12-21 15:25:10 -0700297 omap2_init_common_infrastructure();
298 omap2_init_common_devices(hyb18m512160af6_sdrc_params, NULL);
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300299}
300
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700301static int sdp3430_batt_table[] = {
302/* 0 C*/
30330800, 29500, 28300, 27100,
30426000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
30517200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
30611600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
3078020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
3085640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
3094040, 3910, 3790, 3670, 3550
310};
311
312static struct twl4030_bci_platform_data sdp3430_bci_data = {
313 .battery_tmp_tbl = sdp3430_batt_table,
314 .tblsize = ARRAY_SIZE(sdp3430_batt_table),
315};
316
Adrian Hunter68ff0422010-02-15 10:03:34 -0800317static struct omap2_hsmmc_info mmc[] = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700318 {
319 .mmc = 1,
320 /* 8 bits (default) requires S6.3 == ON,
321 * so the SIM card isn't used; else 4 bits.
322 */
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000323 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700324 .gpio_wp = 4,
325 },
326 {
327 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000328 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700329 .gpio_wp = 7,
330 },
331 {} /* Terminator */
332};
333
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700334static int sdp3430_twl_gpio_setup(struct device *dev,
335 unsigned gpio, unsigned ngpio)
336{
337 /* gpio + 0 is "mmc0_cd" (input/IRQ),
338 * gpio + 1 is "mmc1_cd" (input/IRQ)
339 */
340 mmc[0].gpio_cd = gpio + 0;
341 mmc[1].gpio_cd = gpio + 1;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800342 omap2_hsmmc_init(mmc);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700343
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700344 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
345 gpio_request(gpio + 7, "sub_lcd_en_bkl");
346 gpio_direction_output(gpio + 7, 0);
347
348 /* gpio + 15 is "sub_lcd_nRST" (output) */
349 gpio_request(gpio + 15, "sub_lcd_nRST");
350 gpio_direction_output(gpio + 15, 0);
351
352 return 0;
353}
354
355static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
356 .gpio_base = OMAP_MAX_GPIO_LINES,
357 .irq_base = TWL4030_GPIO_IRQ_BASE,
358 .irq_end = TWL4030_GPIO_IRQ_END,
359 .pulldowns = BIT(2) | BIT(6) | BIT(8) | BIT(13)
360 | BIT(16) | BIT(17),
361 .setup = sdp3430_twl_gpio_setup,
362};
363
364static struct twl4030_usb_data sdp3430_usb_data = {
365 .usb_mode = T2_USB_MODE_ULPI,
366};
367
368static struct twl4030_madc_platform_data sdp3430_madc_data = {
369 .irq_line = 1,
370};
371
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000372/* regulator consumer mappings */
373
Rajendra Nayak4b087ff2011-02-03 12:45:21 +0000374/* ads7846 on SPI */
375static struct regulator_consumer_supply sdp3430_vaux3_supplies[] = {
376 REGULATOR_SUPPLY("vcc", "spi1.0"),
377};
378
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000379static struct regulator_consumer_supply sdp3430_vdda_dac_supplies[] = {
Senthilvadivu Guruswamy30ea50c2011-01-24 06:22:01 +0000380 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000381};
382
383/* VPLL2 for digital video outputs */
384static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
385 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
Senthilvadivu Guruswamyc8aac012011-01-24 06:22:02 +0000386 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000387};
388
389static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530390 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000391};
392
393static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530394 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000395};
396
397static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530398 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000399};
400
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700401/*
402 * Apply all the fixed voltages since most versions of U-Boot
403 * don't bother with that initialization.
404 */
405
406/* VAUX1 for mainboard (irda and sub-lcd) */
407static struct regulator_init_data sdp3430_vaux1 = {
408 .constraints = {
409 .min_uV = 2800000,
410 .max_uV = 2800000,
411 .apply_uV = true,
412 .valid_modes_mask = REGULATOR_MODE_NORMAL
413 | REGULATOR_MODE_STANDBY,
414 .valid_ops_mask = REGULATOR_CHANGE_MODE
415 | REGULATOR_CHANGE_STATUS,
416 },
417};
418
419/* VAUX2 for camera module */
420static struct regulator_init_data sdp3430_vaux2 = {
421 .constraints = {
422 .min_uV = 2800000,
423 .max_uV = 2800000,
424 .apply_uV = true,
425 .valid_modes_mask = REGULATOR_MODE_NORMAL
426 | REGULATOR_MODE_STANDBY,
427 .valid_ops_mask = REGULATOR_CHANGE_MODE
428 | REGULATOR_CHANGE_STATUS,
429 },
430};
431
432/* VAUX3 for LCD board */
433static struct regulator_init_data sdp3430_vaux3 = {
434 .constraints = {
435 .min_uV = 2800000,
436 .max_uV = 2800000,
437 .apply_uV = true,
438 .valid_modes_mask = REGULATOR_MODE_NORMAL
439 | REGULATOR_MODE_STANDBY,
440 .valid_ops_mask = REGULATOR_CHANGE_MODE
441 | REGULATOR_CHANGE_STATUS,
442 },
Rajendra Nayak4b087ff2011-02-03 12:45:21 +0000443 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vaux3_supplies),
444 .consumer_supplies = sdp3430_vaux3_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700445};
446
447/* VAUX4 for OMAP VDD_CSI2 (camera) */
448static struct regulator_init_data sdp3430_vaux4 = {
449 .constraints = {
450 .min_uV = 1800000,
451 .max_uV = 1800000,
452 .apply_uV = true,
453 .valid_modes_mask = REGULATOR_MODE_NORMAL
454 | REGULATOR_MODE_STANDBY,
455 .valid_ops_mask = REGULATOR_CHANGE_MODE
456 | REGULATOR_CHANGE_STATUS,
457 },
458};
459
460/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
461static struct regulator_init_data sdp3430_vmmc1 = {
462 .constraints = {
463 .min_uV = 1850000,
464 .max_uV = 3150000,
465 .valid_modes_mask = REGULATOR_MODE_NORMAL
466 | REGULATOR_MODE_STANDBY,
467 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
468 | REGULATOR_CHANGE_MODE
469 | REGULATOR_CHANGE_STATUS,
470 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000471 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc1_supplies),
472 .consumer_supplies = sdp3430_vmmc1_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700473};
474
475/* VMMC2 for MMC2 card */
476static struct regulator_init_data sdp3430_vmmc2 = {
477 .constraints = {
478 .min_uV = 1850000,
479 .max_uV = 1850000,
480 .apply_uV = true,
481 .valid_modes_mask = REGULATOR_MODE_NORMAL
482 | REGULATOR_MODE_STANDBY,
483 .valid_ops_mask = REGULATOR_CHANGE_MODE
484 | REGULATOR_CHANGE_STATUS,
485 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000486 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc2_supplies),
487 .consumer_supplies = sdp3430_vmmc2_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700488};
489
490/* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
491static struct regulator_init_data sdp3430_vsim = {
492 .constraints = {
493 .min_uV = 1800000,
494 .max_uV = 3000000,
495 .valid_modes_mask = REGULATOR_MODE_NORMAL
496 | REGULATOR_MODE_STANDBY,
497 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
498 | REGULATOR_CHANGE_MODE
499 | REGULATOR_CHANGE_STATUS,
500 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000501 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vsim_supplies),
502 .consumer_supplies = sdp3430_vsim_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700503};
504
505/* VDAC for DSS driving S-Video */
506static struct regulator_init_data sdp3430_vdac = {
507 .constraints = {
508 .min_uV = 1800000,
509 .max_uV = 1800000,
510 .apply_uV = true,
511 .valid_modes_mask = REGULATOR_MODE_NORMAL
512 | REGULATOR_MODE_STANDBY,
513 .valid_ops_mask = REGULATOR_CHANGE_MODE
514 | REGULATOR_CHANGE_STATUS,
515 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000516 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vdda_dac_supplies),
517 .consumer_supplies = sdp3430_vdda_dac_supplies,
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200518};
519
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700520static struct regulator_init_data sdp3430_vpll2 = {
521 .constraints = {
522 .name = "VDVI",
523 .min_uV = 1800000,
524 .max_uV = 1800000,
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200525 .apply_uV = true,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700526 .valid_modes_mask = REGULATOR_MODE_NORMAL
527 | REGULATOR_MODE_STANDBY,
528 .valid_ops_mask = REGULATOR_CHANGE_MODE
529 | REGULATOR_CHANGE_STATUS,
530 },
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200531 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vpll2_supplies),
532 .consumer_supplies = sdp3430_vpll2_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700533};
534
Ilkka Koskinen6a58baf2011-03-02 13:24:05 +0000535static struct twl4030_codec_audio_data sdp3430_audio;
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300536
537static struct twl4030_codec_data sdp3430_codec = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200538 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300539 .audio = &sdp3430_audio,
540};
541
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700542static struct twl4030_platform_data sdp3430_twldata = {
543 .irq_base = TWL4030_IRQ_BASE,
544 .irq_end = TWL4030_IRQ_END,
545
546 /* platform_data for children goes here */
547 .bci = &sdp3430_bci_data,
548 .gpio = &sdp3430_gpio_data,
549 .madc = &sdp3430_madc_data,
550 .keypad = &sdp3430_kp_data,
551 .usb = &sdp3430_usb_data,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300552 .codec = &sdp3430_codec,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700553
554 .vaux1 = &sdp3430_vaux1,
555 .vaux2 = &sdp3430_vaux2,
556 .vaux3 = &sdp3430_vaux3,
557 .vaux4 = &sdp3430_vaux4,
558 .vmmc1 = &sdp3430_vmmc1,
559 .vmmc2 = &sdp3430_vmmc2,
560 .vsim = &sdp3430_vsim,
561 .vdac = &sdp3430_vdac,
562 .vpll2 = &sdp3430_vpll2,
563};
564
565static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
566 {
567 I2C_BOARD_INFO("twl4030", 0x48),
568 .flags = I2C_CLIENT_WAKE,
569 .irq = INT_34XX_SYS_NIRQ,
570 .platform_data = &sdp3430_twldata,
571 },
572};
573
574static int __init omap3430_i2c_init(void)
575{
576 /* i2c1 for PMIC only */
577 omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo,
578 ARRAY_SIZE(sdp3430_i2c_boardinfo));
579 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
580 omap_register_i2c_bus(2, 400, NULL, 0);
581 /* i2c3 on display connector (for DVI, tfp410) */
582 omap_register_i2c_bus(3, 400, NULL, 0);
583 return 0;
584}
585
Tony Lindgren1a48e152009-05-28 13:23:52 -0700586#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
587
588static struct omap_smc91x_platform_data board_smc91x_data = {
589 .cs = 3,
590 .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
591 IORESOURCE_IRQ_LOWLEVEL,
592};
593
594static void __init board_smc91x_init(void)
595{
596 if (omap_rev() > OMAP3430_REV_ES1_0)
597 board_smc91x_data.gpio_irq = 6;
598 else
599 board_smc91x_data.gpio_irq = 29;
600
601 gpmc_smc91x_init(&board_smc91x_data);
602}
603
604#else
605
606static inline void board_smc91x_init(void)
607{
608}
609
610#endif
611
Reddy, Teerth5110b292009-08-24 11:58:59 +0530612static void enable_board_wakeup_source(void)
613{
Tony Lindgren4896e392009-12-11 16:16:32 -0800614 /* T2 interrupt line (keypad) */
615 omap_mux_init_signal("sys_nirq",
616 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
Reddy, Teerth5110b292009-08-24 11:58:59 +0530617}
618
Keshava Munegowda181b2502011-03-01 20:08:16 +0530619static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
Felipe Balbi58a54912009-11-22 10:11:01 -0800620
Keshava Munegowda181b2502011-03-01 20:08:16 +0530621 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
622 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
623 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
Felipe Balbi58a54912009-11-22 10:11:01 -0800624
625 .phy_reset = true,
626 .reset_gpio_port[0] = 57,
627 .reset_gpio_port[1] = 61,
628 .reset_gpio_port[2] = -EINVAL
629};
630
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800631#ifdef CONFIG_OMAP_MUX
632static struct omap_board_mux board_mux[] __initdata = {
633 { .reg_offset = OMAP_MUX_TERMINATOR },
634};
R Sricharan626dda82011-03-11 06:04:45 +0000635
636static struct omap_device_pad serial1_pads[] __initdata = {
637 /*
638 * Note that off output enable is an active low
639 * signal. So setting this means pin is a
640 * input enabled in off mode
641 */
642 OMAP_MUX_STATIC("uart1_cts.uart1_cts",
643 OMAP_PIN_INPUT |
644 OMAP_PIN_OFF_INPUT_PULLDOWN |
645 OMAP_OFFOUT_EN |
646 OMAP_MUX_MODE0),
647 OMAP_MUX_STATIC("uart1_rts.uart1_rts",
648 OMAP_PIN_OUTPUT |
649 OMAP_OFF_EN |
650 OMAP_MUX_MODE0),
651 OMAP_MUX_STATIC("uart1_rx.uart1_rx",
652 OMAP_PIN_INPUT |
653 OMAP_PIN_OFF_INPUT_PULLDOWN |
654 OMAP_OFFOUT_EN |
655 OMAP_MUX_MODE0),
656 OMAP_MUX_STATIC("uart1_tx.uart1_tx",
657 OMAP_PIN_OUTPUT |
658 OMAP_OFF_EN |
659 OMAP_MUX_MODE0),
660};
661
662static struct omap_device_pad serial2_pads[] __initdata = {
663 OMAP_MUX_STATIC("uart2_cts.uart2_cts",
664 OMAP_PIN_INPUT_PULLUP |
665 OMAP_PIN_OFF_INPUT_PULLDOWN |
666 OMAP_OFFOUT_EN |
667 OMAP_MUX_MODE0),
668 OMAP_MUX_STATIC("uart2_rts.uart2_rts",
669 OMAP_PIN_OUTPUT |
670 OMAP_OFF_EN |
671 OMAP_MUX_MODE0),
672 OMAP_MUX_STATIC("uart2_rx.uart2_rx",
673 OMAP_PIN_INPUT |
674 OMAP_PIN_OFF_INPUT_PULLDOWN |
675 OMAP_OFFOUT_EN |
676 OMAP_MUX_MODE0),
677 OMAP_MUX_STATIC("uart2_tx.uart2_tx",
678 OMAP_PIN_OUTPUT |
679 OMAP_OFF_EN |
680 OMAP_MUX_MODE0),
681};
682
683static struct omap_device_pad serial3_pads[] __initdata = {
684 OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
685 OMAP_PIN_INPUT_PULLDOWN |
686 OMAP_PIN_OFF_INPUT_PULLDOWN |
687 OMAP_OFFOUT_EN |
688 OMAP_MUX_MODE0),
689 OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
690 OMAP_PIN_OUTPUT |
691 OMAP_OFF_EN |
692 OMAP_MUX_MODE0),
693 OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
694 OMAP_PIN_INPUT |
695 OMAP_PIN_OFF_INPUT_PULLDOWN |
696 OMAP_OFFOUT_EN |
697 OMAP_MUX_MODE0),
698 OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
699 OMAP_PIN_OUTPUT |
700 OMAP_OFF_EN |
701 OMAP_MUX_MODE0),
702};
703
704static struct omap_board_data serial1_data = {
705 .id = 0,
706 .pads = serial1_pads,
707 .pads_cnt = ARRAY_SIZE(serial1_pads),
708};
709
710static struct omap_board_data serial2_data = {
711 .id = 1,
712 .pads = serial2_pads,
713 .pads_cnt = ARRAY_SIZE(serial2_pads),
714};
715
716static struct omap_board_data serial3_data = {
717 .id = 2,
718 .pads = serial3_pads,
719 .pads_cnt = ARRAY_SIZE(serial3_pads),
720};
721
722static inline void board_serial_init(void)
723{
724 omap_serial_init_port(&serial1_data);
725 omap_serial_init_port(&serial2_data);
726 omap_serial_init_port(&serial3_data);
727}
728#else
729#define board_mux NULL
730
731static inline void board_serial_init(void)
732{
733 omap_serial_init();
734}
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800735#endif
736
Sukumar Ghorai13d6b73c2010-07-09 14:27:47 +0000737/*
738 * SDP3430 V2 Board CS organization
739 * Different from SDP3430 V1. Now 4 switches used to specify CS
740 *
741 * See also the Switch S8 settings in the comments.
742 */
743static char chip_sel_3430[][GPMC_CS_NUM] = {
744 {PDC_NOR, PDC_NAND, PDC_ONENAND, DBG_MPDB, 0, 0, 0, 0}, /* S8:1111 */
745 {PDC_ONENAND, PDC_NAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1110 */
746 {PDC_NAND, PDC_ONENAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1101 */
747};
748
Vimal Singh88c84602010-02-15 10:03:34 -0800749static struct mtd_partition sdp_nor_partitions[] = {
750 /* bootloader (U-Boot, etc) in first sector */
751 {
752 .name = "Bootloader-NOR",
753 .offset = 0,
754 .size = SZ_256K,
755 .mask_flags = MTD_WRITEABLE, /* force read-only */
756 },
757 /* bootloader params in the next sector */
758 {
759 .name = "Params-NOR",
760 .offset = MTDPART_OFS_APPEND,
761 .size = SZ_256K,
762 .mask_flags = 0,
763 },
764 /* kernel */
765 {
766 .name = "Kernel-NOR",
767 .offset = MTDPART_OFS_APPEND,
768 .size = SZ_2M,
769 .mask_flags = 0
770 },
771 /* file system */
772 {
773 .name = "Filesystem-NOR",
774 .offset = MTDPART_OFS_APPEND,
775 .size = MTDPART_SIZ_FULL,
776 .mask_flags = 0
777 }
778};
779
780static struct mtd_partition sdp_onenand_partitions[] = {
781 {
782 .name = "X-Loader-OneNAND",
783 .offset = 0,
784 .size = 4 * (64 * 2048),
785 .mask_flags = MTD_WRITEABLE /* force read-only */
786 },
787 {
788 .name = "U-Boot-OneNAND",
789 .offset = MTDPART_OFS_APPEND,
790 .size = 2 * (64 * 2048),
791 .mask_flags = MTD_WRITEABLE /* force read-only */
792 },
793 {
794 .name = "U-Boot Environment-OneNAND",
795 .offset = MTDPART_OFS_APPEND,
796 .size = 1 * (64 * 2048),
797 },
798 {
799 .name = "Kernel-OneNAND",
800 .offset = MTDPART_OFS_APPEND,
801 .size = 16 * (64 * 2048),
802 },
803 {
804 .name = "File System-OneNAND",
805 .offset = MTDPART_OFS_APPEND,
806 .size = MTDPART_SIZ_FULL,
807 },
808};
809
810static struct mtd_partition sdp_nand_partitions[] = {
811 /* All the partition sizes are listed in terms of NAND block size */
812 {
813 .name = "X-Loader-NAND",
814 .offset = 0,
815 .size = 4 * (64 * 2048),
816 .mask_flags = MTD_WRITEABLE, /* force read-only */
817 },
818 {
819 .name = "U-Boot-NAND",
820 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
821 .size = 10 * (64 * 2048),
822 .mask_flags = MTD_WRITEABLE, /* force read-only */
823 },
824 {
825 .name = "Boot Env-NAND",
826
827 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
828 .size = 6 * (64 * 2048),
829 },
830 {
831 .name = "Kernel-NAND",
832 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
833 .size = 40 * (64 * 2048),
834 },
835 {
836 .name = "File System - NAND",
837 .size = MTDPART_SIZ_FULL,
838 .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
839 },
840};
841
842static struct flash_partitions sdp_flash_partitions[] = {
843 {
844 .parts = sdp_nor_partitions,
845 .nr_parts = ARRAY_SIZE(sdp_nor_partitions),
846 },
847 {
848 .parts = sdp_onenand_partitions,
849 .nr_parts = ARRAY_SIZE(sdp_onenand_partitions),
850 },
851 {
852 .parts = sdp_nand_partitions,
853 .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
854 },
855};
856
Maulik Mankad884b8362010-02-17 14:09:30 -0800857static struct omap_musb_board_data musb_board_data = {
858 .interface_type = MUSB_INTERFACE_ULPI,
859 .mode = MUSB_OTG,
860 .power = 100,
861};
862
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700863static void __init omap_3430sdp_init(void)
864{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800865 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Tony Lindgrene41cccf2011-02-24 14:36:03 -0800866 omap_board_config = sdp3430_config;
867 omap_board_config_size = ARRAY_SIZE(sdp3430_config);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700868 omap3430_i2c_init();
Senthilvadivu Guruswamyd5e13222011-02-22 11:24:50 +0200869 omap_display_init(&sdp3430_dss_data);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700870 if (omap_rev() > OMAP3430_REV_ES1_0)
871 ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2;
872 else
873 ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV1;
874 sdp3430_spi_board_info[0].irq = gpio_to_irq(ts_gpio);
875 spi_register_board_info(sdp3430_spi_board_info,
876 ARRAY_SIZE(sdp3430_spi_board_info));
877 ads7846_dev_init();
R Sricharan626dda82011-03-11 06:04:45 +0000878 board_serial_init();
Maulik Mankad884b8362010-02-17 14:09:30 -0800879 usb_musb_init(&musb_board_data);
Tony Lindgren1a48e152009-05-28 13:23:52 -0700880 board_smc91x_init();
Sukumar Ghoraid5ce2b62011-01-28 15:42:03 +0530881 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200882 sdp3430_display_init();
Reddy, Teerth5110b292009-08-24 11:58:59 +0530883 enable_board_wakeup_source();
Keshava Munegowda9e64bb12011-03-01 20:08:19 +0530884 usbhs_init(&usbhs_bdata);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700885}
886
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700887MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
888 /* Maintainer: Syed Khasim - Texas Instruments Inc */
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700889 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100890 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800891 .map_io = omap3_map_io,
892 .init_early = omap_3430sdp_init_early,
893 .init_irq = omap_init_irq,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700894 .init_machine = omap_3430sdp_init,
895 .timer = &omap_timer,
896MACHINE_END