ARM: S3C2410: H1940: Use leds-gpio driver for LEDs managing
[linux-2.6-block.git] / arch / arm / mach-s3c2410 / mach-h1940.c
CommitLineData
1da177e4
LT
1/* linux/arch/arm/mach-s3c2410/mach-h1940.c
2 *
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * http://www.handhelds.org/projects/h1940.html
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 *
1da177e4
LT
12*/
13
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/list.h>
8d717a52 18#include <linux/memblock.h>
1da177e4
LT
19#include <linux/timer.h>
20#include <linux/init.h>
333a42e1 21#include <linux/sysdev.h>
b6d1f542 22#include <linux/serial_core.h>
d052d1be 23#include <linux/platform_device.h>
fced80c7 24#include <linux/io.h>
3909b9f7 25#include <linux/gpio.h>
bbb1c832
APR
26#include <linux/input.h>
27#include <linux/gpio_keys.h>
22e649ff 28#include <linux/pwm_backlight.h>
68730b45 29#include <linux/i2c.h>
50e2d10d
VK
30#include <linux/leds.h>
31
22e649ff 32#include <video/platform_lcd.h>
3909b9f7 33
34#include <linux/mmc/host.h>
1da177e4
LT
35
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
39
a09e64fb 40#include <mach/hardware.h>
1da177e4
LT
41#include <asm/irq.h>
42#include <asm/mach-types.h>
43
a2b7ba9c 44#include <plat/regs-serial.h>
a09e64fb 45#include <mach/regs-lcd.h>
a09e64fb 46#include <mach/regs-clock.h>
f92273c1 47
3909b9f7 48#include <mach/regs-gpio.h>
49#include <mach/gpio-fns.h>
50#include <mach/gpio-nrs.h>
51
a09e64fb
RK
52#include <mach/h1940.h>
53#include <mach/h1940-latch.h>
54#include <mach/fb.h>
57bd4b91 55#include <plat/udc.h>
3e1b776c 56#include <plat/iic.h>
1da177e4 57
40b956f0 58#include <plat/gpio-cfg.h>
d5120ae7 59#include <plat/clock.h>
a2b7ba9c
BD
60#include <plat/devs.h>
61#include <plat/cpu.h>
e24b864a 62#include <plat/pll.h>
a2b7ba9c 63#include <plat/pm.h>
3909b9f7 64#include <plat/mci.h>
73e59b1d 65#include <plat/ts.h>
1da177e4 66
68730b45
VK
67#include <sound/uda1380.h>
68
14477095
VK
69#define H1940_LATCH ((void __force __iomem *)0xF8000000)
70
71#define H1940_PA_LATCH S3C2410_CS2
72
73#define H1940_LATCH_BIT(x) (1 << ((x) + 16 - S3C_GPIO_END))
74
1da177e4 75static struct map_desc h1940_iodesc[] __initdata = {
e1981680
BD
76 [0] = {
77 .virtual = (unsigned long)H1940_LATCH,
78 .pfn = __phys_to_pfn(H1940_PA_LATCH),
79 .length = SZ_16K,
80 .type = MT_DEVICE
81 },
1da177e4
LT
82};
83
84#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
85#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
86#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
87
66a9b49a 88static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata = {
1da177e4
LT
89 [0] = {
90 .hwport = 0,
91 .flags = 0,
92 .ucon = 0x3c5,
93 .ulcon = 0x03,
94 .ufcon = 0x51,
95 },
96 [1] = {
97 .hwport = 1,
98 .flags = 0,
99 .ucon = 0x245,
100 .ulcon = 0x03,
101 .ufcon = 0x00,
102 },
103 /* IR port */
104 [2] = {
105 .hwport = 2,
106 .flags = 0,
107 .uart_flags = UPF_CONS_FLOW,
108 .ucon = 0x3c5,
109 .ulcon = 0x43,
110 .ufcon = 0x51,
111 }
112};
113
e1981680
BD
114/* Board control latch control */
115
53193dd3 116static unsigned int latch_state;
e1981680 117
14477095 118static void h1940_latch_control(unsigned int clear, unsigned int set)
e1981680
BD
119{
120 unsigned long flags;
121
122 local_irq_save(flags);
123
124 latch_state &= ~clear;
125 latch_state |= set;
126
127 __raw_writel(latch_state, H1940_LATCH);
128
129 local_irq_restore(flags);
130}
131
14477095
VK
132static inline int h1940_gpiolib_to_latch(int offset)
133{
134 return 1 << (offset + 16);
135}
136
137static void h1940_gpiolib_latch_set(struct gpio_chip *chip,
138 unsigned offset, int value)
139{
140 int latch_bit = h1940_gpiolib_to_latch(offset);
141
142 h1940_latch_control(value ? 0 : latch_bit,
143 value ? latch_bit : 0);
144}
145
146static int h1940_gpiolib_latch_output(struct gpio_chip *chip,
147 unsigned offset, int value)
148{
149 h1940_gpiolib_latch_set(chip, offset, value);
150 return 0;
151}
152
153static int h1940_gpiolib_latch_get(struct gpio_chip *chip,
154 unsigned offset)
155{
156 return (latch_state >> (offset + 16)) & 1;
157}
158
159struct gpio_chip h1940_latch_gpiochip = {
160 .base = H1940_LATCH_GPIO(0),
161 .owner = THIS_MODULE,
162 .label = "H1940_LATCH",
163 .ngpio = 16,
164 .direction_output = h1940_gpiolib_latch_output,
165 .set = h1940_gpiolib_latch_set,
166 .get = h1940_gpiolib_latch_get,
167};
1da177e4 168
71a9c424 169static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = {
070276d5 170 .vbus_pin = S3C2410_GPG(5),
71a9c424 171 .vbus_pin_inverted = 1,
e27c3c5c 172 .pullup_pin = H1940_LATCH_USB_DP,
71a9c424
AP
173};
174
ce8877b5
AP
175static struct s3c2410_ts_mach_info h1940_ts_cfg __initdata = {
176 .delay = 10000,
177 .presc = 49,
178 .oversampling_shift = 2,
5bfdca14 179 .cfg_gpio = s3c24xx_ts_cfg_gpio,
ce8877b5 180};
71a9c424 181
f92273c1
AP
182/**
183 * Set lcd on or off
184 **/
09fe75f6 185static struct s3c2410fb_display h1940_lcd __initdata = {
f28ef573
KH
186 .lcdcon5= S3C2410_LCDCON5_FRM565 | \
187 S3C2410_LCDCON5_INVVLINE | \
188 S3C2410_LCDCON5_HWSWP,
09fe75f6 189
1f411537 190 .type = S3C2410_LCDCON1_TFT,
09fe75f6
KH
191 .width = 240,
192 .height = 320,
69816699 193 .pixclock = 260000,
09fe75f6
KH
194 .xres = 240,
195 .yres = 320,
196 .bpp = 16,
26be1b7b
MS
197 .left_margin = 8,
198 .right_margin = 20,
93d11f5a 199 .hsync_len = 4,
5f20f69b
KH
200 .upper_margin = 8,
201 .lower_margin = 7,
93d11f5a 202 .vsync_len = 1,
09fe75f6
KH
203};
204
205static struct s3c2410fb_mach_info h1940_fb_info __initdata = {
09fe75f6
KH
206 .displays = &h1940_lcd,
207 .num_displays = 1,
208 .default_display = 0,
209
f92273c1
AP
210 .lpcsel= 0x02,
211 .gpccon= 0xaa940659,
212 .gpccon_mask= 0xffffffff,
213 .gpcup= 0x0000ffff,
214 .gpcup_mask= 0xffffffff,
215 .gpdcon= 0xaa84aaa0,
216 .gpdcon_mask= 0xffffffff,
217 .gpdup= 0x0000faff,
218 .gpdup_mask= 0xffffffff,
f92273c1 219};
1da177e4 220
50e2d10d
VK
221DEFINE_SPINLOCK(h1940_blink_spin);
222
223int h1940_led_blink_set(unsigned gpio, int state,
224 unsigned long *delay_on, unsigned long *delay_off)
225{
226 int blink_gpio, check_gpio1, check_gpio2;
227
228 switch (gpio) {
229 case H1940_LATCH_LED_GREEN:
230 blink_gpio = S3C2410_GPA(7);
231 check_gpio1 = S3C2410_GPA(1);
232 check_gpio2 = S3C2410_GPA(3);
233 break;
234 case H1940_LATCH_LED_RED:
235 blink_gpio = S3C2410_GPA(1);
236 check_gpio1 = S3C2410_GPA(7);
237 check_gpio2 = S3C2410_GPA(3);
238 break;
239 default:
240 blink_gpio = S3C2410_GPA(3);
241 check_gpio1 = S3C2410_GPA(1);
242 check_gpio1 = S3C2410_GPA(7);
243 break;
244 }
245
246 if (delay_on && delay_off && !*delay_on && !*delay_off)
247 *delay_on = *delay_off = 500;
248
249 spin_lock(&h1940_blink_spin);
250
251 switch (state) {
252 case GPIO_LED_NO_BLINK_LOW:
253 case GPIO_LED_NO_BLINK_HIGH:
254 if (!gpio_get_value(check_gpio1) &&
255 !gpio_get_value(check_gpio2))
256 gpio_set_value(H1940_LATCH_LED_FLASH, 0);
257 gpio_set_value(blink_gpio, 0);
258 if (gpio_is_valid(gpio))
259 gpio_set_value(gpio, state);
260 break;
261 case GPIO_LED_BLINK:
262 if (gpio_is_valid(gpio))
263 gpio_set_value(gpio, 0);
264 gpio_set_value(H1940_LATCH_LED_FLASH, 1);
265 gpio_set_value(blink_gpio, 1);
266 break;
267 }
268
269 spin_unlock(&h1940_blink_spin);
270
271 return 0;
272}
273EXPORT_SYMBOL(h1940_led_blink_set);
274
275static struct gpio_led h1940_leds_desc[] = {
276 {
277 .name = "Green",
278 .default_trigger = "main-battery-charging-or-full",
279 .gpio = H1940_LATCH_LED_GREEN,
280 .retain_state_suspended = 1,
281 },
282 {
283 .name = "Red",
284 .default_trigger = "main-battery-full",
285 .gpio = H1940_LATCH_LED_RED,
286 .retain_state_suspended = 1,
287 },
288};
289
290static struct gpio_led_platform_data h1940_leds_pdata = {
291 .num_leds = ARRAY_SIZE(h1940_leds_desc),
292 .leds = h1940_leds_desc,
293 .gpio_blink_set = h1940_led_blink_set,
294};
295
ff34aaa9 296static struct platform_device h1940_device_leds = {
50e2d10d
VK
297 .name = "leds-gpio",
298 .id = -1,
299 .dev = {
300 .platform_data = &h1940_leds_pdata,
301 },
d2a76020
AP
302};
303
ff34aaa9 304static struct platform_device h1940_device_bluetooth = {
7fdc7849
AP
305 .name = "h1940-bt",
306 .id = -1,
307};
308
48cd65a6
VK
309static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)
310{
311 switch (power_mode) {
312 case MMC_POWER_OFF:
313 gpio_set_value(H1940_LATCH_SD_POWER, 0);
314 break;
315 case MMC_POWER_UP:
316 case MMC_POWER_ON:
317 gpio_set_value(H1940_LATCH_SD_POWER, 1);
318 break;
319 default:
320 break;
321 };
322}
323
22c810ab 324static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
3909b9f7 325 .gpio_detect = S3C2410_GPF(5),
326 .gpio_wprotect = S3C2410_GPH(8),
48cd65a6 327 .set_power = h1940_set_mmc_power,
3909b9f7 328 .ocr_avail = MMC_VDD_32_33,
329};
330
22e649ff 331static int h1940_backlight_init(struct device *dev)
332{
333 gpio_request(S3C2410_GPB(0), "Backlight");
334
db61ac54 335 gpio_direction_output(S3C2410_GPB(0), 0);
fb378747 336 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
40b956f0 337 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
53193dd3 338 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
22e649ff 339
340 return 0;
341}
342
53193dd3
VK
343static int h1940_backlight_notify(struct device *dev, int brightness)
344{
345 if (!brightness) {
346 gpio_direction_output(S3C2410_GPB(0), 1);
347 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
348 } else {
349 gpio_direction_output(S3C2410_GPB(0), 0);
350 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
351 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
352 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
353 }
354 return brightness;
355}
356
22e649ff 357static void h1940_backlight_exit(struct device *dev)
358{
db61ac54 359 gpio_direction_output(S3C2410_GPB(0), 1);
53193dd3 360 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
22e649ff 361}
362
53193dd3 363
22e649ff 364static struct platform_pwm_backlight_data backlight_data = {
365 .pwm_id = 0,
366 .max_brightness = 100,
367 .dft_brightness = 50,
368 /* tcnt = 0x31 */
369 .pwm_period_ns = 36296,
370 .init = h1940_backlight_init,
53193dd3 371 .notify = h1940_backlight_notify,
22e649ff 372 .exit = h1940_backlight_exit,
373};
374
375static struct platform_device h1940_backlight = {
376 .name = "pwm-backlight",
377 .dev = {
378 .parent = &s3c_device_timer[0].dev,
379 .platform_data = &backlight_data,
380 },
381 .id = -1,
382};
383
384static void h1940_lcd_power_set(struct plat_lcd_data *pd,
385 unsigned int power)
386{
387 int value;
388
389 if (!power) {
53193dd3 390 gpio_set_value(S3C2410_GPC(0), 0);
22e649ff 391 /* wait for 3ac */
392 do {
db61ac54 393 value = gpio_get_value(S3C2410_GPC(6));
22e649ff 394 } while (value);
53193dd3
VK
395
396 gpio_set_value(H1940_LATCH_LCD_P2, 0);
397 gpio_set_value(H1940_LATCH_LCD_P3, 0);
398 gpio_set_value(H1940_LATCH_LCD_P4, 0);
399
400 gpio_direction_output(S3C2410_GPC(1), 0);
401 gpio_direction_output(S3C2410_GPC(4), 0);
402
403 gpio_set_value(H1940_LATCH_LCD_P1, 0);
404 gpio_set_value(H1940_LATCH_LCD_P0, 0);
405
406 gpio_set_value(S3C2410_GPC(5), 0);
407
22e649ff 408 } else {
53193dd3
VK
409 gpio_set_value(H1940_LATCH_LCD_P0, 1);
410 gpio_set_value(H1940_LATCH_LCD_P1, 1);
411
412 s3c_gpio_cfgpin(S3C2410_GPC(1), S3C_GPIO_SFN(2));
413 s3c_gpio_cfgpin(S3C2410_GPC(4), S3C_GPIO_SFN(2));
414
415 gpio_set_value(S3C2410_GPC(5), 1);
416 gpio_set_value(S3C2410_GPC(0), 1);
417
418 gpio_set_value(H1940_LATCH_LCD_P3, 1);
419 gpio_set_value(H1940_LATCH_LCD_P2, 1);
420 gpio_set_value(H1940_LATCH_LCD_P4, 1);
22e649ff 421 }
422}
423
424static struct plat_lcd_data h1940_lcd_power_data = {
425 .set_power = h1940_lcd_power_set,
426};
427
428static struct platform_device h1940_lcd_powerdev = {
429 .name = "platform-lcd",
430 .dev.parent = &s3c_device_lcd.dev,
431 .dev.platform_data = &h1940_lcd_power_data,
432};
433
68730b45
VK
434static struct uda1380_platform_data uda1380_info = {
435 .gpio_power = H1940_LATCH_UDA_POWER,
436 .gpio_reset = S3C2410_GPA(12),
437 .dac_clk = UDA1380_DAC_CLK_SYSCLK,
438};
439
440static struct i2c_board_info h1940_i2c_devices[] = {
441 {
442 I2C_BOARD_INFO("uda1380", 0x1a),
443 .platform_data = &uda1380_info,
444 },
445};
446
bbb1c832
APR
447#define DECLARE_BUTTON(p, k, n, w) \
448 { \
449 .gpio = p, \
450 .code = k, \
451 .desc = n, \
452 .wakeup = w, \
453 .active_low = 1, \
454 }
455
456static struct gpio_keys_button h1940_buttons[] = {
457 DECLARE_BUTTON(S3C2410_GPF(0), KEY_POWER, "Power", 1),
458 DECLARE_BUTTON(S3C2410_GPF(6), KEY_ENTER, "Select", 1),
459 DECLARE_BUTTON(S3C2410_GPF(7), KEY_RECORD, "Record", 0),
460 DECLARE_BUTTON(S3C2410_GPG(0), KEY_F11, "Calendar", 0),
461 DECLARE_BUTTON(S3C2410_GPG(2), KEY_F12, "Contacts", 0),
462 DECLARE_BUTTON(S3C2410_GPG(3), KEY_MAIL, "Mail", 0),
463 DECLARE_BUTTON(S3C2410_GPG(6), KEY_LEFT, "Left_arrow", 0),
464 DECLARE_BUTTON(S3C2410_GPG(7), KEY_HOMEPAGE, "Home", 0),
465 DECLARE_BUTTON(S3C2410_GPG(8), KEY_RIGHT, "Right_arrow", 0),
466 DECLARE_BUTTON(S3C2410_GPG(9), KEY_UP, "Up_arrow", 0),
467 DECLARE_BUTTON(S3C2410_GPG(10), KEY_DOWN, "Down_arrow", 0),
468};
469
470static struct gpio_keys_platform_data h1940_buttons_data = {
471 .buttons = h1940_buttons,
472 .nbuttons = ARRAY_SIZE(h1940_buttons),
473};
474
475static struct platform_device h1940_dev_buttons = {
476 .name = "gpio-keys",
477 .id = -1,
478 .dev = {
479 .platform_data = &h1940_buttons_data,
480 }
481};
482
1da177e4 483static struct platform_device *h1940_devices[] __initdata = {
bbb1c832 484 &h1940_dev_buttons,
b813248c 485 &s3c_device_ohci,
1da177e4
LT
486 &s3c_device_lcd,
487 &s3c_device_wdt,
3e1b776c 488 &s3c_device_i2c0,
1da177e4 489 &s3c_device_iis,
83e37b8e 490 &samsung_asoc_dma,
71a9c424 491 &s3c_device_usbgadget,
ff34aaa9
BD
492 &h1940_device_leds,
493 &h1940_device_bluetooth,
3909b9f7 494 &s3c_device_sdi,
13733d52 495 &s3c_device_rtc,
22e649ff 496 &s3c_device_timer[0],
497 &h1940_backlight,
498 &h1940_lcd_powerdev,
17dcd13a
AP
499 &s3c_device_adc,
500 &s3c_device_ts,
1da177e4
LT
501};
502
5fe10ab1 503static void __init h1940_map_io(void)
1da177e4
LT
504{
505 s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
506 s3c24xx_init_clocks(0);
507 s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
9073341c
BD
508
509 /* setup PM */
510
b1dfe1f1 511#ifdef CONFIG_PM_H1940
9073341c 512 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
b1dfe1f1 513#endif
4e59c25d 514 s3c_pm_init();
14477095 515
53193dd3
VK
516 /* Add latch gpio chip, set latch initial value */
517 h1940_latch_control(0, 0);
14477095 518 WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
1da177e4
LT
519}
520
98c672cf
RK
521/* H1940 and RX3715 need to reserve this for suspend */
522static void __init h1940_reserve(void)
523{
8d717a52
RK
524 memblock_reserve(0x30003000, 0x1000);
525 memblock_reserve(0x30081000, 0x1000);
98c672cf
RK
526}
527
5fe10ab1 528static void __init h1940_init_irq(void)
1da177e4
LT
529{
530 s3c24xx_init_irq();
1da177e4
LT
531}
532
5fe10ab1 533static void __init h1940_init(void)
f92273c1 534{
71a9c424
AP
535 u32 tmp;
536
09fe75f6 537 s3c24xx_fb_set_platdata(&h1940_fb_info);
22c810ab 538 s3c24xx_mci_set_platdata(&h1940_mmc_cfg);
71a9c424 539 s3c24xx_udc_set_platdata(&h1940_udc_cfg);
ce8877b5 540 s3c24xx_ts_set_platdata(&h1940_ts_cfg);
3e1b776c 541 s3c_i2c0_set_platdata(NULL);
71a9c424
AP
542
543 /* Turn off suspend on both USB ports, and switch the
544 * selectable USB port to USB device mode. */
545
546 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
547 S3C2410_MISCCR_USBSUSPND0 |
548 S3C2410_MISCCR_USBSUSPND1, 0x0);
549
e24b864a
BD
550 tmp = (0x78 << S3C24XX_PLLCON_MDIVSHIFT)
551 | (0x02 << S3C24XX_PLLCON_PDIVSHIFT)
552 | (0x03 << S3C24XX_PLLCON_SDIVSHIFT);
71a9c424 553 writel(tmp, S3C2410_UPLLCON);
57e5171c 554
22e649ff 555 gpio_request(S3C2410_GPC(0), "LCD power");
53193dd3
VK
556 gpio_request(S3C2410_GPC(1), "LCD power");
557 gpio_request(S3C2410_GPC(4), "LCD power");
22e649ff 558 gpio_request(S3C2410_GPC(5), "LCD power");
559 gpio_request(S3C2410_GPC(6), "LCD power");
53193dd3
VK
560 gpio_request(H1940_LATCH_LCD_P0, "LCD power");
561 gpio_request(H1940_LATCH_LCD_P1, "LCD power");
562 gpio_request(H1940_LATCH_LCD_P2, "LCD power");
563 gpio_request(H1940_LATCH_LCD_P3, "LCD power");
564 gpio_request(H1940_LATCH_LCD_P4, "LCD power");
565 gpio_request(H1940_LATCH_MAX1698_nSHUTDOWN, "LCD power");
566 gpio_direction_output(S3C2410_GPC(0), 0);
567 gpio_direction_output(S3C2410_GPC(1), 0);
568 gpio_direction_output(S3C2410_GPC(4), 0);
569 gpio_direction_output(S3C2410_GPC(5), 0);
db61ac54 570 gpio_direction_input(S3C2410_GPC(6));
53193dd3
VK
571 gpio_direction_output(H1940_LATCH_LCD_P0, 0);
572 gpio_direction_output(H1940_LATCH_LCD_P1, 0);
573 gpio_direction_output(H1940_LATCH_LCD_P2, 0);
574 gpio_direction_output(H1940_LATCH_LCD_P3, 0);
575 gpio_direction_output(H1940_LATCH_LCD_P4, 0);
576 gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
22e649ff 577
48cd65a6
VK
578 gpio_request(H1940_LATCH_SD_POWER, "SD power");
579 gpio_direction_output(H1940_LATCH_SD_POWER, 0);
22e649ff 580
57e5171c 581 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
68730b45 582
50e2d10d
VK
583 gpio_request(S3C2410_GPA(1), "Red LED blink");
584 gpio_request(S3C2410_GPA(3), "Blue LED blink");
585 gpio_request(S3C2410_GPA(7), "Green LED blink");
586 gpio_request(H1940_LATCH_LED_FLASH, "LED blink");
587 gpio_direction_output(S3C2410_GPA(1), 0);
588 gpio_direction_output(S3C2410_GPA(3), 0);
589 gpio_direction_output(S3C2410_GPA(7), 0);
590 gpio_direction_output(H1940_LATCH_LED_FLASH, 0);
591
68730b45
VK
592 i2c_register_board_info(0, h1940_i2c_devices,
593 ARRAY_SIZE(h1940_i2c_devices));
f92273c1
AP
594}
595
1da177e4 596MACHINE_START(H1940, "IPAQ-H1940")
afdd225d 597 /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
e9dea0c6
RK
598 .boot_params = S3C2410_SDRAM_PA + 0x100,
599 .map_io = h1940_map_io,
98c672cf 600 .reserve = h1940_reserve,
e9dea0c6 601 .init_irq = h1940_init_irq,
71a9c424 602 .init_machine = h1940_init,
1da177e4
LT
603 .timer = &s3c24xx_timer,
604MACHINE_END