blob: a857446f153e4370be97cca2bc70b7076e649d7a [file] [log] [blame]
Joonyoung Shim2e57da42010-05-19 23:15:32 +09001/* 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>
Marek Szyprowski3965fde2010-07-14 19:38:18 +090015#include <linux/fb.h>
Marek Szyprowskiba149f32010-07-14 19:39:47 +090016#include <linux/i2c.h>
17#include <linux/i2c-gpio.h>
Marek Szyprowskib4a0dca2010-10-04 18:38:12 +090018#include <linux/i2c/qt602240_ts.h>
Marek Szyprowskiba149f32010-07-14 19:39:47 +090019#include <linux/mfd/max8998.h>
Marek Szyprowskie9dde6f12010-09-29 22:05:19 +090020#include <linux/regulator/fixed.h>
Marek Szyprowski8415d5c2010-10-04 16:39:20 +090021#include <linux/spi/spi.h>
22#include <linux/spi/spi_gpio.h>
23#include <linux/lcd.h>
Marek Szyprowskiba149f32010-07-14 19:39:47 +090024#include <linux/gpio_keys.h>
25#include <linux/input.h>
26#include <linux/gpio.h>
Joonyoung Shim2e57da42010-05-19 23:15:32 +090027
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30#include <asm/setup.h>
31#include <asm/mach-types.h>
32
33#include <mach/map.h>
34#include <mach/regs-clock.h>
Marek Szyprowski3965fde2010-07-14 19:38:18 +090035#include <mach/regs-fb.h>
Joonyoung Shim2e57da42010-05-19 23:15:32 +090036
Marek Szyprowskiba149f32010-07-14 19:39:47 +090037#include <plat/gpio-cfg.h>
Joonyoung Shim2e57da42010-05-19 23:15:32 +090038#include <plat/regs-serial.h>
39#include <plat/s5pv210.h>
40#include <plat/devs.h>
41#include <plat/cpu.h>
Marek Szyprowski3965fde2010-07-14 19:38:18 +090042#include <plat/fb.h>
Marek Szyprowski528ef1b2010-10-04 16:39:22 +090043#include <plat/iic.h>
Joonyoung Shim2a555582010-09-09 08:17:43 +090044#include <plat/keypad.h>
Marek Szyprowski19b90c72010-08-05 18:00:18 +090045#include <plat/sdhci.h>
Marek Szyprowskid5889d52010-09-30 20:59:46 +090046#include <plat/clock.h>
Joonyoung Shim2e57da42010-05-19 23:15:32 +090047
48/* Following are default values for UCON, ULCON and UFCON UART registers */
Kukjin Kimc8def082010-07-21 09:19:51 +090049#define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
Joonyoung Shim2e57da42010-05-19 23:15:32 +090050 S3C2410_UCON_RXILEVEL | \
51 S3C2410_UCON_TXIRQMODE | \
52 S3C2410_UCON_RXIRQMODE | \
53 S3C2410_UCON_RXFIFO_TOI | \
54 S3C2443_UCON_RXERR_IRQEN)
55
Kukjin Kimc8def082010-07-21 09:19:51 +090056#define GONI_ULCON_DEFAULT S3C2410_LCON_CS8
Joonyoung Shim2e57da42010-05-19 23:15:32 +090057
Kukjin Kimf2b7e3c2010-08-06 21:34:55 +090058#define GONI_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
Joonyoung Shim2e57da42010-05-19 23:15:32 +090059
60static struct s3c2410_uartcfg goni_uartcfgs[] __initdata = {
61 [0] = {
62 .hwport = 0,
63 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090064 .ucon = GONI_UCON_DEFAULT,
65 .ulcon = GONI_ULCON_DEFAULT,
Kukjin Kimf2b7e3c2010-08-06 21:34:55 +090066 .ufcon = GONI_UFCON_DEFAULT |
Joonyoung Shimbbf7b352010-06-24 19:28:55 +090067 S5PV210_UFCON_TXTRIG256 | S5PV210_UFCON_RXTRIG256,
Joonyoung Shim2e57da42010-05-19 23:15:32 +090068 },
69 [1] = {
70 .hwport = 1,
71 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090072 .ucon = GONI_UCON_DEFAULT,
73 .ulcon = GONI_ULCON_DEFAULT,
Kukjin Kimf2b7e3c2010-08-06 21:34:55 +090074 .ufcon = GONI_UFCON_DEFAULT |
Joonyoung Shimbbf7b352010-06-24 19:28:55 +090075 S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
Joonyoung Shim2e57da42010-05-19 23:15:32 +090076 },
77 [2] = {
78 .hwport = 2,
79 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090080 .ucon = GONI_UCON_DEFAULT,
81 .ulcon = GONI_ULCON_DEFAULT,
Kukjin Kimf2b7e3c2010-08-06 21:34:55 +090082 .ufcon = GONI_UFCON_DEFAULT |
Joonyoung Shimbbf7b352010-06-24 19:28:55 +090083 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
Joonyoung Shim2e57da42010-05-19 23:15:32 +090084 },
85 [3] = {
86 .hwport = 3,
87 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090088 .ucon = GONI_UCON_DEFAULT,
89 .ulcon = GONI_ULCON_DEFAULT,
Kukjin Kimf2b7e3c2010-08-06 21:34:55 +090090 .ufcon = GONI_UFCON_DEFAULT |
Joonyoung Shimbbf7b352010-06-24 19:28:55 +090091 S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
Joonyoung Shim2e57da42010-05-19 23:15:32 +090092 },
93};
94
Marek Szyprowski3965fde2010-07-14 19:38:18 +090095/* Frame Buffer */
96static struct s3c_fb_pd_win goni_fb_win0 = {
97 .win_mode = {
Marek Szyprowski3965fde2010-07-14 19:38:18 +090098 .left_margin = 16,
99 .right_margin = 16,
Marek Szyprowski9d1fc392010-09-29 21:49:17 +0900100 .upper_margin = 2,
Marek Szyprowski3965fde2010-07-14 19:38:18 +0900101 .lower_margin = 28,
102 .hsync_len = 2,
Marek Szyprowski9d1fc392010-09-29 21:49:17 +0900103 .vsync_len = 1,
Marek Szyprowski3965fde2010-07-14 19:38:18 +0900104 .xres = 480,
105 .yres = 800,
106 .refresh = 55,
107 },
108 .max_bpp = 32,
109 .default_bpp = 16,
110};
111
112static struct s3c_fb_platdata goni_lcd_pdata __initdata = {
113 .win[0] = &goni_fb_win0,
114 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
115 VIDCON0_CLKSEL_LCD,
116 .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
117 | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
118 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
119};
120
Marek Szyprowski8415d5c2010-10-04 16:39:20 +0900121static int lcd_power_on(struct lcd_device *ld, int enable)
122{
123 return 1;
124}
125
126static int reset_lcd(struct lcd_device *ld)
127{
128 static unsigned int first = 1;
129 int reset_gpio = -1;
130
131 reset_gpio = S5PV210_MP05(5);
132
133 if (first) {
134 gpio_request(reset_gpio, "MLCD_RST");
135 first = 0;
136 }
137
138 gpio_direction_output(reset_gpio, 1);
139 return 1;
140}
141
142static struct lcd_platform_data goni_lcd_platform_data = {
143 .reset = reset_lcd,
144 .power_on = lcd_power_on,
145 .lcd_enabled = 0,
146 .reset_delay = 120, /* 120ms */
147 .power_on_delay = 25, /* 25ms */
148 .power_off_delay = 200, /* 200ms */
149};
150
151#define LCD_BUS_NUM 3
152static struct spi_board_info spi_board_info[] __initdata = {
153 {
154 .modalias = "s6e63m0",
155 .platform_data = &goni_lcd_platform_data,
156 .max_speed_hz = 1200000,
157 .bus_num = LCD_BUS_NUM,
158 .chip_select = 0,
159 .mode = SPI_MODE_3,
160 .controller_data = (void *)S5PV210_MP01(1), /* DISPLAY_CS */
161 },
162};
163
164static struct spi_gpio_platform_data lcd_spi_gpio_data = {
165 .sck = S5PV210_MP04(1), /* DISPLAY_CLK */
166 .mosi = S5PV210_MP04(3), /* DISPLAY_SI */
167 .miso = SPI_GPIO_NO_MISO,
168 .num_chipselect = 1,
169};
170
171static struct platform_device goni_spi_gpio = {
172 .name = "spi_gpio",
173 .id = LCD_BUS_NUM,
174 .dev = {
175 .parent = &s3c_device_fb.dev,
176 .platform_data = &lcd_spi_gpio_data,
177 },
178};
179
Joonyoung Shim2a555582010-09-09 08:17:43 +0900180/* KEYPAD */
181static uint32_t keymap[] __initdata = {
182 /* KEY(row, col, keycode) */
183 KEY(0, 1, KEY_MENU), /* Send */
184 KEY(0, 2, KEY_BACK), /* End */
185 KEY(1, 1, KEY_CONFIG), /* Half shot */
186 KEY(1, 2, KEY_VOLUMEUP),
187 KEY(2, 1, KEY_CAMERA), /* Full shot */
188 KEY(2, 2, KEY_VOLUMEDOWN),
189};
190
191static struct matrix_keymap_data keymap_data __initdata = {
192 .keymap = keymap,
193 .keymap_size = ARRAY_SIZE(keymap),
194};
195
196static struct samsung_keypad_platdata keypad_data __initdata = {
197 .keymap_data = &keymap_data,
198 .rows = 3,
199 .cols = 3,
200};
201
Marek Szyprowski528ef1b2010-10-04 16:39:22 +0900202/* Radio */
203static struct i2c_board_info i2c1_devs[] __initdata = {
204 {
205 I2C_BOARD_INFO("si470x", 0x10),
206 },
207};
208
209static void __init goni_radio_init(void)
210{
211 int gpio;
212
213 gpio = S5PV210_GPJ2(4); /* XMSMDATA_4 */
214 gpio_request(gpio, "FM_INT");
215 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
216 i2c1_devs[0].irq = gpio_to_irq(gpio);
217
218 gpio = S5PV210_GPJ2(5); /* XMSMDATA_5 */
219 gpio_request(gpio, "FM_RST");
220 gpio_direction_output(gpio, 1);
221}
222
Marek Szyprowskib4a0dca2010-10-04 18:38:12 +0900223/* TSP */
224static struct qt602240_platform_data qt602240_platform_data = {
225 .x_line = 17,
226 .y_line = 11,
227 .x_size = 800,
228 .y_size = 480,
229 .blen = 0x21,
230 .threshold = 0x28,
231 .voltage = 2800000, /* 2.8V */
232 .orient = QT602240_DIAGONAL,
233};
234
235static struct s3c2410_platform_i2c i2c2_data __initdata = {
236 .flags = 0,
237 .bus_num = 2,
238 .slave_addr = 0x10,
239 .frequency = 400 * 1000,
240 .sda_delay = 100,
241};
242
243static struct i2c_board_info i2c2_devs[] __initdata = {
244 {
245 I2C_BOARD_INFO("qt602240_ts", 0x4a),
246 .platform_data = &qt602240_platform_data,
247 },
248};
249
250static void __init goni_tsp_init(void)
251{
252 int gpio;
253
254 gpio = S5PV210_GPJ1(3); /* XMSMADDR_11 */
255 gpio_request(gpio, "TSP_LDO_ON");
256 gpio_direction_output(gpio, 1);
257 gpio_export(gpio, 0);
258
259 gpio = S5PV210_GPJ0(5); /* XMSMADDR_5 */
260 gpio_request(gpio, "TSP_INT");
261
262 s5p_register_gpio_interrupt(gpio);
263 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
264 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
265 i2c2_devs[0].irq = gpio_to_irq(gpio);
266}
267
Marek Szyprowskiba149f32010-07-14 19:39:47 +0900268/* MAX8998 regulators */
269#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
270
Marek Szyprowskie9dde6f12010-09-29 22:05:19 +0900271static struct regulator_consumer_supply goni_ldo5_consumers[] = {
272 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
273};
274
Marek Szyprowskiba149f32010-07-14 19:39:47 +0900275static struct regulator_init_data goni_ldo2_data = {
276 .constraints = {
277 .name = "VALIVE_1.1V",
278 .min_uV = 1100000,
279 .max_uV = 1100000,
280 .apply_uV = 1,
281 .always_on = 1,
282 .state_mem = {
283 .enabled = 1,
284 },
285 },
286};
287
288static struct regulator_init_data goni_ldo3_data = {
289 .constraints = {
290 .name = "VUSB/MIPI_1.1V",
291 .min_uV = 1100000,
292 .max_uV = 1100000,
293 .apply_uV = 1,
294 .always_on = 1,
295 },
296};
297
298static struct regulator_init_data goni_ldo4_data = {
299 .constraints = {
300 .name = "VDAC_3.3V",
301 .min_uV = 3300000,
302 .max_uV = 3300000,
303 .apply_uV = 1,
304 },
305};
306
307static struct regulator_init_data goni_ldo5_data = {
308 .constraints = {
309 .name = "VTF_2.8V",
310 .min_uV = 2800000,
311 .max_uV = 2800000,
312 .apply_uV = 1,
313 },
Marek Szyprowskie9dde6f12010-09-29 22:05:19 +0900314 .num_consumer_supplies = ARRAY_SIZE(goni_ldo5_consumers),
315 .consumer_supplies = goni_ldo5_consumers,
Marek Szyprowskiba149f32010-07-14 19:39:47 +0900316};
317
318static struct regulator_init_data goni_ldo6_data = {
319 .constraints = {
320 .name = "VCC_3.3V",
321 .min_uV = 3300000,
322 .max_uV = 3300000,
323 .apply_uV = 1,
324 },
325};
326
327static struct regulator_init_data goni_ldo7_data = {
328 .constraints = {
329 .name = "VLCD_1.8V",
330 .min_uV = 1800000,
331 .max_uV = 1800000,
332 .apply_uV = 1,
333 .always_on = 1,
334 },
335};
336
337static struct regulator_init_data goni_ldo8_data = {
338 .constraints = {
339 .name = "VUSB/VADC_3.3V",
340 .min_uV = 3300000,
341 .max_uV = 3300000,
342 .apply_uV = 1,
343 .always_on = 1,
344 },
345};
346
347static struct regulator_init_data goni_ldo9_data = {
348 .constraints = {
349 .name = "VCC/VCAM_2.8V",
350 .min_uV = 2800000,
351 .max_uV = 2800000,
352 .apply_uV = 1,
353 .always_on = 1,
354 },
355};
356
357static struct regulator_init_data goni_ldo10_data = {
358 .constraints = {
359 .name = "VPLL_1.1V",
360 .min_uV = 1100000,
361 .max_uV = 1100000,
362 .apply_uV = 1,
363 .boot_on = 1,
364 },
365};
366
367static struct regulator_init_data goni_ldo11_data = {
368 .constraints = {
369 .name = "CAM_IO_2.8V",
370 .min_uV = 2800000,
371 .max_uV = 2800000,
372 .apply_uV = 1,
373 .always_on = 1,
374 },
375};
376
377static struct regulator_init_data goni_ldo12_data = {
378 .constraints = {
379 .name = "CAM_ISP_1.2V",
380 .min_uV = 1200000,
381 .max_uV = 1200000,
382 .apply_uV = 1,
383 .always_on = 1,
384 },
385};
386
387static struct regulator_init_data goni_ldo13_data = {
388 .constraints = {
389 .name = "CAM_A_2.8V",
390 .min_uV = 2800000,
391 .max_uV = 2800000,
392 .apply_uV = 1,
393 .always_on = 1,
394 },
395};
396
397static struct regulator_init_data goni_ldo14_data = {
398 .constraints = {
399 .name = "CAM_CIF_1.8V",
400 .min_uV = 1800000,
401 .max_uV = 1800000,
402 .apply_uV = 1,
403 .always_on = 1,
404 },
405};
406
407static struct regulator_init_data goni_ldo15_data = {
408 .constraints = {
409 .name = "CAM_AF_3.3V",
410 .min_uV = 3300000,
411 .max_uV = 3300000,
412 .apply_uV = 1,
413 .always_on = 1,
414 },
415};
416
417static struct regulator_init_data goni_ldo16_data = {
418 .constraints = {
419 .name = "VMIPI_1.8V",
420 .min_uV = 1800000,
421 .max_uV = 1800000,
422 .apply_uV = 1,
423 .always_on = 1,
424 },
425};
426
427static struct regulator_init_data goni_ldo17_data = {
428 .constraints = {
429 .name = "VCC_3.0V_LCD",
430 .min_uV = 3000000,
431 .max_uV = 3000000,
432 .apply_uV = 1,
433 .always_on = 1,
434 },
435};
436
437/* BUCK */
438static struct regulator_consumer_supply buck1_consumer[] = {
439 { .supply = "vddarm", },
440};
441
442static struct regulator_consumer_supply buck2_consumer[] = {
443 { .supply = "vddint", },
444};
445
446static struct regulator_init_data goni_buck1_data = {
447 .constraints = {
448 .name = "VARM_1.2V",
449 .min_uV = 1200000,
450 .max_uV = 1200000,
451 .apply_uV = 1,
452 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
453 REGULATOR_CHANGE_STATUS,
454 },
455 .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
456 .consumer_supplies = buck1_consumer,
457};
458
459static struct regulator_init_data goni_buck2_data = {
460 .constraints = {
461 .name = "VINT_1.2V",
462 .min_uV = 1200000,
463 .max_uV = 1200000,
464 .apply_uV = 1,
465 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
466 REGULATOR_CHANGE_STATUS,
467 },
468 .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
469 .consumer_supplies = buck2_consumer,
470};
471
472static struct regulator_init_data goni_buck3_data = {
473 .constraints = {
474 .name = "VCC_1.8V",
475 .min_uV = 1800000,
476 .max_uV = 1800000,
477 .apply_uV = 1,
478 .state_mem = {
479 .enabled = 1,
480 },
481 },
482};
483
484static struct regulator_init_data goni_buck4_data = {
485 .constraints = {
486 .name = "CAM_CORE_1.2V",
487 .min_uV = 1200000,
488 .max_uV = 1200000,
489 .apply_uV = 1,
490 .always_on = 1,
491 },
492};
493
494static struct max8998_regulator_data goni_regulators[] = {
495 { MAX8998_LDO2, &goni_ldo2_data },
496 { MAX8998_LDO3, &goni_ldo3_data },
497 { MAX8998_LDO4, &goni_ldo4_data },
498 { MAX8998_LDO5, &goni_ldo5_data },
499 { MAX8998_LDO6, &goni_ldo6_data },
500 { MAX8998_LDO7, &goni_ldo7_data },
501 { MAX8998_LDO8, &goni_ldo8_data },
502 { MAX8998_LDO9, &goni_ldo9_data },
503 { MAX8998_LDO10, &goni_ldo10_data },
504 { MAX8998_LDO11, &goni_ldo11_data },
505 { MAX8998_LDO12, &goni_ldo12_data },
506 { MAX8998_LDO13, &goni_ldo13_data },
507 { MAX8998_LDO14, &goni_ldo14_data },
508 { MAX8998_LDO15, &goni_ldo15_data },
509 { MAX8998_LDO16, &goni_ldo16_data },
510 { MAX8998_LDO17, &goni_ldo17_data },
511 { MAX8998_BUCK1, &goni_buck1_data },
512 { MAX8998_BUCK2, &goni_buck2_data },
513 { MAX8998_BUCK3, &goni_buck3_data },
514 { MAX8998_BUCK4, &goni_buck4_data },
515};
516
517static struct max8998_platform_data goni_max8998_pdata = {
518 .num_regulators = ARRAY_SIZE(goni_regulators),
519 .regulators = goni_regulators,
520};
521#endif
522
523/* GPIO I2C PMIC */
524#define AP_I2C_GPIO_PMIC_BUS_4 4
525static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = {
526 .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
527 .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
528};
529
530static struct platform_device goni_i2c_gpio_pmic = {
531 .name = "i2c-gpio",
532 .id = AP_I2C_GPIO_PMIC_BUS_4,
533 .dev = {
534 .platform_data = &goni_i2c_gpio_pmic_data,
535 },
536};
537
538static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
539#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
540 {
541 /* 0xCC when SRAD = 0 */
542 I2C_BOARD_INFO("max8998", 0xCC >> 1),
543 .platform_data = &goni_max8998_pdata,
544 },
545#endif
546};
547
Chanwoo Choi51122672010-10-14 15:02:44 +0900548/* GPIO I2C AP 1.8V */
549#define AP_I2C_GPIO_BUS_5 5
550static struct i2c_gpio_platform_data goni_i2c_gpio5_data = {
551 .sda_pin = S5PV210_MP05(3), /* XM0ADDR_11 */
552 .scl_pin = S5PV210_MP05(2), /* XM0ADDR_10 */
553};
554
555static struct platform_device goni_i2c_gpio5 = {
556 .name = "i2c-gpio",
557 .id = AP_I2C_GPIO_BUS_5,
558 .dev = {
559 .platform_data = &goni_i2c_gpio5_data,
560 },
561};
562
563static struct i2c_board_info i2c_gpio5_devs[] __initdata = {
564 {
565 /* CS/ADDR = low 0x34 (FYI: high = 0x36) */
566 I2C_BOARD_INFO("wm8994", 0x1a),
567 },
568};
569
Marek Szyprowskiba149f32010-07-14 19:39:47 +0900570/* PMIC Power button */
571static struct gpio_keys_button goni_gpio_keys_table[] = {
572 {
573 .code = KEY_POWER,
574 .gpio = S5PV210_GPH2(6),
575 .desc = "gpio-keys: KEY_POWER",
576 .type = EV_KEY,
577 .active_low = 1,
578 .wakeup = 1,
579 .debounce_interval = 1,
580 },
581};
582
583static struct gpio_keys_platform_data goni_gpio_keys_data = {
584 .buttons = goni_gpio_keys_table,
585 .nbuttons = ARRAY_SIZE(goni_gpio_keys_table),
586};
587
588static struct platform_device goni_device_gpiokeys = {
589 .name = "gpio-keys",
590 .dev = {
591 .platform_data = &goni_gpio_keys_data,
592 },
593};
594
595static void __init goni_pmic_init(void)
596{
597 /* AP_PMIC_IRQ: EINT7 */
598 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
599 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
600
601 /* nPower: EINT22 */
602 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
603 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
604}
605
Marek Szyprowski19b90c72010-08-05 18:00:18 +0900606/* MoviNAND */
607static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = {
608 .max_width = 4,
609 .cd_type = S3C_SDHCI_CD_PERMANENT,
610};
611
612/* Wireless LAN */
613static struct s3c_sdhci_platdata goni_hsmmc1_data __initdata = {
614 .max_width = 4,
615 .cd_type = S3C_SDHCI_CD_EXTERNAL,
616 /* ext_cd_{init,cleanup} callbacks will be added later */
617};
618
619/* External Flash */
620#define GONI_EXT_FLASH_EN S5PV210_MP05(4)
621#define GONI_EXT_FLASH_CD S5PV210_GPH3(4)
622static struct s3c_sdhci_platdata goni_hsmmc2_data __initdata = {
623 .max_width = 4,
624 .cd_type = S3C_SDHCI_CD_GPIO,
625 .ext_cd_gpio = GONI_EXT_FLASH_CD,
626 .ext_cd_gpio_invert = 1,
627};
628
Marek Szyprowskie9dde6f12010-09-29 22:05:19 +0900629static struct regulator_consumer_supply mmc2_supplies[] = {
630 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
631};
632
633static struct regulator_init_data mmc2_fixed_voltage_init_data = {
634 .constraints = {
635 .name = "V_TF_2.8V",
636 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
637 },
638 .num_consumer_supplies = ARRAY_SIZE(mmc2_supplies),
639 .consumer_supplies = mmc2_supplies,
640};
641
642static struct fixed_voltage_config mmc2_fixed_voltage_config = {
643 .supply_name = "EXT_FLASH_EN",
644 .microvolts = 2800000,
645 .gpio = GONI_EXT_FLASH_EN,
646 .enable_high = true,
647 .init_data = &mmc2_fixed_voltage_init_data,
648};
649
650static struct platform_device mmc2_fixed_voltage = {
651 .name = "reg-fixed-voltage",
652 .id = 2,
653 .dev = {
654 .platform_data = &mmc2_fixed_voltage_config,
655 },
656};
657
Marek Szyprowski19b90c72010-08-05 18:00:18 +0900658static void goni_setup_sdhci(void)
659{
Marek Szyprowski19b90c72010-08-05 18:00:18 +0900660 s3c_sdhci0_set_platdata(&goni_hsmmc0_data);
661 s3c_sdhci1_set_platdata(&goni_hsmmc1_data);
662 s3c_sdhci2_set_platdata(&goni_hsmmc2_data);
663};
Marek Szyprowskiba149f32010-07-14 19:39:47 +0900664
Joonyoung Shim2e57da42010-05-19 23:15:32 +0900665static struct platform_device *goni_devices[] __initdata = {
Marek Szyprowski3965fde2010-07-14 19:38:18 +0900666 &s3c_device_fb,
Kukjin Kim13904fb2010-08-27 13:56:54 +0900667 &s5p_device_onenand,
Marek Szyprowski8415d5c2010-10-04 16:39:20 +0900668 &goni_spi_gpio,
Marek Szyprowskiba149f32010-07-14 19:39:47 +0900669 &goni_i2c_gpio_pmic,
Chanwoo Choi51122672010-10-14 15:02:44 +0900670 &goni_i2c_gpio5,
Marek Szyprowskie9dde6f12010-09-29 22:05:19 +0900671 &mmc2_fixed_voltage,
Marek Szyprowskiba149f32010-07-14 19:39:47 +0900672 &goni_device_gpiokeys,
Sylwester Nawrocki9f488c62010-08-09 16:55:34 +0900673 &s5p_device_fimc0,
674 &s5p_device_fimc1,
675 &s5p_device_fimc2,
Marek Szyprowski19b90c72010-08-05 18:00:18 +0900676 &s3c_device_hsmmc0,
677 &s3c_device_hsmmc1,
678 &s3c_device_hsmmc2,
Chanwoo Choi6c29e712010-10-14 16:00:42 +0900679 &s5pv210_device_iis0,
Marek Szyprowskid5889d52010-09-30 20:59:46 +0900680 &s3c_device_usb_hsotg,
Joonyoung Shim2a555582010-09-09 08:17:43 +0900681 &samsung_device_keypad,
Marek Szyprowski528ef1b2010-10-04 16:39:22 +0900682 &s3c_device_i2c1,
Marek Szyprowskib4a0dca2010-10-04 18:38:12 +0900683 &s3c_device_i2c2,
Joonyoung Shim2e57da42010-05-19 23:15:32 +0900684};
685
Chanwoo Choi6c29e712010-10-14 16:00:42 +0900686static void __init goni_sound_init(void)
687{
688 /* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
689 * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
690 * because it needs 24MHz clock to operate WM8994 codec.
691 */
692 __raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS);
693}
694
Joonyoung Shim2e57da42010-05-19 23:15:32 +0900695static void __init goni_map_io(void)
696{
697 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
698 s3c24xx_init_clocks(24000000);
699 s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
700}
701
702static void __init goni_machine_init(void)
703{
Marek Szyprowski528ef1b2010-10-04 16:39:22 +0900704 /* Radio: call before I2C 1 registeration */
705 goni_radio_init();
706
707 /* I2C1 */
708 s3c_i2c1_set_platdata(NULL);
709 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
710
Marek Szyprowskib4a0dca2010-10-04 18:38:12 +0900711 /* TSP: call before I2C 2 registeration */
712 goni_tsp_init();
713
714 /* I2C2 */
715 s3c_i2c2_set_platdata(&i2c2_data);
716 i2c_register_board_info(2, i2c2_devs, ARRAY_SIZE(i2c2_devs));
717
Marek Szyprowskiba149f32010-07-14 19:39:47 +0900718 /* PMIC */
719 goni_pmic_init();
720 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
721 ARRAY_SIZE(i2c_gpio_pmic_devs));
Marek Szyprowski19b90c72010-08-05 18:00:18 +0900722 /* SDHCI */
723 goni_setup_sdhci();
724
Chanwoo Choi51122672010-10-14 15:02:44 +0900725 /* SOUND */
Chanwoo Choi6c29e712010-10-14 16:00:42 +0900726 goni_sound_init();
Chanwoo Choi51122672010-10-14 15:02:44 +0900727 i2c_register_board_info(AP_I2C_GPIO_BUS_5, i2c_gpio5_devs,
728 ARRAY_SIZE(i2c_gpio5_devs));
729
Marek Szyprowski3965fde2010-07-14 19:38:18 +0900730 /* FB */
731 s3c_fb_set_platdata(&goni_lcd_pdata);
732
Marek Szyprowski8415d5c2010-10-04 16:39:20 +0900733 /* SPI */
734 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
735
Joonyoung Shim2a555582010-09-09 08:17:43 +0900736 /* KEYPAD */
737 samsung_keypad_set_platdata(&keypad_data);
738
Marek Szyprowskid5889d52010-09-30 20:59:46 +0900739 clk_xusbxti.rate = 24000000;
740
Joonyoung Shim2e57da42010-05-19 23:15:32 +0900741 platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices));
742}
743
744MACHINE_START(GONI, "GONI")
745 /* Maintainers: Kyungmin Park <kyungmin.park@samsung.com> */
746 .phys_io = S3C_PA_UART & 0xfff00000,
747 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
748 .boot_params = S5P_PA_SDRAM + 0x100,
749 .init_irq = s5pv210_init_irq,
750 .map_io = goni_map_io,
751 .init_machine = goni_machine_init,
752 .timer = &s3c24xx_timer,
753MACHINE_END