1 /* linux/arch/arm/mach-s5pv210/mach-goni.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/sdhci.h>
40 /* Following are default values for UCON, ULCON and UFCON UART registers */
41 #define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
42 S3C2410_UCON_RXILEVEL | \
43 S3C2410_UCON_TXIRQMODE | \
44 S3C2410_UCON_RXIRQMODE | \
45 S3C2410_UCON_RXFIFO_TOI | \
46 S3C2443_UCON_RXERR_IRQEN)
48 #define GONI_ULCON_DEFAULT S3C2410_LCON_CS8
50 #define GONI_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
52 static struct s3c2410_uartcfg goni_uartcfgs
[] __initdata
= {
56 .ucon
= GONI_UCON_DEFAULT
,
57 .ulcon
= GONI_ULCON_DEFAULT
,
58 .ufcon
= GONI_UFCON_DEFAULT
|
59 S5PV210_UFCON_TXTRIG256
| S5PV210_UFCON_RXTRIG256
,
64 .ucon
= GONI_UCON_DEFAULT
,
65 .ulcon
= GONI_ULCON_DEFAULT
,
66 .ufcon
= GONI_UFCON_DEFAULT
|
67 S5PV210_UFCON_TXTRIG64
| S5PV210_UFCON_RXTRIG64
,
72 .ucon
= GONI_UCON_DEFAULT
,
73 .ulcon
= GONI_ULCON_DEFAULT
,
74 .ufcon
= GONI_UFCON_DEFAULT
|
75 S5PV210_UFCON_TXTRIG16
| S5PV210_UFCON_RXTRIG16
,
80 .ucon
= GONI_UCON_DEFAULT
,
81 .ulcon
= GONI_ULCON_DEFAULT
,
82 .ufcon
= GONI_UFCON_DEFAULT
|
83 S5PV210_UFCON_TXTRIG16
| S5PV210_UFCON_RXTRIG16
,
88 static struct s3c_fb_pd_win goni_fb_win0
= {
90 .pixclock
= 1000000000000ULL / ((16+16+2+480)*(28+3+2+800)*55),
105 static struct s3c_fb_platdata goni_lcd_pdata __initdata
= {
106 .win
[0] = &goni_fb_win0
,
107 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
|
109 .vidcon1
= VIDCON1_INV_VCLK
| VIDCON1_INV_VDEN
110 | VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
,
111 .setup_gpio
= s5pv210_fb_gpio_setup_24bpp
,
114 /* MAX8998 regulators */
115 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
117 static struct regulator_init_data goni_ldo2_data
= {
119 .name
= "VALIVE_1.1V",
130 static struct regulator_init_data goni_ldo3_data
= {
132 .name
= "VUSB/MIPI_1.1V",
140 static struct regulator_init_data goni_ldo4_data
= {
149 static struct regulator_init_data goni_ldo5_data
= {
158 static struct regulator_init_data goni_ldo6_data
= {
167 static struct regulator_init_data goni_ldo7_data
= {
177 static struct regulator_init_data goni_ldo8_data
= {
179 .name
= "VUSB/VADC_3.3V",
187 static struct regulator_init_data goni_ldo9_data
= {
189 .name
= "VCC/VCAM_2.8V",
197 static struct regulator_init_data goni_ldo10_data
= {
207 static struct regulator_init_data goni_ldo11_data
= {
209 .name
= "CAM_IO_2.8V",
217 static struct regulator_init_data goni_ldo12_data
= {
219 .name
= "CAM_ISP_1.2V",
227 static struct regulator_init_data goni_ldo13_data
= {
229 .name
= "CAM_A_2.8V",
237 static struct regulator_init_data goni_ldo14_data
= {
239 .name
= "CAM_CIF_1.8V",
247 static struct regulator_init_data goni_ldo15_data
= {
249 .name
= "CAM_AF_3.3V",
257 static struct regulator_init_data goni_ldo16_data
= {
259 .name
= "VMIPI_1.8V",
267 static struct regulator_init_data goni_ldo17_data
= {
269 .name
= "VCC_3.0V_LCD",
278 static struct regulator_consumer_supply buck1_consumer
[] = {
279 { .supply
= "vddarm", },
282 static struct regulator_consumer_supply buck2_consumer
[] = {
283 { .supply
= "vddint", },
286 static struct regulator_init_data goni_buck1_data
= {
292 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
293 REGULATOR_CHANGE_STATUS
,
295 .num_consumer_supplies
= ARRAY_SIZE(buck1_consumer
),
296 .consumer_supplies
= buck1_consumer
,
299 static struct regulator_init_data goni_buck2_data
= {
305 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
306 REGULATOR_CHANGE_STATUS
,
308 .num_consumer_supplies
= ARRAY_SIZE(buck2_consumer
),
309 .consumer_supplies
= buck2_consumer
,
312 static struct regulator_init_data goni_buck3_data
= {
324 static struct regulator_init_data goni_buck4_data
= {
326 .name
= "CAM_CORE_1.2V",
334 static struct max8998_regulator_data goni_regulators
[] = {
335 { MAX8998_LDO2
, &goni_ldo2_data
},
336 { MAX8998_LDO3
, &goni_ldo3_data
},
337 { MAX8998_LDO4
, &goni_ldo4_data
},
338 { MAX8998_LDO5
, &goni_ldo5_data
},
339 { MAX8998_LDO6
, &goni_ldo6_data
},
340 { MAX8998_LDO7
, &goni_ldo7_data
},
341 { MAX8998_LDO8
, &goni_ldo8_data
},
342 { MAX8998_LDO9
, &goni_ldo9_data
},
343 { MAX8998_LDO10
, &goni_ldo10_data
},
344 { MAX8998_LDO11
, &goni_ldo11_data
},
345 { MAX8998_LDO12
, &goni_ldo12_data
},
346 { MAX8998_LDO13
, &goni_ldo13_data
},
347 { MAX8998_LDO14
, &goni_ldo14_data
},
348 { MAX8998_LDO15
, &goni_ldo15_data
},
349 { MAX8998_LDO16
, &goni_ldo16_data
},
350 { MAX8998_LDO17
, &goni_ldo17_data
},
351 { MAX8998_BUCK1
, &goni_buck1_data
},
352 { MAX8998_BUCK2
, &goni_buck2_data
},
353 { MAX8998_BUCK3
, &goni_buck3_data
},
354 { MAX8998_BUCK4
, &goni_buck4_data
},
357 static struct max8998_platform_data goni_max8998_pdata
= {
358 .num_regulators
= ARRAY_SIZE(goni_regulators
),
359 .regulators
= goni_regulators
,
364 #define AP_I2C_GPIO_PMIC_BUS_4 4
365 static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data
= {
366 .sda_pin
= S5PV210_GPJ4(0), /* XMSMCSN */
367 .scl_pin
= S5PV210_GPJ4(3), /* XMSMIRQN */
370 static struct platform_device goni_i2c_gpio_pmic
= {
372 .id
= AP_I2C_GPIO_PMIC_BUS_4
,
374 .platform_data
= &goni_i2c_gpio_pmic_data
,
378 static struct i2c_board_info i2c_gpio_pmic_devs
[] __initdata
= {
379 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
381 /* 0xCC when SRAD = 0 */
382 I2C_BOARD_INFO("max8998", 0xCC >> 1),
383 .platform_data
= &goni_max8998_pdata
,
388 /* PMIC Power button */
389 static struct gpio_keys_button goni_gpio_keys_table
[] = {
392 .gpio
= S5PV210_GPH2(6),
393 .desc
= "gpio-keys: KEY_POWER",
397 .debounce_interval
= 1,
401 static struct gpio_keys_platform_data goni_gpio_keys_data
= {
402 .buttons
= goni_gpio_keys_table
,
403 .nbuttons
= ARRAY_SIZE(goni_gpio_keys_table
),
406 static struct platform_device goni_device_gpiokeys
= {
409 .platform_data
= &goni_gpio_keys_data
,
413 static void __init
goni_pmic_init(void)
415 /* AP_PMIC_IRQ: EINT7 */
416 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
417 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP
);
420 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
421 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP
);
425 static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata
= {
427 .cd_type
= S3C_SDHCI_CD_PERMANENT
,
431 static struct s3c_sdhci_platdata goni_hsmmc1_data __initdata
= {
433 .cd_type
= S3C_SDHCI_CD_EXTERNAL
,
434 /* ext_cd_{init,cleanup} callbacks will be added later */
438 #define GONI_EXT_FLASH_EN S5PV210_MP05(4)
439 #define GONI_EXT_FLASH_CD S5PV210_GPH3(4)
440 static struct s3c_sdhci_platdata goni_hsmmc2_data __initdata
= {
442 .cd_type
= S3C_SDHCI_CD_GPIO
,
443 .ext_cd_gpio
= GONI_EXT_FLASH_CD
,
444 .ext_cd_gpio_invert
= 1,
447 static void goni_setup_sdhci(void)
449 gpio_request(GONI_EXT_FLASH_EN
, "FLASH_EN");
450 gpio_direction_output(GONI_EXT_FLASH_EN
, 1);
452 s3c_sdhci0_set_platdata(&goni_hsmmc0_data
);
453 s3c_sdhci1_set_platdata(&goni_hsmmc1_data
);
454 s3c_sdhci2_set_platdata(&goni_hsmmc2_data
);
457 static struct platform_device
*goni_devices
[] __initdata
= {
459 &s5pc110_device_onenand
,
461 &goni_device_gpiokeys
,
470 static void __init
goni_map_io(void)
472 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
473 s3c24xx_init_clocks(24000000);
474 s3c24xx_init_uarts(goni_uartcfgs
, ARRAY_SIZE(goni_uartcfgs
));
477 static void __init
goni_machine_init(void)
481 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4
, i2c_gpio_pmic_devs
,
482 ARRAY_SIZE(i2c_gpio_pmic_devs
));
487 s3c_fb_set_platdata(&goni_lcd_pdata
);
489 platform_add_devices(goni_devices
, ARRAY_SIZE(goni_devices
));
492 MACHINE_START(GONI
, "GONI")
493 /* Maintainers: Kyungmin Park <kyungmin.park@samsung.com> */
494 .phys_io
= S3C_PA_UART
& 0xfff00000,
495 .io_pg_offst
= (((u32
)S3C_VA_UART
) >> 18) & 0xfffc,
496 .boot_params
= S5P_PA_SDRAM
+ 0x100,
497 .init_irq
= s5pv210_init_irq
,
498 .map_io
= goni_map_io
,
499 .init_machine
= goni_machine_init
,
500 .timer
= &s3c24xx_timer
,