blob: ddd0eb84e81fce1873244e37a2c3fb514bcc6e41 [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>
Lukasz Majewski126625e2012-05-09 13:16:53 +020033#include <linux/platform_data/s3c-hsotg.h>
Ben Dooks438a5d42008-11-19 15:41:34 +000034
Mark Brownecc558a2009-02-17 15:59:38 +000035#ifdef CONFIG_SMDK6410_WM1190_EV1
36#include <linux/mfd/wm8350/core.h>
37#include <linux/mfd/wm8350/pmic.h>
38#endif
Ben Dooks438a5d42008-11-19 15:41:34 +000039
Mark Brown60f91012010-02-17 18:19:29 +000040#ifdef CONFIG_SMDK6410_WM1192_EV1
Mark Browna7a81d02010-02-17 18:19:31 +000041#include <linux/mfd/wm831x/core.h>
Mark Brown60f91012010-02-17 18:19:29 +000042#include <linux/mfd/wm831x/pdata.h>
43#endif
44
Ben Dooks438a5d42008-11-19 15:41:34 +000045#include <video/platform_lcd.h>
Leela Krishna Amudala5a213a52012-08-08 09:44:49 +090046#include <video/samsung_fimd.h>
Ben Dooks5718df92008-10-21 14:07:09 +010047
Jamie Iles774b51f2011-11-04 01:10:04 +000048#include <asm/hardware/vic.h>
Ben Dooks5718df92008-10-21 14:07:09 +010049#include <asm/mach/arch.h>
50#include <asm/mach/map.h>
51#include <asm/mach/irq.h>
52
53#include <mach/hardware.h>
54#include <mach/map.h>
55
56#include <asm/irq.h>
57#include <asm/mach-types.h>
58
59#include <plat/regs-serial.h>
Ben Dooks3501c9a2010-01-26 10:45:40 +090060#include <mach/regs-gpio.h>
Arnd Bergmann436d42c2012-08-24 15:22:12 +020061#include <linux/platform_data/ata-samsung_cf.h>
62#include <linux/platform_data/i2c-s3c2410.h>
Ben Dooks438a5d42008-11-19 15:41:34 +000063#include <plat/fb.h>
Mark Brown3056ea02009-01-27 16:18:01 +000064#include <plat/gpio-cfg.h>
Ben Dooks5718df92008-10-21 14:07:09 +010065
Ben Dooks5718df92008-10-21 14:07:09 +010066#include <plat/clock.h>
67#include <plat/devs.h>
68#include <plat/cpu.h>
Naveen Krishna Ch85b14a32010-05-20 11:39:52 +090069#include <plat/adc.h>
Arnd Bergmann436d42c2012-08-24 15:22:12 +020070#include <linux/platform_data/touchscreen-s3c2410.h>
Naveen Krishna Ch290d0982010-06-22 07:39:18 +090071#include <plat/keypad.h>
Banajit Goswami96d78682011-07-20 23:45:22 +090072#include <plat/backlight.h>
Ben Dooks5718df92008-10-21 14:07:09 +010073
Kukjin Kimb024043b2011-12-22 23:27:42 +010074#include "common.h"
Kukjin Kima81c1972013-01-02 13:24:12 -080075#include "regs-modem.h"
Kukjin Kim8eba8ea2013-01-02 13:26:25 -080076#include "regs-srom.h"
Kukjin Kimf2bfd172013-01-02 13:31:15 -080077#include "regs-sys.h"
Kukjin Kimb024043b2011-12-22 23:27:42 +010078
Ben Dooks5718df92008-10-21 14:07:09 +010079#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
80#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
81#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
82
83static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
84 [0] = {
85 .hwport = 0,
86 .flags = 0,
Matt Hsubd258e52009-06-29 19:03:41 +080087 .ucon = UCON,
88 .ulcon = ULCON,
89 .ufcon = UFCON,
Ben Dooks5718df92008-10-21 14:07:09 +010090 },
91 [1] = {
92 .hwport = 1,
93 .flags = 0,
Matt Hsubd258e52009-06-29 19:03:41 +080094 .ucon = UCON,
95 .ulcon = ULCON,
96 .ufcon = UFCON,
97 },
98 [2] = {
99 .hwport = 2,
100 .flags = 0,
101 .ucon = UCON,
102 .ulcon = ULCON,
103 .ufcon = UFCON,
104 },
105 [3] = {
106 .hwport = 3,
107 .flags = 0,
108 .ucon = UCON,
109 .ulcon = ULCON,
110 .ufcon = UFCON,
Ben Dooks5718df92008-10-21 14:07:09 +0100111 },
112};
113
Ben Dooks438a5d42008-11-19 15:41:34 +0000114/* framebuffer and LCD setup. */
115
116/* GPF15 = LCD backlight control
117 * GPF13 => Panel power
118 * GPN5 = LCD nRESET signal
119 * PWM_TOUT1 => backlight brightness
120 */
121
122static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
123 unsigned int power)
124{
125 if (power) {
126 gpio_direction_output(S3C64XX_GPF(13), 1);
Ben Dooks438a5d42008-11-19 15:41:34 +0000127
128 /* fire nRESET on power up */
129 gpio_direction_output(S3C64XX_GPN(5), 0);
130 msleep(10);
131 gpio_direction_output(S3C64XX_GPN(5), 1);
132 msleep(1);
133 } else {
Ben Dooks438a5d42008-11-19 15:41:34 +0000134 gpio_direction_output(S3C64XX_GPF(13), 0);
135 }
136}
137
138static struct plat_lcd_data smdk6410_lcd_power_data = {
139 .set_power = smdk6410_lcd_power_set,
140};
141
142static struct platform_device smdk6410_lcd_powerdev = {
143 .name = "platform-lcd",
144 .dev.parent = &s3c_device_fb.dev,
145 .dev.platform_data = &smdk6410_lcd_power_data,
146};
147
148static struct s3c_fb_pd_win smdk6410_fb_win0 = {
Ben Dooks438a5d42008-11-19 15:41:34 +0000149 .max_bpp = 32,
150 .default_bpp = 16,
Thomas Abraham79d3c412012-03-24 21:58:48 +0530151 .xres = 800,
152 .yres = 480,
Ben Dooks001ca742010-07-26 10:56:40 +0100153 .virtual_y = 480 * 2,
154 .virtual_x = 800,
Ben Dooks438a5d42008-11-19 15:41:34 +0000155};
156
Thomas Abraham79d3c412012-03-24 21:58:48 +0530157static struct fb_videomode smdk6410_lcd_timing = {
158 .left_margin = 8,
159 .right_margin = 13,
160 .upper_margin = 7,
161 .lower_margin = 5,
162 .hsync_len = 3,
163 .vsync_len = 1,
164 .xres = 800,
165 .yres = 480,
166};
167
Ben Dooks438a5d42008-11-19 15:41:34 +0000168/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
169static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
170 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
Thomas Abraham79d3c412012-03-24 21:58:48 +0530171 .vtiming = &smdk6410_lcd_timing,
Ben Dooks438a5d42008-11-19 15:41:34 +0000172 .win[0] = &smdk6410_fb_win0,
173 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
174 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
175};
176
Andy Greena4e94692009-12-29 14:40:43 +0000177/*
178 * Configuring Ethernet on SMDK6410
179 *
180 * Both CS8900A and LAN9115 chips share one chip select mediated by CFG6.
181 * The constant address below corresponds to nCS1
182 *
183 * 1) Set CFGB2 p3 ON others off, no other CFGB selects "ethernet"
184 * 2) CFG6 needs to be switched to "LAN9115" side
185 */
186
Mark Brown3056ea02009-01-27 16:18:01 +0000187static struct resource smdk6410_smsc911x_resources[] = {
Tushar Beherac858fd52012-05-12 16:12:30 +0900188 [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, SZ_64K),
189 [1] = DEFINE_RES_NAMED(S3C_EINT(10), 1, NULL, IORESOURCE_IRQ \
190 | IRQ_TYPE_LEVEL_LOW),
Mark Brown3056ea02009-01-27 16:18:01 +0000191};
192
193static struct smsc911x_platform_config smdk6410_smsc911x_pdata = {
194 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
195 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
196 .flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY,
197 .phy_interface = PHY_INTERFACE_MODE_MII,
198};
199
200
201static struct platform_device smdk6410_smsc911x = {
202 .name = "smsc911x",
203 .id = -1,
204 .num_resources = ARRAY_SIZE(smdk6410_smsc911x_resources),
205 .resource = &smdk6410_smsc911x_resources[0],
206 .dev = {
207 .platform_data = &smdk6410_smsc911x_pdata,
208 },
209};
210
Mark Brown42015c12009-11-03 14:42:06 +0000211#ifdef CONFIG_REGULATOR
Mark Brownb5930b82011-05-24 08:27:59 +0800212static struct regulator_consumer_supply smdk6410_b_pwr_5v_consumers[] __initdata = {
213 REGULATOR_SUPPLY("PVDD", "0-001b"),
214 REGULATOR_SUPPLY("AVDD", "0-001b"),
Mark Brown42015c12009-11-03 14:42:06 +0000215};
216
217static struct regulator_init_data smdk6410_b_pwr_5v_data = {
218 .constraints = {
219 .always_on = 1,
220 },
221 .num_consumer_supplies = ARRAY_SIZE(smdk6410_b_pwr_5v_consumers),
222 .consumer_supplies = smdk6410_b_pwr_5v_consumers,
223};
224
225static struct fixed_voltage_config smdk6410_b_pwr_5v_pdata = {
226 .supply_name = "B_PWR_5V",
227 .microvolts = 5000000,
228 .init_data = &smdk6410_b_pwr_5v_data,
Mark Brownd3cf4482010-01-13 13:57:04 +0000229 .gpio = -EINVAL,
Mark Brown42015c12009-11-03 14:42:06 +0000230};
231
232static struct platform_device smdk6410_b_pwr_5v = {
233 .name = "reg-fixed-voltage",
234 .id = -1,
235 .dev = {
236 .platform_data = &smdk6410_b_pwr_5v_pdata,
237 },
238};
239#endif
240
Abhilash Kesavan0ab0b6d2010-06-08 16:55:45 +0900241static struct s3c_ide_platdata smdk6410_ide_pdata __initdata = {
242 .setup_gpio = s3c64xx_ide_setup_gpio,
243};
244
Naveen Krishna Ch290d0982010-06-22 07:39:18 +0900245static uint32_t smdk6410_keymap[] __initdata = {
246 /* KEY(row, col, keycode) */
247 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
248 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
249 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
250 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
251};
252
253static struct matrix_keymap_data smdk6410_keymap_data __initdata = {
254 .keymap = smdk6410_keymap,
255 .keymap_size = ARRAY_SIZE(smdk6410_keymap),
256};
257
258static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = {
259 .keymap_data = &smdk6410_keymap_data,
260 .rows = 2,
261 .cols = 8,
262};
263
Mark Brown027191a2009-01-23 16:29:43 +0000264static struct map_desc smdk6410_iodesc[] = {};
Ben Dooks5718df92008-10-21 14:07:09 +0100265
266static struct platform_device *smdk6410_devices[] __initdata = {
Ben Dooksb24636c2008-11-03 20:14:53 +0000267#ifdef CONFIG_SMDK6410_SD_CH0
Ben Dooks39057f22008-10-31 16:14:29 +0000268 &s3c_device_hsmmc0,
Ben Dooksb24636c2008-11-03 20:14:53 +0000269#endif
270#ifdef CONFIG_SMDK6410_SD_CH1
271 &s3c_device_hsmmc1,
272#endif
Ben Dooksd85fa242008-10-31 16:14:52 +0000273 &s3c_device_i2c0,
Ben Dooksd7ea3742008-10-31 16:14:57 +0000274 &s3c_device_i2c1,
Ben Dooks438a5d42008-11-19 15:41:34 +0000275 &s3c_device_fb,
Ben Dooksb8132482009-11-23 00:13:39 +0000276 &s3c_device_ohci,
Ben Dooks06fa1d32009-05-16 22:11:20 +0100277 &s3c_device_usb_hsotg,
Mark Brown1f100862010-02-17 19:03:20 +0000278 &s3c64xx_device_iisv4,
Naveen Krishna Ch290d0982010-06-22 07:39:18 +0900279 &samsung_device_keypad,
Mark Brown42015c12009-11-03 14:42:06 +0000280
281#ifdef CONFIG_REGULATOR
282 &smdk6410_b_pwr_5v,
283#endif
Ben Dooks438a5d42008-11-19 15:41:34 +0000284 &smdk6410_lcd_powerdev,
Mark Brown3056ea02009-01-27 16:18:01 +0000285
286 &smdk6410_smsc911x,
Naveen Krishna Ch85b14a32010-05-20 11:39:52 +0900287 &s3c_device_adc,
Abhilash Kesavan0ab0b6d2010-06-08 16:55:45 +0900288 &s3c_device_cfcon,
Atul Dahiya9bbf4a62010-07-20 16:31:32 +0530289 &s3c_device_rtc,
Naveen Krishna Ch85b14a32010-05-20 11:39:52 +0900290 &s3c_device_ts,
Banajit Goswamib351c4a2010-05-20 16:21:30 +0900291 &s3c_device_wdt,
Ben Dooks5718df92008-10-21 14:07:09 +0100292};
293
Mark Brown60f91012010-02-17 18:19:29 +0000294#ifdef CONFIG_REGULATOR
295/* ARM core */
296static struct regulator_consumer_supply smdk6410_vddarm_consumers[] = {
Mark Brownb5930b82011-05-24 08:27:59 +0800297 REGULATOR_SUPPLY("vddarm", NULL),
Mark Brown60f91012010-02-17 18:19:29 +0000298};
299
300/* VDDARM, BUCK1 on J5 */
301static struct regulator_init_data smdk6410_vddarm = {
302 .constraints = {
303 .name = "PVDD_ARM",
304 .min_uV = 1000000,
305 .max_uV = 1300000,
306 .always_on = 1,
307 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
308 },
309 .num_consumer_supplies = ARRAY_SIZE(smdk6410_vddarm_consumers),
310 .consumer_supplies = smdk6410_vddarm_consumers,
311};
312
313/* VDD_INT, BUCK2 on J5 */
314static struct regulator_init_data smdk6410_vddint = {
315 .constraints = {
316 .name = "PVDD_INT",
317 .min_uV = 1000000,
318 .max_uV = 1200000,
319 .always_on = 1,
320 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
321 },
322};
323
324/* VDD_HI, LDO3 on J5 */
325static struct regulator_init_data smdk6410_vddhi = {
326 .constraints = {
327 .name = "PVDD_HI",
328 .always_on = 1,
329 },
330};
331
332/* VDD_PLL, LDO2 on J5 */
333static struct regulator_init_data smdk6410_vddpll = {
334 .constraints = {
335 .name = "PVDD_PLL",
336 .always_on = 1,
337 },
338};
339
340/* VDD_UH_MMC, LDO5 on J5 */
341static struct regulator_init_data smdk6410_vdduh_mmc = {
342 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900343 .name = "PVDD_UH+PVDD_MMC",
Mark Brown60f91012010-02-17 18:19:29 +0000344 .always_on = 1,
345 },
346};
347
348/* VCCM3BT, LDO8 on J5 */
349static struct regulator_init_data smdk6410_vccmc3bt = {
350 .constraints = {
351 .name = "PVCCM3BT",
352 .always_on = 1,
353 },
354};
355
356/* VCCM2MTV, LDO11 on J5 */
357static struct regulator_init_data smdk6410_vccm2mtv = {
358 .constraints = {
359 .name = "PVCCM2MTV",
360 .always_on = 1,
361 },
362};
363
364/* VDD_LCD, LDO12 on J5 */
365static struct regulator_init_data smdk6410_vddlcd = {
366 .constraints = {
367 .name = "PVDD_LCD",
368 .always_on = 1,
369 },
370};
371
372/* VDD_OTGI, LDO9 on J5 */
373static struct regulator_init_data smdk6410_vddotgi = {
374 .constraints = {
375 .name = "PVDD_OTGI",
376 .always_on = 1,
377 },
378};
379
380/* VDD_OTG, LDO14 on J5 */
381static struct regulator_init_data smdk6410_vddotg = {
382 .constraints = {
383 .name = "PVDD_OTG",
384 .always_on = 1,
385 },
386};
387
388/* VDD_ALIVE, LDO15 on J5 */
389static struct regulator_init_data smdk6410_vddalive = {
390 .constraints = {
391 .name = "PVDD_ALIVE",
392 .always_on = 1,
393 },
394};
395
396/* VDD_AUDIO, VLDO_AUDIO on J5 */
397static struct regulator_init_data smdk6410_vddaudio = {
398 .constraints = {
399 .name = "PVDD_AUDIO",
400 .always_on = 1,
401 },
402};
403#endif
404
Mark Brownecc558a2009-02-17 15:59:38 +0000405#ifdef CONFIG_SMDK6410_WM1190_EV1
406/* S3C64xx internal logic & PLL */
407static struct regulator_init_data wm8350_dcdc1_data = {
408 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900409 .name = "PVDD_INT+PVDD_PLL",
Mark Brownecc558a2009-02-17 15:59:38 +0000410 .min_uV = 1200000,
411 .max_uV = 1200000,
412 .always_on = 1,
413 .apply_uV = 1,
414 },
415};
416
417/* Memory */
418static struct regulator_init_data wm8350_dcdc3_data = {
419 .constraints = {
420 .name = "PVDD_MEM",
421 .min_uV = 1800000,
422 .max_uV = 1800000,
423 .always_on = 1,
424 .state_mem = {
425 .uV = 1800000,
426 .mode = REGULATOR_MODE_NORMAL,
427 .enabled = 1,
Mark Brown60f91012010-02-17 18:19:29 +0000428 },
Mark Brownecc558a2009-02-17 15:59:38 +0000429 .initial_state = PM_SUSPEND_MEM,
430 },
431};
432
433/* USB, EXT, PCM, ADC/DAC, USB, MMC */
Mark Brown42015c12009-11-03 14:42:06 +0000434static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = {
Mark Brownb5930b82011-05-24 08:27:59 +0800435 REGULATOR_SUPPLY("DVDD", "0-001b"),
Mark Brown42015c12009-11-03 14:42:06 +0000436};
437
Mark Brownecc558a2009-02-17 15:59:38 +0000438static struct regulator_init_data wm8350_dcdc4_data = {
439 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900440 .name = "PVDD_HI+PVDD_EXT+PVDD_SYS+PVCCM2MTV",
Mark Brownecc558a2009-02-17 15:59:38 +0000441 .min_uV = 3000000,
442 .max_uV = 3000000,
443 .always_on = 1,
444 },
Mark Brown42015c12009-11-03 14:42:06 +0000445 .num_consumer_supplies = ARRAY_SIZE(wm8350_dcdc4_consumers),
446 .consumer_supplies = wm8350_dcdc4_consumers,
Mark Brownecc558a2009-02-17 15:59:38 +0000447};
448
Mark Brownecc558a2009-02-17 15:59:38 +0000449/* OTGi/1190-EV1 HPVDD & AVDD */
450static struct regulator_init_data wm8350_ldo4_data = {
451 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900452 .name = "PVDD_OTGI+HPVDD+AVDD",
Mark Brownecc558a2009-02-17 15:59:38 +0000453 .min_uV = 1200000,
454 .max_uV = 1200000,
455 .apply_uV = 1,
Mark Brownf53aee22009-04-09 16:30:40 +0100456 .always_on = 1,
Mark Brownecc558a2009-02-17 15:59:38 +0000457 },
458};
459
460static struct {
461 int regulator;
462 struct regulator_init_data *initdata;
463} wm1190_regulators[] = {
464 { WM8350_DCDC_1, &wm8350_dcdc1_data },
465 { WM8350_DCDC_3, &wm8350_dcdc3_data },
466 { WM8350_DCDC_4, &wm8350_dcdc4_data },
Mark Brown60f91012010-02-17 18:19:29 +0000467 { WM8350_DCDC_6, &smdk6410_vddarm },
468 { WM8350_LDO_1, &smdk6410_vddalive },
469 { WM8350_LDO_2, &smdk6410_vddotg },
470 { WM8350_LDO_3, &smdk6410_vddlcd },
Mark Brownecc558a2009-02-17 15:59:38 +0000471 { WM8350_LDO_4, &wm8350_ldo4_data },
472};
473
474static int __init smdk6410_wm8350_init(struct wm8350 *wm8350)
475{
476 int i;
477
Mark Browna3323b72009-11-03 14:42:04 +0000478 /* Configure the IRQ line */
479 s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);
480
Mark Brownecc558a2009-02-17 15:59:38 +0000481 /* Instantiate the regulators */
482 for (i = 0; i < ARRAY_SIZE(wm1190_regulators); i++)
483 wm8350_register_regulator(wm8350,
484 wm1190_regulators[i].regulator,
485 wm1190_regulators[i].initdata);
486
487 return 0;
488}
489
490static struct wm8350_platform_data __initdata smdk6410_wm8350_pdata = {
491 .init = smdk6410_wm8350_init,
Mark Browndb9256f2009-04-09 19:00:19 +0100492 .irq_high = 1,
Mark Brown9fca8782010-01-19 15:26:56 +0000493 .irq_base = IRQ_BOARD_START,
Mark Brownecc558a2009-02-17 15:59:38 +0000494};
495#endif
496
Mark Brown60f91012010-02-17 18:19:29 +0000497#ifdef CONFIG_SMDK6410_WM1192_EV1
Mark Browna7a81d02010-02-17 18:19:31 +0000498static struct gpio_led wm1192_pmic_leds[] = {
499 {
500 .name = "PMIC:red:power",
501 .gpio = GPIO_BOARD_START + 3,
502 .default_state = LEDS_GPIO_DEFSTATE_ON,
503 },
504};
505
506static struct gpio_led_platform_data wm1192_pmic_led = {
507 .num_leds = ARRAY_SIZE(wm1192_pmic_leds),
508 .leds = wm1192_pmic_leds,
509};
510
511static struct platform_device wm1192_pmic_led_dev = {
512 .name = "leds-gpio",
513 .id = -1,
514 .dev = {
515 .platform_data = &wm1192_pmic_led,
516 },
517};
518
Mark Brown60f91012010-02-17 18:19:29 +0000519static int wm1192_pre_init(struct wm831x *wm831x)
520{
Mark Browna7a81d02010-02-17 18:19:31 +0000521 int ret;
522
Mark Brown60f91012010-02-17 18:19:29 +0000523 /* Configure the IRQ line */
524 s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);
525
Mark Browna7a81d02010-02-17 18:19:31 +0000526 ret = platform_device_register(&wm1192_pmic_led_dev);
527 if (ret != 0)
528 dev_err(wm831x->dev, "Failed to add PMIC LED: %d\n", ret);
529
Mark Brown60f91012010-02-17 18:19:29 +0000530 return 0;
531}
532
533static struct wm831x_backlight_pdata wm1192_backlight_pdata = {
534 .isink = 1,
535 .max_uA = 27554,
536};
537
538static struct regulator_init_data wm1192_dcdc3 = {
539 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900540 .name = "PVDD_MEM+PVDD_GPS",
Mark Brown60f91012010-02-17 18:19:29 +0000541 .always_on = 1,
542 },
543};
544
545static struct regulator_consumer_supply wm1192_ldo1_consumers[] = {
Mark Brownb5930b82011-05-24 08:27:59 +0800546 REGULATOR_SUPPLY("DVDD", "0-001b"), /* WM8580 */
Mark Brown60f91012010-02-17 18:19:29 +0000547};
548
549static struct regulator_init_data wm1192_ldo1 = {
550 .constraints = {
Mark Brown18b52ca2011-03-04 08:24:15 +0900551 .name = "PVDD_LCD+PVDD_EXT",
Mark Brown60f91012010-02-17 18:19:29 +0000552 .always_on = 1,
553 },
554 .consumer_supplies = wm1192_ldo1_consumers,
555 .num_consumer_supplies = ARRAY_SIZE(wm1192_ldo1_consumers),
556};
557
558static struct wm831x_status_pdata wm1192_led7_pdata = {
559 .name = "LED7:green:",
560};
561
562static struct wm831x_status_pdata wm1192_led8_pdata = {
563 .name = "LED8:green:",
564};
565
566static struct wm831x_pdata smdk6410_wm1192_pdata = {
567 .pre_init = wm1192_pre_init,
Mark Brown60f91012010-02-17 18:19:29 +0000568
569 .backlight = &wm1192_backlight_pdata,
570 .dcdc = {
571 &smdk6410_vddarm, /* DCDC1 */
572 &smdk6410_vddint, /* DCDC2 */
573 &wm1192_dcdc3,
574 },
Mark Browna7a81d02010-02-17 18:19:31 +0000575 .gpio_base = GPIO_BOARD_START,
Mark Brown60f91012010-02-17 18:19:29 +0000576 .ldo = {
577 &wm1192_ldo1, /* LDO1 */
578 &smdk6410_vdduh_mmc, /* LDO2 */
579 NULL, /* LDO3 NC */
580 &smdk6410_vddotgi, /* LDO4 */
581 &smdk6410_vddotg, /* LDO5 */
582 &smdk6410_vddhi, /* LDO6 */
583 &smdk6410_vddaudio, /* LDO7 */
584 &smdk6410_vccm2mtv, /* LDO8 */
585 &smdk6410_vddpll, /* LDO9 */
586 &smdk6410_vccmc3bt, /* LDO10 */
587 &smdk6410_vddalive, /* LDO11 */
588 },
589 .status = {
590 &wm1192_led7_pdata,
591 &wm1192_led8_pdata,
592 },
593};
594#endif
595
Ben Dooks096941e2008-10-31 16:14:59 +0000596static struct i2c_board_info i2c_devs0[] __initdata = {
597 { I2C_BOARD_INFO("24c08", 0x50), },
Mark Brown77897472009-01-23 16:29:41 +0000598 { I2C_BOARD_INFO("wm8580", 0x1b), },
Mark Brownecc558a2009-02-17 15:59:38 +0000599
Mark Brown60f91012010-02-17 18:19:29 +0000600#ifdef CONFIG_SMDK6410_WM1192_EV1
601 { I2C_BOARD_INFO("wm8312", 0x34),
602 .platform_data = &smdk6410_wm1192_pdata,
603 .irq = S3C_EINT(12),
604 },
605#endif
606
Mark Brownecc558a2009-02-17 15:59:38 +0000607#ifdef CONFIG_SMDK6410_WM1190_EV1
608 { I2C_BOARD_INFO("wm8350", 0x1a),
609 .platform_data = &smdk6410_wm8350_pdata,
610 .irq = S3C_EINT(12),
611 },
612#endif
Ben Dooks096941e2008-10-31 16:14:59 +0000613};
614
615static struct i2c_board_info i2c_devs1[] __initdata = {
616 { I2C_BOARD_INFO("24c128", 0x57), }, /* Samsung S524AD0XD1 */
Ben Dooks5718df92008-10-21 14:07:09 +0100617};
618
Banajit Goswami96d78682011-07-20 23:45:22 +0900619/* LCD Backlight data */
620static struct samsung_bl_gpio_info smdk6410_bl_gpio_info = {
621 .no = S3C64XX_GPF(15),
622 .func = S3C_GPIO_SFN(2),
623};
624
625static struct platform_pwm_backlight_data smdk6410_bl_data = {
626 .pwm_id = 1,
627};
628
Joonyoung Shim99f6e1f2012-03-07 04:23:47 -0800629static struct s3c_hsotg_plat smdk6410_hsotg_pdata;
630
Ben Dooks5718df92008-10-21 14:07:09 +0100631static void __init smdk6410_map_io(void)
632{
Ben Dooksd6662c32008-12-12 00:24:40 +0000633 u32 tmp;
634
Ben Dooks5718df92008-10-21 14:07:09 +0100635 s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
636 s3c24xx_init_clocks(12000000);
637 s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
Ben Dooksd6662c32008-12-12 00:24:40 +0000638
639 /* set the LCD type */
640
641 tmp = __raw_readl(S3C64XX_SPCON);
642 tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
643 tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
644 __raw_writel(tmp, S3C64XX_SPCON);
645
646 /* remove the lcd bypass */
647 tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
648 tmp &= ~MIFPCON_LCD_BYPASS;
649 __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
Ben Dooks5718df92008-10-21 14:07:09 +0100650}
651
652static void __init smdk6410_machine_init(void)
653{
Andy Greenf01fdac2009-12-29 14:40:36 +0000654 u32 cs1;
655
Ben Dooksd85fa242008-10-31 16:14:52 +0000656 s3c_i2c0_set_platdata(NULL);
Ben Dooksd7ea3742008-10-31 16:14:57 +0000657 s3c_i2c1_set_platdata(NULL);
Ben Dooks438a5d42008-11-19 15:41:34 +0000658 s3c_fb_set_platdata(&smdk6410_lcd_pdata);
Joonyoung Shim99f6e1f2012-03-07 04:23:47 -0800659 s3c_hsotg_set_platdata(&smdk6410_hsotg_pdata);
Ben Dooks096941e2008-10-31 16:14:59 +0000660
Naveen Krishna Ch290d0982010-06-22 07:39:18 +0900661 samsung_keypad_set_platdata(&smdk6410_keypad_data);
662
Naveen Krishna Chatradhi08047652011-08-19 21:56:10 +0900663 s3c24xx_ts_set_platdata(NULL);
Naveen Krishna Ch85b14a32010-05-20 11:39:52 +0900664
Andy Greenf01fdac2009-12-29 14:40:36 +0000665 /* configure nCS1 width to 16 bits */
666
667 cs1 = __raw_readl(S3C64XX_SROM_BW) &
668 ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
669 cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
670 (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
671 (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
672 S3C64XX_SROM_BW__NCS1__SHIFT;
673 __raw_writel(cs1, S3C64XX_SROM_BW);
674
675 /* set timing for nCS1 suitable for ethernet chip */
676
677 __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
678 (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
679 (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
680 (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
681 (0xe << S3C64XX_SROM_BCX__TACC__SHIFT) |
682 (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
683 (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
684
Mark Brownb7f9a942009-04-08 16:12:35 +0100685 gpio_request(S3C64XX_GPN(5), "LCD power");
686 gpio_request(S3C64XX_GPF(13), "LCD power");
Mark Brownb7f9a942009-04-08 16:12:35 +0100687
Ben Dooks096941e2008-10-31 16:14:59 +0000688 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
689 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
690
Abhilash Kesavan0ab0b6d2010-06-08 16:55:45 +0900691 s3c_ide_set_platdata(&smdk6410_ide_pdata);
692
Banajit Goswami96d78682011-07-20 23:45:22 +0900693 samsung_bl_set(&smdk6410_bl_gpio_info, &smdk6410_bl_data);
694
Ben Dooks5718df92008-10-21 14:07:09 +0100695 platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
696}
697
698MACHINE_START(SMDK6410, "SMDK6410")
Ben Dooksafdd2252010-05-07 09:24:05 +0900699 /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
Nicolas Pitre170a5902011-07-05 22:38:17 -0400700 .atag_offset = 0x100,
Ben Dooks5718df92008-10-21 14:07:09 +0100701
702 .init_irq = s3c6410_init_irq,
Jamie Iles774b51f2011-11-04 01:10:04 +0000703 .handle_irq = vic_handle_irq,
Ben Dooks5718df92008-10-21 14:07:09 +0100704 .map_io = smdk6410_map_io,
705 .init_machine = smdk6410_machine_init,
Shawn Guocc8f2522012-04-26 21:08:52 +0800706 .init_late = s3c64xx_init_late,
Ben Dooks5718df92008-10-21 14:07:09 +0100707 .timer = &s3c24xx_timer,
Kukjin Kimff84ded2012-01-03 14:03:30 +0100708 .restart = s3c64xx_restart,
Ben Dooks5718df92008-10-21 14:07:09 +0100709MACHINE_END