Merge branch 'next-samsung-devel' into next-samsung-devel-2
[deliverable/linux.git] / arch / arm / mach-exynos4 / mach-smdk4212.c
1 /*
2 * linux/arch/arm/mach-exynos4/mach-smdk4212.c
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12 #include <linux/gpio.h>
13 #include <linux/i2c.h>
14 #include <linux/input.h>
15 #include <linux/io.h>
16 #include <linux/mfd/max8997.h>
17 #include <linux/mmc/host.h>
18 #include <linux/platform_device.h>
19 #include <linux/pwm_backlight.h>
20 #include <linux/regulator/machine.h>
21 #include <linux/serial_core.h>
22
23 #include <asm/mach/arch.h>
24 #include <asm/mach-types.h>
25
26 #include <plat/backlight.h>
27 #include <plat/clock.h>
28 #include <plat/cpu.h>
29 #include <plat/devs.h>
30 #include <plat/exynos4.h>
31 #include <plat/gpio-cfg.h>
32 #include <plat/iic.h>
33 #include <plat/keypad.h>
34 #include <plat/regs-serial.h>
35 #include <plat/sdhci.h>
36
37 #include <mach/map.h>
38
39 /* Following are default values for UCON, ULCON and UFCON UART registers */
40 #define SMDK4212_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
41 S3C2410_UCON_RXILEVEL | \
42 S3C2410_UCON_TXIRQMODE | \
43 S3C2410_UCON_RXIRQMODE | \
44 S3C2410_UCON_RXFIFO_TOI | \
45 S3C2443_UCON_RXERR_IRQEN)
46
47 #define SMDK4212_ULCON_DEFAULT S3C2410_LCON_CS8
48
49 #define SMDK4212_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
50 S5PV210_UFCON_TXTRIG4 | \
51 S5PV210_UFCON_RXTRIG4)
52
53 static struct s3c2410_uartcfg smdk4212_uartcfgs[] __initdata = {
54 [0] = {
55 .hwport = 0,
56 .flags = 0,
57 .ucon = SMDK4212_UCON_DEFAULT,
58 .ulcon = SMDK4212_ULCON_DEFAULT,
59 .ufcon = SMDK4212_UFCON_DEFAULT,
60 },
61 [1] = {
62 .hwport = 1,
63 .flags = 0,
64 .ucon = SMDK4212_UCON_DEFAULT,
65 .ulcon = SMDK4212_ULCON_DEFAULT,
66 .ufcon = SMDK4212_UFCON_DEFAULT,
67 },
68 [2] = {
69 .hwport = 2,
70 .flags = 0,
71 .ucon = SMDK4212_UCON_DEFAULT,
72 .ulcon = SMDK4212_ULCON_DEFAULT,
73 .ufcon = SMDK4212_UFCON_DEFAULT,
74 },
75 [3] = {
76 .hwport = 3,
77 .flags = 0,
78 .ucon = SMDK4212_UCON_DEFAULT,
79 .ulcon = SMDK4212_ULCON_DEFAULT,
80 .ufcon = SMDK4212_UFCON_DEFAULT,
81 },
82 };
83
84 static struct s3c_sdhci_platdata smdk4212_hsmmc2_pdata __initdata = {
85 .cd_type = S3C_SDHCI_CD_INTERNAL,
86 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
87 #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
88 .max_width = 8,
89 .host_caps = MMC_CAP_8_BIT_DATA,
90 #endif
91 };
92
93 static struct s3c_sdhci_platdata smdk4212_hsmmc3_pdata __initdata = {
94 .cd_type = S3C_SDHCI_CD_INTERNAL,
95 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
96 };
97
98 static struct regulator_consumer_supply max8997_buck1 =
99 REGULATOR_SUPPLY("vdd_arm", NULL);
100
101 static struct regulator_consumer_supply max8997_buck2 =
102 REGULATOR_SUPPLY("vdd_int", NULL);
103
104 static struct regulator_consumer_supply max8997_buck3 =
105 REGULATOR_SUPPLY("vdd_g3d", NULL);
106
107 static struct regulator_init_data max8997_buck1_data = {
108 .constraints = {
109 .name = "VDD_ARM_SMDK4212",
110 .min_uV = 925000,
111 .max_uV = 1350000,
112 .always_on = 1,
113 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
114 .state_mem = {
115 .disabled = 1,
116 },
117 },
118 .num_consumer_supplies = 1,
119 .consumer_supplies = &max8997_buck1,
120 };
121
122 static struct regulator_init_data max8997_buck2_data = {
123 .constraints = {
124 .name = "VDD_INT_SMDK4212",
125 .min_uV = 950000,
126 .max_uV = 1150000,
127 .always_on = 1,
128 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
129 .state_mem = {
130 .disabled = 1,
131 },
132 },
133 .num_consumer_supplies = 1,
134 .consumer_supplies = &max8997_buck2,
135 };
136
137 static struct regulator_init_data max8997_buck3_data = {
138 .constraints = {
139 .name = "VDD_G3D_SMDK4212",
140 .min_uV = 950000,
141 .max_uV = 1150000,
142 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
143 REGULATOR_CHANGE_STATUS,
144 .state_mem = {
145 .disabled = 1,
146 },
147 },
148 .num_consumer_supplies = 1,
149 .consumer_supplies = &max8997_buck3,
150 };
151
152 static struct max8997_regulator_data smdk4212_max8997_regulators[] = {
153 { MAX8997_BUCK1, &max8997_buck1_data },
154 { MAX8997_BUCK2, &max8997_buck2_data },
155 { MAX8997_BUCK3, &max8997_buck3_data },
156 };
157
158 static struct max8997_platform_data smdk4212_max8997_pdata = {
159 .num_regulators = ARRAY_SIZE(smdk4212_max8997_regulators),
160 .regulators = smdk4212_max8997_regulators,
161
162 .buck1_voltage[0] = 1100000, /* 1.1V */
163 .buck1_voltage[1] = 1100000, /* 1.1V */
164 .buck1_voltage[2] = 1100000, /* 1.1V */
165 .buck1_voltage[3] = 1100000, /* 1.1V */
166 .buck1_voltage[4] = 1100000, /* 1.1V */
167 .buck1_voltage[5] = 1100000, /* 1.1V */
168 .buck1_voltage[6] = 1000000, /* 1.0V */
169 .buck1_voltage[7] = 950000, /* 0.95V */
170
171 .buck2_voltage[0] = 1100000, /* 1.1V */
172 .buck2_voltage[1] = 1000000, /* 1.0V */
173 .buck2_voltage[2] = 950000, /* 0.95V */
174 .buck2_voltage[3] = 900000, /* 0.9V */
175 .buck2_voltage[4] = 1100000, /* 1.1V */
176 .buck2_voltage[5] = 1000000, /* 1.0V */
177 .buck2_voltage[6] = 950000, /* 0.95V */
178 .buck2_voltage[7] = 900000, /* 0.9V */
179
180 .buck5_voltage[0] = 1100000, /* 1.1V */
181 .buck5_voltage[1] = 1100000, /* 1.1V */
182 .buck5_voltage[2] = 1100000, /* 1.1V */
183 .buck5_voltage[3] = 1100000, /* 1.1V */
184 .buck5_voltage[4] = 1100000, /* 1.1V */
185 .buck5_voltage[5] = 1100000, /* 1.1V */
186 .buck5_voltage[6] = 1100000, /* 1.1V */
187 .buck5_voltage[7] = 1100000, /* 1.1V */
188 };
189
190 static struct i2c_board_info smdk4212_i2c_devs0[] __initdata = {
191 {
192 I2C_BOARD_INFO("max8997", 0x66),
193 .platform_data = &smdk4212_max8997_pdata,
194 }
195 };
196
197 static struct i2c_board_info smdk4212_i2c_devs1[] __initdata = {
198 { I2C_BOARD_INFO("wm8994", 0x1a), }
199 };
200
201 static struct i2c_board_info smdk4212_i2c_devs3[] __initdata = {
202 /* nothing here yet */
203 };
204
205 static struct i2c_board_info smdk4212_i2c_devs7[] __initdata = {
206 /* nothing here yet */
207 };
208
209 static struct samsung_bl_gpio_info smdk4212_bl_gpio_info = {
210 .no = EXYNOS4_GPD0(1),
211 .func = S3C_GPIO_SFN(2),
212 };
213
214 static struct platform_pwm_backlight_data smdk4212_bl_data = {
215 .pwm_id = 1,
216 .pwm_period_ns = 1000,
217 };
218
219 static uint32_t smdk4212_keymap[] __initdata = {
220 /* KEY(row, col, keycode) */
221 KEY(1, 0, KEY_D), KEY(1, 1, KEY_A), KEY(1, 2, KEY_B),
222 KEY(1, 3, KEY_E), KEY(1, 4, KEY_C)
223 };
224
225 static struct matrix_keymap_data smdk4212_keymap_data __initdata = {
226 .keymap = smdk4212_keymap,
227 .keymap_size = ARRAY_SIZE(smdk4212_keymap),
228 };
229
230 static struct samsung_keypad_platdata smdk4212_keypad_data __initdata = {
231 .keymap_data = &smdk4212_keymap_data,
232 .rows = 2,
233 .cols = 5,
234 };
235
236 static struct platform_device *smdk4212_devices[] __initdata = {
237 &s3c_device_hsmmc2,
238 &s3c_device_hsmmc3,
239 &s3c_device_i2c0,
240 &s3c_device_i2c1,
241 &s3c_device_i2c3,
242 &s3c_device_i2c7,
243 &s3c_device_rtc,
244 &s3c_device_wdt,
245 &samsung_device_keypad,
246 };
247
248 static void __init smdk4212_map_io(void)
249 {
250 clk_xusbxti.rate = 24000000;
251
252 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
253 s3c24xx_init_clocks(clk_xusbxti.rate);
254 s3c24xx_init_uarts(smdk4212_uartcfgs, ARRAY_SIZE(smdk4212_uartcfgs));
255 }
256
257 static void __init smdk4212_machine_init(void)
258 {
259 s3c_i2c0_set_platdata(NULL);
260 i2c_register_board_info(0, smdk4212_i2c_devs0,
261 ARRAY_SIZE(smdk4212_i2c_devs0));
262
263 s3c_i2c1_set_platdata(NULL);
264 i2c_register_board_info(1, smdk4212_i2c_devs1,
265 ARRAY_SIZE(smdk4212_i2c_devs1));
266
267 s3c_i2c3_set_platdata(NULL);
268 i2c_register_board_info(3, smdk4212_i2c_devs3,
269 ARRAY_SIZE(smdk4212_i2c_devs3));
270
271 s3c_i2c7_set_platdata(NULL);
272 i2c_register_board_info(7, smdk4212_i2c_devs7,
273 ARRAY_SIZE(smdk4212_i2c_devs7));
274
275 samsung_bl_set(&smdk4212_bl_gpio_info, &smdk4212_bl_data);
276
277 samsung_keypad_set_platdata(&smdk4212_keypad_data);
278
279 s3c_sdhci2_set_platdata(&smdk4212_hsmmc2_pdata);
280 s3c_sdhci3_set_platdata(&smdk4212_hsmmc3_pdata);
281
282 platform_add_devices(smdk4212_devices, ARRAY_SIZE(smdk4212_devices));
283 }
284
285 MACHINE_START(SMDK4212, "SMDK4212")
286 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
287 .boot_params = S5P_PA_SDRAM + 0x100,
288 .init_irq = exynos4_init_irq,
289 .map_io = smdk4212_map_io,
290 .init_machine = smdk4212_machine_init,
291 .timer = &exynos4_timer,
292 MACHINE_END
This page took 0.04415 seconds and 5 git commands to generate.