2 * linux/arch/arm/mach-omap2/board-3430sdp.c
4 * Copyright (C) 2007 Texas Instruments
6 * Modified from mach-omap2/board-generic.c
8 * Initial code: Syed Mohammed Khasim
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.
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>
20 #include <linux/input/matrix_keypad.h>
21 #include <linux/spi/spi.h>
22 #include <linux/i2c/twl.h>
23 #include <linux/regulator/machine.h>
25 #include <linux/gpio.h>
26 #include <linux/mmc/host.h>
27 #include <linux/platform_data/spi-omap2-mcspi.h>
28 #include <linux/platform_data/omap-twl4030.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
35 #include <linux/omap-dma.h>
36 #include <video/omapdss.h>
37 #include <video/omap-panel-tfp410.h>
40 #include "gpmc-smc91x.h"
43 #include "board-flash.h"
45 #include "sdram-qimonda-hyb18m512160af-6.h"
49 #include "common-board-devices.h"
51 #define CONFIG_DISABLE_HFCLK 1
53 #define SDP3430_TS_GPIO_IRQ_SDPV1 3
54 #define SDP3430_TS_GPIO_IRQ_SDPV2 2
56 #define ENABLE_VAUX3_DEDICATED 0x03
57 #define ENABLE_VAUX3_DEV_GRP 0x20
59 #define TWL4030_MSECURE_GPIO 22
61 static uint32_t board_keymap[] = {
95 static struct matrix_keymap_data board_map_data = {
96 .keymap = board_keymap,
97 .keymap_size = ARRAY_SIZE(board_keymap),
100 static struct twl4030_keypad_data sdp3430_kp_data = {
101 .keymap_data = &board_map_data,
107 #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
108 #define SDP3430_LCD_PANEL_ENABLE_GPIO 5
110 static struct gpio sdp3430_dss_gpios[] __initdata = {
111 {SDP3430_LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "LCD reset" },
112 {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"},
115 static void __init sdp3430_display_init(void)
119 r = gpio_request_array(sdp3430_dss_gpios,
120 ARRAY_SIZE(sdp3430_dss_gpios));
122 printk(KERN_ERR "failed to get LCD control GPIOs\n");
126 static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
128 gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1);
129 gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1);
134 static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
136 gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0);
137 gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0);
140 static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev)
145 static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev)
150 static struct omap_dss_device sdp3430_lcd_device = {
152 .driver_name = "sharp_ls_panel",
153 .type = OMAP_DISPLAY_TYPE_DPI,
154 .phy.dpi.data_lines = 16,
155 .platform_enable = sdp3430_panel_enable_lcd,
156 .platform_disable = sdp3430_panel_disable_lcd,
159 static struct tfp410_platform_data dvi_panel = {
160 .power_down_gpio = -1,
164 static struct omap_dss_device sdp3430_dvi_device = {
166 .type = OMAP_DISPLAY_TYPE_DPI,
167 .driver_name = "tfp410",
169 .phy.dpi.data_lines = 24,
172 static struct omap_dss_device sdp3430_tv_device = {
174 .driver_name = "venc",
175 .type = OMAP_DISPLAY_TYPE_VENC,
176 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
177 .platform_enable = sdp3430_panel_enable_tv,
178 .platform_disable = sdp3430_panel_disable_tv,
182 static struct omap_dss_device *sdp3430_dss_devices[] = {
188 static struct omap_dss_board_info sdp3430_dss_data = {
189 .num_devices = ARRAY_SIZE(sdp3430_dss_devices),
190 .devices = sdp3430_dss_devices,
191 .default_device = &sdp3430_lcd_device,
194 static struct omap2_hsmmc_info mmc[] = {
197 /* 8 bits (default) requires S6.3 == ON,
198 * so the SIM card isn't used; else 4 bits.
200 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
206 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
213 static struct omap_tw4030_pdata omap_twl4030_audio_data = {
214 .voice_connected = true,
215 .custom_routing = true,
217 .has_hs = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
218 .has_hf = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
223 .has_linein = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
226 static int sdp3430_twl_gpio_setup(struct device *dev,
227 unsigned gpio, unsigned ngpio)
229 /* gpio + 0 is "mmc0_cd" (input/IRQ),
230 * gpio + 1 is "mmc1_cd" (input/IRQ)
232 mmc[0].gpio_cd = gpio + 0;
233 mmc[1].gpio_cd = gpio + 1;
234 omap_hsmmc_late_init(mmc);
236 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
237 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl");
239 /* gpio + 15 is "sub_lcd_nRST" (output) */
240 gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST");
242 omap_twl4030_audio_data.jack_detect = gpio + 2;
243 omap_twl4030_audio_init("SDP3430", &omap_twl4030_audio_data);
248 static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
249 .pulldowns = BIT(2) | BIT(6) | BIT(8) | BIT(13)
251 .setup = sdp3430_twl_gpio_setup,
254 /* regulator consumer mappings */
257 static struct regulator_consumer_supply sdp3430_vaux3_supplies[] = {
258 REGULATOR_SUPPLY("vcc", "spi1.0"),
261 static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
262 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
265 static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
266 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
269 static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
270 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
274 * Apply all the fixed voltages since most versions of U-Boot
275 * don't bother with that initialization.
278 /* VAUX1 for mainboard (irda and sub-lcd) */
279 static struct regulator_init_data sdp3430_vaux1 = {
284 .valid_modes_mask = REGULATOR_MODE_NORMAL
285 | REGULATOR_MODE_STANDBY,
286 .valid_ops_mask = REGULATOR_CHANGE_MODE
287 | REGULATOR_CHANGE_STATUS,
291 /* VAUX2 for camera module */
292 static struct regulator_init_data sdp3430_vaux2 = {
297 .valid_modes_mask = REGULATOR_MODE_NORMAL
298 | REGULATOR_MODE_STANDBY,
299 .valid_ops_mask = REGULATOR_CHANGE_MODE
300 | REGULATOR_CHANGE_STATUS,
304 /* VAUX3 for LCD board */
305 static struct regulator_init_data sdp3430_vaux3 = {
310 .valid_modes_mask = REGULATOR_MODE_NORMAL
311 | REGULATOR_MODE_STANDBY,
312 .valid_ops_mask = REGULATOR_CHANGE_MODE
313 | REGULATOR_CHANGE_STATUS,
315 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vaux3_supplies),
316 .consumer_supplies = sdp3430_vaux3_supplies,
319 /* VAUX4 for OMAP VDD_CSI2 (camera) */
320 static struct regulator_init_data sdp3430_vaux4 = {
325 .valid_modes_mask = REGULATOR_MODE_NORMAL
326 | REGULATOR_MODE_STANDBY,
327 .valid_ops_mask = REGULATOR_CHANGE_MODE
328 | REGULATOR_CHANGE_STATUS,
332 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
333 static struct regulator_init_data sdp3430_vmmc1 = {
337 .valid_modes_mask = REGULATOR_MODE_NORMAL
338 | REGULATOR_MODE_STANDBY,
339 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
340 | REGULATOR_CHANGE_MODE
341 | REGULATOR_CHANGE_STATUS,
343 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc1_supplies),
344 .consumer_supplies = sdp3430_vmmc1_supplies,
347 /* VMMC2 for MMC2 card */
348 static struct regulator_init_data sdp3430_vmmc2 = {
353 .valid_modes_mask = REGULATOR_MODE_NORMAL
354 | REGULATOR_MODE_STANDBY,
355 .valid_ops_mask = REGULATOR_CHANGE_MODE
356 | REGULATOR_CHANGE_STATUS,
358 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc2_supplies),
359 .consumer_supplies = sdp3430_vmmc2_supplies,
362 /* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
363 static struct regulator_init_data sdp3430_vsim = {
367 .valid_modes_mask = REGULATOR_MODE_NORMAL
368 | REGULATOR_MODE_STANDBY,
369 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
370 | REGULATOR_CHANGE_MODE
371 | REGULATOR_CHANGE_STATUS,
373 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vsim_supplies),
374 .consumer_supplies = sdp3430_vsim_supplies,
377 static struct twl4030_platform_data sdp3430_twldata = {
378 /* platform_data for children goes here */
379 .gpio = &sdp3430_gpio_data,
380 .keypad = &sdp3430_kp_data,
382 .vaux1 = &sdp3430_vaux1,
383 .vaux2 = &sdp3430_vaux2,
384 .vaux3 = &sdp3430_vaux3,
385 .vaux4 = &sdp3430_vaux4,
386 .vmmc1 = &sdp3430_vmmc1,
387 .vmmc2 = &sdp3430_vmmc2,
388 .vsim = &sdp3430_vsim,
391 static int __init omap3430_i2c_init(void)
393 /* i2c1 for PMIC only */
394 omap3_pmic_get_config(&sdp3430_twldata,
395 TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_BCI |
396 TWL_COMMON_PDATA_MADC | TWL_COMMON_PDATA_AUDIO,
397 TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
398 sdp3430_twldata.vdac->constraints.apply_uV = true;
399 sdp3430_twldata.vpll2->constraints.apply_uV = true;
400 sdp3430_twldata.vpll2->constraints.name = "VDVI";
402 sdp3430_twldata.audio->codec->hs_extmute = 1;
403 sdp3430_twldata.audio->codec->hs_extmute_gpio = -EINVAL;
405 omap3_pmic_init("twl4030", &sdp3430_twldata);
407 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
408 omap_register_i2c_bus(2, 400, NULL, 0);
409 /* i2c3 on display connector (for DVI, tfp410) */
410 omap_register_i2c_bus(3, 400, NULL, 0);
414 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
416 static struct omap_smc91x_platform_data board_smc91x_data = {
418 .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
419 IORESOURCE_IRQ_LOWLEVEL,
422 static void __init board_smc91x_init(void)
424 if (omap_rev() > OMAP3430_REV_ES1_0)
425 board_smc91x_data.gpio_irq = 6;
427 board_smc91x_data.gpio_irq = 29;
429 gpmc_smc91x_init(&board_smc91x_data);
434 static inline void board_smc91x_init(void)
440 static void enable_board_wakeup_source(void)
442 /* T2 interrupt line (keypad) */
443 omap_mux_init_signal("sys_nirq",
444 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
447 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
449 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
450 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
451 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
454 .reset_gpio_port[0] = 57,
455 .reset_gpio_port[1] = 61,
456 .reset_gpio_port[2] = -EINVAL
459 #ifdef CONFIG_OMAP_MUX
460 static struct omap_board_mux board_mux[] __initdata = {
461 { .reg_offset = OMAP_MUX_TERMINATOR },
464 #define board_mux NULL
468 * SDP3430 V2 Board CS organization
469 * Different from SDP3430 V1. Now 4 switches used to specify CS
471 * See also the Switch S8 settings in the comments.
473 static char chip_sel_3430[][GPMC_CS_NUM] = {
474 {PDC_NOR, PDC_NAND, PDC_ONENAND, DBG_MPDB, 0, 0, 0, 0}, /* S8:1111 */
475 {PDC_ONENAND, PDC_NAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1110 */
476 {PDC_NAND, PDC_ONENAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1101 */
479 static struct mtd_partition sdp_nor_partitions[] = {
480 /* bootloader (U-Boot, etc) in first sector */
482 .name = "Bootloader-NOR",
485 .mask_flags = MTD_WRITEABLE, /* force read-only */
487 /* bootloader params in the next sector */
489 .name = "Params-NOR",
490 .offset = MTDPART_OFS_APPEND,
496 .name = "Kernel-NOR",
497 .offset = MTDPART_OFS_APPEND,
503 .name = "Filesystem-NOR",
504 .offset = MTDPART_OFS_APPEND,
505 .size = MTDPART_SIZ_FULL,
510 static struct mtd_partition sdp_onenand_partitions[] = {
512 .name = "X-Loader-OneNAND",
514 .size = 4 * (64 * 2048),
515 .mask_flags = MTD_WRITEABLE /* force read-only */
518 .name = "U-Boot-OneNAND",
519 .offset = MTDPART_OFS_APPEND,
520 .size = 2 * (64 * 2048),
521 .mask_flags = MTD_WRITEABLE /* force read-only */
524 .name = "U-Boot Environment-OneNAND",
525 .offset = MTDPART_OFS_APPEND,
526 .size = 1 * (64 * 2048),
529 .name = "Kernel-OneNAND",
530 .offset = MTDPART_OFS_APPEND,
531 .size = 16 * (64 * 2048),
534 .name = "File System-OneNAND",
535 .offset = MTDPART_OFS_APPEND,
536 .size = MTDPART_SIZ_FULL,
540 static struct mtd_partition sdp_nand_partitions[] = {
541 /* All the partition sizes are listed in terms of NAND block size */
543 .name = "X-Loader-NAND",
545 .size = 4 * (64 * 2048),
546 .mask_flags = MTD_WRITEABLE, /* force read-only */
549 .name = "U-Boot-NAND",
550 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
551 .size = 10 * (64 * 2048),
552 .mask_flags = MTD_WRITEABLE, /* force read-only */
555 .name = "Boot Env-NAND",
557 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
558 .size = 6 * (64 * 2048),
561 .name = "Kernel-NAND",
562 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
563 .size = 40 * (64 * 2048),
566 .name = "File System - NAND",
567 .size = MTDPART_SIZ_FULL,
568 .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
572 static struct flash_partitions sdp_flash_partitions[] = {
574 .parts = sdp_nor_partitions,
575 .nr_parts = ARRAY_SIZE(sdp_nor_partitions),
578 .parts = sdp_onenand_partitions,
579 .nr_parts = ARRAY_SIZE(sdp_onenand_partitions),
582 .parts = sdp_nand_partitions,
583 .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
587 static void __init omap_3430sdp_init(void)
591 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
592 omap_hsmmc_init(mmc);
594 omap_display_init(&sdp3430_dss_data);
595 if (omap_rev() > OMAP3430_REV_ES1_0)
596 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2;
598 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
599 omap_ads7846_init(1, gpio_pendown, 310, NULL);
601 omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL);
604 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
605 sdp3430_display_init();
606 enable_board_wakeup_source();
607 usbhs_init(&usbhs_bdata);
610 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
611 /* Maintainer: Syed Khasim - Texas Instruments Inc */
612 .atag_offset = 0x100,
613 .reserve = omap_reserve,
614 .map_io = omap3_map_io,
615 .init_early = omap3430_init_early,
616 .init_irq = omap3_init_irq,
617 .handle_irq = omap3_intc_handle_irq,
618 .init_machine = omap_3430sdp_init,
619 .init_late = omap3430_init_late,
620 .timer = &omap3_timer,
621 .restart = omap3xxx_restart,