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/usb/phy.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 int sdp3430_twl_gpio_setup(struct device *dev,
214 unsigned gpio, unsigned ngpio)
216 /* gpio + 0 is "mmc0_cd" (input/IRQ),
217 * gpio + 1 is "mmc1_cd" (input/IRQ)
219 mmc[0].gpio_cd = gpio + 0;
220 mmc[1].gpio_cd = gpio + 1;
221 omap_hsmmc_late_init(mmc);
223 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
224 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl");
226 /* gpio + 15 is "sub_lcd_nRST" (output) */
227 gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST");
232 static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
233 .pulldowns = BIT(2) | BIT(6) | BIT(8) | BIT(13)
235 .setup = sdp3430_twl_gpio_setup,
238 /* regulator consumer mappings */
241 static struct regulator_consumer_supply sdp3430_vaux3_supplies[] = {
242 REGULATOR_SUPPLY("vcc", "spi1.0"),
245 static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
246 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
249 static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
250 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
253 static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
254 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
258 * Apply all the fixed voltages since most versions of U-Boot
259 * don't bother with that initialization.
262 /* VAUX1 for mainboard (irda and sub-lcd) */
263 static struct regulator_init_data sdp3430_vaux1 = {
268 .valid_modes_mask = REGULATOR_MODE_NORMAL
269 | REGULATOR_MODE_STANDBY,
270 .valid_ops_mask = REGULATOR_CHANGE_MODE
271 | REGULATOR_CHANGE_STATUS,
275 /* VAUX2 for camera module */
276 static struct regulator_init_data sdp3430_vaux2 = {
281 .valid_modes_mask = REGULATOR_MODE_NORMAL
282 | REGULATOR_MODE_STANDBY,
283 .valid_ops_mask = REGULATOR_CHANGE_MODE
284 | REGULATOR_CHANGE_STATUS,
288 /* VAUX3 for LCD board */
289 static struct regulator_init_data sdp3430_vaux3 = {
294 .valid_modes_mask = REGULATOR_MODE_NORMAL
295 | REGULATOR_MODE_STANDBY,
296 .valid_ops_mask = REGULATOR_CHANGE_MODE
297 | REGULATOR_CHANGE_STATUS,
299 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vaux3_supplies),
300 .consumer_supplies = sdp3430_vaux3_supplies,
303 /* VAUX4 for OMAP VDD_CSI2 (camera) */
304 static struct regulator_init_data sdp3430_vaux4 = {
309 .valid_modes_mask = REGULATOR_MODE_NORMAL
310 | REGULATOR_MODE_STANDBY,
311 .valid_ops_mask = REGULATOR_CHANGE_MODE
312 | REGULATOR_CHANGE_STATUS,
316 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
317 static struct regulator_init_data sdp3430_vmmc1 = {
321 .valid_modes_mask = REGULATOR_MODE_NORMAL
322 | REGULATOR_MODE_STANDBY,
323 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
324 | REGULATOR_CHANGE_MODE
325 | REGULATOR_CHANGE_STATUS,
327 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc1_supplies),
328 .consumer_supplies = sdp3430_vmmc1_supplies,
331 /* VMMC2 for MMC2 card */
332 static struct regulator_init_data sdp3430_vmmc2 = {
337 .valid_modes_mask = REGULATOR_MODE_NORMAL
338 | REGULATOR_MODE_STANDBY,
339 .valid_ops_mask = REGULATOR_CHANGE_MODE
340 | REGULATOR_CHANGE_STATUS,
342 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vmmc2_supplies),
343 .consumer_supplies = sdp3430_vmmc2_supplies,
346 /* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
347 static struct regulator_init_data sdp3430_vsim = {
351 .valid_modes_mask = REGULATOR_MODE_NORMAL
352 | REGULATOR_MODE_STANDBY,
353 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
354 | REGULATOR_CHANGE_MODE
355 | REGULATOR_CHANGE_STATUS,
357 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vsim_supplies),
358 .consumer_supplies = sdp3430_vsim_supplies,
361 static struct twl4030_platform_data sdp3430_twldata = {
362 /* platform_data for children goes here */
363 .gpio = &sdp3430_gpio_data,
364 .keypad = &sdp3430_kp_data,
366 .vaux1 = &sdp3430_vaux1,
367 .vaux2 = &sdp3430_vaux2,
368 .vaux3 = &sdp3430_vaux3,
369 .vaux4 = &sdp3430_vaux4,
370 .vmmc1 = &sdp3430_vmmc1,
371 .vmmc2 = &sdp3430_vmmc2,
372 .vsim = &sdp3430_vsim,
375 static int __init omap3430_i2c_init(void)
377 /* i2c1 for PMIC only */
378 omap3_pmic_get_config(&sdp3430_twldata,
379 TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_BCI |
380 TWL_COMMON_PDATA_MADC | TWL_COMMON_PDATA_AUDIO,
381 TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
382 sdp3430_twldata.vdac->constraints.apply_uV = true;
383 sdp3430_twldata.vpll2->constraints.apply_uV = true;
384 sdp3430_twldata.vpll2->constraints.name = "VDVI";
386 omap3_pmic_init("twl4030", &sdp3430_twldata);
388 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
389 omap_register_i2c_bus(2, 400, NULL, 0);
390 /* i2c3 on display connector (for DVI, tfp410) */
391 omap_register_i2c_bus(3, 400, NULL, 0);
395 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
397 static struct omap_smc91x_platform_data board_smc91x_data = {
399 .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
400 IORESOURCE_IRQ_LOWLEVEL,
403 static void __init board_smc91x_init(void)
405 if (omap_rev() > OMAP3430_REV_ES1_0)
406 board_smc91x_data.gpio_irq = 6;
408 board_smc91x_data.gpio_irq = 29;
410 gpmc_smc91x_init(&board_smc91x_data);
415 static inline void board_smc91x_init(void)
421 static void enable_board_wakeup_source(void)
423 /* T2 interrupt line (keypad) */
424 omap_mux_init_signal("sys_nirq",
425 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
428 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
430 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
431 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
432 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
435 .reset_gpio_port[0] = 57,
436 .reset_gpio_port[1] = 61,
437 .reset_gpio_port[2] = -EINVAL
440 #ifdef CONFIG_OMAP_MUX
441 static struct omap_board_mux board_mux[] __initdata = {
442 { .reg_offset = OMAP_MUX_TERMINATOR },
445 #define board_mux NULL
449 * SDP3430 V2 Board CS organization
450 * Different from SDP3430 V1. Now 4 switches used to specify CS
452 * See also the Switch S8 settings in the comments.
454 static char chip_sel_3430[][GPMC_CS_NUM] = {
455 {PDC_NOR, PDC_NAND, PDC_ONENAND, DBG_MPDB, 0, 0, 0, 0}, /* S8:1111 */
456 {PDC_ONENAND, PDC_NAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1110 */
457 {PDC_NAND, PDC_ONENAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1101 */
460 static struct mtd_partition sdp_nor_partitions[] = {
461 /* bootloader (U-Boot, etc) in first sector */
463 .name = "Bootloader-NOR",
466 .mask_flags = MTD_WRITEABLE, /* force read-only */
468 /* bootloader params in the next sector */
470 .name = "Params-NOR",
471 .offset = MTDPART_OFS_APPEND,
477 .name = "Kernel-NOR",
478 .offset = MTDPART_OFS_APPEND,
484 .name = "Filesystem-NOR",
485 .offset = MTDPART_OFS_APPEND,
486 .size = MTDPART_SIZ_FULL,
491 static struct mtd_partition sdp_onenand_partitions[] = {
493 .name = "X-Loader-OneNAND",
495 .size = 4 * (64 * 2048),
496 .mask_flags = MTD_WRITEABLE /* force read-only */
499 .name = "U-Boot-OneNAND",
500 .offset = MTDPART_OFS_APPEND,
501 .size = 2 * (64 * 2048),
502 .mask_flags = MTD_WRITEABLE /* force read-only */
505 .name = "U-Boot Environment-OneNAND",
506 .offset = MTDPART_OFS_APPEND,
507 .size = 1 * (64 * 2048),
510 .name = "Kernel-OneNAND",
511 .offset = MTDPART_OFS_APPEND,
512 .size = 16 * (64 * 2048),
515 .name = "File System-OneNAND",
516 .offset = MTDPART_OFS_APPEND,
517 .size = MTDPART_SIZ_FULL,
521 static struct mtd_partition sdp_nand_partitions[] = {
522 /* All the partition sizes are listed in terms of NAND block size */
524 .name = "X-Loader-NAND",
526 .size = 4 * (64 * 2048),
527 .mask_flags = MTD_WRITEABLE, /* force read-only */
530 .name = "U-Boot-NAND",
531 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
532 .size = 10 * (64 * 2048),
533 .mask_flags = MTD_WRITEABLE, /* force read-only */
536 .name = "Boot Env-NAND",
538 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
539 .size = 6 * (64 * 2048),
542 .name = "Kernel-NAND",
543 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
544 .size = 40 * (64 * 2048),
547 .name = "File System - NAND",
548 .size = MTDPART_SIZ_FULL,
549 .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
553 static struct flash_partitions sdp_flash_partitions[] = {
555 .parts = sdp_nor_partitions,
556 .nr_parts = ARRAY_SIZE(sdp_nor_partitions),
559 .parts = sdp_onenand_partitions,
560 .nr_parts = ARRAY_SIZE(sdp_onenand_partitions),
563 .parts = sdp_nand_partitions,
564 .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
568 static void __init omap_3430sdp_init(void)
572 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
573 omap_hsmmc_init(mmc);
575 omap_display_init(&sdp3430_dss_data);
576 if (omap_rev() > OMAP3430_REV_ES1_0)
577 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2;
579 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
580 omap_ads7846_init(1, gpio_pendown, 310, NULL);
582 omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL);
583 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
586 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
587 sdp3430_display_init();
588 enable_board_wakeup_source();
589 usbhs_init(&usbhs_bdata);
592 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
593 /* Maintainer: Syed Khasim - Texas Instruments Inc */
594 .atag_offset = 0x100,
595 .reserve = omap_reserve,
596 .map_io = omap3_map_io,
597 .init_early = omap3430_init_early,
598 .init_irq = omap3_init_irq,
599 .handle_irq = omap3_intc_handle_irq,
600 .init_machine = omap_3430sdp_init,
601 .init_late = omap3430_init_late,
602 .timer = &omap3_timer,
603 .restart = omap3xxx_restart,