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>
29 #include <linux/usb/phy.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
36 #include <linux/omap-dma.h>
37 #include <video/omapdss.h>
38 #include <video/omap-panel-data.h>
41 #include "gpmc-smc91x.h"
44 #include "board-flash.h"
46 #include "sdram-qimonda-hyb18m512160af-6.h"
50 #include "common-board-devices.h"
52 #define CONFIG_DISABLE_HFCLK 1
54 #define SDP3430_TS_GPIO_IRQ_SDPV1 3
55 #define SDP3430_TS_GPIO_IRQ_SDPV2 2
57 #define ENABLE_VAUX3_DEDICATED 0x03
58 #define ENABLE_VAUX3_DEV_GRP 0x20
60 #define TWL4030_MSECURE_GPIO 22
62 static uint32_t board_keymap[] = {
96 static struct matrix_keymap_data board_map_data = {
97 .keymap = board_keymap,
98 .keymap_size = ARRAY_SIZE(board_keymap),
101 static struct twl4030_keypad_data sdp3430_kp_data = {
102 .keymap_data = &board_map_data,
108 #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
109 #define SDP3430_LCD_PANEL_ENABLE_GPIO 5
111 static void __init sdp3430_display_init(void)
116 * the backlight GPIO doesn't directly go to the panel, it enables
117 * an internal circuit on 3430sdp to create the signal V_BKL_28V,
118 * this is connected to LED+ pin of the sharp panel. This GPIO
119 * is left enabled in the board file, and not passed to the panel
122 r = gpio_request_one(SDP3430_LCD_PANEL_BACKLIGHT_GPIO,
123 GPIOF_OUT_INIT_HIGH, "LCD Backlight");
125 pr_err("failed to get LCD Backlight GPIO\n");
129 static struct panel_sharp_ls037v7dw01_data sdp3430_lcd_data = {
130 .resb_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO,
137 static struct omap_dss_device sdp3430_lcd_device = {
139 .driver_name = "sharp_ls_panel",
140 .type = OMAP_DISPLAY_TYPE_DPI,
141 .phy.dpi.data_lines = 16,
142 .data = &sdp3430_lcd_data,
145 static struct tfp410_platform_data dvi_panel = {
146 .power_down_gpio = -1,
150 static struct omap_dss_device sdp3430_dvi_device = {
152 .type = OMAP_DISPLAY_TYPE_DPI,
153 .driver_name = "tfp410",
155 .phy.dpi.data_lines = 24,
158 static struct omap_dss_device sdp3430_tv_device = {
160 .driver_name = "venc",
161 .type = OMAP_DISPLAY_TYPE_VENC,
162 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
166 static struct omap_dss_device *sdp3430_dss_devices[] = {
172 static struct omap_dss_board_info sdp3430_dss_data = {
173 .num_devices = ARRAY_SIZE(sdp3430_dss_devices),
174 .devices = sdp3430_dss_devices,
175 .default_device = &sdp3430_lcd_device,
178 static struct omap2_hsmmc_info mmc[] = {
181 /* 8 bits (default) requires S6.3 == ON,
182 * so the SIM card isn't used; else 4 bits.
184 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
190 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
197 static struct omap_tw4030_pdata omap_twl4030_audio_data = {
198 .voice_connected = true,
199 .custom_routing = true,
201 .has_hs = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
202 .has_hf = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
207 .has_linein = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT,
210 static int sdp3430_twl_gpio_setup(struct device *dev,
211 unsigned gpio, unsigned ngpio)
213 /* gpio + 0 is "mmc0_cd" (input/IRQ),
214 * gpio + 1 is "mmc1_cd" (input/IRQ)
216 mmc[0].gpio_cd = gpio + 0;
217 mmc[1].gpio_cd = gpio + 1;
218 omap_hsmmc_late_init(mmc);
220 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
221 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl");
223 /* gpio + 15 is "sub_lcd_nRST" (output) */
224 gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST");
226 omap_twl4030_audio_data.jack_detect = gpio + 2;
227 omap_twl4030_audio_init("SDP3430", &omap_twl4030_audio_data);
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 sdp3430_twldata.audio->codec->hs_extmute = 1;
387 sdp3430_twldata.audio->codec->hs_extmute_gpio = -EINVAL;
389 omap3_pmic_init("twl4030", &sdp3430_twldata);
391 /* i2c2 on camera connector (for sensor control) and optional isp1301 */
392 omap_register_i2c_bus(2, 400, NULL, 0);
393 /* i2c3 on display connector (for DVI, tfp410) */
394 omap_register_i2c_bus(3, 400, NULL, 0);
398 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
400 static struct omap_smc91x_platform_data board_smc91x_data = {
402 .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
403 IORESOURCE_IRQ_LOWLEVEL,
406 static void __init board_smc91x_init(void)
408 if (omap_rev() > OMAP3430_REV_ES1_0)
409 board_smc91x_data.gpio_irq = 6;
411 board_smc91x_data.gpio_irq = 29;
413 gpmc_smc91x_init(&board_smc91x_data);
418 static inline void board_smc91x_init(void)
424 static void enable_board_wakeup_source(void)
426 /* T2 interrupt line (keypad) */
427 omap_mux_init_signal("sys_nirq",
428 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
431 static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
433 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
434 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
435 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
438 .reset_gpio_port[0] = 57,
439 .reset_gpio_port[1] = 61,
440 .reset_gpio_port[2] = -EINVAL
443 #ifdef CONFIG_OMAP_MUX
444 static struct omap_board_mux board_mux[] __initdata = {
445 { .reg_offset = OMAP_MUX_TERMINATOR },
448 #define board_mux NULL
452 * SDP3430 V2 Board CS organization
453 * Different from SDP3430 V1. Now 4 switches used to specify CS
455 * See also the Switch S8 settings in the comments.
457 static char chip_sel_3430[][GPMC_CS_NUM] = {
458 {PDC_NOR, PDC_NAND, PDC_ONENAND, DBG_MPDB, 0, 0, 0, 0}, /* S8:1111 */
459 {PDC_ONENAND, PDC_NAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1110 */
460 {PDC_NAND, PDC_ONENAND, PDC_NOR, DBG_MPDB, 0, 0, 0, 0}, /* S8:1101 */
463 static struct mtd_partition sdp_nor_partitions[] = {
464 /* bootloader (U-Boot, etc) in first sector */
466 .name = "Bootloader-NOR",
469 .mask_flags = MTD_WRITEABLE, /* force read-only */
471 /* bootloader params in the next sector */
473 .name = "Params-NOR",
474 .offset = MTDPART_OFS_APPEND,
480 .name = "Kernel-NOR",
481 .offset = MTDPART_OFS_APPEND,
487 .name = "Filesystem-NOR",
488 .offset = MTDPART_OFS_APPEND,
489 .size = MTDPART_SIZ_FULL,
494 static struct mtd_partition sdp_onenand_partitions[] = {
496 .name = "X-Loader-OneNAND",
498 .size = 4 * (64 * 2048),
499 .mask_flags = MTD_WRITEABLE /* force read-only */
502 .name = "U-Boot-OneNAND",
503 .offset = MTDPART_OFS_APPEND,
504 .size = 2 * (64 * 2048),
505 .mask_flags = MTD_WRITEABLE /* force read-only */
508 .name = "U-Boot Environment-OneNAND",
509 .offset = MTDPART_OFS_APPEND,
510 .size = 1 * (64 * 2048),
513 .name = "Kernel-OneNAND",
514 .offset = MTDPART_OFS_APPEND,
515 .size = 16 * (64 * 2048),
518 .name = "File System-OneNAND",
519 .offset = MTDPART_OFS_APPEND,
520 .size = MTDPART_SIZ_FULL,
524 static struct mtd_partition sdp_nand_partitions[] = {
525 /* All the partition sizes are listed in terms of NAND block size */
527 .name = "X-Loader-NAND",
529 .size = 4 * (64 * 2048),
530 .mask_flags = MTD_WRITEABLE, /* force read-only */
533 .name = "U-Boot-NAND",
534 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
535 .size = 10 * (64 * 2048),
536 .mask_flags = MTD_WRITEABLE, /* force read-only */
539 .name = "Boot Env-NAND",
541 .offset = MTDPART_OFS_APPEND, /* Offset = 0x1c0000 */
542 .size = 6 * (64 * 2048),
545 .name = "Kernel-NAND",
546 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
547 .size = 40 * (64 * 2048),
550 .name = "File System - NAND",
551 .size = MTDPART_SIZ_FULL,
552 .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
556 static struct flash_partitions sdp_flash_partitions[] = {
558 .parts = sdp_nor_partitions,
559 .nr_parts = ARRAY_SIZE(sdp_nor_partitions),
562 .parts = sdp_onenand_partitions,
563 .nr_parts = ARRAY_SIZE(sdp_onenand_partitions),
566 .parts = sdp_nand_partitions,
567 .nr_parts = ARRAY_SIZE(sdp_nand_partitions),
571 static void __init omap_3430sdp_init(void)
575 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
576 omap_hsmmc_init(mmc);
578 omap_display_init(&sdp3430_dss_data);
579 if (omap_rev() > OMAP3430_REV_ES1_0)
580 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2;
582 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
583 omap_ads7846_init(1, gpio_pendown, 310, NULL);
585 omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL);
586 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
589 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
590 sdp3430_display_init();
591 enable_board_wakeup_source();
592 usbhs_init(&usbhs_bdata);
595 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
596 /* Maintainer: Syed Khasim - Texas Instruments Inc */
597 .atag_offset = 0x100,
598 .reserve = omap_reserve,
599 .map_io = omap3_map_io,
600 .init_early = omap3430_init_early,
601 .init_irq = omap3_init_irq,
602 .handle_irq = omap3_intc_handle_irq,
603 .init_machine = omap_3430sdp_init,
604 .init_late = omap3430_init_late,
605 .init_time = omap3_sync32k_timer_init,
606 .restart = omap3xxx_restart,