blob: 3726465d34e3756e12b0b6559ae96f36c1aff9cb [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>
Santosh Shilimkarb07682b2009-12-13 20:05:51 +010022#include <linux/i2c/twl.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070023#include <linux/regulator/machine.h>
24#include <linux/io.h>
25#include <linux/gpio.h>
Sukumar Ghorai3a638332010-09-15 14:49:23 +000026#include <linux/mmc/host.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070027
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>
Bryan Wu89747c92010-11-17 13:34:34 +000040#include <plat/panel-generic-dpi.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070041
Tony Lindgrence491cf2009-10-20 09:40:47 -070042#include <plat/gpmc-smc91x.h>
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -070043
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -070044#include "board-flash.h"
Tony Lindgrenca5742b2009-12-11 16:16:32 -080045#include "mux.h"
Paul Walmsley17a722c2009-05-28 14:03:59 -070046#include "sdram-qimonda-hyb18m512160af-6.h"
Adrian Hunterd02a9002010-02-15 10:03:34 -080047#include "hsmmc.h"
Kevin Hilmanbb4de3d2009-12-15 16:37:18 -080048#include "pm.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060049#include "control.h"
Mike Rapoport96974a22011-04-25 01:09:05 +030050#include "common-board-devices.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
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200126#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
127#define SDP3430_LCD_PANEL_ENABLE_GPIO 5
128
129static unsigned backlight_gpio;
130static unsigned enable_gpio;
131static int lcd_enabled;
132static int dvi_enabled;
133
134static void __init sdp3430_display_init(void)
135{
136 int r;
137
138 enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO;
139 backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
140
141 r = gpio_request(enable_gpio, "LCD reset");
142 if (r) {
143 printk(KERN_ERR "failed to get LCD reset GPIO\n");
144 goto err0;
145 }
146
147 r = gpio_request(backlight_gpio, "LCD Backlight");
148 if (r) {
149 printk(KERN_ERR "failed to get LCD backlight GPIO\n");
150 goto err1;
151 }
152
153 gpio_direction_output(enable_gpio, 0);
154 gpio_direction_output(backlight_gpio, 0);
155
156 return;
157err1:
158 gpio_free(enable_gpio);
159err0:
160 return;
161}
162
163static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
164{
165 if (dvi_enabled) {
166 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
167 return -EINVAL;
168 }
169
170 gpio_direction_output(enable_gpio, 1);
171 gpio_direction_output(backlight_gpio, 1);
172
173 lcd_enabled = 1;
174
175 return 0;
176}
177
178static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
179{
180 lcd_enabled = 0;
181
182 gpio_direction_output(enable_gpio, 0);
183 gpio_direction_output(backlight_gpio, 0);
184}
185
186static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
187{
188 if (lcd_enabled) {
189 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
190 return -EINVAL;
191 }
192
193 dvi_enabled = 1;
194
195 return 0;
196}
197
198static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev)
199{
200 dvi_enabled = 0;
201}
202
203static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev)
204{
205 return 0;
206}
207
208static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev)
209{
210}
211
212
213static struct omap_dss_device sdp3430_lcd_device = {
214 .name = "lcd",
215 .driver_name = "sharp_ls_panel",
216 .type = OMAP_DISPLAY_TYPE_DPI,
217 .phy.dpi.data_lines = 16,
218 .platform_enable = sdp3430_panel_enable_lcd,
219 .platform_disable = sdp3430_panel_disable_lcd,
220};
221
Bryan Wu89747c92010-11-17 13:34:34 +0000222static struct panel_generic_dpi_data dvi_panel = {
223 .name = "generic",
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200224 .platform_enable = sdp3430_panel_enable_dvi,
225 .platform_disable = sdp3430_panel_disable_dvi,
226};
227
Bryan Wu89747c92010-11-17 13:34:34 +0000228static struct omap_dss_device sdp3430_dvi_device = {
229 .name = "dvi",
230 .type = OMAP_DISPLAY_TYPE_DPI,
231 .driver_name = "generic_dpi_panel",
232 .data = &dvi_panel,
233 .phy.dpi.data_lines = 24,
234};
235
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200236static struct omap_dss_device sdp3430_tv_device = {
237 .name = "tv",
238 .driver_name = "venc",
239 .type = OMAP_DISPLAY_TYPE_VENC,
240 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
241 .platform_enable = sdp3430_panel_enable_tv,
242 .platform_disable = sdp3430_panel_disable_tv,
243};
244
245
246static struct omap_dss_device *sdp3430_dss_devices[] = {
247 &sdp3430_lcd_device,
248 &sdp3430_dvi_device,
249 &sdp3430_tv_device,
250};
251
252static struct omap_dss_board_info sdp3430_dss_data = {
253 .num_devices = ARRAY_SIZE(sdp3430_dss_devices),
254 .devices = sdp3430_dss_devices,
255 .default_device = &sdp3430_lcd_device,
256};
257
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700258static struct omap_board_config_kernel sdp3430_config[] __initdata = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700259};
260
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800261static void __init omap_3430sdp_init_early(void)
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300262{
Paul Walmsley48057342010-12-21 15:25:10 -0700263 omap2_init_common_infrastructure();
264 omap2_init_common_devices(hyb18m512160af6_sdrc_params, NULL);
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300265}
266
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700267static int sdp3430_batt_table[] = {
268/* 0 C*/
26930800, 29500, 28300, 27100,
27026000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
27117200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
27211600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
2738020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
2745640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
2754040, 3910, 3790, 3670, 3550
276};
277
278static struct twl4030_bci_platform_data sdp3430_bci_data = {
279 .battery_tmp_tbl = sdp3430_batt_table,
280 .tblsize = ARRAY_SIZE(sdp3430_batt_table),
281};
282
Adrian Hunter68ff0422010-02-15 10:03:34 -0800283static struct omap2_hsmmc_info mmc[] = {
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700284 {
285 .mmc = 1,
286 /* 8 bits (default) requires S6.3 == ON,
287 * so the SIM card isn't used; else 4 bits.
288 */
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000289 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700290 .gpio_wp = 4,
291 },
292 {
293 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000294 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700295 .gpio_wp = 7,
296 },
297 {} /* Terminator */
298};
299
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700300static int sdp3430_twl_gpio_setup(struct device *dev,
301 unsigned gpio, unsigned ngpio)
302{
303 /* gpio + 0 is "mmc0_cd" (input/IRQ),
304 * gpio + 1 is "mmc1_cd" (input/IRQ)
305 */
306 mmc[0].gpio_cd = gpio + 0;
307 mmc[1].gpio_cd = gpio + 1;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800308 omap2_hsmmc_init(mmc);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700309
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700310 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
311 gpio_request(gpio + 7, "sub_lcd_en_bkl");
312 gpio_direction_output(gpio + 7, 0);
313
314 /* gpio + 15 is "sub_lcd_nRST" (output) */
315 gpio_request(gpio + 15, "sub_lcd_nRST");
316 gpio_direction_output(gpio + 15, 0);
317
318 return 0;
319}
320
321static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
322 .gpio_base = OMAP_MAX_GPIO_LINES,
323 .irq_base = TWL4030_GPIO_IRQ_BASE,
324 .irq_end = TWL4030_GPIO_IRQ_END,
325 .pulldowns = BIT(2) | BIT(6) | BIT(8) | BIT(13)
326 | BIT(16) | BIT(17),
327 .setup = sdp3430_twl_gpio_setup,
328};
329
330static struct twl4030_usb_data sdp3430_usb_data = {
331 .usb_mode = T2_USB_MODE_ULPI,
332};
333
334static struct twl4030_madc_platform_data sdp3430_madc_data = {
335 .irq_line = 1,
336};
337
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000338/* regulator consumer mappings */
339
Rajendra Nayak4b087ff2011-02-03 12:45:21 +0000340/* ads7846 on SPI */
341static struct regulator_consumer_supply sdp3430_vaux3_supplies[] = {
342 REGULATOR_SUPPLY("vcc", "spi1.0"),
343};
344
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000345static struct regulator_consumer_supply sdp3430_vdda_dac_supplies[] = {
Senthilvadivu Guruswamy30ea50c2011-01-24 06:22:01 +0000346 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000347};
348
349/* VPLL2 for digital video outputs */
350static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
351 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
Senthilvadivu Guruswamyc8aac012011-01-24 06:22:02 +0000352 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000353};
354
355static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530356 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000357};
358
359static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530360 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000361};
362
363static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530364 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000365};
366
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700367/*
368 * Apply all the fixed voltages since most versions of U-Boot
369 * don't bother with that initialization.
370 */
371
372/* VAUX1 for mainboard (irda and sub-lcd) */
373static struct regulator_init_data sdp3430_vaux1 = {
374 .constraints = {
375 .min_uV = 2800000,
376 .max_uV = 2800000,
377 .apply_uV = true,
378 .valid_modes_mask = REGULATOR_MODE_NORMAL
379 | REGULATOR_MODE_STANDBY,
380 .valid_ops_mask = REGULATOR_CHANGE_MODE
381 | REGULATOR_CHANGE_STATUS,
382 },
383};
384
385/* VAUX2 for camera module */
386static struct regulator_init_data sdp3430_vaux2 = {
387 .constraints = {
388 .min_uV = 2800000,
389 .max_uV = 2800000,
390 .apply_uV = true,
391 .valid_modes_mask = REGULATOR_MODE_NORMAL
392 | REGULATOR_MODE_STANDBY,
393 .valid_ops_mask = REGULATOR_CHANGE_MODE
394 | REGULATOR_CHANGE_STATUS,
395 },
396};
397
398/* VAUX3 for LCD board */
399static struct regulator_init_data sdp3430_vaux3 = {
400 .constraints = {
401 .min_uV = 2800000,
402 .max_uV = 2800000,
403 .apply_uV = true,
404 .valid_modes_mask = REGULATOR_MODE_NORMAL
405 | REGULATOR_MODE_STANDBY,
406 .valid_ops_mask = REGULATOR_CHANGE_MODE
407 | REGULATOR_CHANGE_STATUS,
408 },
Rajendra Nayak4b087ff2011-02-03 12:45:21 +0000409 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vaux3_supplies),
410 .consumer_supplies = sdp3430_vaux3_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700411};
412
413/* VAUX4 for OMAP VDD_CSI2 (camera) */
414static struct regulator_init_data sdp3430_vaux4 = {
415 .constraints = {
416 .min_uV = 1800000,
417 .max_uV = 1800000,
418 .apply_uV = true,
419 .valid_modes_mask = REGULATOR_MODE_NORMAL
420 | REGULATOR_MODE_STANDBY,
421 .valid_ops_mask = REGULATOR_CHANGE_MODE
422 | REGULATOR_CHANGE_STATUS,
423 },
424};
425
426/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
427static struct regulator_init_data sdp3430_vmmc1 = {
428 .constraints = {
429 .min_uV = 1850000,
430 .max_uV = 3150000,
431 .valid_modes_mask = REGULATOR_MODE_NORMAL
432 | REGULATOR_MODE_STANDBY,
433 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
434 | REGULATOR_CHANGE_MODE
435 | REGULATOR_CHANGE_STATUS,
436 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000437 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc1_supplies),
438 .consumer_supplies = sdp3430_vmmc1_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700439};
440
441/* VMMC2 for MMC2 card */
442static struct regulator_init_data sdp3430_vmmc2 = {
443 .constraints = {
444 .min_uV = 1850000,
445 .max_uV = 1850000,
446 .apply_uV = true,
447 .valid_modes_mask = REGULATOR_MODE_NORMAL
448 | REGULATOR_MODE_STANDBY,
449 .valid_ops_mask = REGULATOR_CHANGE_MODE
450 | REGULATOR_CHANGE_STATUS,
451 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000452 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc2_supplies),
453 .consumer_supplies = sdp3430_vmmc2_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700454};
455
456/* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
457static struct regulator_init_data sdp3430_vsim = {
458 .constraints = {
459 .min_uV = 1800000,
460 .max_uV = 3000000,
461 .valid_modes_mask = REGULATOR_MODE_NORMAL
462 | REGULATOR_MODE_STANDBY,
463 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
464 | REGULATOR_CHANGE_MODE
465 | REGULATOR_CHANGE_STATUS,
466 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000467 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vsim_supplies),
468 .consumer_supplies = sdp3430_vsim_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700469};
470
471/* VDAC for DSS driving S-Video */
472static struct regulator_init_data sdp3430_vdac = {
473 .constraints = {
474 .min_uV = 1800000,
475 .max_uV = 1800000,
476 .apply_uV = true,
477 .valid_modes_mask = REGULATOR_MODE_NORMAL
478 | REGULATOR_MODE_STANDBY,
479 .valid_ops_mask = REGULATOR_CHANGE_MODE
480 | REGULATOR_CHANGE_STATUS,
481 },
Rajendra Nayak73a92aa2011-02-03 12:45:22 +0000482 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vdda_dac_supplies),
483 .consumer_supplies = sdp3430_vdda_dac_supplies,
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200484};
485
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700486static struct regulator_init_data sdp3430_vpll2 = {
487 .constraints = {
488 .name = "VDVI",
489 .min_uV = 1800000,
490 .max_uV = 1800000,
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200491 .apply_uV = true,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700492 .valid_modes_mask = REGULATOR_MODE_NORMAL
493 | REGULATOR_MODE_STANDBY,
494 .valid_ops_mask = REGULATOR_CHANGE_MODE
495 | REGULATOR_CHANGE_STATUS,
496 },
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200497 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vpll2_supplies),
498 .consumer_supplies = sdp3430_vpll2_supplies,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700499};
500
Ilkka Koskinen6a58baf2011-03-02 13:24:05 +0000501static struct twl4030_codec_audio_data sdp3430_audio;
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300502
503static struct twl4030_codec_data sdp3430_codec = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200504 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300505 .audio = &sdp3430_audio,
506};
507
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700508static struct twl4030_platform_data sdp3430_twldata = {
509 .irq_base = TWL4030_IRQ_BASE,
510 .irq_end = TWL4030_IRQ_END,
511
512 /* platform_data for children goes here */
513 .bci = &sdp3430_bci_data,
514 .gpio = &sdp3430_gpio_data,
515 .madc = &sdp3430_madc_data,
516 .keypad = &sdp3430_kp_data,
517 .usb = &sdp3430_usb_data,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300518 .codec = &sdp3430_codec,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700519
520 .vaux1 = &sdp3430_vaux1,
521 .vaux2 = &sdp3430_vaux2,
522 .vaux3 = &sdp3430_vaux3,
523 .vaux4 = &sdp3430_vaux4,
524 .vmmc1 = &sdp3430_vmmc1,
525 .vmmc2 = &sdp3430_vmmc2,
526 .vsim = &sdp3430_vsim,
527 .vdac = &sdp3430_vdac,
528 .vpll2 = &sdp3430_vpll2,
529};
530
531static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = {
532 {
533 I2C_BOARD_INFO("twl4030", 0x48),
534 .flags = I2C_CLIENT_WAKE,
535 .irq = INT_34XX_SYS_NIRQ,
536 .platform_data = &sdp3430_twldata,
537 },
538};
539
540static int __init omap3430_i2c_init(void)
541{
542 /* i2c1 for PMIC only */
543 omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo,
544 ARRAY_SIZE(sdp3430_i2c_boardinfo));
545 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
546 omap_register_i2c_bus(2, 400, NULL, 0);
547 /* i2c3 on display connector (for DVI, tfp410) */
548 omap_register_i2c_bus(3, 400, NULL, 0);
549 return 0;
550}
551
Tony Lindgren1a48e152009-05-28 13:23:52 -0700552#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
553
554static struct omap_smc91x_platform_data board_smc91x_data = {
555 .cs = 3,
556 .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
557 IORESOURCE_IRQ_LOWLEVEL,
558};
559
560static void __init board_smc91x_init(void)
561{
562 if (omap_rev() > OMAP3430_REV_ES1_0)
563 board_smc91x_data.gpio_irq = 6;
564 else
565 board_smc91x_data.gpio_irq = 29;
566
567 gpmc_smc91x_init(&board_smc91x_data);
568}
569
570#else
571
572static inline void board_smc91x_init(void)
573{
574}
575
576#endif
577
Reddy, Teerth5110b292009-08-24 11:58:59 +0530578static void enable_board_wakeup_source(void)
579{
Tony Lindgren4896e392009-12-11 16:16:32 -0800580 /* T2 interrupt line (keypad) */
581 omap_mux_init_signal("sys_nirq",
582 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
Reddy, Teerth5110b292009-08-24 11:58:59 +0530583}
584
Keshava Munegowda181b2502011-03-01 20:08:16 +0530585static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
Felipe Balbi58a54912009-11-22 10:11:01 -0800586
Keshava Munegowda181b2502011-03-01 20:08:16 +0530587 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
588 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
589 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
Felipe Balbi58a54912009-11-22 10:11:01 -0800590
591 .phy_reset = true,
592 .reset_gpio_port[0] = 57,
593 .reset_gpio_port[1] = 61,
594 .reset_gpio_port[2] = -EINVAL
595};
596
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800597#ifdef CONFIG_OMAP_MUX
598static struct omap_board_mux board_mux[] __initdata = {
599 { .reg_offset = OMAP_MUX_TERMINATOR },
600};
R Sricharan626dda82011-03-11 06:04:45 +0000601
602static struct omap_device_pad serial1_pads[] __initdata = {
603 /*
604 * Note that off output enable is an active low
605 * signal. So setting this means pin is a
606 * input enabled in off mode
607 */
608 OMAP_MUX_STATIC("uart1_cts.uart1_cts",
609 OMAP_PIN_INPUT |
610 OMAP_PIN_OFF_INPUT_PULLDOWN |
611 OMAP_OFFOUT_EN |
612 OMAP_MUX_MODE0),
613 OMAP_MUX_STATIC("uart1_rts.uart1_rts",
614 OMAP_PIN_OUTPUT |
615 OMAP_OFF_EN |
616 OMAP_MUX_MODE0),
617 OMAP_MUX_STATIC("uart1_rx.uart1_rx",
618 OMAP_PIN_INPUT |
619 OMAP_PIN_OFF_INPUT_PULLDOWN |
620 OMAP_OFFOUT_EN |
621 OMAP_MUX_MODE0),
622 OMAP_MUX_STATIC("uart1_tx.uart1_tx",
623 OMAP_PIN_OUTPUT |
624 OMAP_OFF_EN |
625 OMAP_MUX_MODE0),
626};
627
628static struct omap_device_pad serial2_pads[] __initdata = {
629 OMAP_MUX_STATIC("uart2_cts.uart2_cts",
630 OMAP_PIN_INPUT_PULLUP |
631 OMAP_PIN_OFF_INPUT_PULLDOWN |
632 OMAP_OFFOUT_EN |
633 OMAP_MUX_MODE0),
634 OMAP_MUX_STATIC("uart2_rts.uart2_rts",
635 OMAP_PIN_OUTPUT |
636 OMAP_OFF_EN |
637 OMAP_MUX_MODE0),
638 OMAP_MUX_STATIC("uart2_rx.uart2_rx",
639 OMAP_PIN_INPUT |
640 OMAP_PIN_OFF_INPUT_PULLDOWN |
641 OMAP_OFFOUT_EN |
642 OMAP_MUX_MODE0),
643 OMAP_MUX_STATIC("uart2_tx.uart2_tx",
644 OMAP_PIN_OUTPUT |
645 OMAP_OFF_EN |
646 OMAP_MUX_MODE0),
647};
648
649static struct omap_device_pad serial3_pads[] __initdata = {
650 OMAP_MUX_STATIC("uart3_cts_rctx.uart3_cts_rctx",
651 OMAP_PIN_INPUT_PULLDOWN |
652 OMAP_PIN_OFF_INPUT_PULLDOWN |
653 OMAP_OFFOUT_EN |
654 OMAP_MUX_MODE0),
655 OMAP_MUX_STATIC("uart3_rts_sd.uart3_rts_sd",
656 OMAP_PIN_OUTPUT |
657 OMAP_OFF_EN |
658 OMAP_MUX_MODE0),
659 OMAP_MUX_STATIC("uart3_rx_irrx.uart3_rx_irrx",
660 OMAP_PIN_INPUT |
661 OMAP_PIN_OFF_INPUT_PULLDOWN |
662 OMAP_OFFOUT_EN |
663 OMAP_MUX_MODE0),
664 OMAP_MUX_STATIC("uart3_tx_irtx.uart3_tx_irtx",
665 OMAP_PIN_OUTPUT |
666 OMAP_OFF_EN |
667 OMAP_MUX_MODE0),
668};
669
670static struct omap_board_data serial1_data = {
671 .id = 0,
672 .pads = serial1_pads,
673 .pads_cnt = ARRAY_SIZE(serial1_pads),
674};
675
676static struct omap_board_data serial2_data = {
677 .id = 1,
678 .pads = serial2_pads,
679 .pads_cnt = ARRAY_SIZE(serial2_pads),
680};
681
682static struct omap_board_data serial3_data = {
683 .id = 2,
684 .pads = serial3_pads,
685 .pads_cnt = ARRAY_SIZE(serial3_pads),
686};
687
688static inline void board_serial_init(void)
689{
690 omap_serial_init_port(&serial1_data);
691 omap_serial_init_port(&serial2_data);
692 omap_serial_init_port(&serial3_data);
693}
694#else
695#define board_mux NULL
696
697static inline void board_serial_init(void)
698{
699 omap_serial_init();
700}
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800701#endif
702
Sukumar Ghorai13d6b73c2010-07-09 14:27:47 +0000703/*
704 * SDP3430 V2 Board CS organization
705 * Different from SDP3430 V1. Now 4 switches used to specify CS
706 *
707 * See also the Switch S8 settings in the comments.
708 */
709static char chip_sel_3430[][GPMC_CS_NUM] = {
710 {PDC_NOR, PDC_NAND, PDC_ONENAND, DBG_MPDB, 0, 0, 0, 0}, /* S8:1111 */
711 {PDC_ONENAND, PDC_NAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1110 */
712 {PDC_NAND, PDC_ONENAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1101 */
713};
714
Vimal Singh88c84602010-02-15 10:03:34 -0800715static struct mtd_partition sdp_nor_partitions[] = {
716 /* bootloader (U-Boot, etc) in first sector */
717 {
718 .name = "Bootloader-NOR",
719 .offset = 0,
720 .size = SZ_256K,
721 .mask_flags = MTD_WRITEABLE, /* force read-only */
722 },
723 /* bootloader params in the next sector */
724 {
725 .name = "Params-NOR",
726 .offset = MTDPART_OFS_APPEND,
727 .size = SZ_256K,
728 .mask_flags = 0,
729 },
730 /* kernel */
731 {
732 .name = "Kernel-NOR",
733 .offset = MTDPART_OFS_APPEND,
734 .size = SZ_2M,
735 .mask_flags = 0
736 },
737 /* file system */
738 {
739 .name = "Filesystem-NOR",
740 .offset = MTDPART_OFS_APPEND,
741 .size = MTDPART_SIZ_FULL,
742 .mask_flags = 0
743 }
744};
745
746static struct mtd_partition sdp_onenand_partitions[] = {
747 {
748 .name = "X-Loader-OneNAND",
749 .offset = 0,
750 .size = 4 * (64 * 2048),
751 .mask_flags = MTD_WRITEABLE /* force read-only */
752 },
753 {
754 .name = "U-Boot-OneNAND",
755 .offset = MTDPART_OFS_APPEND,
756 .size = 2 * (64 * 2048),
757 .mask_flags = MTD_WRITEABLE /* force read-only */
758 },
759 {
760 .name = "U-Boot Environment-OneNAND",
761 .offset = MTDPART_OFS_APPEND,
762 .size = 1 * (64 * 2048),
763 },
764 {
765 .name = "Kernel-OneNAND",
766 .offset = MTDPART_OFS_APPEND,
767 .size = 16 * (64 * 2048),
768 },
769 {
770 .name = "File System-OneNAND",
771 .offset = MTDPART_OFS_APPEND,
772 .size = MTDPART_SIZ_FULL,
773 },
774};
775
776static struct mtd_partition sdp_nand_partitions[] = {
777 /* All the partition sizes are listed in terms of NAND block size */
778 {
779 .name = "X-Loader-NAND",
780 .offset = 0,
781 .size = 4 * (64 * 2048),
782 .mask_flags = MTD_WRITEABLE, /* force read-only */
783 },
784 {
785 .name = "U-Boot-NAND",
786 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
787 .size = 10 * (64 * 2048),
788 .mask_flags = MTD_WRITEABLE, /* force read-only */
789 },
790 {
791 .name = "Boot Env-NAND",
792
793 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
794 .size = 6 * (64 * 2048),
795 },
796 {
797 .name = "Kernel-NAND",
798 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
799 .size = 40 * (64 * 2048),
800 },
801 {
802 .name = "File System - NAND",
803 .size = MTDPART_SIZ_FULL,
804 .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
805 },
806};
807
808static struct flash_partitions sdp_flash_partitions[] = {
809 {
810 .parts = sdp_nor_partitions,
811 .nr_parts = ARRAY_SIZE(sdp_nor_partitions),
812 },
813 {
814 .parts = sdp_onenand_partitions,
815 .nr_parts = ARRAY_SIZE(sdp_onenand_partitions),
816 },
817 {
818 .parts = sdp_nand_partitions,
819 .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
820 },
821};
822
Maulik Mankad884b8362010-02-17 14:09:30 -0800823static struct omap_musb_board_data musb_board_data = {
824 .interface_type = MUSB_INTERFACE_ULPI,
825 .mode = MUSB_OTG,
826 .power = 100,
827};
828
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700829static void __init omap_3430sdp_init(void)
830{
Mike Rapoport96974a22011-04-25 01:09:05 +0300831 int gpio_pendown;
832
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800833 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Tony Lindgrene41cccf2011-02-24 14:36:03 -0800834 omap_board_config = sdp3430_config;
835 omap_board_config_size = ARRAY_SIZE(sdp3430_config);
836 omap3_pm_init_cpuidle(omap3_cpuidle_params_table);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700837 omap3430_i2c_init();
Senthilvadivu Guruswamyd5e13222011-02-22 11:24:50 +0200838 omap_display_init(&sdp3430_dss_data);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700839 if (omap_rev() > OMAP3430_REV_ES1_0)
Mike Rapoport96974a22011-04-25 01:09:05 +0300840 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2;
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700841 else
Mike Rapoport96974a22011-04-25 01:09:05 +0300842 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
843 omap_ads7846_init(1, gpio_pendown, 310, NULL);
R Sricharan626dda82011-03-11 06:04:45 +0000844 board_serial_init();
Maulik Mankad884b8362010-02-17 14:09:30 -0800845 usb_musb_init(&musb_board_data);
Tony Lindgren1a48e152009-05-28 13:23:52 -0700846 board_smc91x_init();
Sukumar Ghoraid5ce2b62011-01-28 15:42:03 +0530847 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
Tomi Valkeinend9056ce2009-12-09 18:25:18 +0200848 sdp3430_display_init();
Reddy, Teerth5110b292009-08-24 11:58:59 +0530849 enable_board_wakeup_source();
Keshava Munegowda9e64bb12011-03-01 20:08:19 +0530850 usbhs_init(&usbhs_bdata);
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700851}
852
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700853MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
854 /* Maintainer: Syed Khasim - Texas Instruments Inc */
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700855 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100856 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800857 .map_io = omap3_map_io,
858 .init_early = omap_3430sdp_init_early,
859 .init_irq = omap_init_irq,
Syed Mohammed Khasim6fdc29e2009-03-23 18:38:16 -0700860 .init_machine = omap_3430sdp_init,
861 .timer = &omap_timer,
862MACHINE_END