blob: edc52968315d31c134206648826a2e228f54e240 [file] [log] [blame]
Marek Szyprowskid947e792010-05-17 08:53:10 +02001/* linux/arch/arm/mach-s5pv210/mach-aquila.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
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.
9*/
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/init.h>
14#include <linux/serial_core.h>
Marek Szyprowskib3150322010-05-17 08:53:13 +020015#include <linux/fb.h>
Marek Szyprowskia1660c12010-07-14 18:33:44 +090016#include <linux/i2c.h>
17#include <linux/i2c-gpio.h>
18#include <linux/mfd/max8998.h>
Chanwoo Choi80849792010-10-14 17:25:57 +090019#include <linux/mfd/wm8994/pdata.h>
20#include <linux/regulator/fixed.h>
Marek Szyprowskia1660c12010-07-14 18:33:44 +090021#include <linux/gpio_keys.h>
22#include <linux/input.h>
23#include <linux/gpio.h>
Marek Szyprowskid947e792010-05-17 08:53:10 +020024
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/setup.h>
28#include <asm/mach-types.h>
29
30#include <mach/map.h>
31#include <mach/regs-clock.h>
32
Marek Szyprowskia1660c12010-07-14 18:33:44 +090033#include <plat/gpio-cfg.h>
Marek Szyprowskid947e792010-05-17 08:53:10 +020034#include <plat/regs-serial.h>
Marek Szyprowskid947e792010-05-17 08:53:10 +020035#include <plat/devs.h>
36#include <plat/cpu.h>
Marek Szyprowskib3150322010-05-17 08:53:13 +020037#include <plat/fb.h>
Sylwester Nawrocki187749b2010-08-09 16:55:35 +090038#include <plat/fimc-core.h>
Marek Szyprowskiba3fbef92010-08-05 18:00:12 +090039#include <plat/sdhci.h>
Sangbeom Kim20780fc2011-03-12 08:02:12 +090040#include <plat/s5p-time.h>
Ajay Kumar7bf3ba62011-07-21 01:14:58 +090041#include <plat/regs-fb-v4.h>
Marek Szyprowskid947e792010-05-17 08:53:10 +020042
Kukjin Kim3fa754c2011-12-22 23:32:07 +010043#include "common.h"
44
Marek Szyprowskid947e792010-05-17 08:53:10 +020045/* Following are default values for UCON, ULCON and UFCON UART registers */
Kukjin Kimc8def082010-07-21 09:19:51 +090046#define AQUILA_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
Marek Szyprowskid947e792010-05-17 08:53:10 +020047 S3C2410_UCON_RXILEVEL | \
48 S3C2410_UCON_TXIRQMODE | \
49 S3C2410_UCON_RXIRQMODE | \
50 S3C2410_UCON_RXFIFO_TOI | \
51 S3C2443_UCON_RXERR_IRQEN)
52
Kukjin Kimc8def082010-07-21 09:19:51 +090053#define AQUILA_ULCON_DEFAULT S3C2410_LCON_CS8
Marek Szyprowskid947e792010-05-17 08:53:10 +020054
Kukjin Kimf2b7e3c2010-08-06 21:34:55 +090055#define AQUILA_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
Marek Szyprowskid947e792010-05-17 08:53:10 +020056
Joonyoung Shimdf017142010-06-24 19:28:55 +090057static struct s3c2410_uartcfg aquila_uartcfgs[] __initdata = {
Marek Szyprowskid947e792010-05-17 08:53:10 +020058 [0] = {
59 .hwport = 0,
60 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090061 .ucon = AQUILA_UCON_DEFAULT,
62 .ulcon = AQUILA_ULCON_DEFAULT,
Joonyoung Shimdf017142010-06-24 19:28:55 +090063 /*
64 * Actually UART0 can support 256 bytes fifo, but aquila board
65 * supports 128 bytes fifo because of initial chip bug
66 */
Kukjin Kimf2b7e3c2010-08-06 21:34:55 +090067 .ufcon = AQUILA_UFCON_DEFAULT |
Joonyoung Shimdf017142010-06-24 19:28:55 +090068 S5PV210_UFCON_TXTRIG128 | S5PV210_UFCON_RXTRIG128,
Marek Szyprowskid947e792010-05-17 08:53:10 +020069 },
70 [1] = {
71 .hwport = 1,
72 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090073 .ucon = AQUILA_UCON_DEFAULT,
74 .ulcon = AQUILA_ULCON_DEFAULT,
Kukjin Kimf2b7e3c2010-08-06 21:34:55 +090075 .ufcon = AQUILA_UFCON_DEFAULT |
Joonyoung Shimdf017142010-06-24 19:28:55 +090076 S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
Marek Szyprowskid947e792010-05-17 08:53:10 +020077 },
78 [2] = {
79 .hwport = 2,
80 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090081 .ucon = AQUILA_UCON_DEFAULT,
82 .ulcon = AQUILA_ULCON_DEFAULT,
Kukjin Kimf2b7e3c2010-08-06 21:34:55 +090083 .ufcon = AQUILA_UFCON_DEFAULT |
Joonyoung Shimdf017142010-06-24 19:28:55 +090084 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
Marek Szyprowskid947e792010-05-17 08:53:10 +020085 },
86 [3] = {
87 .hwport = 3,
88 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090089 .ucon = AQUILA_UCON_DEFAULT,
90 .ulcon = AQUILA_ULCON_DEFAULT,
Kukjin Kimf2b7e3c2010-08-06 21:34:55 +090091 .ufcon = AQUILA_UFCON_DEFAULT |
Joonyoung Shimdf017142010-06-24 19:28:55 +090092 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
Marek Szyprowskid947e792010-05-17 08:53:10 +020093 },
94};
95
Marek Szyprowskib3150322010-05-17 08:53:13 +020096/* Frame Buffer */
97static struct s3c_fb_pd_win aquila_fb_win0 = {
98 .win_mode = {
Marek Szyprowskib3150322010-05-17 08:53:13 +020099 .left_margin = 16,
100 .right_margin = 16,
101 .upper_margin = 3,
102 .lower_margin = 28,
103 .hsync_len = 2,
104 .vsync_len = 2,
105 .xres = 480,
106 .yres = 800,
107 },
108 .max_bpp = 32,
109 .default_bpp = 16,
110};
111
112static struct s3c_fb_pd_win aquila_fb_win1 = {
113 .win_mode = {
Marek Szyprowskib3150322010-05-17 08:53:13 +0200114 .left_margin = 16,
115 .right_margin = 16,
116 .upper_margin = 3,
117 .lower_margin = 28,
118 .hsync_len = 2,
119 .vsync_len = 2,
120 .xres = 480,
121 .yres = 800,
122 },
123 .max_bpp = 32,
124 .default_bpp = 16,
125};
126
127static struct s3c_fb_platdata aquila_lcd_pdata __initdata = {
128 .win[0] = &aquila_fb_win0,
129 .win[1] = &aquila_fb_win1,
130 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
131 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
132 VIDCON1_INV_VCLK | VIDCON1_INV_VDEN,
133 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
134};
135
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900136/* MAX8998 regulators */
137#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
138
139static struct regulator_init_data aquila_ldo2_data = {
140 .constraints = {
141 .name = "VALIVE_1.1V",
142 .min_uV = 1100000,
143 .max_uV = 1100000,
144 .apply_uV = 1,
145 .always_on = 1,
146 .state_mem = {
147 .enabled = 1,
148 },
149 },
150};
151
152static struct regulator_init_data aquila_ldo3_data = {
153 .constraints = {
Marek Szyprowskid1061332011-02-18 17:51:43 +0900154 .name = "VUSB+MIPI_1.1V",
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900155 .min_uV = 1100000,
156 .max_uV = 1100000,
157 .apply_uV = 1,
158 .always_on = 1,
159 },
160};
161
162static struct regulator_init_data aquila_ldo4_data = {
163 .constraints = {
164 .name = "VDAC_3.3V",
165 .min_uV = 3300000,
166 .max_uV = 3300000,
167 .apply_uV = 1,
168 },
169};
170
171static struct regulator_init_data aquila_ldo5_data = {
172 .constraints = {
173 .name = "VTF_2.8V",
174 .min_uV = 2800000,
175 .max_uV = 2800000,
176 .apply_uV = 1,
177 },
178};
179
180static struct regulator_init_data aquila_ldo6_data = {
181 .constraints = {
182 .name = "VCC_3.3V",
183 .min_uV = 3300000,
184 .max_uV = 3300000,
185 .apply_uV = 1,
186 },
187};
188
189static struct regulator_init_data aquila_ldo7_data = {
190 .constraints = {
191 .name = "VCC_3.0V",
192 .min_uV = 3000000,
193 .max_uV = 3000000,
194 .apply_uV = 1,
195 .boot_on = 1,
196 .always_on = 1,
197 },
198};
199
200static struct regulator_init_data aquila_ldo8_data = {
201 .constraints = {
Marek Szyprowskid1061332011-02-18 17:51:43 +0900202 .name = "VUSB+VADC_3.3V",
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900203 .min_uV = 3300000,
204 .max_uV = 3300000,
205 .apply_uV = 1,
206 .always_on = 1,
207 },
208};
209
210static struct regulator_init_data aquila_ldo9_data = {
211 .constraints = {
Marek Szyprowskid1061332011-02-18 17:51:43 +0900212 .name = "VCC+VCAM_2.8V",
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900213 .min_uV = 2800000,
214 .max_uV = 2800000,
215 .apply_uV = 1,
216 .always_on = 1,
217 },
218};
219
220static struct regulator_init_data aquila_ldo10_data = {
221 .constraints = {
222 .name = "VPLL_1.1V",
223 .min_uV = 1100000,
224 .max_uV = 1100000,
225 .apply_uV = 1,
226 .boot_on = 1,
227 },
228};
229
230static struct regulator_init_data aquila_ldo11_data = {
231 .constraints = {
232 .name = "CAM_IO_2.8V",
233 .min_uV = 2800000,
234 .max_uV = 2800000,
235 .apply_uV = 1,
236 .always_on = 1,
237 },
238};
239
240static struct regulator_init_data aquila_ldo12_data = {
241 .constraints = {
242 .name = "CAM_ISP_1.2V",
243 .min_uV = 1200000,
244 .max_uV = 1200000,
245 .apply_uV = 1,
246 .always_on = 1,
247 },
248};
249
250static struct regulator_init_data aquila_ldo13_data = {
251 .constraints = {
252 .name = "CAM_A_2.8V",
253 .min_uV = 2800000,
254 .max_uV = 2800000,
255 .apply_uV = 1,
256 .always_on = 1,
257 },
258};
259
260static struct regulator_init_data aquila_ldo14_data = {
261 .constraints = {
262 .name = "CAM_CIF_1.8V",
263 .min_uV = 1800000,
264 .max_uV = 1800000,
265 .apply_uV = 1,
266 .always_on = 1,
267 },
268};
269
270static struct regulator_init_data aquila_ldo15_data = {
271 .constraints = {
272 .name = "CAM_AF_3.3V",
273 .min_uV = 3300000,
274 .max_uV = 3300000,
275 .apply_uV = 1,
276 .always_on = 1,
277 },
278};
279
280static struct regulator_init_data aquila_ldo16_data = {
281 .constraints = {
282 .name = "VMIPI_1.8V",
283 .min_uV = 1800000,
284 .max_uV = 1800000,
285 .apply_uV = 1,
286 .always_on = 1,
287 },
288};
289
290static struct regulator_init_data aquila_ldo17_data = {
291 .constraints = {
292 .name = "CAM_8M_1.8V",
293 .min_uV = 1800000,
294 .max_uV = 1800000,
295 .apply_uV = 1,
296 .always_on = 1,
297 },
298};
299
300/* BUCK */
Kukjin Kimd3f9c572011-01-28 18:22:10 +0900301static struct regulator_consumer_supply buck1_consumer =
302 REGULATOR_SUPPLY("vddarm", NULL);
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900303
Kukjin Kimd3f9c572011-01-28 18:22:10 +0900304static struct regulator_consumer_supply buck2_consumer =
305 REGULATOR_SUPPLY("vddint", NULL);
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900306
307static struct regulator_init_data aquila_buck1_data = {
308 .constraints = {
309 .name = "VARM_1.2V",
310 .min_uV = 1200000,
311 .max_uV = 1200000,
312 .apply_uV = 1,
313 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
314 REGULATOR_CHANGE_STATUS,
315 },
Kukjin Kimd3f9c572011-01-28 18:22:10 +0900316 .num_consumer_supplies = 1,
317 .consumer_supplies = &buck1_consumer,
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900318};
319
320static struct regulator_init_data aquila_buck2_data = {
321 .constraints = {
322 .name = "VINT_1.2V",
323 .min_uV = 1200000,
324 .max_uV = 1200000,
325 .apply_uV = 1,
326 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
327 REGULATOR_CHANGE_STATUS,
328 },
Kukjin Kimd3f9c572011-01-28 18:22:10 +0900329 .num_consumer_supplies = 1,
330 .consumer_supplies = &buck2_consumer,
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900331};
332
333static struct regulator_init_data aquila_buck3_data = {
334 .constraints = {
335 .name = "VCC_1.8V",
336 .min_uV = 1800000,
337 .max_uV = 1800000,
338 .apply_uV = 1,
339 .state_mem = {
340 .enabled = 1,
341 },
342 },
343};
344
345static struct regulator_init_data aquila_buck4_data = {
346 .constraints = {
347 .name = "CAM_CORE_1.2V",
348 .min_uV = 1200000,
349 .max_uV = 1200000,
350 .apply_uV = 1,
351 .always_on = 1,
352 },
353};
354
355static struct max8998_regulator_data aquila_regulators[] = {
356 { MAX8998_LDO2, &aquila_ldo2_data },
357 { MAX8998_LDO3, &aquila_ldo3_data },
358 { MAX8998_LDO4, &aquila_ldo4_data },
359 { MAX8998_LDO5, &aquila_ldo5_data },
360 { MAX8998_LDO6, &aquila_ldo6_data },
361 { MAX8998_LDO7, &aquila_ldo7_data },
362 { MAX8998_LDO8, &aquila_ldo8_data },
363 { MAX8998_LDO9, &aquila_ldo9_data },
364 { MAX8998_LDO10, &aquila_ldo10_data },
365 { MAX8998_LDO11, &aquila_ldo11_data },
366 { MAX8998_LDO12, &aquila_ldo12_data },
367 { MAX8998_LDO13, &aquila_ldo13_data },
368 { MAX8998_LDO14, &aquila_ldo14_data },
369 { MAX8998_LDO15, &aquila_ldo15_data },
370 { MAX8998_LDO16, &aquila_ldo16_data },
371 { MAX8998_LDO17, &aquila_ldo17_data },
372 { MAX8998_BUCK1, &aquila_buck1_data },
373 { MAX8998_BUCK2, &aquila_buck2_data },
374 { MAX8998_BUCK3, &aquila_buck3_data },
375 { MAX8998_BUCK4, &aquila_buck4_data },
376};
377
378static struct max8998_platform_data aquila_max8998_pdata = {
379 .num_regulators = ARRAY_SIZE(aquila_regulators),
380 .regulators = aquila_regulators,
Marek Szyprowskicb186882010-12-17 14:47:42 +0900381 .buck1_set1 = S5PV210_GPH0(3),
382 .buck1_set2 = S5PV210_GPH0(4),
383 .buck2_set3 = S5PV210_GPH0(5),
Marek Szyprowski979f3952011-02-18 17:47:34 +0900384 .buck1_voltage1 = 1200000,
385 .buck1_voltage2 = 1200000,
386 .buck1_voltage3 = 1200000,
387 .buck1_voltage4 = 1200000,
388 .buck2_voltage1 = 1200000,
389 .buck2_voltage2 = 1200000,
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900390};
391#endif
392
Chanwoo Choi80849792010-10-14 17:25:57 +0900393static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
Kukjin Kimd3f9c572011-01-28 18:22:10 +0900394 REGULATOR_SUPPLY("DBVDD", "5-001a"),
395 REGULATOR_SUPPLY("AVDD2", "5-001a"),
396 REGULATOR_SUPPLY("CPVDD", "5-001a"),
Chanwoo Choi80849792010-10-14 17:25:57 +0900397};
398
399static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
Kukjin Kimd3f9c572011-01-28 18:22:10 +0900400 REGULATOR_SUPPLY("SPKVDD1", "5-001a"),
401 REGULATOR_SUPPLY("SPKVDD2", "5-001a"),
Chanwoo Choi80849792010-10-14 17:25:57 +0900402};
403
404static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
405 .constraints = {
406 .always_on = 1,
407 },
408 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies),
409 .consumer_supplies = wm8994_fixed_voltage0_supplies,
410};
411
412static struct regulator_init_data wm8994_fixed_voltage1_init_data = {
413 .constraints = {
414 .always_on = 1,
415 },
416 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies),
417 .consumer_supplies = wm8994_fixed_voltage1_supplies,
418};
419
420static struct fixed_voltage_config wm8994_fixed_voltage0_config = {
421 .supply_name = "VCC_1.8V_PDA",
422 .microvolts = 1800000,
423 .gpio = -EINVAL,
424 .init_data = &wm8994_fixed_voltage0_init_data,
425};
426
427static struct fixed_voltage_config wm8994_fixed_voltage1_config = {
428 .supply_name = "V_BAT",
429 .microvolts = 3700000,
430 .gpio = -EINVAL,
431 .init_data = &wm8994_fixed_voltage1_init_data,
432};
433
434static struct platform_device wm8994_fixed_voltage0 = {
435 .name = "reg-fixed-voltage",
436 .id = 0,
437 .dev = {
438 .platform_data = &wm8994_fixed_voltage0_config,
439 },
440};
441
442static struct platform_device wm8994_fixed_voltage1 = {
443 .name = "reg-fixed-voltage",
444 .id = 1,
445 .dev = {
446 .platform_data = &wm8994_fixed_voltage1_config,
447 },
448};
449
Kukjin Kimd3f9c572011-01-28 18:22:10 +0900450static struct regulator_consumer_supply wm8994_avdd1_supply =
451 REGULATOR_SUPPLY("AVDD1", "5-001a");
Chanwoo Choi80849792010-10-14 17:25:57 +0900452
Kukjin Kimd3f9c572011-01-28 18:22:10 +0900453static struct regulator_consumer_supply wm8994_dcvdd_supply =
454 REGULATOR_SUPPLY("DCVDD", "5-001a");
Chanwoo Choi80849792010-10-14 17:25:57 +0900455
456static struct regulator_init_data wm8994_ldo1_data = {
457 .constraints = {
458 .name = "AVDD1_3.0V",
459 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
460 },
461 .num_consumer_supplies = 1,
462 .consumer_supplies = &wm8994_avdd1_supply,
463};
464
465static struct regulator_init_data wm8994_ldo2_data = {
466 .constraints = {
467 .name = "DCVDD_1.0V",
468 },
469 .num_consumer_supplies = 1,
470 .consumer_supplies = &wm8994_dcvdd_supply,
471};
472
473static struct wm8994_pdata wm8994_platform_data = {
474 /* configure gpio1 function: 0x0001(Logic level input/output) */
475 .gpio_defaults[0] = 0x0001,
476 /* configure gpio3/4/5/7 function for AIF2 voice */
477 .gpio_defaults[2] = 0x8100,
478 .gpio_defaults[3] = 0x8100,
479 .gpio_defaults[4] = 0x8100,
480 .gpio_defaults[6] = 0x0100,
481 /* configure gpio8/9/10/11 function for AIF3 BT */
482 .gpio_defaults[7] = 0x8100,
483 .gpio_defaults[8] = 0x0100,
484 .gpio_defaults[9] = 0x0100,
485 .gpio_defaults[10] = 0x0100,
486 .ldo[0] = { S5PV210_MP03(6), NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */
487 .ldo[1] = { 0, NULL, &wm8994_ldo2_data },
488};
489
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900490/* GPIO I2C PMIC */
491#define AP_I2C_GPIO_PMIC_BUS_4 4
492static struct i2c_gpio_platform_data aquila_i2c_gpio_pmic_data = {
493 .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
494 .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
495};
496
497static struct platform_device aquila_i2c_gpio_pmic = {
498 .name = "i2c-gpio",
499 .id = AP_I2C_GPIO_PMIC_BUS_4,
500 .dev = {
501 .platform_data = &aquila_i2c_gpio_pmic_data,
502 },
503};
504
505static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
506#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
507 {
508 /* 0xCC when SRAD = 0 */
509 I2C_BOARD_INFO("max8998", 0xCC >> 1),
510 .platform_data = &aquila_max8998_pdata,
511 },
512#endif
513};
514
Chanwoo Choi51122672010-10-14 15:02:44 +0900515/* GPIO I2C AP 1.8V */
516#define AP_I2C_GPIO_BUS_5 5
517static struct i2c_gpio_platform_data aquila_i2c_gpio5_data = {
518 .sda_pin = S5PV210_MP05(3), /* XM0ADDR_11 */
519 .scl_pin = S5PV210_MP05(2), /* XM0ADDR_10 */
520};
521
522static struct platform_device aquila_i2c_gpio5 = {
523 .name = "i2c-gpio",
524 .id = AP_I2C_GPIO_BUS_5,
525 .dev = {
526 .platform_data = &aquila_i2c_gpio5_data,
527 },
528};
529
530static struct i2c_board_info i2c_gpio5_devs[] __initdata = {
531 {
532 /* CS/ADDR = low 0x34 (FYI: high = 0x36) */
533 I2C_BOARD_INFO("wm8994", 0x1a),
Chanwoo Choi80849792010-10-14 17:25:57 +0900534 .platform_data = &wm8994_platform_data,
Chanwoo Choi51122672010-10-14 15:02:44 +0900535 },
536};
537
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900538/* PMIC Power button */
539static struct gpio_keys_button aquila_gpio_keys_table[] = {
540 {
541 .code = KEY_POWER,
542 .gpio = S5PV210_GPH2(6),
543 .desc = "gpio-keys: KEY_POWER",
544 .type = EV_KEY,
545 .active_low = 1,
546 .wakeup = 1,
547 .debounce_interval = 1,
548 },
549};
550
551static struct gpio_keys_platform_data aquila_gpio_keys_data = {
552 .buttons = aquila_gpio_keys_table,
553 .nbuttons = ARRAY_SIZE(aquila_gpio_keys_table),
554};
555
556static struct platform_device aquila_device_gpiokeys = {
557 .name = "gpio-keys",
558 .dev = {
559 .platform_data = &aquila_gpio_keys_data,
560 },
561};
562
563static void __init aquila_pmic_init(void)
564{
565 /* AP_PMIC_IRQ: EINT7 */
566 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
567 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
568
569 /* nPower: EINT22 */
570 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
571 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
572}
573
Marek Szyprowskiba3fbef92010-08-05 18:00:12 +0900574/* MoviNAND */
575static struct s3c_sdhci_platdata aquila_hsmmc0_data __initdata = {
576 .max_width = 4,
577 .cd_type = S3C_SDHCI_CD_PERMANENT,
578};
579
580/* Wireless LAN */
581static struct s3c_sdhci_platdata aquila_hsmmc1_data __initdata = {
582 .max_width = 4,
583 .cd_type = S3C_SDHCI_CD_EXTERNAL,
584 /* ext_cd_{init,cleanup} callbacks will be added later */
585};
586
587/* External Flash */
588#define AQUILA_EXT_FLASH_EN S5PV210_MP05(4)
589#define AQUILA_EXT_FLASH_CD S5PV210_GPH3(4)
590static struct s3c_sdhci_platdata aquila_hsmmc2_data __initdata = {
591 .max_width = 4,
592 .cd_type = S3C_SDHCI_CD_GPIO,
593 .ext_cd_gpio = AQUILA_EXT_FLASH_CD,
594 .ext_cd_gpio_invert = 1,
595};
596
597static void aquila_setup_sdhci(void)
598{
599 gpio_request(AQUILA_EXT_FLASH_EN, "FLASH_EN");
600 gpio_direction_output(AQUILA_EXT_FLASH_EN, 1);
601
602 s3c_sdhci0_set_platdata(&aquila_hsmmc0_data);
603 s3c_sdhci1_set_platdata(&aquila_hsmmc1_data);
604 s3c_sdhci2_set_platdata(&aquila_hsmmc2_data);
605};
606
Marek Szyprowskid947e792010-05-17 08:53:10 +0200607static struct platform_device *aquila_devices[] __initdata = {
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900608 &aquila_i2c_gpio_pmic,
Chanwoo Choi51122672010-10-14 15:02:44 +0900609 &aquila_i2c_gpio5,
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900610 &aquila_device_gpiokeys,
Marek Szyprowskib3150322010-05-17 08:53:13 +0200611 &s3c_device_fb,
Kukjin Kim13904fb2010-08-27 13:56:54 +0900612 &s5p_device_onenand,
Marek Szyprowskiba3fbef92010-08-05 18:00:12 +0900613 &s3c_device_hsmmc0,
614 &s3c_device_hsmmc1,
615 &s3c_device_hsmmc2,
Sylwester Nawrocki7200c112010-08-09 16:55:24 +0900616 &s5p_device_fimc0,
617 &s5p_device_fimc1,
618 &s5p_device_fimc2,
Chanwoo Choi6c29e712010-10-14 16:00:42 +0900619 &s5pv210_device_iis0,
Chanwoo Choi80849792010-10-14 17:25:57 +0900620 &wm8994_fixed_voltage0,
621 &wm8994_fixed_voltage1,
Marek Szyprowskid947e792010-05-17 08:53:10 +0200622};
623
Chanwoo Choi6c29e712010-10-14 16:00:42 +0900624static void __init aquila_sound_init(void)
625{
626 unsigned int gpio;
627
628 /* CODEC_XTAL_EN
629 *
630 * The Aquila board have a oscillator which provide main clock
631 * to WM8994 codec. The oscillator provide 24MHz clock to WM8994
632 * clock. Set gpio setting of "CODEC_XTAL_EN" to enable a oscillator.
633 * */
634 gpio = S5PV210_GPH3(2); /* XEINT_26 */
635 gpio_request(gpio, "CODEC_XTAL_EN");
636 s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
637 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
638
639 /* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
640 * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
641 * because it needs 24MHz clock to operate WM8994 codec.
642 */
643 __raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS);
644}
645
Marek Szyprowskid947e792010-05-17 08:53:10 +0200646static void __init aquila_map_io(void)
647{
Kukjin Kim3fa754c2011-12-22 23:32:07 +0100648 s5pv210_init_io(NULL, 0);
Marek Szyprowskid947e792010-05-17 08:53:10 +0200649 s3c24xx_init_clocks(24000000);
Joonyoung Shimdf017142010-06-24 19:28:55 +0900650 s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900651 s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
Marek Szyprowskid947e792010-05-17 08:53:10 +0200652}
653
654static void __init aquila_machine_init(void)
655{
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900656 /* PMIC */
657 aquila_pmic_init();
658 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
659 ARRAY_SIZE(i2c_gpio_pmic_devs));
Marek Szyprowskiba3fbef92010-08-05 18:00:12 +0900660 /* SDHCI */
661 aquila_setup_sdhci();
Marek Szyprowskia1660c12010-07-14 18:33:44 +0900662
Sylwester Nawrocki187749b2010-08-09 16:55:35 +0900663 s3c_fimc_setname(0, "s5p-fimc");
664 s3c_fimc_setname(1, "s5p-fimc");
665 s3c_fimc_setname(2, "s5p-fimc");
666
Chanwoo Choi51122672010-10-14 15:02:44 +0900667 /* SOUND */
Chanwoo Choi6c29e712010-10-14 16:00:42 +0900668 aquila_sound_init();
Chanwoo Choi51122672010-10-14 15:02:44 +0900669 i2c_register_board_info(AP_I2C_GPIO_BUS_5, i2c_gpio5_devs,
670 ARRAY_SIZE(i2c_gpio5_devs));
671
Marek Szyprowskib3150322010-05-17 08:53:13 +0200672 /* FB */
673 s3c_fb_set_platdata(&aquila_lcd_pdata);
674
Marek Szyprowskid947e792010-05-17 08:53:10 +0200675 platform_add_devices(aquila_devices, ARRAY_SIZE(aquila_devices));
676}
677
678MACHINE_START(AQUILA, "Aquila")
679 /* Maintainers:
680 Marek Szyprowski <m.szyprowski@samsung.com>
681 Kyungmin Park <kyungmin.park@samsung.com> */
Nicolas Pitre02350a12011-07-05 22:38:17 -0400682 .atag_offset = 0x100,
Marek Szyprowskid947e792010-05-17 08:53:10 +0200683 .init_irq = s5pv210_init_irq,
684 .map_io = aquila_map_io,
685 .init_machine = aquila_machine_init,
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900686 .timer = &s5p_timer,
Russell King1f34f0e2011-12-22 23:36:02 +0100687 .restart = s5pv210_restart,
Marek Szyprowskid947e792010-05-17 08:53:10 +0200688MACHINE_END