2 * linux/arch/arm/mach-exynos4/mach-nuri.c
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/platform_device.h>
12 #include <linux/serial_core.h>
13 #include <linux/input.h>
14 #include <linux/i2c.h>
15 #include <linux/gpio_keys.h>
16 #include <linux/gpio.h>
17 #include <linux/regulator/machine.h>
18 #include <linux/regulator/fixed.h>
19 #include <linux/mmc/host.h>
21 #include <linux/pwm_backlight.h>
23 #include <video/platform_lcd.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach-types.h>
28 #include <plat/regs-serial.h>
29 #include <plat/exynos4.h>
31 #include <plat/devs.h>
32 #include <plat/sdhci.h>
33 #include <plat/ehci.h>
34 #include <plat/clock.h>
38 /* Following are default values for UCON, ULCON and UFCON UART registers */
39 #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
40 S3C2410_UCON_RXILEVEL | \
41 S3C2410_UCON_TXIRQMODE | \
42 S3C2410_UCON_RXIRQMODE | \
43 S3C2410_UCON_RXFIFO_TOI | \
44 S3C2443_UCON_RXERR_IRQEN)
46 #define NURI_ULCON_DEFAULT S3C2410_LCON_CS8
48 #define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
49 S5PV210_UFCON_TXTRIG256 | \
50 S5PV210_UFCON_RXTRIG256)
52 enum fixed_regulator_id {
56 static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
59 .ucon = NURI_UCON_DEFAULT,
60 .ulcon = NURI_ULCON_DEFAULT,
61 .ufcon = NURI_UFCON_DEFAULT,
65 .ucon = NURI_UCON_DEFAULT,
66 .ulcon = NURI_ULCON_DEFAULT,
67 .ufcon = NURI_UFCON_DEFAULT,
71 .ucon = NURI_UCON_DEFAULT,
72 .ulcon = NURI_ULCON_DEFAULT,
73 .ufcon = NURI_UFCON_DEFAULT,
77 .ucon = NURI_UCON_DEFAULT,
78 .ulcon = NURI_ULCON_DEFAULT,
79 .ufcon = NURI_UFCON_DEFAULT,
84 static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
86 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
87 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
88 MMC_CAP_DISABLE | MMC_CAP_ERASE),
89 .cd_type = S3C_SDHCI_CD_PERMANENT,
90 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
93 static struct regulator_consumer_supply emmc_supplies[] = {
94 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
95 REGULATOR_SUPPLY("vmmc", "dw_mmc"),
98 static struct regulator_init_data emmc_fixed_voltage_init_data = {
100 .name = "VMEM_VDD_2.8V",
101 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
103 .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
104 .consumer_supplies = emmc_supplies,
107 static struct fixed_voltage_config emmc_fixed_voltage_config = {
108 .supply_name = "MASSMEMORY_EN (inverted)",
109 .microvolts = 2800000,
110 .gpio = EXYNOS4_GPL1(1),
111 .enable_high = false,
112 .init_data = &emmc_fixed_voltage_init_data,
115 static struct platform_device emmc_fixed_voltage = {
116 .name = "reg-fixed-voltage",
117 .id = FIXED_REG_ID_MMC,
119 .platform_data = &emmc_fixed_voltage_config,
124 static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
126 .host_caps = MMC_CAP_4_BIT_DATA |
127 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
129 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
130 .ext_cd_gpio_invert = 1,
131 .cd_type = S3C_SDHCI_CD_GPIO,
132 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
136 static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
138 .host_caps = MMC_CAP_4_BIT_DATA |
139 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
140 .cd_type = S3C_SDHCI_CD_EXTERNAL,
141 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
144 static void __init nuri_sdhci_init(void)
146 s3c_sdhci0_set_platdata(&nuri_hsmmc0_data);
147 s3c_sdhci2_set_platdata(&nuri_hsmmc2_data);
148 s3c_sdhci3_set_platdata(&nuri_hsmmc3_data);
152 static struct gpio_keys_button nuri_gpio_keys_tables[] = {
154 .code = KEY_VOLUMEUP,
155 .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
156 .desc = "gpio-keys: KEY_VOLUMEUP",
159 .debounce_interval = 1,
161 .code = KEY_VOLUMEDOWN,
162 .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
163 .desc = "gpio-keys: KEY_VOLUMEDOWN",
166 .debounce_interval = 1,
169 .gpio = EXYNOS4_GPX2(7), /* XEINT23 */
170 .desc = "gpio-keys: KEY_POWER",
174 .debounce_interval = 1,
178 static struct gpio_keys_platform_data nuri_gpio_keys_data = {
179 .buttons = nuri_gpio_keys_tables,
180 .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables),
183 static struct platform_device nuri_gpio_keys = {
186 .platform_data = &nuri_gpio_keys_data,
190 static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
192 int gpio = EXYNOS4_GPE1(5);
194 gpio_request(gpio, "LVDS_nSHDN");
195 gpio_direction_output(gpio, power);
199 static int nuri_bl_init(struct device *dev)
201 int ret, gpio = EXYNOS4_GPE2(3);
203 ret = gpio_request(gpio, "LCD_LDO_EN");
205 gpio_direction_output(gpio, 0);
210 static int nuri_bl_notify(struct device *dev, int brightness)
215 gpio_set_value(EXYNOS4_GPE2(3), 1);
220 static void nuri_bl_exit(struct device *dev)
222 gpio_free(EXYNOS4_GPE2(3));
225 /* nuri pwm backlight */
226 static struct platform_pwm_backlight_data nuri_backlight_data = {
228 .pwm_period_ns = 30000,
229 .max_brightness = 100,
230 .dft_brightness = 50,
231 .init = nuri_bl_init,
232 .notify = nuri_bl_notify,
233 .exit = nuri_bl_exit,
236 static struct platform_device nuri_backlight_device = {
237 .name = "pwm-backlight",
240 .parent = &s3c_device_timer[0].dev,
241 .platform_data = &nuri_backlight_data,
245 static struct plat_lcd_data nuri_lcd_platform_data = {
246 .set_power = nuri_lcd_power_on,
249 static struct platform_device nuri_lcd_device = {
250 .name = "platform-lcd",
253 .platform_data = &nuri_lcd_platform_data,
258 static struct i2c_board_info i2c1_devs[] __initdata = {
259 /* Gyro, To be updated */
262 /* GPIO I2C 5 (PMIC) */
263 static struct i2c_board_info i2c5_devs[] __initdata = {
264 /* max8997, To be updated */
268 static struct s5p_ehci_platdata nuri_ehci_pdata;
270 static void __init nuri_ehci_init(void)
272 struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
274 s5p_ehci_set_platdata(pdata);
277 static struct platform_device *nuri_devices[] __initdata = {
278 /* Samsung Platform Devices */
284 &s3c_device_timer[0],
290 &nuri_backlight_device,
293 static void __init nuri_map_io(void)
295 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
296 s3c24xx_init_clocks(24000000);
297 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
300 static void __init nuri_machine_init(void)
304 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
305 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
308 clk_xusbxti.rate = 24000000;
311 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
314 MACHINE_START(NURI, "NURI")
315 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
316 .boot_params = S5P_PA_SDRAM + 0x100,
317 .init_irq = exynos4_init_irq,
318 .map_io = nuri_map_io,
319 .init_machine = nuri_machine_init,
320 .timer = &exynos4_timer,