| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 | /* * linux/arch/arm/mach-omap2/board-3430sdp.c * * Copyright (C) 2007 Texas Instruments * * Modified from mach-omap2/board-generic.c * * Initial code: Syed Mohammed Khasim * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */#include <linux/kernel.h>#include <linux/init.h>#include <linux/platform_device.h>#include <linux/delay.h>#include <linux/input.h>#include <linux/input/matrix_keypad.h>#include <linux/spi/spi.h>#include <linux/i2c/twl.h>#include <linux/regulator/machine.h>#include <linux/io.h>#include <linux/gpio.h>#include <linux/mmc/host.h>#include <linux/platform_data/spi-omap2-mcspi.h>#include <asm/mach-types.h>#include <asm/mach/arch.h>#include <asm/mach/map.h>#include "common.h"#include <linux/omap-dma.h>#include <video/omapdss.h>#include <video/omap-panel-tfp410.h>#include "gpmc.h"#include "gpmc-smc91x.h"#include "soc.h"#include "board-flash.h"#include "mux.h"#include "sdram-qimonda-hyb18m512160af-6.h"#include "hsmmc.h"#include "pm.h"#include "control.h"#include "common-board-devices.h"#define CONFIG_DISABLE_HFCLK 1#define SDP3430_TS_GPIO_IRQ_SDPV1	3#define SDP3430_TS_GPIO_IRQ_SDPV2	2#define ENABLE_VAUX3_DEDICATED	0x03#define ENABLE_VAUX3_DEV_GRP	0x20#define TWL4030_MSECURE_GPIO 22static uint32_t board_keymap[] = {	KEY(0, 0, KEY_LEFT),	KEY(0, 1, KEY_RIGHT),	KEY(0, 2, KEY_A),	KEY(0, 3, KEY_B),	KEY(0, 4, KEY_C),	KEY(1, 0, KEY_DOWN),	KEY(1, 1, KEY_UP),	KEY(1, 2, KEY_E),	KEY(1, 3, KEY_F),	KEY(1, 4, KEY_G),	KEY(2, 0, KEY_ENTER),	KEY(2, 1, KEY_I),	KEY(2, 2, KEY_J),	KEY(2, 3, KEY_K),	KEY(2, 4, KEY_3),	KEY(3, 0, KEY_M),	KEY(3, 1, KEY_N),	KEY(3, 2, KEY_O),	KEY(3, 3, KEY_P),	KEY(3, 4, KEY_Q),	KEY(4, 0, KEY_R),	KEY(4, 1, KEY_4),	KEY(4, 2, KEY_T),	KEY(4, 3, KEY_U),	KEY(4, 4, KEY_D),	KEY(5, 0, KEY_V),	KEY(5, 1, KEY_W),	KEY(5, 2, KEY_L),	KEY(5, 3, KEY_S),	KEY(5, 4, KEY_H),	0};static struct matrix_keymap_data board_map_data = {	.keymap			= board_keymap,	.keymap_size		= ARRAY_SIZE(board_keymap),};static struct twl4030_keypad_data sdp3430_kp_data = {	.keymap_data	= &board_map_data,	.rows		= 5,	.cols		= 6,	.rep		= 1,};#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO	8#define SDP3430_LCD_PANEL_ENABLE_GPIO		5static struct gpio sdp3430_dss_gpios[] __initdata = {	{SDP3430_LCD_PANEL_ENABLE_GPIO,    GPIOF_OUT_INIT_LOW, "LCD reset"    },	{SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"},};static void __init sdp3430_display_init(void){	int r;	r = gpio_request_array(sdp3430_dss_gpios,			       ARRAY_SIZE(sdp3430_dss_gpios));	if (r)		printk(KERN_ERR "failed to get LCD control GPIOs\n");}static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev){	gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1);	gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1);	return 0;}static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev){	gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0);	gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0);}static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev){	return 0;}static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev){}static struct omap_dss_device sdp3430_lcd_device = {	.name			= "lcd",	.driver_name		= "sharp_ls_panel",	.type			= OMAP_DISPLAY_TYPE_DPI,	.phy.dpi.data_lines	= 16,	.platform_enable	= sdp3430_panel_enable_lcd,	.platform_disable	= sdp3430_panel_disable_lcd,};static struct tfp410_platform_data dvi_panel = {	.power_down_gpio	= -1,	.i2c_bus_num		= -1,};static struct omap_dss_device sdp3430_dvi_device = {	.name			= "dvi",	.type			= OMAP_DISPLAY_TYPE_DPI,	.driver_name		= "tfp410",	.data			= &dvi_panel,	.phy.dpi.data_lines	= 24,};static struct omap_dss_device sdp3430_tv_device = {	.name			= "tv",	.driver_name		= "venc",	.type			= OMAP_DISPLAY_TYPE_VENC,	.phy.venc.type		= OMAP_DSS_VENC_TYPE_SVIDEO,	.platform_enable	= sdp3430_panel_enable_tv,	.platform_disable	= sdp3430_panel_disable_tv,};static struct omap_dss_device *sdp3430_dss_devices[] = {	&sdp3430_lcd_device,	&sdp3430_dvi_device,	&sdp3430_tv_device,};static struct omap_dss_board_info sdp3430_dss_data = {	.num_devices	= ARRAY_SIZE(sdp3430_dss_devices),	.devices	= sdp3430_dss_devices,	.default_device	= &sdp3430_lcd_device,};static struct omap2_hsmmc_info mmc[] = {	{		.mmc		= 1,		/* 8 bits (default) requires S6.3 == ON,		 * so the SIM card isn't used; else 4 bits.		 */		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,		.gpio_wp	= 4,		.deferred	= true,	},	{		.mmc		= 2,		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,		.gpio_wp	= 7,		.deferred	= true,	},	{}	/* Terminator */};static int sdp3430_twl_gpio_setup(struct device *dev,		unsigned gpio, unsigned ngpio){	/* gpio + 0 is "mmc0_cd" (input/IRQ),	 * gpio + 1 is "mmc1_cd" (input/IRQ)	 */	mmc[0].gpio_cd = gpio + 0;	mmc[1].gpio_cd = gpio + 1;	omap_hsmmc_late_init(mmc);	/* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl");	/* gpio + 15 is "sub_lcd_nRST" (output) */	gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST");	return 0;}static struct twl4030_gpio_platform_data sdp3430_gpio_data = {	.pulldowns	= BIT(2) | BIT(6) | BIT(8) | BIT(13)				| BIT(16) | BIT(17),	.setup		= sdp3430_twl_gpio_setup,};/* regulator consumer mappings *//* ads7846 on SPI */static struct regulator_consumer_supply sdp3430_vaux3_supplies[] = {	REGULATOR_SUPPLY("vcc", "spi1.0"),};static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {	REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),};static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {	REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),};static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {	REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
 |