ARM: S5PV210: fb setup for GONI - remove pixel clock
[deliverable/linux.git] / arch / arm / mach-s5pv210 / mach-goni.c
CommitLineData
2e57da41
JS
1/* linux/arch/arm/mach-s5pv210/mach-goni.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>
3965fdee 15#include <linux/fb.h>
ba149f3a
MS
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>
2e57da41
JS
22
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/setup.h>
26#include <asm/mach-types.h>
27
28#include <mach/map.h>
29#include <mach/regs-clock.h>
3965fdee 30#include <mach/regs-fb.h>
2e57da41 31
ba149f3a 32#include <plat/gpio-cfg.h>
2e57da41
JS
33#include <plat/regs-serial.h>
34#include <plat/s5pv210.h>
35#include <plat/devs.h>
36#include <plat/cpu.h>
3965fdee 37#include <plat/fb.h>
2a555582 38#include <plat/keypad.h>
19b90c7c 39#include <plat/sdhci.h>
2e57da41
JS
40
41/* Following are default values for UCON, ULCON and UFCON UART registers */
c8def085 42#define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
2e57da41
JS
43 S3C2410_UCON_RXILEVEL | \
44 S3C2410_UCON_TXIRQMODE | \
45 S3C2410_UCON_RXIRQMODE | \
46 S3C2410_UCON_RXFIFO_TOI | \
47 S3C2443_UCON_RXERR_IRQEN)
48
c8def085 49#define GONI_ULCON_DEFAULT S3C2410_LCON_CS8
2e57da41 50
f2b7e3c5 51#define GONI_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
2e57da41
JS
52
53static struct s3c2410_uartcfg goni_uartcfgs[] __initdata = {
54 [0] = {
55 .hwport = 0,
56 .flags = 0,
c8def085
KK
57 .ucon = GONI_UCON_DEFAULT,
58 .ulcon = GONI_ULCON_DEFAULT,
f2b7e3c5 59 .ufcon = GONI_UFCON_DEFAULT |
bbf7b358 60 S5PV210_UFCON_TXTRIG256 | S5PV210_UFCON_RXTRIG256,
2e57da41
JS
61 },
62 [1] = {
63 .hwport = 1,
64 .flags = 0,
c8def085
KK
65 .ucon = GONI_UCON_DEFAULT,
66 .ulcon = GONI_ULCON_DEFAULT,
f2b7e3c5 67 .ufcon = GONI_UFCON_DEFAULT |
bbf7b358 68 S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
2e57da41
JS
69 },
70 [2] = {
71 .hwport = 2,
72 .flags = 0,
c8def085
KK
73 .ucon = GONI_UCON_DEFAULT,
74 .ulcon = GONI_ULCON_DEFAULT,
f2b7e3c5 75 .ufcon = GONI_UFCON_DEFAULT |
bbf7b358 76 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
2e57da41
JS
77 },
78 [3] = {
79 .hwport = 3,
80 .flags = 0,
c8def085
KK
81 .ucon = GONI_UCON_DEFAULT,
82 .ulcon = GONI_ULCON_DEFAULT,
f2b7e3c5 83 .ufcon = GONI_UFCON_DEFAULT |
bbf7b358 84 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
2e57da41
JS
85 },
86};
87
3965fdee
MS
88/* Frame Buffer */
89static struct s3c_fb_pd_win goni_fb_win0 = {
90 .win_mode = {
3965fdee
MS
91 .left_margin = 16,
92 .right_margin = 16,
9d1fc39c 93 .upper_margin = 2,
3965fdee
MS
94 .lower_margin = 28,
95 .hsync_len = 2,
9d1fc39c 96 .vsync_len = 1,
3965fdee
MS
97 .xres = 480,
98 .yres = 800,
99 .refresh = 55,
100 },
101 .max_bpp = 32,
102 .default_bpp = 16,
103};
104
105static 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,
112};
113
2a555582
JS
114/* KEYPAD */
115static 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),
123};
124
125static struct matrix_keymap_data keymap_data __initdata = {
126 .keymap = keymap,
127 .keymap_size = ARRAY_SIZE(keymap),
128};
129
130static struct samsung_keypad_platdata keypad_data __initdata = {
131 .keymap_data = &keymap_data,
132 .rows = 3,
133 .cols = 3,
134};
135
ba149f3a
MS
136/* MAX8998 regulators */
137#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
138
139static 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,
148 },
149 },
150};
151
152static 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,
159 },
160};
161
162static 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,
168 },
169};
170
171static 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,
177 },
178};
179
180static 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,
186 },
187};
188
189static 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,
196 },
197};
198
199static 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,
206 },
207};
208
209static 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,
216 },
217};
218
219static 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,
226 },
227};
228
229static 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,
236 },
237};
238
239static 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,
246 },
247};
248
249static 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,
256 },
257};
258
259static 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,
266 },
267};
268
269static 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,
276 },
277};
278
279static 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,
286 },
287};
288
289static 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,
296 },
297};
298
299/* BUCK */
300static struct regulator_consumer_supply buck1_consumer[] = {
301 { .supply = "vddarm", },
302};
303
304static struct regulator_consumer_supply buck2_consumer[] = {
305 { .supply = "vddint", },
306};
307
308static 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,
316 },
317 .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
318 .consumer_supplies = buck1_consumer,
319};
320
321static 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,
329 },
330 .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
331 .consumer_supplies = buck2_consumer,
332};
333
334static 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,
342 },
343 },
344};
345
346static 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,
353 },
354};
355
356static 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 },
377};
378
379static struct max8998_platform_data goni_max8998_pdata = {
380 .num_regulators = ARRAY_SIZE(goni_regulators),
381 .regulators = goni_regulators,
382};
383#endif
384
385/* GPIO I2C PMIC */
386#define AP_I2C_GPIO_PMIC_BUS_4 4
387static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = {
388 .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
389 .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
390};
391
392static 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,
397 },
398};
399
400static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
401#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
402 {
403 /* 0xCC when SRAD = 0 */
404 I2C_BOARD_INFO("max8998", 0xCC >> 1),
405 .platform_data = &goni_max8998_pdata,
406 },
407#endif
408};
409
410/* PMIC Power button */
411static struct gpio_keys_button goni_gpio_keys_table[] = {
412 {
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,
420 },
421};
422
423static struct gpio_keys_platform_data goni_gpio_keys_data = {
424 .buttons = goni_gpio_keys_table,
425 .nbuttons = ARRAY_SIZE(goni_gpio_keys_table),
426};
427
428static struct platform_device goni_device_gpiokeys = {
429 .name = "gpio-keys",
430 .dev = {
431 .platform_data = &goni_gpio_keys_data,
432 },
433};
434
435static void __init goni_pmic_init(void)
436{
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);
440
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);
444}
445
19b90c7c
MS
446/* MoviNAND */
447static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = {
448 .max_width = 4,
449 .cd_type = S3C_SDHCI_CD_PERMANENT,
450};
451
452/* Wireless LAN */
453static 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 */
457};
458
459/* External Flash */
460#define GONI_EXT_FLASH_EN S5PV210_MP05(4)
461#define GONI_EXT_FLASH_CD S5PV210_GPH3(4)
462static 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,
467};
468
469static void goni_setup_sdhci(void)
470{
471 gpio_request(GONI_EXT_FLASH_EN, "FLASH_EN");
472 gpio_direction_output(GONI_EXT_FLASH_EN, 1);
473
474 s3c_sdhci0_set_platdata(&goni_hsmmc0_data);
475 s3c_sdhci1_set_platdata(&goni_hsmmc1_data);
476 s3c_sdhci2_set_platdata(&goni_hsmmc2_data);
477};
ba149f3a 478
2e57da41 479static struct platform_device *goni_devices[] __initdata = {
3965fdee 480 &s3c_device_fb,
13904fba 481 &s5p_device_onenand,
ba149f3a
MS
482 &goni_i2c_gpio_pmic,
483 &goni_device_gpiokeys,
9f488c6f
SN
484 &s5p_device_fimc0,
485 &s5p_device_fimc1,
486 &s5p_device_fimc2,
19b90c7c
MS
487 &s3c_device_hsmmc0,
488 &s3c_device_hsmmc1,
489 &s3c_device_hsmmc2,
2a555582 490 &samsung_device_keypad,
2e57da41
JS
491};
492
493static void __init goni_map_io(void)
494{
495 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
496 s3c24xx_init_clocks(24000000);
497 s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
498}
499
500static void __init goni_machine_init(void)
501{
ba149f3a
MS
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));
19b90c7c
MS
506 /* SDHCI */
507 goni_setup_sdhci();
508
3965fdee
MS
509 /* FB */
510 s3c_fb_set_platdata(&goni_lcd_pdata);
511
2a555582
JS
512 /* KEYPAD */
513 samsung_keypad_set_platdata(&keypad_data);
514
2e57da41
JS
515 platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices));
516}
517
518MACHINE_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,
527MACHINE_END
This page took 0.08769 seconds and 5 git commands to generate.