ARM: S5PV210: fb setup for GONI - remove pixel clock
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-s5pv210 / mach-goni.c
blobb0ae20889a3a33a7416bc058f1498fbcc8f1bfdd
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.
9 */
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/init.h>
14 #include <linux/serial_core.h>
15 #include <linux/fb.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>
28 #include <mach/map.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>
36 #include <plat/cpu.h>
37 #include <plat/fb.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 = {
54 [0] = {
55 .hwport = 0,
56 .flags = 0,
57 .ucon = GONI_UCON_DEFAULT,
58 .ulcon = GONI_ULCON_DEFAULT,
59 .ufcon = GONI_UFCON_DEFAULT |
60 S5PV210_UFCON_TXTRIG256 | S5PV210_UFCON_RXTRIG256,
62 [1] = {
63 .hwport = 1,
64 .flags = 0,
65 .ucon = GONI_UCON_DEFAULT,
66 .ulcon = GONI_ULCON_DEFAULT,
67 .ufcon = GONI_UFCON_DEFAULT |
68 S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
70 [2] = {
71 .hwport = 2,
72 .flags = 0,
73 .ucon = GONI_UCON_DEFAULT,
74 .ulcon = GONI_ULCON_DEFAULT,
75 .ufcon = GONI_UFCON_DEFAULT |
76 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
78 [3] = {
79 .hwport = 3,
80 .flags = 0,
81 .ucon = GONI_UCON_DEFAULT,
82 .ulcon = GONI_ULCON_DEFAULT,
83 .ufcon = GONI_UFCON_DEFAULT |
84 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
88 /* Frame Buffer */
89 static struct s3c_fb_pd_win goni_fb_win0 = {
90 .win_mode = {
91 .left_margin = 16,
92 .right_margin = 16,
93 .upper_margin = 2,
94 .lower_margin = 28,
95 .hsync_len = 2,
96 .vsync_len = 1,
97 .xres = 480,
98 .yres = 800,
99 .refresh = 55,
101 .max_bpp = 32,
102 .default_bpp = 16,
105 static struct s3c_fb_platdata goni_lcd_pdata __initdata = {
106 .win[0] = &goni_fb_win0,
107 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
108 VIDCON0_CLKSEL_LCD,
109 .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
110 | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
111 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
114 /* KEYPAD */
115 static uint32_t keymap[] __initdata = {
116 /* KEY(row, col, keycode) */
117 KEY(0, 1, KEY_MENU), /* Send */
118 KEY(0, 2, KEY_BACK), /* End */
119 KEY(1, 1, KEY_CONFIG), /* Half shot */
120 KEY(1, 2, KEY_VOLUMEUP),
121 KEY(2, 1, KEY_CAMERA), /* Full shot */
122 KEY(2, 2, KEY_VOLUMEDOWN),
125 static struct matrix_keymap_data keymap_data __initdata = {
126 .keymap = keymap,
127 .keymap_size = ARRAY_SIZE(keymap),
130 static struct samsung_keypad_platdata keypad_data __initdata = {
131 .keymap_data = &keymap_data,
132 .rows = 3,
133 .cols = 3,
136 /* MAX8998 regulators */
137 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
139 static struct regulator_init_data goni_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,
152 static struct regulator_init_data goni_ldo3_data = {
153 .constraints = {
154 .name = "VUSB/MIPI_1.1V",
155 .min_uV = 1100000,
156 .max_uV = 1100000,
157 .apply_uV = 1,
158 .always_on = 1,
162 static struct regulator_init_data goni_ldo4_data = {
163 .constraints = {
164 .name = "VDAC_3.3V",
165 .min_uV = 3300000,
166 .max_uV = 3300000,
167 .apply_uV = 1,
171 static struct regulator_init_data goni_ldo5_data = {
172 .constraints = {
173 .name = "VTF_2.8V",
174 .min_uV = 2800000,
175 .max_uV = 2800000,
176 .apply_uV = 1,
180 static struct regulator_init_data goni_ldo6_data = {
181 .constraints = {
182 .name = "VCC_3.3V",
183 .min_uV = 3300000,
184 .max_uV = 3300000,
185 .apply_uV = 1,
189 static struct regulator_init_data goni_ldo7_data = {
190 .constraints = {
191 .name = "VLCD_1.8V",
192 .min_uV = 1800000,
193 .max_uV = 1800000,
194 .apply_uV = 1,
195 .always_on = 1,
199 static struct regulator_init_data goni_ldo8_data = {
200 .constraints = {
201 .name = "VUSB/VADC_3.3V",
202 .min_uV = 3300000,
203 .max_uV = 3300000,
204 .apply_uV = 1,
205 .always_on = 1,
209 static struct regulator_init_data goni_ldo9_data = {
210 .constraints = {
211 .name = "VCC/VCAM_2.8V",
212 .min_uV = 2800000,
213 .max_uV = 2800000,
214 .apply_uV = 1,
215 .always_on = 1,
219 static struct regulator_init_data goni_ldo10_data = {
220 .constraints = {
221 .name = "VPLL_1.1V",
222 .min_uV = 1100000,
223 .max_uV = 1100000,
224 .apply_uV = 1,
225 .boot_on = 1,
229 static struct regulator_init_data goni_ldo11_data = {
230 .constraints = {
231 .name = "CAM_IO_2.8V",
232 .min_uV = 2800000,
233 .max_uV = 2800000,
234 .apply_uV = 1,
235 .always_on = 1,
239 static struct regulator_init_data goni_ldo12_data = {
240 .constraints = {
241 .name = "CAM_ISP_1.2V",
242 .min_uV = 1200000,
243 .max_uV = 1200000,
244 .apply_uV = 1,
245 .always_on = 1,
249 static struct regulator_init_data goni_ldo13_data = {
250 .constraints = {
251 .name = "CAM_A_2.8V",
252 .min_uV = 2800000,
253 .max_uV = 2800000,
254 .apply_uV = 1,
255 .always_on = 1,
259 static struct regulator_init_data goni_ldo14_data = {
260 .constraints = {
261 .name = "CAM_CIF_1.8V",
262 .min_uV = 1800000,
263 .max_uV = 1800000,
264 .apply_uV = 1,
265 .always_on = 1,
269 static struct regulator_init_data goni_ldo15_data = {
270 .constraints = {
271 .name = "CAM_AF_3.3V",
272 .min_uV = 3300000,
273 .max_uV = 3300000,
274 .apply_uV = 1,
275 .always_on = 1,
279 static struct regulator_init_data goni_ldo16_data = {
280 .constraints = {
281 .name = "VMIPI_1.8V",
282 .min_uV = 1800000,
283 .max_uV = 1800000,
284 .apply_uV = 1,
285 .always_on = 1,
289 static struct regulator_init_data goni_ldo17_data = {
290 .constraints = {
291 .name = "VCC_3.0V_LCD",
292 .min_uV = 3000000,
293 .max_uV = 3000000,
294 .apply_uV = 1,
295 .always_on = 1,
299 /* BUCK */
300 static struct regulator_consumer_supply buck1_consumer[] = {
301 { .supply = "vddarm", },
304 static struct regulator_consumer_supply buck2_consumer[] = {
305 { .supply = "vddint", },
308 static struct regulator_init_data goni_buck1_data = {
309 .constraints = {
310 .name = "VARM_1.2V",
311 .min_uV = 1200000,
312 .max_uV = 1200000,
313 .apply_uV = 1,
314 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
315 REGULATOR_CHANGE_STATUS,
317 .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
318 .consumer_supplies = buck1_consumer,
321 static struct regulator_init_data goni_buck2_data = {
322 .constraints = {
323 .name = "VINT_1.2V",
324 .min_uV = 1200000,
325 .max_uV = 1200000,
326 .apply_uV = 1,
327 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
328 REGULATOR_CHANGE_STATUS,
330 .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
331 .consumer_supplies = buck2_consumer,
334 static struct regulator_init_data goni_buck3_data = {
335 .constraints = {
336 .name = "VCC_1.8V",
337 .min_uV = 1800000,
338 .max_uV = 1800000,
339 .apply_uV = 1,
340 .state_mem = {
341 .enabled = 1,
346 static struct regulator_init_data goni_buck4_data = {
347 .constraints = {
348 .name = "CAM_CORE_1.2V",
349 .min_uV = 1200000,
350 .max_uV = 1200000,
351 .apply_uV = 1,
352 .always_on = 1,
356 static struct max8998_regulator_data goni_regulators[] = {
357 { MAX8998_LDO2, &goni_ldo2_data },
358 { MAX8998_LDO3, &goni_ldo3_data },
359 { MAX8998_LDO4, &goni_ldo4_data },
360 { MAX8998_LDO5, &goni_ldo5_data },
361 { MAX8998_LDO6, &goni_ldo6_data },
362 { MAX8998_LDO7, &goni_ldo7_data },
363 { MAX8998_LDO8, &goni_ldo8_data },
364 { MAX8998_LDO9, &goni_ldo9_data },
365 { MAX8998_LDO10, &goni_ldo10_data },
366 { MAX8998_LDO11, &goni_ldo11_data },
367 { MAX8998_LDO12, &goni_ldo12_data },
368 { MAX8998_LDO13, &goni_ldo13_data },
369 { MAX8998_LDO14, &goni_ldo14_data },
370 { MAX8998_LDO15, &goni_ldo15_data },
371 { MAX8998_LDO16, &goni_ldo16_data },
372 { MAX8998_LDO17, &goni_ldo17_data },
373 { MAX8998_BUCK1, &goni_buck1_data },
374 { MAX8998_BUCK2, &goni_buck2_data },
375 { MAX8998_BUCK3, &goni_buck3_data },
376 { MAX8998_BUCK4, &goni_buck4_data },
379 static struct max8998_platform_data goni_max8998_pdata = {
380 .num_regulators = ARRAY_SIZE(goni_regulators),
381 .regulators = goni_regulators,
383 #endif
385 /* GPIO I2C PMIC */
386 #define AP_I2C_GPIO_PMIC_BUS_4 4
387 static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = {
388 .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
389 .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
392 static struct platform_device goni_i2c_gpio_pmic = {
393 .name = "i2c-gpio",
394 .id = AP_I2C_GPIO_PMIC_BUS_4,
395 .dev = {
396 .platform_data = &goni_i2c_gpio_pmic_data,
400 static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
401 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
403 /* 0xCC when SRAD = 0 */
404 I2C_BOARD_INFO("max8998", 0xCC >> 1),
405 .platform_data = &goni_max8998_pdata,
407 #endif
410 /* PMIC Power button */
411 static struct gpio_keys_button goni_gpio_keys_table[] = {
413 .code = KEY_POWER,
414 .gpio = S5PV210_GPH2(6),
415 .desc = "gpio-keys: KEY_POWER",
416 .type = EV_KEY,
417 .active_low = 1,
418 .wakeup = 1,
419 .debounce_interval = 1,
423 static struct gpio_keys_platform_data goni_gpio_keys_data = {
424 .buttons = goni_gpio_keys_table,
425 .nbuttons = ARRAY_SIZE(goni_gpio_keys_table),
428 static struct platform_device goni_device_gpiokeys = {
429 .name = "gpio-keys",
430 .dev = {
431 .platform_data = &goni_gpio_keys_data,
435 static void __init goni_pmic_init(void)
437 /* AP_PMIC_IRQ: EINT7 */
438 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
439 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
441 /* nPower: EINT22 */
442 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
443 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
446 /* MoviNAND */
447 static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = {
448 .max_width = 4,
449 .cd_type = S3C_SDHCI_CD_PERMANENT,
452 /* Wireless LAN */
453 static struct s3c_sdhci_platdata goni_hsmmc1_data __initdata = {
454 .max_width = 4,
455 .cd_type = S3C_SDHCI_CD_EXTERNAL,
456 /* ext_cd_{init,cleanup} callbacks will be added later */
459 /* External Flash */
460 #define GONI_EXT_FLASH_EN S5PV210_MP05(4)
461 #define GONI_EXT_FLASH_CD S5PV210_GPH3(4)
462 static struct s3c_sdhci_platdata goni_hsmmc2_data __initdata = {
463 .max_width = 4,
464 .cd_type = S3C_SDHCI_CD_GPIO,
465 .ext_cd_gpio = GONI_EXT_FLASH_CD,
466 .ext_cd_gpio_invert = 1,
469 static void goni_setup_sdhci(void)
471 gpio_request(GONI_EXT_FLASH_EN, "FLASH_EN");
472 gpio_direction_output(GONI_EXT_FLASH_EN, 1);
474 s3c_sdhci0_set_platdata(&goni_hsmmc0_data);
475 s3c_sdhci1_set_platdata(&goni_hsmmc1_data);
476 s3c_sdhci2_set_platdata(&goni_hsmmc2_data);
479 static struct platform_device *goni_devices[] __initdata = {
480 &s3c_device_fb,
481 &s5p_device_onenand,
482 &goni_i2c_gpio_pmic,
483 &goni_device_gpiokeys,
484 &s5p_device_fimc0,
485 &s5p_device_fimc1,
486 &s5p_device_fimc2,
487 &s3c_device_hsmmc0,
488 &s3c_device_hsmmc1,
489 &s3c_device_hsmmc2,
490 &samsung_device_keypad,
493 static void __init goni_map_io(void)
495 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
496 s3c24xx_init_clocks(24000000);
497 s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
500 static void __init goni_machine_init(void)
502 /* PMIC */
503 goni_pmic_init();
504 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
505 ARRAY_SIZE(i2c_gpio_pmic_devs));
506 /* SDHCI */
507 goni_setup_sdhci();
509 /* FB */
510 s3c_fb_set_platdata(&goni_lcd_pdata);
512 /* KEYPAD */
513 samsung_keypad_set_platdata(&keypad_data);
515 platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices));
518 MACHINE_START(GONI, "GONI")
519 /* Maintainers: Kyungmin Park <kyungmin.park@samsung.com> */
520 .phys_io = S3C_PA_UART & 0xfff00000,
521 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
522 .boot_params = S5P_PA_SDRAM + 0x100,
523 .init_irq = s5pv210_init_irq,
524 .map_io = goni_map_io,
525 .init_machine = goni_machine_init,
526 .timer = &s3c24xx_timer,
527 MACHINE_END