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>
36 /* Following are default values for UCON, ULCON and UFCON UART registers */
37 #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
38 S3C2410_UCON_RXILEVEL | \
39 S3C2410_UCON_TXIRQMODE | \
40 S3C2410_UCON_RXIRQMODE | \
41 S3C2410_UCON_RXFIFO_TOI | \
42 S3C2443_UCON_RXERR_IRQEN)
44 #define NURI_ULCON_DEFAULT S3C2410_LCON_CS8
46 #define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
47 S5PV210_UFCON_TXTRIG256 | \
48 S5PV210_UFCON_RXTRIG256)
50 enum fixed_regulator_id
{
54 static struct s3c2410_uartcfg nuri_uartcfgs
[] __initdata
= {
57 .ucon
= NURI_UCON_DEFAULT
,
58 .ulcon
= NURI_ULCON_DEFAULT
,
59 .ufcon
= NURI_UFCON_DEFAULT
,
63 .ucon
= NURI_UCON_DEFAULT
,
64 .ulcon
= NURI_ULCON_DEFAULT
,
65 .ufcon
= NURI_UFCON_DEFAULT
,
69 .ucon
= NURI_UCON_DEFAULT
,
70 .ulcon
= NURI_ULCON_DEFAULT
,
71 .ufcon
= NURI_UFCON_DEFAULT
,
75 .ucon
= NURI_UCON_DEFAULT
,
76 .ulcon
= NURI_ULCON_DEFAULT
,
77 .ufcon
= NURI_UFCON_DEFAULT
,
82 static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata
= {
84 .host_caps
= (MMC_CAP_8_BIT_DATA
| MMC_CAP_4_BIT_DATA
|
85 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
86 MMC_CAP_DISABLE
| MMC_CAP_ERASE
),
87 .cd_type
= S3C_SDHCI_CD_PERMANENT
,
88 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
91 static struct regulator_consumer_supply emmc_supplies
[] = {
92 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
93 REGULATOR_SUPPLY("vmmc", "dw_mmc"),
96 static struct regulator_init_data emmc_fixed_voltage_init_data
= {
98 .name
= "VMEM_VDD_2.8V",
99 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
101 .num_consumer_supplies
= ARRAY_SIZE(emmc_supplies
),
102 .consumer_supplies
= emmc_supplies
,
105 static struct fixed_voltage_config emmc_fixed_voltage_config
= {
106 .supply_name
= "MASSMEMORY_EN (inverted)",
107 .microvolts
= 2800000,
108 .gpio
= EXYNOS4_GPL1(1),
109 .enable_high
= false,
110 .init_data
= &emmc_fixed_voltage_init_data
,
113 static struct platform_device emmc_fixed_voltage
= {
114 .name
= "reg-fixed-voltage",
115 .id
= FIXED_REG_ID_MMC
,
117 .platform_data
= &emmc_fixed_voltage_config
,
122 static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata
= {
124 .host_caps
= MMC_CAP_4_BIT_DATA
|
125 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
127 .ext_cd_gpio
= EXYNOS4_GPX3(3), /* XEINT_27 */
128 .ext_cd_gpio_invert
= 1,
129 .cd_type
= S3C_SDHCI_CD_GPIO
,
130 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
134 static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata
= {
136 .host_caps
= MMC_CAP_4_BIT_DATA
|
137 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
,
138 .cd_type
= S3C_SDHCI_CD_EXTERNAL
,
139 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
142 static void __init
nuri_sdhci_init(void)
144 s3c_sdhci0_set_platdata(&nuri_hsmmc0_data
);
145 s3c_sdhci2_set_platdata(&nuri_hsmmc2_data
);
146 s3c_sdhci3_set_platdata(&nuri_hsmmc3_data
);
150 static struct gpio_keys_button nuri_gpio_keys_tables
[] = {
152 .code
= KEY_VOLUMEUP
,
153 .gpio
= EXYNOS4_GPX2(0), /* XEINT16 */
154 .desc
= "gpio-keys: KEY_VOLUMEUP",
157 .debounce_interval
= 1,
159 .code
= KEY_VOLUMEDOWN
,
160 .gpio
= EXYNOS4_GPX2(1), /* XEINT17 */
161 .desc
= "gpio-keys: KEY_VOLUMEDOWN",
164 .debounce_interval
= 1,
167 .gpio
= EXYNOS4_GPX2(7), /* XEINT23 */
168 .desc
= "gpio-keys: KEY_POWER",
172 .debounce_interval
= 1,
176 static struct gpio_keys_platform_data nuri_gpio_keys_data
= {
177 .buttons
= nuri_gpio_keys_tables
,
178 .nbuttons
= ARRAY_SIZE(nuri_gpio_keys_tables
),
181 static struct platform_device nuri_gpio_keys
= {
184 .platform_data
= &nuri_gpio_keys_data
,
188 static void nuri_lcd_power_on(struct plat_lcd_data
*pd
, unsigned int power
)
190 int gpio
= EXYNOS4_GPE1(5);
192 gpio_request(gpio
, "LVDS_nSHDN");
193 gpio_direction_output(gpio
, power
);
197 static int nuri_bl_init(struct device
*dev
)
199 int ret
, gpio
= EXYNOS4_GPE2(3);
201 ret
= gpio_request(gpio
, "LCD_LDO_EN");
203 gpio_direction_output(gpio
, 0);
208 static int nuri_bl_notify(struct device
*dev
, int brightness
)
213 gpio_set_value(EXYNOS4_GPE2(3), 1);
218 static void nuri_bl_exit(struct device
*dev
)
220 gpio_free(EXYNOS4_GPE2(3));
223 /* nuri pwm backlight */
224 static struct platform_pwm_backlight_data nuri_backlight_data
= {
226 .pwm_period_ns
= 30000,
227 .max_brightness
= 100,
228 .dft_brightness
= 50,
229 .init
= nuri_bl_init
,
230 .notify
= nuri_bl_notify
,
231 .exit
= nuri_bl_exit
,
234 static struct platform_device nuri_backlight_device
= {
235 .name
= "pwm-backlight",
238 .parent
= &s3c_device_timer
[0].dev
,
239 .platform_data
= &nuri_backlight_data
,
243 static struct plat_lcd_data nuri_lcd_platform_data
= {
244 .set_power
= nuri_lcd_power_on
,
247 static struct platform_device nuri_lcd_device
= {
248 .name
= "platform-lcd",
251 .platform_data
= &nuri_lcd_platform_data
,
256 static struct i2c_board_info i2c1_devs
[] __initdata
= {
257 /* Gyro, To be updated */
260 /* GPIO I2C 5 (PMIC) */
261 static struct i2c_board_info i2c5_devs
[] __initdata
= {
262 /* max8997, To be updated */
265 static struct platform_device
*nuri_devices
[] __initdata
= {
266 /* Samsung Platform Devices */
272 &s3c_device_timer
[0],
277 &nuri_backlight_device
,
280 static void __init
nuri_map_io(void)
282 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
283 s3c24xx_init_clocks(24000000);
284 s3c24xx_init_uarts(nuri_uartcfgs
, ARRAY_SIZE(nuri_uartcfgs
));
287 static void __init
nuri_machine_init(void)
291 i2c_register_board_info(1, i2c1_devs
, ARRAY_SIZE(i2c1_devs
));
292 i2c_register_board_info(5, i2c5_devs
, ARRAY_SIZE(i2c5_devs
));
295 platform_add_devices(nuri_devices
, ARRAY_SIZE(nuri_devices
));
298 MACHINE_START(NURI
, "NURI")
299 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
300 .boot_params
= S5P_PA_SDRAM
+ 0x100,
301 .init_irq
= exynos4_init_irq
,
302 .map_io
= nuri_map_io
,
303 .init_machine
= nuri_machine_init
,
304 .timer
= &exynos4_timer
,