1 /* linux/arch/arm/mach-s5pv210/mach-aquila.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
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/kernel.h>
12 #include <linux/types.h>
13 #include <linux/init.h>
14 #include <linux/serial_core.h>
16 #include <linux/i2c.h>
17 #include <linux/i2c-gpio.h>
18 #include <linux/mfd/max8998.h>
19 #include <linux/gpio_keys.h>
20 #include <linux/input.h>
21 #include <linux/gpio.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25 #include <asm/setup.h>
26 #include <asm/mach-types.h>
29 #include <mach/regs-clock.h>
30 #include <mach/regs-fb.h>
32 #include <plat/gpio-cfg.h>
33 #include <plat/regs-serial.h>
34 #include <plat/s5pv210.h>
35 #include <plat/devs.h>
38 #include <plat/fimc-core.h>
39 #include <plat/sdhci.h>
41 /* Following are default values for UCON, ULCON and UFCON UART registers */
42 #define AQUILA_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
43 S3C2410_UCON_RXILEVEL | \
44 S3C2410_UCON_TXIRQMODE | \
45 S3C2410_UCON_RXIRQMODE | \
46 S3C2410_UCON_RXFIFO_TOI | \
47 S3C2443_UCON_RXERR_IRQEN)
49 #define AQUILA_ULCON_DEFAULT S3C2410_LCON_CS8
51 #define AQUILA_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
53 static struct s3c2410_uartcfg aquila_uartcfgs[] __initdata = {
57 .ucon = AQUILA_UCON_DEFAULT,
58 .ulcon = AQUILA_ULCON_DEFAULT,
60 * Actually UART0 can support 256 bytes fifo, but aquila board
61 * supports 128 bytes fifo because of initial chip bug
63 .ufcon = AQUILA_UFCON_DEFAULT |
64 S5PV210_UFCON_TXTRIG128 | S5PV210_UFCON_RXTRIG128,
69 .ucon = AQUILA_UCON_DEFAULT,
70 .ulcon = AQUILA_ULCON_DEFAULT,
71 .ufcon = AQUILA_UFCON_DEFAULT |
72 S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
77 .ucon = AQUILA_UCON_DEFAULT,
78 .ulcon = AQUILA_ULCON_DEFAULT,
79 .ufcon = AQUILA_UFCON_DEFAULT |
80 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
85 .ucon = AQUILA_UCON_DEFAULT,
86 .ulcon = AQUILA_ULCON_DEFAULT,
87 .ufcon = AQUILA_UFCON_DEFAULT |
88 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
93 static struct s3c_fb_pd_win aquila_fb_win0 = {
108 static struct s3c_fb_pd_win aquila_fb_win1 = {
123 static struct s3c_fb_platdata aquila_lcd_pdata __initdata = {
124 .win[0] = &aquila_fb_win0,
125 .win[1] = &aquila_fb_win1,
126 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
127 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
128 VIDCON1_INV_VCLK | VIDCON1_INV_VDEN,
129 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
132 /* MAX8998 regulators */
133 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
135 static struct regulator_init_data aquila_ldo2_data = {
137 .name = "VALIVE_1.1V",
148 static struct regulator_init_data aquila_ldo3_data = {
150 .name = "VUSB/MIPI_1.1V",
158 static struct regulator_init_data aquila_ldo4_data = {
167 static struct regulator_init_data aquila_ldo5_data = {
176 static struct regulator_init_data aquila_ldo6_data = {
185 static struct regulator_init_data aquila_ldo7_data = {
196 static struct regulator_init_data aquila_ldo8_data = {
198 .name = "VUSB/VADC_3.3V",
206 static struct regulator_init_data aquila_ldo9_data = {
208 .name = "VCC/VCAM_2.8V",
216 static struct regulator_init_data aquila_ldo10_data = {
226 static struct regulator_init_data aquila_ldo11_data = {
228 .name = "CAM_IO_2.8V",
236 static struct regulator_init_data aquila_ldo12_data = {
238 .name = "CAM_ISP_1.2V",
246 static struct regulator_init_data aquila_ldo13_data = {
248 .name = "CAM_A_2.8V",
256 static struct regulator_init_data aquila_ldo14_data = {
258 .name = "CAM_CIF_1.8V",
266 static struct regulator_init_data aquila_ldo15_data = {
268 .name = "CAM_AF_3.3V",
276 static struct regulator_init_data aquila_ldo16_data = {
278 .name = "VMIPI_1.8V",
286 static struct regulator_init_data aquila_ldo17_data = {
288 .name = "CAM_8M_1.8V",
297 static struct regulator_consumer_supply buck1_consumer[] = {
298 { .supply = "vddarm", },
301 static struct regulator_consumer_supply buck2_consumer[] = {
302 { .supply = "vddint", },
305 static struct regulator_init_data aquila_buck1_data = {
311 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
312 REGULATOR_CHANGE_STATUS,
314 .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
315 .consumer_supplies = buck1_consumer,
318 static struct regulator_init_data aquila_buck2_data = {
324 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
325 REGULATOR_CHANGE_STATUS,
327 .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
328 .consumer_supplies = buck2_consumer,
331 static struct regulator_init_data aquila_buck3_data = {
343 static struct regulator_init_data aquila_buck4_data = {
345 .name = "CAM_CORE_1.2V",
353 static struct max8998_regulator_data aquila_regulators[] = {
354 { MAX8998_LDO2, &aquila_ldo2_data },
355 { MAX8998_LDO3, &aquila_ldo3_data },
356 { MAX8998_LDO4, &aquila_ldo4_data },
357 { MAX8998_LDO5, &aquila_ldo5_data },
358 { MAX8998_LDO6, &aquila_ldo6_data },
359 { MAX8998_LDO7, &aquila_ldo7_data },
360 { MAX8998_LDO8, &aquila_ldo8_data },
361 { MAX8998_LDO9, &aquila_ldo9_data },
362 { MAX8998_LDO10, &aquila_ldo10_data },
363 { MAX8998_LDO11, &aquila_ldo11_data },
364 { MAX8998_LDO12, &aquila_ldo12_data },
365 { MAX8998_LDO13, &aquila_ldo13_data },
366 { MAX8998_LDO14, &aquila_ldo14_data },
367 { MAX8998_LDO15, &aquila_ldo15_data },
368 { MAX8998_LDO16, &aquila_ldo16_data },
369 { MAX8998_LDO17, &aquila_ldo17_data },
370 { MAX8998_BUCK1, &aquila_buck1_data },
371 { MAX8998_BUCK2, &aquila_buck2_data },
372 { MAX8998_BUCK3, &aquila_buck3_data },
373 { MAX8998_BUCK4, &aquila_buck4_data },
376 static struct max8998_platform_data aquila_max8998_pdata = {
377 .num_regulators = ARRAY_SIZE(aquila_regulators),
378 .regulators = aquila_regulators,
383 #define AP_I2C_GPIO_PMIC_BUS_4 4
384 static struct i2c_gpio_platform_data aquila_i2c_gpio_pmic_data = {
385 .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
386 .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
389 static struct platform_device aquila_i2c_gpio_pmic = {
391 .id = AP_I2C_GPIO_PMIC_BUS_4,
393 .platform_data = &aquila_i2c_gpio_pmic_data,
397 static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
398 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
400 /* 0xCC when SRAD = 0 */
401 I2C_BOARD_INFO("max8998", 0xCC >> 1),
402 .platform_data = &aquila_max8998_pdata,
407 /* PMIC Power button */
408 static struct gpio_keys_button aquila_gpio_keys_table[] = {
411 .gpio = S5PV210_GPH2(6),
412 .desc = "gpio-keys: KEY_POWER",
416 .debounce_interval = 1,
420 static struct gpio_keys_platform_data aquila_gpio_keys_data = {
421 .buttons = aquila_gpio_keys_table,
422 .nbuttons = ARRAY_SIZE(aquila_gpio_keys_table),
425 static struct platform_device aquila_device_gpiokeys = {
428 .platform_data = &aquila_gpio_keys_data,
432 static void __init aquila_pmic_init(void)
434 /* AP_PMIC_IRQ: EINT7 */
435 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
436 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
439 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
440 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
444 static struct s3c_sdhci_platdata aquila_hsmmc0_data __initdata = {
446 .cd_type = S3C_SDHCI_CD_PERMANENT,
450 static struct s3c_sdhci_platdata aquila_hsmmc1_data __initdata = {
452 .cd_type = S3C_SDHCI_CD_EXTERNAL,
453 /* ext_cd_{init,cleanup} callbacks will be added later */
457 #define AQUILA_EXT_FLASH_EN S5PV210_MP05(4)
458 #define AQUILA_EXT_FLASH_CD S5PV210_GPH3(4)
459 static struct s3c_sdhci_platdata aquila_hsmmc2_data __initdata = {
461 .cd_type = S3C_SDHCI_CD_GPIO,
462 .ext_cd_gpio = AQUILA_EXT_FLASH_CD,
463 .ext_cd_gpio_invert = 1,
466 static void aquila_setup_sdhci(void)
468 gpio_request(AQUILA_EXT_FLASH_EN, "FLASH_EN");
469 gpio_direction_output(AQUILA_EXT_FLASH_EN, 1);
471 s3c_sdhci0_set_platdata(&aquila_hsmmc0_data);
472 s3c_sdhci1_set_platdata(&aquila_hsmmc1_data);
473 s3c_sdhci2_set_platdata(&aquila_hsmmc2_data);
476 static struct platform_device *aquila_devices[] __initdata = {
477 &aquila_i2c_gpio_pmic,
478 &aquila_device_gpiokeys,
480 &s5pc110_device_onenand,
489 static void __init aquila_map_io(void)
491 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
492 s3c24xx_init_clocks(24000000);
493 s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
496 static void __init aquila_machine_init(void)
500 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
501 ARRAY_SIZE(i2c_gpio_pmic_devs));
503 aquila_setup_sdhci();
505 s3c_fimc_setname(0, "s5p-fimc");
506 s3c_fimc_setname(1, "s5p-fimc");
507 s3c_fimc_setname(2, "s5p-fimc");
510 s3c_fb_set_platdata(&aquila_lcd_pdata);
512 platform_add_devices(aquila_devices, ARRAY_SIZE(aquila_devices));
515 MACHINE_START(AQUILA, "Aquila")
517 Marek Szyprowski <m.szyprowski@samsung.com>
518 Kyungmin Park <kyungmin.park@samsung.com> */
519 .phys_io = S3C_PA_UART & 0xfff00000,
520 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
521 .boot_params = S5P_PA_SDRAM + 0x100,
522 .init_irq = s5pv210_init_irq,
523 .map_io = aquila_map_io,
524 .init_machine = aquila_machine_init,
525 .timer = &s3c24xx_timer,