blob: 40b0174a4efd6bd69ae13637414fae9ba95956f7 [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 Hunterd02a900b2010-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
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080062/* FIXME: These values need to be updated based on more profiling on 3430sdp*/
63static struct cpuidle_params omap3_cpuidle_params_table[] = {
64 /* C1 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020065 {1, 2, 2, 5},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080066 /* C2 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020067 {1, 10, 10, 30},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080068 /* C3 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020069 {1, 50, 50, 300},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080070 /* C4 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020071 {1, 1500, 1800, 4000},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080072 /* C5 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020073 {1, 2500, 7500, 12000},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080074 /* C6 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020075 {1, 3000, 8500, 15000},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080076 /* C7 */
Kalle Jokiniemi709731b2009-10-29 10:30:19 +020077 {1, 10000, 30000, 300000},
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080078};
79
Manjunath Kondaiah Gbead4372010-10-08 10:01:13 -070080static uint32_t board_keymap[] = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070081 KEY(0, 0, KEY_LEFT),
82 KEY(0, 1, KEY_RIGHT),
83 KEY(0, 2, KEY_A),
84 KEY(0, 3, KEY_B),
85 KEY(0, 4, KEY_C),
86 KEY(1, 0, KEY_DOWN),
87 KEY(1, 1, KEY_UP),
88 KEY(1, 2, KEY_E),
89 KEY(1, 3, KEY_F),
90 KEY(1, 4, KEY_G),
91 KEY(2, 0, KEY_ENTER),
92 KEY(2, 1, KEY_I),
93 KEY(2, 2, KEY_J),
94 KEY(2, 3, KEY_K),
95 KEY(2, 4, KEY_3),
96 KEY(3, 0, KEY_M),
97 KEY(3, 1, KEY_N),
98 KEY(3, 2, KEY_O),
99 KEY(3, 3, KEY_P),
100 KEY(3, 4, KEY_Q),
101 KEY(4, 0, KEY_R),
102 KEY(4, 1, KEY_4),
103 KEY(4, 2, KEY_T),
104 KEY(4, 3, KEY_U),
105 KEY(4, 4, KEY_D),
106 KEY(5, 0, KEY_V),
107 KEY(5, 1, KEY_W),
108 KEY(5, 2, KEY_L),
109 KEY(5, 3, KEY_S),
110 KEY(5, 4, KEY_H),
111 0
112};
113
Tony Lindgren4f543332009-09-24 16:23:16 -0700114static struct matrix_keymap_data board_map_data = {
115 .keymap = board_keymap,
116 .keymap_size = ARRAY_SIZE(board_keymap),
117};
118
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700119static struct twl4030_keypad_data sdp3430_kp_data = {
Tony Lindgren4f543332009-09-24 16:23:16 -0700120 .keymap_data = &board_map_data,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700121 .rows = 5,
122 .cols = 6,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700123 .rep = 1,
124};
125
126static int ts_gpio; /* Needed for ads7846_get_pendown_state */
127
128/**
129 * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq
130 *
131 * @return - void. If request gpio fails then Flag KERN_ERR.
132 */
133static void ads7846_dev_init(void)
134{
135 if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) {
136 printk(KERN_ERR "can't get ads746 pen down GPIO\n");
137 return;
138 }
139
140 gpio_direction_input(ts_gpio);
Felipe Balbi48feb332010-05-26 14:42:24 -0700141 gpio_set_debounce(ts_gpio, 310);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700142}
143
144static int ads7846_get_pendown_state(void)
145{
146 return !gpio_get_value(ts_gpio);
147}
148
149static struct ads7846_platform_data tsc2046_config __initdata = {
150 .get_pendown_state = ads7846_get_pendown_state,
151 .keep_vref_on = 1,
Ranjith Lohithakshan7a44ad22010-05-08 12:39:21 +0530152 .wakeup = true,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700153};
154
155
156static struct omap2_mcspi_device_config tsc2046_mcspi_config = {
157 .turbo_mode = 0,
158 .single_channel = 1, /* 0: slave, 1: master */
159};
160
161static struct spi_board_info sdp3430_spi_board_info[] __initdata = {
162 [0] = {
163 /*
164 * TSC2046 operates at a max freqency of 2MHz, so
165 * operate slightly below at 1.5MHz
166 */
167 .modalias = "ads7846",
168 .bus_num = 1,
169 .chip_select = 0,
170 .max_speed_hz = 1500000,
171 .controller_data = &tsc2046_mcspi_config,
172 .irq = 0,
173 .platform_data = &tsc2046_config,
174 },
175};
176
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200177
178#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
179#define SDP3430_LCD_PANEL_ENABLE_GPIO 5
180
181static unsigned backlight_gpio;
182static unsigned enable_gpio;
183static int lcd_enabled;
184static int dvi_enabled;
185
186static void __init sdp3430_display_init(void)
187{
188 int r;
189
190 enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO;
191 backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
192
193 r = gpio_request(enable_gpio, "LCD reset");
194 if (r) {
195 printk(KERN_ERR "failed to get LCD reset GPIO\n");
196 goto err0;
197 }
198
199 r = gpio_request(backlight_gpio, "LCD Backlight");
200 if (r) {
201 printk(KERN_ERR "failed to get LCD backlight GPIO\n");
202 goto err1;
203 }
204
205 gpio_direction_output(enable_gpio, 0);
206 gpio_direction_output(backlight_gpio, 0);
207
208 return;
209err1:
210 gpio_free(enable_gpio);
211err0:
212 return;
213}
214
215static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
216{
217 if (dvi_enabled) {
218 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
219 return -EINVAL;
220 }
221
222 gpio_direction_output(enable_gpio, 1);
223 gpio_direction_output(backlight_gpio, 1);
224
225 lcd_enabled = 1;
226
227 return 0;
228}
229
230static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
231{
232 lcd_enabled = 0;
233
234 gpio_direction_output(enable_gpio, 0);
235 gpio_direction_output(backlight_gpio, 0);
236}
237
238static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
239{
240 if (lcd_enabled) {
241 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
242 return -EINVAL;
243 }
244
245 dvi_enabled = 1;
246
247 return 0;
248}
249
250static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev)
251{
252 dvi_enabled = 0;
253}
254
255static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev)
256{
257 return 0;
258}
259
260static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev)
261{
262}
263
264
265static struct omap_dss_device sdp3430_lcd_device = {
266 .name = "lcd",
267 .driver_name = "sharp_ls_panel",
268 .type = OMAP_DISPLAY_TYPE_DPI,
269 .phy.dpi.data_lines = 16,
270 .platform_enable = sdp3430_panel_enable_lcd,
271 .platform_disable = sdp3430_panel_disable_lcd,
272};
273
Bryan Wu89747c92010-11-17 13:34:34 +0000274static struct panel_generic_dpi_data dvi_panel = {
275 .name = "generic",
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200276 .platform_enable = sdp3430_panel_enable_dvi,
277 .platform_disable = sdp3430_panel_disable_dvi,
278};
279
Bryan Wu89747c92010-11-17 13:34:34 +0000280static struct omap_dss_device sdp3430_dvi_device = {
281 .name = "dvi",
282 .type = OMAP_DISPLAY_TYPE_DPI,
283 .driver_name = "generic_dpi_panel",
284 .data = &dvi_panel,
285 .phy.dpi.data_lines = 24,
286};
287
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200288static struct omap_dss_device sdp3430_tv_device = {
289 .name = "tv",
290 .driver_name = "venc",
291 .type = OMAP_DISPLAY_TYPE_VENC,
292 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
293 .platform_enable = sdp3430_panel_enable_tv,
294 .platform_disable = sdp3430_panel_disable_tv,
295};
296
297
298static struct omap_dss_device *sdp3430_dss_devices[] = {
299 &sdp3430_lcd_device,
300 &sdp3430_dvi_device,
301 &sdp3430_tv_device,
302};
303
304static struct omap_dss_board_info sdp3430_dss_data = {
305 .num_devices = ARRAY_SIZE(sdp3430_dss_devices),
306 .devices = sdp3430_dss_devices,
307 .default_device = &sdp3430_lcd_device,
308};
309
Senthilvadivu Guruswamy1dde9732011-01-24 06:21:53 +0000310static struct regulator_consumer_supply sdp3430_vdda_dac_supply =
311 REGULATOR_SUPPLY("vdda_dac", "omapdss");
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700312
313static struct omap_board_config_kernel sdp3430_config[] __initdata = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700314};
315
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800316static void __init omap_3430sdp_init_early(void)
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300317{
318 omap_board_config = sdp3430_config;
319 omap_board_config_size = ARRAY_SIZE(sdp3430_config);
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -0800320 omap3_pm_init_cpuidle(omap3_cpuidle_params_table);
Paul Walmsley48057342010-12-21 15:25:10 -0700321 omap2_init_common_infrastructure();
322 omap2_init_common_devices(hyb18m512160af6_sdrc_params, NULL);
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300323}
324
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700325static int sdp3430_batt_table[] = {
326/* 0 C*/
32730800, 29500, 28300, 27100,
32826000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
32917200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
33011600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
3318020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
3325640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
3334040, 3910, 3790, 3670, 3550
334};
335
336static struct twl4030_bci_platform_data sdp3430_bci_data = {
337 .battery_tmp_tbl = sdp3430_batt_table,
338 .tblsize = ARRAY_SIZE(sdp3430_batt_table),
339};
340
Adrian Hunter68ff0422010-02-15 10:03:34 -0800341static struct omap2_hsmmc_info mmc[] = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700342 {
343 .mmc = 1,
344 /* 8 bits (default) requires S6.3 == ON,
345 * so the SIM card isn't used; else 4 bits.
346 */
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000347 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700348 .gpio_wp = 4,
349 },
350 {
351 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000352 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700353 .gpio_wp = 7,
354 },
355 {} /* Terminator */
356};
357
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700358static int sdp3430_twl_gpio_setup(struct device *dev,
359 unsigned gpio, unsigned ngpio)
360{
361 /* gpio + 0 is "mmc0_cd" (input/IRQ),
362 * gpio + 1 is "mmc1_cd" (input/IRQ)
363 */
364 mmc[0].gpio_cd = gpio + 0;
365 mmc[1].gpio_cd = gpio + 1;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800366 omap2_hsmmc_init(mmc);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700367
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700368 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
369 gpio_request(gpio + 7, "sub_lcd_en_bkl");
370 gpio_direction_output(gpio + 7, 0);
371
372 /* gpio + 15 is "sub_lcd_nRST" (output) */
373 gpio_request(gpio + 15, "sub_lcd_nRST");
374 gpio_direction_output(gpio + 15, 0);
375
376 return 0;
377}
378
379static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
380 .gpio_base = OMAP_MAX_GPIO_LINES,
381 .irq_base = TWL4030_GPIO_IRQ_BASE,
382 .irq_end = TWL4030_GPIO_IRQ_END,
383 .pulldowns = BIT(2) | BIT(6) | BIT(8) | BIT(13)
384 | BIT(16) | BIT(17),
385 .setup = sdp3430_twl_gpio_setup,
386};
387
388static struct twl4030_usb_data sdp3430_usb_data = {
389 .usb_mode = T2_USB_MODE_ULPI,
390};
391
392static struct twl4030_madc_platform_data sdp3430_madc_data = {
393 .irq_line = 1,
394};
395
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000396/* regulator consumer mappings */
397
Rajendra Nayak4b087ff82011-02-03 12:45:21 +0000398/* ads7846 on SPI */
399static struct regulator_consumer_supply sdp3430_vaux3_supplies[] = {
400 REGULATOR_SUPPLY("vcc", "spi1.0"),
401};
402
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000403static struct regulator_consumer_supply sdp3430_vdda_dac_supplies[] = {
404 REGULATOR_SUPPLY("vdda_dac", "omapdss"),
405};
406
407/* VPLL2 for digital video outputs */
408static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
409 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
410};
411
412static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530413 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000414};
415
416static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530417 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000418};
419
420static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530421 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000422};
423
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700424/*
425 * Apply all the fixed voltages since most versions of U-Boot
426 * don't bother with that initialization.
427 */
428
429/* VAUX1 for mainboard (irda and sub-lcd) */
430static struct regulator_init_data sdp3430_vaux1 = {
431 .constraints = {
432 .min_uV = 2800000,
433 .max_uV = 2800000,
434 .apply_uV = true,
435 .valid_modes_mask = REGULATOR_MODE_NORMAL
436 | REGULATOR_MODE_STANDBY,
437 .valid_ops_mask = REGULATOR_CHANGE_MODE
438 | REGULATOR_CHANGE_STATUS,
439 },
440};
441
442/* VAUX2 for camera module */
443static struct regulator_init_data sdp3430_vaux2 = {
444 .constraints = {
445 .min_uV = 2800000,
446 .max_uV = 2800000,
447 .apply_uV = true,
448 .valid_modes_mask = REGULATOR_MODE_NORMAL
449 | REGULATOR_MODE_STANDBY,
450 .valid_ops_mask = REGULATOR_CHANGE_MODE
451 | REGULATOR_CHANGE_STATUS,
452 },
453};
454
455/* VAUX3 for LCD board */
456static struct regulator_init_data sdp3430_vaux3 = {
457 .constraints = {
458 .min_uV = 2800000,
459 .max_uV = 2800000,
460 .apply_uV = true,
461 .valid_modes_mask = REGULATOR_MODE_NORMAL
462 | REGULATOR_MODE_STANDBY,
463 .valid_ops_mask = REGULATOR_CHANGE_MODE
464 | REGULATOR_CHANGE_STATUS,
465 },
Rajendra Nayak4b087ff82011-02-03 12:45:21 +0000466 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vaux3_supplies),
467 .consumer_supplies = sdp3430_vaux3_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700468};
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 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000494 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc1_supplies),
495 .consumer_supplies = sdp3430_vmmc1_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700496};
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 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000509 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc2_supplies),
510 .consumer_supplies = sdp3430_vmmc2_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700511};
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 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000524 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vsim_supplies),
525 .consumer_supplies = sdp3430_vsim_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700526};
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 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000539 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vdda_dac_supplies),
540 .consumer_supplies = sdp3430_vdda_dac_supplies,
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200541};
542
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700543static struct regulator_init_data sdp3430_vpll2 = {
544 .constraints = {
545 .name = "VDVI",
546 .min_uV = 1800000,
547 .max_uV = 1800000,
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200548 .apply_uV = true,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700549 .valid_modes_mask = REGULATOR_MODE_NORMAL
550 | REGULATOR_MODE_STANDBY,
551 .valid_ops_mask = REGULATOR_CHANGE_MODE
552 | REGULATOR_CHANGE_STATUS,
553 },
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200554 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vpll2_supplies),
555 .consumer_supplies = sdp3430_vpll2_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700556};
557
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300558static struct twl4030_codec_audio_data sdp3430_audio = {
559 .audio_mclk = 26000000,
560};
561
562static struct twl4030_codec_data sdp3430_codec = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200563 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300564 .audio = &sdp3430_audio,
565};
566
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700567static struct twl4030_platform_data sdp3430_twldata = {
568 .irq_base = TWL4030_IRQ_BASE,
569 .irq_end = TWL4030_IRQ_END,
570
571 /* platform_data for children goes here */
572 .bci = &sdp3430_bci_data,
573 .gpio = &sdp3430_gpio_data,
574 .madc = &sdp3430_madc_data,
575 .keypad = &sdp3430_kp_data,
576 .usb = &sdp3430_usb_data,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300577 .codec = &sdp3430_codec,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700578
579 .vaux1 = &sdp3430_vaux1,
580 .vaux2 = &sdp3430_vaux2,
581 .vaux3 = &sdp3430_vaux3,
582 .vaux4 = &sdp3430_vaux4,
583 .vmmc1 = &sdp3430_vmmc1,
584 .vmmc2 = &sdp3430_vmmc2,
585 .vsim = &sdp3430_vsim,
586 .vdac = &sdp3430_vdac,
587 .vpll2 = &sdp3430_vpll2,
588};
589
590static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
591 {
592 I2C_BOARD_INFO("twl4030", 0x48),
593 .flags = I2C_CLIENT_WAKE,
594 .irq = INT_34XX_SYS_NIRQ,
595 .platform_data = &sdp3430_twldata,
596 },
597};
598
599static int __init omap3430_i2c_init(void)
600{
601 /* i2c1 for PMIC only */
602 omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo,
603 ARRAY_SIZE(sdp3430_i2c_boardinfo));
604 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
605 omap_register_i2c_bus(2, 400, NULL, 0);
606 /* i2c3 on display connector (for DVI, tfp410) */
607 omap_register_i2c_bus(3, 400, NULL, 0);
608 return 0;
609}
610
Tony Lindgren1a48e152009-05-28 13:23:52 -0700611#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
612
613static struct omap_smc91x_platform_data board_smc91x_data = {
614 .cs = 3,
615 .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
616 IORESOURCE_IRQ_LOWLEVEL,
617};
618
619static void __init board_smc91x_init(void)
620{
621 if (omap_rev() > OMAP3430_REV_ES1_0)
622 board_smc91x_data.gpio_irq = 6;
623 else
624 board_smc91x_data.gpio_irq = 29;
625
626 gpmc_smc91x_init(&board_smc91x_data);
627}
628
629#else
630
631static inline void board_smc91x_init(void)
632{
633}
634
635#endif
636
Reddy, Teerth5110b292009-08-24 11:58:59 +0530637static void enable_board_wakeup_source(void)
638{
Tony Lindgren4896e392009-12-11 16:16:32 -0800639 /* T2 interrupt line (keypad) */
640 omap_mux_init_signal("sys_nirq",
641 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
Reddy, Teerth5110b292009-08-24 11:58:59 +0530642}
643
Felipe Balbi6f69a182010-03-04 09:45:53 +0200644static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
Felipe Balbi58a54912009-11-22 10:11:01 -0800645
646 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
647 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
648 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
649
650 .phy_reset = true,
651 .reset_gpio_port[0] = 57,
652 .reset_gpio_port[1] = 61,
653 .reset_gpio_port[2] = -EINVAL
654};
655
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800656#ifdef CONFIG_OMAP_MUX
657static struct omap_board_mux board_mux[] __initdata = {
658 { .reg_offset = OMAP_MUX_TERMINATOR },
659};
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800660#endif
661
Sukumar Ghorai13d6b73c2010-07-09 14:27:47 +0000662/*
663 * SDP3430 V2 Board CS organization
664 * Different from SDP3430 V1. Now 4 switches used to specify CS
665 *
666 * See also the Switch S8 settings in the comments.
667 */
668static char chip_sel_3430[][GPMC_CS_NUM] = {
669 {PDC_NOR, PDC_NAND, PDC_ONENAND, DBG_MPDB, 0, 0, 0, 0}, /* S8:1111 */
670 {PDC_ONENAND, PDC_NAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1110 */
671 {PDC_NAND, PDC_ONENAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1101 */
672};
673
Vimal Singh88c84602010-02-15 10:03:34 -0800674static struct mtd_partition sdp_nor_partitions[] = {
675 /* bootloader (U-Boot, etc) in first sector */
676 {
677 .name = "Bootloader-NOR",
678 .offset = 0,
679 .size = SZ_256K,
680 .mask_flags = MTD_WRITEABLE, /* force read-only */
681 },
682 /* bootloader params in the next sector */
683 {
684 .name = "Params-NOR",
685 .offset = MTDPART_OFS_APPEND,
686 .size = SZ_256K,
687 .mask_flags = 0,
688 },
689 /* kernel */
690 {
691 .name = "Kernel-NOR",
692 .offset = MTDPART_OFS_APPEND,
693 .size = SZ_2M,
694 .mask_flags = 0
695 },
696 /* file system */
697 {
698 .name = "Filesystem-NOR",
699 .offset = MTDPART_OFS_APPEND,
700 .size = MTDPART_SIZ_FULL,
701 .mask_flags = 0
702 }
703};
704
705static struct mtd_partition sdp_onenand_partitions[] = {
706 {
707 .name = "X-Loader-OneNAND",
708 .offset = 0,
709 .size = 4 * (64 * 2048),
710 .mask_flags = MTD_WRITEABLE /* force read-only */
711 },
712 {
713 .name = "U-Boot-OneNAND",
714 .offset = MTDPART_OFS_APPEND,
715 .size = 2 * (64 * 2048),
716 .mask_flags = MTD_WRITEABLE /* force read-only */
717 },
718 {
719 .name = "U-Boot Environment-OneNAND",
720 .offset = MTDPART_OFS_APPEND,
721 .size = 1 * (64 * 2048),
722 },
723 {
724 .name = "Kernel-OneNAND",
725 .offset = MTDPART_OFS_APPEND,
726 .size = 16 * (64 * 2048),
727 },
728 {
729 .name = "File System-OneNAND",
730 .offset = MTDPART_OFS_APPEND,
731 .size = MTDPART_SIZ_FULL,
732 },
733};
734
735static struct mtd_partition sdp_nand_partitions[] = {
736 /* All the partition sizes are listed in terms of NAND block size */
737 {
738 .name = "X-Loader-NAND",
739 .offset = 0,
740 .size = 4 * (64 * 2048),
741 .mask_flags = MTD_WRITEABLE, /* force read-only */
742 },
743 {
744 .name = "U-Boot-NAND",
745 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
746 .size = 10 * (64 * 2048),
747 .mask_flags = MTD_WRITEABLE, /* force read-only */
748 },
749 {
750 .name = "Boot Env-NAND",
751
752 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
753 .size = 6 * (64 * 2048),
754 },
755 {
756 .name = "Kernel-NAND",
757 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
758 .size = 40 * (64 * 2048),
759 },
760 {
761 .name = "File System - NAND",
762 .size = MTDPART_SIZ_FULL,
763 .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
764 },
765};
766
767static struct flash_partitions sdp_flash_partitions[] = {
768 {
769 .parts = sdp_nor_partitions,
770 .nr_parts = ARRAY_SIZE(sdp_nor_partitions),
771 },
772 {
773 .parts = sdp_onenand_partitions,
774 .nr_parts = ARRAY_SIZE(sdp_onenand_partitions),
775 },
776 {
777 .parts = sdp_nand_partitions,
778 .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
779 },
780};
781
Maulik Mankad884b8362010-02-17 14:09:30 -0800782static struct omap_musb_board_data musb_board_data = {
783 .interface_type = MUSB_INTERFACE_ULPI,
784 .mode = MUSB_OTG,
785 .power = 100,
786};
787
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700788static void __init omap_3430sdp_init(void)
789{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800790 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700791 omap3430_i2c_init();
Senthilvadivu Guruswamyd5e13222011-02-22 11:24:50 +0200792 omap_display_init(&sdp3430_dss_data);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700793 if (omap_rev() > OMAP3430_REV_ES1_0)
794 ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2;
795 else
796 ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV1;
797 sdp3430_spi_board_info[0].irq = gpio_to_irq(ts_gpio);
798 spi_register_board_info(sdp3430_spi_board_info,
799 ARRAY_SIZE(sdp3430_spi_board_info));
800 ads7846_dev_init();
801 omap_serial_init();
Maulik Mankad884b8362010-02-17 14:09:30 -0800802 usb_musb_init(&musb_board_data);
Tony Lindgren1a48e152009-05-28 13:23:52 -0700803 board_smc91x_init();
Sukumar Ghoraid5ce2b62011-01-28 15:42:03 +0530804 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200805 sdp3430_display_init();
Reddy, Teerth5110b292009-08-24 11:58:59 +0530806 enable_board_wakeup_source();
Felipe Balbi58a54912009-11-22 10:11:01 -0800807 usb_ehci_init(&ehci_pdata);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700808}
809
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700810MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
811 /* Maintainer: Syed Khasim - Texas Instruments Inc */
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700812 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100813 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800814 .map_io = omap3_map_io,
815 .init_early = omap_3430sdp_init_early,
816 .init_irq = omap_init_irq,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700817 .init_machine = omap_3430sdp_init,
818 .timer = &omap_timer,
819MACHINE_END