blob: 686a4f270b123d6d1d2372298cfde9e8f69b248f [file] [log] [blame]
Ben Dooks431107e2010-01-26 10:11:04 +09001/* linux/arch/arm/mach-s3c64xx/mach-smdk6410.c
Ben Dooks5718df92008-10-21 14:07:09 +01002 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/list.h>
18#include <linux/timer.h>
19#include <linux/init.h>
Naveen Krishna Ch290d0982010-06-22 07:39:18 +090020#include <linux/input.h>
Ben Dooks5718df92008-10-21 14:07:09 +010021#include <linux/serial_core.h>
22#include <linux/platform_device.h>
23#include <linux/io.h>
Ben Dooks096941e2008-10-31 16:14:59 +000024#include <linux/i2c.h>
Mark Browna7a81d02010-02-17 18:19:31 +000025#include <linux/leds.h>
Ben Dooks438a5d42008-11-19 15:41:34 +000026#include <linux/fb.h>
27#include <linux/gpio.h>
28#include <linux/delay.h>
Mark Brown3056ea02009-01-27 16:18:01 +000029#include <linux/smsc911x.h>
Mark Brown42015c12009-11-03 14:42:06 +000030#include <linux/regulator/fixed.h>
Mark Brown628e7eb2011-03-04 07:59:20 +090031#include <linux/regulator/machine.h>
Banajit Goswami075d1082011-02-28 17:42:35 +053032#include <linux/pwm_backlight.h>
Ben Dooks438a5d42008-11-19 15:41:34 +000033
Mark Brownecc558a2009-02-17 15:59:38 +000034#ifdef CONFIG_SMDK6410_WM1190_EV1
35#include <linux/mfd/wm8350/core.h>
36#include <linux/mfd/wm8350/pmic.h>
37#endif
Ben Dooks438a5d42008-11-19 15:41:34 +000038
Mark Brown60f91012010-02-17 18:19:29 +000039#ifdef CONFIG_SMDK6410_WM1192_EV1
Mark Browna7a81d02010-02-17 18:19:31 +000040#include <linux/mfd/wm831x/core.h>
Mark Brown60f91012010-02-17 18:19:29 +000041#include <linux/mfd/wm831x/pdata.h>
42#endif
43
Ben Dooks438a5d42008-11-19 15:41:34 +000044#include <video/platform_lcd.h>
Ben Dooks5718df92008-10-21 14:07:09 +010045
46#include <asm/mach/arch.h>
47#include <asm/mach/map.h>
48#include <asm/mach/irq.h>
49
50#include <mach/hardware.h>
Ben Dooks438a5d42008-11-19 15:41:34 +000051#include <mach/regs-fb.h>
Ben Dooks5718df92008-10-21 14:07:09 +010052#include <mach/map.h>
Banajit Goswami075d1082011-02-28 17:42:35 +053053#include <mach/gpio-bank-f.h>
Ben Dooks5718df92008-10-21 14:07:09 +010054
55#include <asm/irq.h>
56#include <asm/mach-types.h>
57
58#include <plat/regs-serial.h>
Ben Dooks3501c9a2010-01-26 10:45:40 +090059#include <mach/regs-modem.h>
60#include <mach/regs-gpio.h>
61#include <mach/regs-sys.h>
62#include <mach/regs-srom.h>
Abhilash Kesavan0ab0b6d2010-06-08 16:55:45 +090063#include <plat/ata.h>
Ben Dooksd85fa242008-10-31 16:14:52 +000064#include <plat/iic.h>
Ben Dooks438a5d42008-11-19 15:41:34 +000065#include <plat/fb.h>
Mark Brown3056ea02009-01-27 16:18:01 +000066#include <plat/gpio-cfg.h>
Ben Dooks5718df92008-10-21 14:07:09 +010067
Ben Dooksf7be9ab2010-01-26 13:41:30 +090068#include <mach/s3c6410.h>
Ben Dooks5718df92008-10-21 14:07:09 +010069#include <plat/clock.h>
70#include <plat/devs.h>
71#include <plat/cpu.h>
Naveen Krishna Ch85b14a32010-05-20 11:39:52 +090072#include <plat/adc.h>
73#include <plat/ts.h>
Naveen Krishna Ch290d0982010-06-22 07:39:18 +090074#include <plat/keypad.h>
Ben Dooks5718df92008-10-21 14:07:09 +010075
76#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
77#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
78#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
79
80static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
81 [0] = {
82 .hwport = 0,
83 .flags = 0,
Matt Hsubd258e52009-06-29 19:03:41 +080084 .ucon = UCON,
85 .ulcon = ULCON,
86 .ufcon = UFCON,
Ben Dooks5718df92008-10-21 14:07:09 +010087 },
88 [1] = {
89 .hwport = 1,
90 .flags = 0,
Matt Hsubd258e52009-06-29 19:03:41 +080091 .ucon = UCON,
92 .ulcon = ULCON,
93 .ufcon = UFCON,
94 },
95 [2] = {
96 .hwport = 2,
97 .flags = 0,
98 .ucon = UCON,
99 .ulcon = ULCON,
100 .ufcon = UFCON,
101 },
102 [3] = {
103 .hwport = 3,
104 .flags = 0,
105 .ucon = UCON,
106 .ulcon = ULCON,
107 .ufcon = UFCON,
Ben Dooks5718df92008-10-21 14:07:09 +0100108 },
109};
110
Ben Dooks438a5d42008-11-19 15:41:34 +0000111/* framebuffer and LCD setup. */
112
113/* GPF15 = LCD backlight control
114 * GPF13 => Panel power
115 * GPN5 = LCD nRESET signal
116 * PWM_TOUT1 => backlight brightness
117 */
118
119static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
120 unsigned int power)
121{
122 if (power) {
123 gpio_direction_output(S3C64XX_GPF(13), 1);
Ben Dooks438a5d42008-11-19 15:41:34 +0000124
125 /* fire nRESET on power up */
126 gpio_direction_output(S3C64XX_GPN(5), 0);
127 msleep(10);
128 gpio_direction_output(S3C64XX_GPN(5), 1);
129 msleep(1);
130 } else {
Ben Dooks438a5d42008-11-19 15:41:34 +0000131 gpio_direction_output(S3C64XX_GPF(13), 0);
132 }
133}
134
135static struct plat_lcd_data smdk6410_lcd_power_data = {
136 .set_power = smdk6410_lcd_power_set,
137};
138
139static struct platform_device smdk6410_lcd_powerdev = {
140 .name = "platform-lcd",
141 .dev.parent = &s3c_device_fb.dev,
142 .dev.platform_data = &smdk6410_lcd_power_data,
143};
144
145static struct s3c_fb_pd_win smdk6410_fb_win0 = {
146 /* this is to ensure we use win0 */
147 .win_mode = {
Ben Dooks438a5d42008-11-19 15:41:34 +0000148 .left_margin = 8,
149 .right_margin = 13,
150 .upper_margin = 7,
151 .lower_margin = 5,
152 .hsync_len = 3,
153 .vsync_len = 1,
154 .xres = 800,
155 .yres = 480,
156 },
157 .max_bpp = 32,
158 .default_bpp = 16,
Ben Dooks001ca742010-07-26 10:56:40 +0100159 .virtual_y = 480 * 2,
160 .virtual_x = 800,
Ben Dooks438a5d42008-11-19 15:41:34 +0000161};
162
163/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
164static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
165 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
166 .win[0] = &smdk6410_fb_win0,
167 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
168 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
169};
170
Andy Greena4e94692009-12-29 14:40:43 +0000171/*
172 * Configuring Ethernet on SMDK6410
173 *
174 * Both CS8900A and LAN9115 chips share one chip select mediated by CFG6.
175 * The constant address below corresponds to nCS1
176 *
177 * 1) Set CFGB2 p3 ON others off, no other CFGB selects "ethernet"
178 * 2) CFG6 needs to be switched to "LAN9115" side
179 */
180
Mark Brown3056ea02009-01-27 16:18:01 +0000181static struct resource smdk6410_smsc911x_resources[] = {
182 [0] = {
Andy Greenf01fdac2009-12-29 14:40:36 +0000183 .start = S3C64XX_PA_XM0CSN1,
184 .end = S3C64XX_PA_XM0CSN1 + SZ_64K - 1,
Mark Brown3056ea02009-01-27 16:18:01 +0000185 .flags = IORESOURCE_MEM,
186 },
187 [1] = {
188 .start = S3C_EINT(10),
189 .end = S3C_EINT(10),
190 .flags = IORESOURCE_IRQ | IRQ_TYPE_LEVEL_LOW,
191 },
192};
193
194static struct smsc911x_platform_config smdk6410_smsc911x_pdata = {
195 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
196 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
197 .flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY,
198 .phy_interface = PHY_INTERFACE_MODE_MII,
199};
200
201
202static struct platform_device smdk6410_smsc911x = {
203 .name = "smsc911x",
204 .id = -1,
205 .num_resources = ARRAY_SIZE(smdk6410_smsc911x_resources),
206 .resource = &smdk6410_smsc911x_resources[0],
207 .dev = {
208 .platform_data = &smdk6410_smsc911x_pdata,
209 },
210};
211
Mark Brown42015c12009-11-03 14:42:06 +0000212#ifdef CONFIG_REGULATOR
213static struct regulator_consumer_supply smdk6410_b_pwr_5v_consumers[] = {
214 {
215 /* WM8580 */
216 .supply = "PVDD",
217 .dev_name = "0-001b",
218 },
219 {
220 /* WM8580 */
221 .supply = "AVDD",
222 .dev_name = "0-001b",
223 },
224};
225
226static struct regulator_init_data smdk6410_b_pwr_5v_data = {
227 .constraints = {
228 .always_on = 1,
229 },
230 .num_consumer_supplies = ARRAY_SIZE(smdk6410_b_pwr_5v_consumers),
231 .consumer_supplies = smdk6410_b_pwr_5v_consumers,
232};
233
234static struct fixed_voltage_config smdk6410_b_pwr_5v_pdata = {
235 .supply_name = "B_PWR_5V",
236 .microvolts = 5000000,
237 .init_data = &smdk6410_b_pwr_5v_data,
Mark Brownd3cf4482010-01-13 13:57:04 +0000238 .gpio = -EINVAL,
Mark Brown42015c12009-11-03 14:42:06 +0000239};
240
241static struct platform_device smdk6410_b_pwr_5v = {
242 .name = "reg-fixed-voltage",
243 .id = -1,
244 .dev = {
245 .platform_data = &smdk6410_b_pwr_5v_pdata,
246 },
247};
248#endif
249
Abhilash Kesavan0ab0b6d2010-06-08 16:55:45 +0900250static struct s3c_ide_platdata smdk6410_ide_pdata __initdata = {
251 .setup_gpio = s3c64xx_ide_setup_gpio,
252};
253
Naveen Krishna Ch290d0982010-06-22 07:39:18 +0900254static uint32_t smdk6410_keymap[] __initdata = {
255 /* KEY(row, col, keycode) */
256 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
257 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
258 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
259 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
260};
261
262static struct matrix_keymap_data smdk6410_keymap_data __initdata = {
263 .keymap = smdk6410_keymap,
264 .keymap_size = ARRAY_SIZE(smdk6410_keymap),
265};
266
267static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = {
268 .keymap_data = &smdk6410_keymap_data,
269 .rows = 2,
270 .cols = 8,
271};
272
Banajit Goswami075d1082011-02-28 17:42:35 +0530273static int smdk6410_backlight_init(struct device *dev)
274{
275 int ret;
276
277 ret = gpio_request(S3C64XX_GPF(15), "Backlight");
278 if (ret) {
279 printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
280 return ret;
281 }
282
283 /* Configure GPIO pin with S3C64XX_GPF15_PWM_TOUT1 */
284 s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2));
285
286 return 0;
287}
288
289static void smdk6410_backlight_exit(struct device *dev)
290{
291 s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_OUTPUT);
292 gpio_free(S3C64XX_GPF(15));
293}
294
295static struct platform_pwm_backlight_data smdk6410_backlight_data = {
296 .pwm_id = 1,
297 .max_brightness = 255,
298 .dft_brightness = 255,
299 .pwm_period_ns = 78770,
300 .init = smdk6410_backlight_init,
301 .exit = smdk6410_backlight_exit,
302};
303
304static struct platform_device smdk6410_backlight_device = {
305 .name = "pwm-backlight",
306 .dev = {
307 .parent = &s3c_device_timer[1].dev,
308 .platform_data = &smdk6410_backlight_data,
309 },
310};
311
Mark Brown027191a2009-01-23 16:29:43 +0000312static struct map_desc smdk6410_iodesc[] = {};
Ben Dooks5718df92008-10-21 14:07:09 +0100313
314static struct platform_device *smdk6410_devices[] __initdata = {
Ben Dooksb24636c2008-11-03 20:14:53 +0000315#ifdef CONFIG_SMDK6410_SD_CH0
Ben Dooks39057f22008-10-31 16:14:29 +0000316 &s3c_device_hsmmc0,
Ben Dooksb24636c2008-11-03 20:14:53 +0000317#endif
318#ifdef CONFIG_SMDK6410_SD_CH1
319 &s3c_device_hsmmc1,
320#endif
Ben Dooksd85fa242008-10-31 16:14:52 +0000321 &s3c_device_i2c0,
Ben Dooksd7ea3742008-10-31 16:14:57 +0000322 &s3c_device_i2c1,
Ben Dooks438a5d42008-11-19 15:41:34 +0000323 &s3c_device_fb,
Ben Dooksb8132482009-11-23 00:13:39 +0000324 &s3c_device_ohci,
Ben Dooks06fa1d32009-05-16 22:11:20 +0100325 &s3c_device_usb_hsotg,
Jassi Brar83e37b82010-11-22 15:35:53 +0900326 &samsung_asoc_dma,
Mark Brown1f100862010-02-17 19:03:20 +0000327 &s3c64xx_device_iisv4,
Naveen Krishna Ch290d0982010-06-22 07:39:18 +0900328 &samsung_device_keypad,
Mark Brown42015c12009-11-03 14:42:06 +0000329
330#ifdef CONFIG_REGULATOR
331 &smdk6410_b_pwr_5v,
332#endif
Ben Dooks438a5d42008-11-19 15:41:34 +0000333 &smdk6410_lcd_powerdev,
Mark Brown3056ea02009-01-27 16:18:01 +0000334
335 &smdk6410_smsc911x,
Naveen Krishna Ch85b14a32010-05-20 11:39:52 +0900336 &s3c_device_adc,
Abhilash Kesavan0ab0b6d2010-06-08 16:55:45 +0900337 &s3c_device_cfcon,
Atul Dahiya9bbf4a62010-07-20 16:31:32 +0530338 &s3c_device_rtc,
Naveen Krishna Ch85b14a32010-05-20 11:39:52 +0900339 &s3c_device_ts,
Banajit Goswamib351c4a2010-05-20 16:21:30 +0900340 &s3c_device_wdt,
Banajit Goswami075d1082011-02-28 17:42:35 +0530341 &s3c_device_timer[1],
342 &smdk6410_backlight_device,
Ben Dooks5718df92008-10-21 14:07:09 +0100343};
344
Mark Brown60f91012010-02-17 18:19:29 +0000345#ifdef CONFIG_REGULATOR
346/* ARM core */
347static struct regulator_consumer_supply smdk6410_vddarm_consumers[] = {
348 {
349 .supply = "vddarm",
350 }
351};
352
353/* VDDARM, BUCK1 on J5 */
354static struct regulator_init_data smdk6410_vddarm = {
355 .constraints = {
356 .name = "PVDD_ARM",
357 .min_uV = 1000000,
358 .max_uV = 1300000,
359 .always_on = 1,
360 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
361 },
362 .num_consumer_supplies = ARRAY_SIZE(smdk6410_vddarm_consumers),
363 .consumer_supplies = smdk6410_vddarm_consumers,
364};
365
366/* VDD_INT, BUCK2 on J5 */
367static struct regulator_init_data smdk6410_vddint = {
368 .constraints = {
369 .name = "PVDD_INT",
370 .min_uV = 1000000,
371 .max_uV = 1200000,
372 .always_on = 1,
373 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
374 },
375};
376
377/* VDD_HI, LDO3 on J5 */
378static struct regulator_init_data smdk6410_vddhi = {
379 .constraints = {
380 .name = "PVDD_HI",
381 .always_on = 1,
382 },
383};
384
385/* VDD_PLL, LDO2 on J5 */
386static struct regulator_init_data smdk6410_vddpll = {
387 .constraints = {
388 .name = "PVDD_PLL",
389 .always_on = 1,
390 },
391};
392
393/* VDD_UH_MMC, LDO5 on J5 */
394static struct regulator_init_data smdk6410_vdduh_mmc = {
395 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900396 .name = "PVDD_UH+PVDD_MMC",
Mark Brown60f91012010-02-17 18:19:29 +0000397 .always_on = 1,
398 },
399};
400
401/* VCCM3BT, LDO8 on J5 */
402static struct regulator_init_data smdk6410_vccmc3bt = {
403 .constraints = {
404 .name = "PVCCM3BT",
405 .always_on = 1,
406 },
407};
408
409/* VCCM2MTV, LDO11 on J5 */
410static struct regulator_init_data smdk6410_vccm2mtv = {
411 .constraints = {
412 .name = "PVCCM2MTV",
413 .always_on = 1,
414 },
415};
416
417/* VDD_LCD, LDO12 on J5 */
418static struct regulator_init_data smdk6410_vddlcd = {
419 .constraints = {
420 .name = "PVDD_LCD",
421 .always_on = 1,
422 },
423};
424
425/* VDD_OTGI, LDO9 on J5 */
426static struct regulator_init_data smdk6410_vddotgi = {
427 .constraints = {
428 .name = "PVDD_OTGI",
429 .always_on = 1,
430 },
431};
432
433/* VDD_OTG, LDO14 on J5 */
434static struct regulator_init_data smdk6410_vddotg = {
435 .constraints = {
436 .name = "PVDD_OTG",
437 .always_on = 1,
438 },
439};
440
441/* VDD_ALIVE, LDO15 on J5 */
442static struct regulator_init_data smdk6410_vddalive = {
443 .constraints = {
444 .name = "PVDD_ALIVE",
445 .always_on = 1,
446 },
447};
448
449/* VDD_AUDIO, VLDO_AUDIO on J5 */
450static struct regulator_init_data smdk6410_vddaudio = {
451 .constraints = {
452 .name = "PVDD_AUDIO",
453 .always_on = 1,
454 },
455};
456#endif
457
Mark Brownecc558a2009-02-17 15:59:38 +0000458#ifdef CONFIG_SMDK6410_WM1190_EV1
459/* S3C64xx internal logic & PLL */
460static struct regulator_init_data wm8350_dcdc1_data = {
461 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900462 .name = "PVDD_INT+PVDD_PLL",
Mark Brownecc558a2009-02-17 15:59:38 +0000463 .min_uV = 1200000,
464 .max_uV = 1200000,
465 .always_on = 1,
466 .apply_uV = 1,
467 },
468};
469
470/* Memory */
471static struct regulator_init_data wm8350_dcdc3_data = {
472 .constraints = {
473 .name = "PVDD_MEM",
474 .min_uV = 1800000,
475 .max_uV = 1800000,
476 .always_on = 1,
477 .state_mem = {
478 .uV = 1800000,
479 .mode = REGULATOR_MODE_NORMAL,
480 .enabled = 1,
Mark Brown60f91012010-02-17 18:19:29 +0000481 },
Mark Brownecc558a2009-02-17 15:59:38 +0000482 .initial_state = PM_SUSPEND_MEM,
483 },
484};
485
486/* USB, EXT, PCM, ADC/DAC, USB, MMC */
Mark Brown42015c12009-11-03 14:42:06 +0000487static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = {
488 {
489 /* WM8580 */
490 .supply = "DVDD",
491 .dev_name = "0-001b",
492 },
493};
494
Mark Brownecc558a2009-02-17 15:59:38 +0000495static struct regulator_init_data wm8350_dcdc4_data = {
496 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900497 .name = "PVDD_HI+PVDD_EXT+PVDD_SYS+PVCCM2MTV",
Mark Brownecc558a2009-02-17 15:59:38 +0000498 .min_uV = 3000000,
499 .max_uV = 3000000,
500 .always_on = 1,
501 },
Mark Brown42015c12009-11-03 14:42:06 +0000502 .num_consumer_supplies = ARRAY_SIZE(wm8350_dcdc4_consumers),
503 .consumer_supplies = wm8350_dcdc4_consumers,
Mark Brownecc558a2009-02-17 15:59:38 +0000504};
505
Mark Brownecc558a2009-02-17 15:59:38 +0000506/* OTGi/1190-EV1 HPVDD & AVDD */
507static struct regulator_init_data wm8350_ldo4_data = {
508 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900509 .name = "PVDD_OTGI+HPVDD+AVDD",
Mark Brownecc558a2009-02-17 15:59:38 +0000510 .min_uV = 1200000,
511 .max_uV = 1200000,
512 .apply_uV = 1,
Mark Brownf53aee22009-04-09 16:30:40 +0100513 .always_on = 1,
Mark Brownecc558a2009-02-17 15:59:38 +0000514 },
515};
516
517static struct {
518 int regulator;
519 struct regulator_init_data *initdata;
520} wm1190_regulators[] = {
521 { WM8350_DCDC_1, &wm8350_dcdc1_data },
522 { WM8350_DCDC_3, &wm8350_dcdc3_data },
523 { WM8350_DCDC_4, &wm8350_dcdc4_data },
Mark Brown60f91012010-02-17 18:19:29 +0000524 { WM8350_DCDC_6, &smdk6410_vddarm },
525 { WM8350_LDO_1, &smdk6410_vddalive },
526 { WM8350_LDO_2, &smdk6410_vddotg },
527 { WM8350_LDO_3, &smdk6410_vddlcd },
Mark Brownecc558a2009-02-17 15:59:38 +0000528 { WM8350_LDO_4, &wm8350_ldo4_data },
529};
530
531static int __init smdk6410_wm8350_init(struct wm8350 *wm8350)
532{
533 int i;
534
Mark Browna3323b72009-11-03 14:42:04 +0000535 /* Configure the IRQ line */
536 s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);
537
Mark Brownecc558a2009-02-17 15:59:38 +0000538 /* Instantiate the regulators */
539 for (i = 0; i < ARRAY_SIZE(wm1190_regulators); i++)
540 wm8350_register_regulator(wm8350,
541 wm1190_regulators[i].regulator,
542 wm1190_regulators[i].initdata);
543
544 return 0;
545}
546
547static struct wm8350_platform_data __initdata smdk6410_wm8350_pdata = {
548 .init = smdk6410_wm8350_init,
Mark Browndb9256f2009-04-09 19:00:19 +0100549 .irq_high = 1,
Mark Brown9fca8782010-01-19 15:26:56 +0000550 .irq_base = IRQ_BOARD_START,
Mark Brownecc558a2009-02-17 15:59:38 +0000551};
552#endif
553
Mark Brown60f91012010-02-17 18:19:29 +0000554#ifdef CONFIG_SMDK6410_WM1192_EV1
Mark Browna7a81d02010-02-17 18:19:31 +0000555static struct gpio_led wm1192_pmic_leds[] = {
556 {
557 .name = "PMIC:red:power",
558 .gpio = GPIO_BOARD_START + 3,
559 .default_state = LEDS_GPIO_DEFSTATE_ON,
560 },
561};
562
563static struct gpio_led_platform_data wm1192_pmic_led = {
564 .num_leds = ARRAY_SIZE(wm1192_pmic_leds),
565 .leds = wm1192_pmic_leds,
566};
567
568static struct platform_device wm1192_pmic_led_dev = {
569 .name = "leds-gpio",
570 .id = -1,
571 .dev = {
572 .platform_data = &wm1192_pmic_led,
573 },
574};
575
Mark Brown60f91012010-02-17 18:19:29 +0000576static int wm1192_pre_init(struct wm831x *wm831x)
577{
Mark Browna7a81d02010-02-17 18:19:31 +0000578 int ret;
579
Mark Brown60f91012010-02-17 18:19:29 +0000580 /* Configure the IRQ line */
581 s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);
582
Mark Browna7a81d02010-02-17 18:19:31 +0000583 ret = platform_device_register(&wm1192_pmic_led_dev);
584 if (ret != 0)
585 dev_err(wm831x->dev, "Failed to add PMIC LED: %d\n", ret);
586
Mark Brown60f91012010-02-17 18:19:29 +0000587 return 0;
588}
589
590static struct wm831x_backlight_pdata wm1192_backlight_pdata = {
591 .isink = 1,
592 .max_uA = 27554,
593};
594
595static struct regulator_init_data wm1192_dcdc3 = {
596 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900597 .name = "PVDD_MEM+PVDD_GPS",
Mark Brown60f91012010-02-17 18:19:29 +0000598 .always_on = 1,
599 },
600};
601
602static struct regulator_consumer_supply wm1192_ldo1_consumers[] = {
603 { .supply = "DVDD", .dev_name = "0-001b", }, /* WM8580 */
604};
605
606static struct regulator_init_data wm1192_ldo1 = {
607 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900608 .name = "PVDD_LCD+PVDD_EXT",
Mark Brown60f91012010-02-17 18:19:29 +0000609 .always_on = 1,
610 },
611 .consumer_supplies = wm1192_ldo1_consumers,
612 .num_consumer_supplies = ARRAY_SIZE(wm1192_ldo1_consumers),
613};
614
615static struct wm831x_status_pdata wm1192_led7_pdata = {
616 .name = "LED7:green:",
617};
618
619static struct wm831x_status_pdata wm1192_led8_pdata = {
620 .name = "LED8:green:",
621};
622
623static struct wm831x_pdata smdk6410_wm1192_pdata = {
624 .pre_init = wm1192_pre_init,
625 .irq_base = IRQ_BOARD_START,
626
627 .backlight = &wm1192_backlight_pdata,
628 .dcdc = {
629 &smdk6410_vddarm, /* DCDC1 */
630 &smdk6410_vddint, /* DCDC2 */
631 &wm1192_dcdc3,
632 },
Mark Browna7a81d02010-02-17 18:19:31 +0000633 .gpio_base = GPIO_BOARD_START,
Mark Brown60f91012010-02-17 18:19:29 +0000634 .ldo = {
635 &wm1192_ldo1, /* LDO1 */
636 &smdk6410_vdduh_mmc, /* LDO2 */
637 NULL, /* LDO3 NC */
638 &smdk6410_vddotgi, /* LDO4 */
639 &smdk6410_vddotg, /* LDO5 */
640 &smdk6410_vddhi, /* LDO6 */
641 &smdk6410_vddaudio, /* LDO7 */
642 &smdk6410_vccm2mtv, /* LDO8 */
643 &smdk6410_vddpll, /* LDO9 */
644 &smdk6410_vccmc3bt, /* LDO10 */
645 &smdk6410_vddalive, /* LDO11 */
646 },
647 .status = {
648 &wm1192_led7_pdata,
649 &wm1192_led8_pdata,
650 },
651};
652#endif
653
Ben Dooks096941e2008-10-31 16:14:59 +0000654static struct i2c_board_info i2c_devs0[] __initdata = {
655 { I2C_BOARD_INFO("24c08", 0x50), },
Mark Brown77897472009-01-23 16:29:41 +0000656 { I2C_BOARD_INFO("wm8580", 0x1b), },
Mark Brownecc558a2009-02-17 15:59:38 +0000657
Mark Brown60f91012010-02-17 18:19:29 +0000658#ifdef CONFIG_SMDK6410_WM1192_EV1
659 { I2C_BOARD_INFO("wm8312", 0x34),
660 .platform_data = &smdk6410_wm1192_pdata,
661 .irq = S3C_EINT(12),
662 },
663#endif
664
Mark Brownecc558a2009-02-17 15:59:38 +0000665#ifdef CONFIG_SMDK6410_WM1190_EV1
666 { I2C_BOARD_INFO("wm8350", 0x1a),
667 .platform_data = &smdk6410_wm8350_pdata,
668 .irq = S3C_EINT(12),
669 },
670#endif
Ben Dooks096941e2008-10-31 16:14:59 +0000671};
672
673static struct i2c_board_info i2c_devs1[] __initdata = {
674 { I2C_BOARD_INFO("24c128", 0x57), }, /* Samsung S524AD0XD1 */
Ben Dooks5718df92008-10-21 14:07:09 +0100675};
676
Naveen Krishna Ch85b14a32010-05-20 11:39:52 +0900677static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
678 .delay = 10000,
679 .presc = 49,
680 .oversampling_shift = 2,
681};
682
Ben Dooks5718df92008-10-21 14:07:09 +0100683static void __init smdk6410_map_io(void)
684{
Ben Dooksd6662c32008-12-12 00:24:40 +0000685 u32 tmp;
686
Ben Dooks5718df92008-10-21 14:07:09 +0100687 s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
688 s3c24xx_init_clocks(12000000);
689 s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
Ben Dooksd6662c32008-12-12 00:24:40 +0000690
691 /* set the LCD type */
692
693 tmp = __raw_readl(S3C64XX_SPCON);
694 tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
695 tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
696 __raw_writel(tmp, S3C64XX_SPCON);
697
698 /* remove the lcd bypass */
699 tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
700 tmp &= ~MIFPCON_LCD_BYPASS;
701 __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
Ben Dooks5718df92008-10-21 14:07:09 +0100702}
703
704static void __init smdk6410_machine_init(void)
705{
Andy Greenf01fdac2009-12-29 14:40:36 +0000706 u32 cs1;
707
Ben Dooksd85fa242008-10-31 16:14:52 +0000708 s3c_i2c0_set_platdata(NULL);
Ben Dooksd7ea3742008-10-31 16:14:57 +0000709 s3c_i2c1_set_platdata(NULL);
Ben Dooks438a5d42008-11-19 15:41:34 +0000710 s3c_fb_set_platdata(&smdk6410_lcd_pdata);
Ben Dooks096941e2008-10-31 16:14:59 +0000711
Naveen Krishna Ch290d0982010-06-22 07:39:18 +0900712 samsung_keypad_set_platdata(&smdk6410_keypad_data);
713
Naveen Krishna Ch85b14a32010-05-20 11:39:52 +0900714 s3c24xx_ts_set_platdata(&s3c_ts_platform);
715
Andy Greenf01fdac2009-12-29 14:40:36 +0000716 /* configure nCS1 width to 16 bits */
717
718 cs1 = __raw_readl(S3C64XX_SROM_BW) &
719 ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
720 cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
721 (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
722 (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
723 S3C64XX_SROM_BW__NCS1__SHIFT;
724 __raw_writel(cs1, S3C64XX_SROM_BW);
725
726 /* set timing for nCS1 suitable for ethernet chip */
727
728 __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
729 (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
730 (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
731 (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
732 (0xe << S3C64XX_SROM_BCX__TACC__SHIFT) |
733 (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
734 (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
735
Mark Brownb7f9a942009-04-08 16:12:35 +0100736 gpio_request(S3C64XX_GPN(5), "LCD power");
737 gpio_request(S3C64XX_GPF(13), "LCD power");
Mark Brownb7f9a942009-04-08 16:12:35 +0100738
Ben Dooks096941e2008-10-31 16:14:59 +0000739 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
740 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
741
Abhilash Kesavan0ab0b6d2010-06-08 16:55:45 +0900742 s3c_ide_set_platdata(&smdk6410_ide_pdata);
743
Ben Dooks5718df92008-10-21 14:07:09 +0100744 platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
745}
746
747MACHINE_START(SMDK6410, "SMDK6410")
Ben Dooksafdd2252010-05-07 09:24:05 +0900748 /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
Ben Dooks5718df92008-10-21 14:07:09 +0100749 .boot_params = S3C64XX_PA_SDRAM + 0x100,
750
751 .init_irq = s3c6410_init_irq,
752 .map_io = smdk6410_map_io,
753 .init_machine = smdk6410_machine_init,
754 .timer = &s3c24xx_timer,
755MACHINE_END