1 /* linux/arch/arm/mach-s5pv310/mach-universal_c210.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
10 #include <linux/platform_device.h>
11 #include <linux/serial_core.h>
12 #include <linux/input.h>
13 #include <linux/i2c.h>
14 #include <linux/gpio_keys.h>
15 #include <linux/gpio.h>
16 #include <linux/regulator/machine.h>
17 #include <linux/regulator/fixed.h>
18 #include <linux/mmc/host.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach-types.h>
23 #include <plat/regs-serial.h>
24 #include <plat/s5pv310.h>
26 #include <plat/devs.h>
27 #include <plat/sdhci.h>
31 /* Following are default values for UCON, ULCON and UFCON UART registers */
32 #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
33 S3C2410_UCON_RXILEVEL | \
34 S3C2410_UCON_TXIRQMODE | \
35 S3C2410_UCON_RXIRQMODE | \
36 S3C2410_UCON_RXFIFO_TOI | \
37 S3C2443_UCON_RXERR_IRQEN)
39 #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
41 #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
42 S5PV210_UFCON_TXTRIG256 | \
43 S5PV210_UFCON_RXTRIG256)
45 static struct s3c2410_uartcfg universal_uartcfgs
[] __initdata
= {
48 .ucon
= UNIVERSAL_UCON_DEFAULT
,
49 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
50 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
54 .ucon
= UNIVERSAL_UCON_DEFAULT
,
55 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
56 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
60 .ucon
= UNIVERSAL_UCON_DEFAULT
,
61 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
62 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
66 .ucon
= UNIVERSAL_UCON_DEFAULT
,
67 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
68 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
72 static struct gpio_keys_button universal_gpio_keys_tables
[] = {
75 .gpio
= S5PV310_GPX2(0), /* XEINT16 */
76 .desc
= "gpio-keys: KEY_VOLUMEUP",
79 .debounce_interval
= 1,
81 .code
= KEY_VOLUMEDOWN
,
82 .gpio
= S5PV310_GPX2(1), /* XEINT17 */
83 .desc
= "gpio-keys: KEY_VOLUMEDOWN",
86 .debounce_interval
= 1,
89 .gpio
= S5PV310_GPX2(2), /* XEINT18 */
90 .desc
= "gpio-keys: KEY_CONFIG",
93 .debounce_interval
= 1,
96 .gpio
= S5PV310_GPX2(3), /* XEINT19 */
97 .desc
= "gpio-keys: KEY_CAMERA",
100 .debounce_interval
= 1,
103 .gpio
= S5PV310_GPX3(5), /* XEINT29 */
104 .desc
= "gpio-keys: KEY_OK",
107 .debounce_interval
= 1,
111 static struct gpio_keys_platform_data universal_gpio_keys_data
= {
112 .buttons
= universal_gpio_keys_tables
,
113 .nbuttons
= ARRAY_SIZE(universal_gpio_keys_tables
),
116 static struct platform_device universal_gpio_keys
= {
119 .platform_data
= &universal_gpio_keys_data
,
124 static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata
= {
126 .host_caps
= (MMC_CAP_8_BIT_DATA
| MMC_CAP_4_BIT_DATA
|
127 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
129 .cd_type
= S3C_SDHCI_CD_PERMANENT
,
130 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
133 static struct regulator_consumer_supply mmc0_supplies
[] = {
134 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
137 static struct regulator_init_data mmc0_fixed_voltage_init_data
= {
139 .name
= "VMEM_VDD_2.8V",
140 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
142 .num_consumer_supplies
= ARRAY_SIZE(mmc0_supplies
),
143 .consumer_supplies
= mmc0_supplies
,
146 static struct fixed_voltage_config mmc0_fixed_voltage_config
= {
147 .supply_name
= "MASSMEMORY_EN",
148 .microvolts
= 2800000,
149 .gpio
= S5PV310_GPE1(3),
151 .init_data
= &mmc0_fixed_voltage_init_data
,
154 static struct platform_device mmc0_fixed_voltage
= {
155 .name
= "reg-fixed-voltage",
158 .platform_data
= &mmc0_fixed_voltage_config
,
163 static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata
= {
165 .host_caps
= MMC_CAP_4_BIT_DATA
|
166 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
168 .ext_cd_gpio
= S5PV310_GPX3(4), /* XEINT_28 */
169 .ext_cd_gpio_invert
= 1,
170 .cd_type
= S3C_SDHCI_CD_GPIO
,
171 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
175 static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata
= {
177 .host_caps
= MMC_CAP_4_BIT_DATA
|
178 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
180 .cd_type
= S3C_SDHCI_CD_EXTERNAL
,
183 static void __init
universal_sdhci_init(void)
185 s3c_sdhci0_set_platdata(&universal_hsmmc0_data
);
186 s3c_sdhci2_set_platdata(&universal_hsmmc2_data
);
187 s3c_sdhci3_set_platdata(&universal_hsmmc3_data
);
191 static struct i2c_board_info i2c0_devs
[] __initdata
= {
192 /* Camera, To be updated */
196 static struct i2c_board_info i2c1_devs
[] __initdata
= {
197 /* Gyro, To be updated */
200 static struct platform_device
*universal_devices
[] __initdata
= {
201 /* Samsung Platform Devices */
207 /* Universal Devices */
208 &universal_gpio_keys
,
212 static void __init
universal_map_io(void)
214 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
215 s3c24xx_init_clocks(24000000);
216 s3c24xx_init_uarts(universal_uartcfgs
, ARRAY_SIZE(universal_uartcfgs
));
219 static void __init
universal_machine_init(void)
221 universal_sdhci_init();
223 i2c_register_board_info(0, i2c0_devs
, ARRAY_SIZE(i2c0_devs
));
224 i2c_register_board_info(1, i2c1_devs
, ARRAY_SIZE(i2c1_devs
));
227 platform_add_devices(universal_devices
, ARRAY_SIZE(universal_devices
));
230 MACHINE_START(UNIVERSAL_C210
, "UNIVERSAL_C210")
231 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
232 .boot_params
= S5P_PA_SDRAM
+ 0x100,
233 .init_irq
= s5pv310_init_irq
,
234 .map_io
= universal_map_io
,
235 .init_machine
= universal_machine_init
,
236 .timer
= &s5pv310_timer
,