| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 | /* linux/arch/arm/mach-s3c64xx/mach-crag6410.c * * Copyright 2011 Wolfson Microelectronics plc *	Mark Brown <broonie@opensource.wolfsonmicro.com> * * Copyright 2011 Simtec Electronics *	Ben Dooks <ben@simtec.co.uk> * * 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/list.h>#include <linux/serial_core.h>#include <linux/platform_device.h>#include <linux/fb.h>#include <linux/io.h>#include <linux/init.h>#include <linux/gpio.h>#include <linux/leds.h>#include <linux/delay.h>#include <linux/mmc/host.h>#include <linux/regulator/machine.h>#include <linux/regulator/fixed.h>#include <linux/pwm_backlight.h>#include <linux/dm9000.h>#include <linux/gpio_keys.h>#include <linux/basic_mmio_gpio.h>#include <linux/spi/spi.h>#include <linux/i2c/pca953x.h>#include <linux/platform_data/s3c-hsotg.h>#include <video/platform_lcd.h>#include <linux/mfd/wm831x/core.h>#include <linux/mfd/wm831x/pdata.h>#include <linux/mfd/wm831x/irq.h>#include <linux/mfd/wm831x/gpio.h>#include <sound/wm1250-ev1.h>#include <asm/hardware/vic.h>#include <asm/mach/arch.h>#include <asm/mach-types.h>#include <video/samsung_fimd.h>#include <mach/hardware.h>#include <mach/map.h>#include <mach/regs-sys.h>#include <mach/regs-gpio.h>#include <mach/regs-modem.h>#include <mach/crag6410.h>#include <mach/regs-gpio-memport.h>#include <plat/regs-serial.h>#include <plat/fb.h>#include <plat/sdhci.h>#include <plat/gpio-cfg.h>#include <linux/platform_data/spi-s3c64xx.h>#include <plat/keypad.h>#include <plat/clock.h>#include <plat/devs.h>#include <plat/cpu.h>#include <plat/adc.h>#include <linux/platform_data/i2c-s3c2410.h>#include <plat/pm.h>#include "common.h"/* serial port setup */#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)static struct s3c2410_uartcfg crag6410_uartcfgs[] __initdata = {	[0] = {		.hwport		= 0,		.flags		= 0,		.ucon		= UCON,		.ulcon		= ULCON,		.ufcon		= UFCON,	},	[1] = {		.hwport		= 1,		.flags		= 0,		.ucon		= UCON,		.ulcon		= ULCON,		.ufcon		= UFCON,	},	[2] = {		.hwport		= 2,		.flags		= 0,		.ucon		= UCON,		.ulcon		= ULCON,		.ufcon		= UFCON,	},	[3] = {		.hwport		= 3,		.flags		= 0,		.ucon		= UCON,		.ulcon		= ULCON,		.ufcon		= UFCON,	},};static struct platform_pwm_backlight_data crag6410_backlight_data = {	.pwm_id		= 0,	.max_brightness	= 1000,	.dft_brightness	= 600,	.pwm_period_ns	= 100000,	/* about 1kHz */};static struct platform_device crag6410_backlight_device = {	.name		= "pwm-backlight",	.id		= -1,	.dev		= {		.parent	= &s3c_device_timer[0].dev,		.platform_data = &crag6410_backlight_data,	},};static void crag6410_lcd_power_set(struct plat_lcd_data *pd, unsigned int power){	pr_debug("%s: setting power %d\n", __func__, power);	if (power) {		gpio_set_value(S3C64XX_GPB(0), 1);		msleep(1);		s3c_gpio_cfgpin(S3C64XX_GPF(14), S3C_GPIO_SFN(2));	} else {		gpio_direction_output(S3C64XX_GPF(14), 0);		gpio_set_value(S3C64XX_GPB(0), 0);	}}static struct platform_device crag6410_lcd_powerdev = {	.name			= "platform-lcd",	.id			= -1,	.dev.parent		= &s3c_device_fb.dev,	.dev.platform_data	= &(struct plat_lcd_data) {		.set_power	= crag6410_lcd_power_set,	},};/* 640x480 URT */static struct s3c_fb_pd_win crag6410_fb_win0 = {	.max_bpp	= 32,	.default_bpp	= 16,	.xres		= 640,	.yres		= 480,	.virtual_y	= 480 * 2,	.virtual_x	= 640,};static struct fb_videomode crag6410_lcd_timing = {	.left_margin	= 150,	.right_margin	= 80,	.upper_margin	= 40,	.lower_margin	= 5,	.hsync_len	= 40,	.vsync_len	= 5,	.xres		= 640,	.yres		= 480,};/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */static struct s3c_fb_platdata crag6410_lcd_pdata = {	.setup_gpio	= s3c64xx_fb_gpio_setup_24bpp,	.vtiming	= &crag6410_lcd_timing,	.win[0]		= &crag6410_fb_win0,	.vidcon0	= VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,	.vidcon1	= VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,};/* 2x6 keypad */static uint32_t crag6410_keymap[] = {	/* KEY(row, col, keycode) */	KEY(0, 0, KEY_VOLUMEUP),	KEY(0, 1, KEY_HOME),	KEY(0, 2, KEY_VOLUMEDOWN),	KEY(0, 3, KEY_HELP),	KEY(0, 4, KEY_MENU),	KEY(0, 5, KEY_MEDIA),	KEY(1, 0, 232),	KEY(1, 1, KEY_DOWN),	KEY(1, 2, KEY_LEFT),	KEY(1, 3, KEY_UP),	KEY(1, 4, KEY_RIGHT),	KEY(1, 5, KEY_CAMERA),};static struct matrix_keymap_data crag6410_keymap_data = {	.keymap		= crag6410_keymap,	.keymap_size	= ARRAY_SIZE(crag6410_keymap),};static struct samsung_keypad_platdata crag6410_keypad_data = {	.keymap_data	= &crag6410_keymap_data,	.rows		= 2,	.cols		= 6,};static struct gpio_keys_button crag6410_gpio_keys[] = {	[0] = {		.code	= KEY_SUSPEND,		.gpio	= S3C64XX_GPL(10),	/* EINT 18 */		.type	= EV_KEY,		.wakeup	= 1,		.active_low = 1,	},	[1] = {		.code	= SW_FRONT_PROXIMITY,		.gpio	= S3C64XX_GPN(11),	/* EINT 11 */		.type	= EV_SW,	},};static struct gpio_keys_platform_data crag6410_gpio_keydata = {	.buttons	= crag6410_gpio_keys,	.nbuttons	= ARRAY_SIZE(crag6410_gpio_keys),};static struct platform_device crag6410_gpio_keydev = {	.name		= "gpio-keys",	.id		= 0,	.dev.platform_data = &crag6410_gpio_keydata,};static struct resource crag6410_dm9k_resource[] = {	[0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5, 2),	[1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5 + (1 << 8), 2),	[2] = DEFINE_RES_NAMED(S3C_EINT(17), 1, NULL, IORESOURCE_IRQ \				| IORESOURCE_IRQ_HIGHLEVEL),};static struct dm9000_plat_data mini6410_dm9k_pdata = {	.flags	= DM9000_PLATF_16BITONLY,};static struct platform_device crag6410_dm9k_device = {	.name		= "dm9000",	.id		= -1,	.num_resources	= ARRAY_SIZE(crag6410_dm9k_resource),	.resource	= crag6410_dm9k_resource,	.dev.platform_data = &mini6410_dm9k_pdata,};static struct resource crag6410_mmgpio_resource[] = {	[0] = DEFINE_RES_MEM_NAMED(S3C64XX_PA_XM0CSN4, 1, "dat"),};static struct platform_device crag6410_mmgpio = {	.name		= "basic-mmio-gpio",	.id		= -1,	.resource	= crag6410_mmgpio_resource,	.num_resources	= ARRAY_SIZE(crag6410_mmgpio_resource),	.dev.platform_data = &(struct bgpio_pdata) {		.base	= MMGPIO_GPIO_BASE,	},};static struct platform_device speyside_device = {	.name		= "speyside",	.id		= -1,};static struct platform_device lowland_device = {	.name		= "lowland",	.id		= -1,};static struct platform_device tobermory_device = {	.name		= "tobermory",	.id		= -1,};static struct platform_device littlemill_device = {	.name		= "littlemill",	.id		= -1,};static struct platform_device bells_wm2200_device = {	.name		= "bells",	.id		= 0,};static struct platform_device bells_wm5102_device = {	.name		= "bells",	.id		= 1,};static struct platform_device bells_wm5110_device = {	.name		= "bells",	.id		= 2,};static struct regulator_consumer_supply wallvdd_consumers[] = {	REGULATOR_SUPPLY("SPKVDD", "1-001a"),	REGULATOR_SUPPLY("SPKVDD1", "1-001a"),	REGULATOR_SUPPLY("SPKVDD2", "1-001a"),	REGULATOR_SUPPLY("SPKVDDL", "1-001a"),	REGULATOR_SUPPLY("SPKVDDR", "1-001a"),	REGULATOR_SUPPLY("SPKVDDL", "spi0.1"),	REGULATOR_SUPPLY("SPKVDDR", "spi0.1"),	REGULATOR_SUPPLY("SPKVDDL", "wm5102-codec"),	REGULATOR_SUPPLY("SPKVDDR", "wm5102-codec"),	REGULATOR_SUPPLY("SPKVDDL", "wm5110-codec"),	REGULATOR_SUPPLY("SPKVDDR", "wm5110-codec"),	REGULATOR_SUPPLY("DC1VDD", "0-0034"),	REGULATOR_SUPPLY("DC2VDD", "0-0034"),	REGULATOR_SUPPLY("DC3VDD", "0-0034"),	REGULATOR_SUPPLY("LDO1VDD", "0-0034"),	REGULATOR_SUPPLY("LDO2VDD", "0-0034"),	REGULATOR_SUPPLY("LDO4VDD", "0-0034"),	REGULATOR_SUPPLY("LDO5VDD", "0-0034"),	REGULATOR_SUPPLY("LDO6VDD", "0-0034"),	REGULATOR_SUPPLY("LDO7VDD", "0-0034"),	REGULATOR_SUPPLY("LDO8VDD", "0-0034"),	REGULATOR_SUPPLY("LDO9VDD", "0-0034"),	REGULATOR_SUPPLY("LDO10VDD", "0-0034"),	REGULATOR_SUPPLY("LDO11VDD", "0-0034"),	REGULATOR_SUPPLY("DC1VDD", "1-0034"),	REGULATOR_SUPPLY("DC2VDD", "1-0034"),	REGULATOR_SUPPLY("DC3VDD", "1-0034"),	REGULATOR_SUPPLY("LDO1VDD", "1-0034"),	REGULATOR_SUPPLY("LDO2VDD", "1-0034"),	REGULATOR_SUPPLY("LDO4VDD", "1-0034"),	REGULATOR_SUPPLY("LDO5VDD", "1-0034"),	REGULATOR_SUPPLY("LDO6VDD", "1-0034"),	REGULATOR_SUPPLY("LDO7VDD", "1-0034"),	REGULATOR_SUPPLY("LDO8VDD", "1-0034"),
 |