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/keypad.h>
39 #include <plat/sdhci.h>
41 /* Following are default values for UCON, ULCON and UFCON UART registers */
42 #define GONI_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 GONI_ULCON_DEFAULT S3C2410_LCON_CS8
51 #define GONI_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
53 static struct s3c2410_uartcfg goni_uartcfgs
[] __initdata
= {
57 .ucon
= GONI_UCON_DEFAULT
,
58 .ulcon
= GONI_ULCON_DEFAULT
,
59 .ufcon
= GONI_UFCON_DEFAULT
|
60 S5PV210_UFCON_TXTRIG256
| S5PV210_UFCON_RXTRIG256
,
65 .ucon
= GONI_UCON_DEFAULT
,
66 .ulcon
= GONI_ULCON_DEFAULT
,
67 .ufcon
= GONI_UFCON_DEFAULT
|
68 S5PV210_UFCON_TXTRIG64
| S5PV210_UFCON_RXTRIG64
,
73 .ucon
= GONI_UCON_DEFAULT
,
74 .ulcon
= GONI_ULCON_DEFAULT
,
75 .ufcon
= GONI_UFCON_DEFAULT
|
76 S5PV210_UFCON_TXTRIG16
| S5PV210_UFCON_RXTRIG16
,
81 .ucon
= GONI_UCON_DEFAULT
,
82 .ulcon
= GONI_ULCON_DEFAULT
,
83 .ufcon
= GONI_UFCON_DEFAULT
|
84 S5PV210_UFCON_TXTRIG16
| S5PV210_UFCON_RXTRIG16
,
89 static struct s3c_fb_pd_win goni_fb_win0
= {
91 .pixclock
= 1000000000000ULL / ((16+16+2+480)*(28+3+2+800)*55),
106 static struct s3c_fb_platdata goni_lcd_pdata __initdata
= {
107 .win
[0] = &goni_fb_win0
,
108 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
|
110 .vidcon1
= VIDCON1_INV_VCLK
| VIDCON1_INV_VDEN
111 | VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
,
112 .setup_gpio
= s5pv210_fb_gpio_setup_24bpp
,
116 static uint32_t keymap
[] __initdata
= {
117 /* KEY(row, col, keycode) */
118 KEY(0, 1, KEY_MENU
), /* Send */
119 KEY(0, 2, KEY_BACK
), /* End */
120 KEY(1, 1, KEY_CONFIG
), /* Half shot */
121 KEY(1, 2, KEY_VOLUMEUP
),
122 KEY(2, 1, KEY_CAMERA
), /* Full shot */
123 KEY(2, 2, KEY_VOLUMEDOWN
),
126 static struct matrix_keymap_data keymap_data __initdata
= {
128 .keymap_size
= ARRAY_SIZE(keymap
),
131 static struct samsung_keypad_platdata keypad_data __initdata
= {
132 .keymap_data
= &keymap_data
,
137 /* MAX8998 regulators */
138 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
140 static struct regulator_init_data goni_ldo2_data
= {
142 .name
= "VALIVE_1.1V",
153 static struct regulator_init_data goni_ldo3_data
= {
155 .name
= "VUSB/MIPI_1.1V",
163 static struct regulator_init_data goni_ldo4_data
= {
172 static struct regulator_init_data goni_ldo5_data
= {
181 static struct regulator_init_data goni_ldo6_data
= {
190 static struct regulator_init_data goni_ldo7_data
= {
200 static struct regulator_init_data goni_ldo8_data
= {
202 .name
= "VUSB/VADC_3.3V",
210 static struct regulator_init_data goni_ldo9_data
= {
212 .name
= "VCC/VCAM_2.8V",
220 static struct regulator_init_data goni_ldo10_data
= {
230 static struct regulator_init_data goni_ldo11_data
= {
232 .name
= "CAM_IO_2.8V",
240 static struct regulator_init_data goni_ldo12_data
= {
242 .name
= "CAM_ISP_1.2V",
250 static struct regulator_init_data goni_ldo13_data
= {
252 .name
= "CAM_A_2.8V",
260 static struct regulator_init_data goni_ldo14_data
= {
262 .name
= "CAM_CIF_1.8V",
270 static struct regulator_init_data goni_ldo15_data
= {
272 .name
= "CAM_AF_3.3V",
280 static struct regulator_init_data goni_ldo16_data
= {
282 .name
= "VMIPI_1.8V",
290 static struct regulator_init_data goni_ldo17_data
= {
292 .name
= "VCC_3.0V_LCD",
301 static struct regulator_consumer_supply buck1_consumer
[] = {
302 { .supply
= "vddarm", },
305 static struct regulator_consumer_supply buck2_consumer
[] = {
306 { .supply
= "vddint", },
309 static struct regulator_init_data goni_buck1_data
= {
315 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
316 REGULATOR_CHANGE_STATUS
,
318 .num_consumer_supplies
= ARRAY_SIZE(buck1_consumer
),
319 .consumer_supplies
= buck1_consumer
,
322 static struct regulator_init_data goni_buck2_data
= {
328 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
329 REGULATOR_CHANGE_STATUS
,
331 .num_consumer_supplies
= ARRAY_SIZE(buck2_consumer
),
332 .consumer_supplies
= buck2_consumer
,
335 static struct regulator_init_data goni_buck3_data
= {
347 static struct regulator_init_data goni_buck4_data
= {
349 .name
= "CAM_CORE_1.2V",
357 static struct max8998_regulator_data goni_regulators
[] = {
358 { MAX8998_LDO2
, &goni_ldo2_data
},
359 { MAX8998_LDO3
, &goni_ldo3_data
},
360 { MAX8998_LDO4
, &goni_ldo4_data
},
361 { MAX8998_LDO5
, &goni_ldo5_data
},
362 { MAX8998_LDO6
, &goni_ldo6_data
},
363 { MAX8998_LDO7
, &goni_ldo7_data
},
364 { MAX8998_LDO8
, &goni_ldo8_data
},
365 { MAX8998_LDO9
, &goni_ldo9_data
},
366 { MAX8998_LDO10
, &goni_ldo10_data
},
367 { MAX8998_LDO11
, &goni_ldo11_data
},
368 { MAX8998_LDO12
, &goni_ldo12_data
},
369 { MAX8998_LDO13
, &goni_ldo13_data
},
370 { MAX8998_LDO14
, &goni_ldo14_data
},
371 { MAX8998_LDO15
, &goni_ldo15_data
},
372 { MAX8998_LDO16
, &goni_ldo16_data
},
373 { MAX8998_LDO17
, &goni_ldo17_data
},
374 { MAX8998_BUCK1
, &goni_buck1_data
},
375 { MAX8998_BUCK2
, &goni_buck2_data
},
376 { MAX8998_BUCK3
, &goni_buck3_data
},
377 { MAX8998_BUCK4
, &goni_buck4_data
},
380 static struct max8998_platform_data goni_max8998_pdata
= {
381 .num_regulators
= ARRAY_SIZE(goni_regulators
),
382 .regulators
= goni_regulators
,
387 #define AP_I2C_GPIO_PMIC_BUS_4 4
388 static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data
= {
389 .sda_pin
= S5PV210_GPJ4(0), /* XMSMCSN */
390 .scl_pin
= S5PV210_GPJ4(3), /* XMSMIRQN */
393 static struct platform_device goni_i2c_gpio_pmic
= {
395 .id
= AP_I2C_GPIO_PMIC_BUS_4
,
397 .platform_data
= &goni_i2c_gpio_pmic_data
,
401 static struct i2c_board_info i2c_gpio_pmic_devs
[] __initdata
= {
402 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
404 /* 0xCC when SRAD = 0 */
405 I2C_BOARD_INFO("max8998", 0xCC >> 1),
406 .platform_data
= &goni_max8998_pdata
,
411 /* PMIC Power button */
412 static struct gpio_keys_button goni_gpio_keys_table
[] = {
415 .gpio
= S5PV210_GPH2(6),
416 .desc
= "gpio-keys: KEY_POWER",
420 .debounce_interval
= 1,
424 static struct gpio_keys_platform_data goni_gpio_keys_data
= {
425 .buttons
= goni_gpio_keys_table
,
426 .nbuttons
= ARRAY_SIZE(goni_gpio_keys_table
),
429 static struct platform_device goni_device_gpiokeys
= {
432 .platform_data
= &goni_gpio_keys_data
,
436 static void __init
goni_pmic_init(void)
438 /* AP_PMIC_IRQ: EINT7 */
439 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
440 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP
);
443 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
444 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP
);
448 static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata
= {
450 .cd_type
= S3C_SDHCI_CD_PERMANENT
,
454 static struct s3c_sdhci_platdata goni_hsmmc1_data __initdata
= {
456 .cd_type
= S3C_SDHCI_CD_EXTERNAL
,
457 /* ext_cd_{init,cleanup} callbacks will be added later */
461 #define GONI_EXT_FLASH_EN S5PV210_MP05(4)
462 #define GONI_EXT_FLASH_CD S5PV210_GPH3(4)
463 static struct s3c_sdhci_platdata goni_hsmmc2_data __initdata
= {
465 .cd_type
= S3C_SDHCI_CD_GPIO
,
466 .ext_cd_gpio
= GONI_EXT_FLASH_CD
,
467 .ext_cd_gpio_invert
= 1,
470 static void goni_setup_sdhci(void)
472 gpio_request(GONI_EXT_FLASH_EN
, "FLASH_EN");
473 gpio_direction_output(GONI_EXT_FLASH_EN
, 1);
475 s3c_sdhci0_set_platdata(&goni_hsmmc0_data
);
476 s3c_sdhci1_set_platdata(&goni_hsmmc1_data
);
477 s3c_sdhci2_set_platdata(&goni_hsmmc2_data
);
480 static struct platform_device
*goni_devices
[] __initdata
= {
484 &goni_device_gpiokeys
,
491 &samsung_device_keypad
,
494 static void __init
goni_map_io(void)
496 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
497 s3c24xx_init_clocks(24000000);
498 s3c24xx_init_uarts(goni_uartcfgs
, ARRAY_SIZE(goni_uartcfgs
));
501 static void __init
goni_machine_init(void)
505 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4
, i2c_gpio_pmic_devs
,
506 ARRAY_SIZE(i2c_gpio_pmic_devs
));
511 s3c_fb_set_platdata(&goni_lcd_pdata
);
514 samsung_keypad_set_platdata(&keypad_data
);
516 platform_add_devices(goni_devices
, ARRAY_SIZE(goni_devices
));
519 MACHINE_START(GONI
, "GONI")
520 /* Maintainers: Kyungmin Park <kyungmin.park@samsung.com> */
521 .phys_io
= S3C_PA_UART
& 0xfff00000,
522 .io_pg_offst
= (((u32
)S3C_VA_UART
) >> 18) & 0xfffc,
523 .boot_params
= S5P_PA_SDRAM
+ 0x100,
524 .init_irq
= s5pv210_init_irq
,
525 .map_io
= goni_map_io
,
526 .init_machine
= goni_machine_init
,
527 .timer
= &s3c24xx_timer
,