Merge tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-s3c24xx / mach-rx1950.c
1 /*
2 * Copyright (c) 2006-2009 Victor Chukhantsev, Denis Grigoriev,
3 * Copyright (c) 2007-2010 Vasily Khoruzhick
4 *
5 * based on smdk2440 written by Ben Dooks
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13 #include <linux/kernel.h>
14 #include <linux/types.h>
15 #include <linux/interrupt.h>
16 #include <linux/list.h>
17 #include <linux/memblock.h>
18 #include <linux/delay.h>
19 #include <linux/timer.h>
20 #include <linux/init.h>
21 #include <linux/gpio.h>
22 #include <linux/platform_device.h>
23 #include <linux/serial_core.h>
24 #include <linux/input.h>
25 #include <linux/gpio_keys.h>
26 #include <linux/device.h>
27 #include <linux/pda_power.h>
28 #include <linux/pwm_backlight.h>
29 #include <linux/pwm.h>
30 #include <linux/s3c_adc_battery.h>
31 #include <linux/leds.h>
32 #include <linux/i2c.h>
33
34 #include <linux/mtd/mtd.h>
35 #include <linux/mtd/partitions.h>
36
37 #include <linux/mmc/host.h>
38
39 #include <asm/mach-types.h>
40 #include <asm/mach/arch.h>
41 #include <asm/mach/map.h>
42
43 #include <linux/platform_data/i2c-s3c2410.h>
44 #include <linux/platform_data/mmc-s3cmci.h>
45 #include <linux/platform_data/mtd-nand-s3c2410.h>
46 #include <linux/platform_data/touchscreen-s3c2410.h>
47 #include <linux/platform_data/usb-s3c2410_udc.h>
48
49 #include <sound/uda1380.h>
50
51 #include <mach/fb.h>
52 #include <mach/regs-gpio.h>
53 #include <mach/regs-lcd.h>
54
55 #include <plat/clock.h>
56 #include <plat/cpu.h>
57 #include <plat/devs.h>
58 #include <plat/pm.h>
59 #include <plat/regs-serial.h>
60 #include <plat/samsung-time.h>
61
62 #include "common.h"
63 #include "h1940.h"
64
65 #define LCD_PWM_PERIOD 192960
66 #define LCD_PWM_DUTY 127353
67
68 static struct map_desc rx1950_iodesc[] __initdata = {
69 };
70
71 static struct s3c2410_uartcfg rx1950_uartcfgs[] __initdata = {
72 [0] = {
73 .hwport = 0,
74 .flags = 0,
75 .ucon = 0x3c5,
76 .ulcon = 0x03,
77 .ufcon = 0x51,
78 .clk_sel = S3C2410_UCON_CLKSEL3,
79 },
80 [1] = {
81 .hwport = 1,
82 .flags = 0,
83 .ucon = 0x3c5,
84 .ulcon = 0x03,
85 .ufcon = 0x51,
86 .clk_sel = S3C2410_UCON_CLKSEL3,
87 },
88 /* IR port */
89 [2] = {
90 .hwport = 2,
91 .flags = 0,
92 .ucon = 0x3c5,
93 .ulcon = 0x43,
94 .ufcon = 0xf1,
95 .clk_sel = S3C2410_UCON_CLKSEL3,
96 },
97 };
98
99 static struct s3c2410fb_display rx1950_display = {
100 .type = S3C2410_LCDCON1_TFT,
101 .width = 240,
102 .height = 320,
103 .xres = 240,
104 .yres = 320,
105 .bpp = 16,
106
107 .pixclock = 260000,
108 .left_margin = 10,
109 .right_margin = 20,
110 .hsync_len = 10,
111 .upper_margin = 2,
112 .lower_margin = 2,
113 .vsync_len = 2,
114
115 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
116 S3C2410_LCDCON5_INVVCLK |
117 S3C2410_LCDCON5_INVVLINE |
118 S3C2410_LCDCON5_INVVFRAME |
119 S3C2410_LCDCON5_HWSWP |
120 (0x02 << 13) |
121 (0x02 << 15),
122
123 };
124
125 static int power_supply_init(struct device *dev)
126 {
127 return gpio_request(S3C2410_GPF(2), "cable plugged");
128 }
129
130 static int rx1950_is_ac_online(void)
131 {
132 return !gpio_get_value(S3C2410_GPF(2));
133 }
134
135 static void power_supply_exit(struct device *dev)
136 {
137 gpio_free(S3C2410_GPF(2));
138 }
139
140 static char *rx1950_supplicants[] = {
141 "main-battery"
142 };
143
144 static struct pda_power_pdata power_supply_info = {
145 .init = power_supply_init,
146 .is_ac_online = rx1950_is_ac_online,
147 .exit = power_supply_exit,
148 .supplied_to = rx1950_supplicants,
149 .num_supplicants = ARRAY_SIZE(rx1950_supplicants),
150 };
151
152 static struct resource power_supply_resources[] = {
153 [0] = DEFINE_RES_NAMED(IRQ_EINT2, 1, "ac", IORESOURCE_IRQ \
154 | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE),
155 };
156
157 static struct platform_device power_supply = {
158 .name = "pda-power",
159 .id = -1,
160 .dev = {
161 .platform_data =
162 &power_supply_info,
163 },
164 .resource = power_supply_resources,
165 .num_resources = ARRAY_SIZE(power_supply_resources),
166 };
167
168 static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
169 { .volt = 4100, .cur = 156, .level = 100},
170 { .volt = 4050, .cur = 156, .level = 95},
171 { .volt = 4025, .cur = 141, .level = 90},
172 { .volt = 3995, .cur = 144, .level = 85},
173 { .volt = 3957, .cur = 162, .level = 80},
174 { .volt = 3931, .cur = 147, .level = 75},
175 { .volt = 3902, .cur = 147, .level = 70},
176 { .volt = 3863, .cur = 153, .level = 65},
177 { .volt = 3838, .cur = 150, .level = 60},
178 { .volt = 3800, .cur = 153, .level = 55},
179 { .volt = 3765, .cur = 153, .level = 50},
180 { .volt = 3748, .cur = 172, .level = 45},
181 { .volt = 3740, .cur = 153, .level = 40},
182 { .volt = 3714, .cur = 175, .level = 35},
183 { .volt = 3710, .cur = 156, .level = 30},
184 { .volt = 3963, .cur = 156, .level = 25},
185 { .volt = 3672, .cur = 178, .level = 20},
186 { .volt = 3651, .cur = 178, .level = 15},
187 { .volt = 3629, .cur = 178, .level = 10},
188 { .volt = 3612, .cur = 162, .level = 5},
189 { .volt = 3605, .cur = 162, .level = 0},
190 };
191
192 static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
193 { .volt = 4200, .cur = 0, .level = 100},
194 { .volt = 4190, .cur = 0, .level = 99},
195 { .volt = 4178, .cur = 0, .level = 95},
196 { .volt = 4110, .cur = 0, .level = 70},
197 { .volt = 4076, .cur = 0, .level = 65},
198 { .volt = 4046, .cur = 0, .level = 60},
199 { .volt = 4021, .cur = 0, .level = 55},
200 { .volt = 3999, .cur = 0, .level = 50},
201 { .volt = 3982, .cur = 0, .level = 45},
202 { .volt = 3965, .cur = 0, .level = 40},
203 { .volt = 3957, .cur = 0, .level = 35},
204 { .volt = 3948, .cur = 0, .level = 30},
205 { .volt = 3936, .cur = 0, .level = 25},
206 { .volt = 3927, .cur = 0, .level = 20},
207 { .volt = 3906, .cur = 0, .level = 15},
208 { .volt = 3880, .cur = 0, .level = 10},
209 { .volt = 3829, .cur = 0, .level = 5},
210 { .volt = 3820, .cur = 0, .level = 0},
211 };
212
213 static int rx1950_bat_init(void)
214 {
215 int ret;
216
217 ret = gpio_request(S3C2410_GPJ(2), "rx1950-charger-enable-1");
218 if (ret)
219 goto err_gpio1;
220 ret = gpio_request(S3C2410_GPJ(3), "rx1950-charger-enable-2");
221 if (ret)
222 goto err_gpio2;
223
224 return 0;
225
226 err_gpio2:
227 gpio_free(S3C2410_GPJ(2));
228 err_gpio1:
229 return ret;
230 }
231
232 static void rx1950_bat_exit(void)
233 {
234 gpio_free(S3C2410_GPJ(2));
235 gpio_free(S3C2410_GPJ(3));
236 }
237
238 static void rx1950_enable_charger(void)
239 {
240 gpio_direction_output(S3C2410_GPJ(2), 1);
241 gpio_direction_output(S3C2410_GPJ(3), 1);
242 }
243
244 static void rx1950_disable_charger(void)
245 {
246 gpio_direction_output(S3C2410_GPJ(2), 0);
247 gpio_direction_output(S3C2410_GPJ(3), 0);
248 }
249
250 static DEFINE_SPINLOCK(rx1950_blink_spin);
251
252 static int rx1950_led_blink_set(unsigned gpio, int state,
253 unsigned long *delay_on, unsigned long *delay_off)
254 {
255 int blink_gpio, check_gpio;
256
257 switch (gpio) {
258 case S3C2410_GPA(6):
259 blink_gpio = S3C2410_GPA(4);
260 check_gpio = S3C2410_GPA(3);
261 break;
262 case S3C2410_GPA(7):
263 blink_gpio = S3C2410_GPA(3);
264 check_gpio = S3C2410_GPA(4);
265 break;
266 default:
267 return -EINVAL;
268 break;
269 }
270
271 if (delay_on && delay_off && !*delay_on && !*delay_off)
272 *delay_on = *delay_off = 500;
273
274 spin_lock(&rx1950_blink_spin);
275
276 switch (state) {
277 case GPIO_LED_NO_BLINK_LOW:
278 case GPIO_LED_NO_BLINK_HIGH:
279 if (!gpio_get_value(check_gpio))
280 gpio_set_value(S3C2410_GPJ(6), 0);
281 gpio_set_value(blink_gpio, 0);
282 gpio_set_value(gpio, state);
283 break;
284 case GPIO_LED_BLINK:
285 gpio_set_value(gpio, 0);
286 gpio_set_value(S3C2410_GPJ(6), 1);
287 gpio_set_value(blink_gpio, 1);
288 break;
289 }
290
291 spin_unlock(&rx1950_blink_spin);
292
293 return 0;
294 }
295
296 static struct gpio_led rx1950_leds_desc[] = {
297 {
298 .name = "Green",
299 .default_trigger = "main-battery-full",
300 .gpio = S3C2410_GPA(6),
301 .retain_state_suspended = 1,
302 },
303 {
304 .name = "Red",
305 .default_trigger
306 = "main-battery-charging-blink-full-solid",
307 .gpio = S3C2410_GPA(7),
308 .retain_state_suspended = 1,
309 },
310 {
311 .name = "Blue",
312 .default_trigger = "rx1950-acx-mem",
313 .gpio = S3C2410_GPA(11),
314 .retain_state_suspended = 1,
315 },
316 };
317
318 static struct gpio_led_platform_data rx1950_leds_pdata = {
319 .num_leds = ARRAY_SIZE(rx1950_leds_desc),
320 .leds = rx1950_leds_desc,
321 .gpio_blink_set = rx1950_led_blink_set,
322 };
323
324 static struct platform_device rx1950_leds = {
325 .name = "leds-gpio",
326 .id = -1,
327 .dev = {
328 .platform_data = &rx1950_leds_pdata,
329 },
330 };
331
332 static struct s3c_adc_bat_pdata rx1950_bat_cfg = {
333 .init = rx1950_bat_init,
334 .exit = rx1950_bat_exit,
335 .enable_charger = rx1950_enable_charger,
336 .disable_charger = rx1950_disable_charger,
337 .gpio_charge_finished = S3C2410_GPF(3),
338 .lut_noac = bat_lut_noac,
339 .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac),
340 .lut_acin = bat_lut_acin,
341 .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin),
342 .volt_channel = 0,
343 .current_channel = 1,
344 .volt_mult = 4235,
345 .current_mult = 2900,
346 .internal_impedance = 200,
347 };
348
349 static struct platform_device rx1950_battery = {
350 .name = "s3c-adc-battery",
351 .id = -1,
352 .dev = {
353 .parent = &s3c_device_adc.dev,
354 .platform_data = &rx1950_bat_cfg,
355 },
356 };
357
358 static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
359 .displays = &rx1950_display,
360 .num_displays = 1,
361 .default_display = 0,
362
363 .lpcsel = 0x02,
364 .gpccon = 0xaa9556a9,
365 .gpccon_mask = 0xffc003fc,
366 .gpcup = 0x0000ffff,
367 .gpcup_mask = 0xffffffff,
368
369 .gpdcon = 0xaa90aaa1,
370 .gpdcon_mask = 0xffc0fff0,
371 .gpdup = 0x0000fcfd,
372 .gpdup_mask = 0xffffffff,
373
374 };
375
376 static struct pwm_device *lcd_pwm;
377
378 static void rx1950_lcd_power(int enable)
379 {
380 int i;
381 static int enabled;
382 if (enabled == enable)
383 return;
384 if (!enable) {
385
386 /* GPC11-GPC15->OUTPUT */
387 for (i = 11; i < 16; i++)
388 gpio_direction_output(S3C2410_GPC(i), 1);
389
390 /* Wait a bit here... */
391 mdelay(100);
392
393 /* GPD2-GPD7->OUTPUT */
394 /* GPD11-GPD15->OUTPUT */
395 /* GPD2-GPD7->1, GPD11-GPD15->1 */
396 for (i = 2; i < 8; i++)
397 gpio_direction_output(S3C2410_GPD(i), 1);
398 for (i = 11; i < 16; i++)
399 gpio_direction_output(S3C2410_GPD(i), 1);
400
401 /* Wait a bit here...*/
402 mdelay(100);
403
404 /* GPB0->OUTPUT, GPB0->0 */
405 gpio_direction_output(S3C2410_GPB(0), 0);
406
407 /* GPC1-GPC4->OUTPUT, GPC1-4->0 */
408 for (i = 1; i < 5; i++)
409 gpio_direction_output(S3C2410_GPC(i), 0);
410
411 /* GPC15-GPC11->0 */
412 for (i = 11; i < 16; i++)
413 gpio_direction_output(S3C2410_GPC(i), 0);
414
415 /* GPD15-GPD11->0, GPD2->GPD7->0 */
416 for (i = 11; i < 16; i++)
417 gpio_direction_output(S3C2410_GPD(i), 0);
418
419 for (i = 2; i < 8; i++)
420 gpio_direction_output(S3C2410_GPD(i), 0);
421
422 /* GPC6->0, GPC7->0, GPC5->0 */
423 gpio_direction_output(S3C2410_GPC(6), 0);
424 gpio_direction_output(S3C2410_GPC(7), 0);
425 gpio_direction_output(S3C2410_GPC(5), 0);
426
427 /* GPB1->OUTPUT, GPB1->0 */
428 gpio_direction_output(S3C2410_GPB(1), 0);
429 pwm_config(lcd_pwm, 0, LCD_PWM_PERIOD);
430 pwm_disable(lcd_pwm);
431
432 /* GPC0->0, GPC10->0 */
433 gpio_direction_output(S3C2410_GPC(0), 0);
434 gpio_direction_output(S3C2410_GPC(10), 0);
435 } else {
436 pwm_config(lcd_pwm, LCD_PWM_DUTY, LCD_PWM_PERIOD);
437 pwm_enable(lcd_pwm);
438
439 gpio_direction_output(S3C2410_GPC(0), 1);
440 gpio_direction_output(S3C2410_GPC(5), 1);
441
442 s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPB1_TOUT1);
443 gpio_direction_output(S3C2410_GPC(7), 1);
444
445 for (i = 1; i < 5; i++)
446 s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2));
447
448 for (i = 11; i < 16; i++)
449 s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2));
450
451 for (i = 2; i < 8; i++)
452 s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2));
453
454 for (i = 11; i < 16; i++)
455 s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2));
456
457 gpio_direction_output(S3C2410_GPC(10), 1);
458 gpio_direction_output(S3C2410_GPC(6), 1);
459 }
460 enabled = enable;
461 }
462
463 static void rx1950_bl_power(int enable)
464 {
465 static int enabled;
466 if (enabled == enable)
467 return;
468 if (!enable) {
469 gpio_direction_output(S3C2410_GPB(0), 0);
470 } else {
471 /* LED driver need a "push" to power on */
472 gpio_direction_output(S3C2410_GPB(0), 1);
473 /* Warm up backlight for one period of PWM.
474 * Without this trick its almost impossible to
475 * enable backlight with low brightness value
476 */
477 ndelay(48000);
478 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
479 }
480 enabled = enable;
481 }
482
483 static int rx1950_backlight_init(struct device *dev)
484 {
485 WARN_ON(gpio_request(S3C2410_GPB(0), "Backlight"));
486 lcd_pwm = pwm_request(1, "RX1950 LCD");
487 if (IS_ERR(lcd_pwm)) {
488 dev_err(dev, "Unable to request PWM for LCD power!\n");
489 return PTR_ERR(lcd_pwm);
490 }
491
492 rx1950_lcd_power(1);
493 rx1950_bl_power(1);
494
495 return 0;
496 }
497
498 static void rx1950_backlight_exit(struct device *dev)
499 {
500 rx1950_bl_power(0);
501 rx1950_lcd_power(0);
502
503 pwm_free(lcd_pwm);
504 gpio_free(S3C2410_GPB(0));
505 }
506
507
508 static int rx1950_backlight_notify(struct device *dev, int brightness)
509 {
510 if (!brightness) {
511 rx1950_bl_power(0);
512 rx1950_lcd_power(0);
513 } else {
514 rx1950_lcd_power(1);
515 rx1950_bl_power(1);
516 }
517 return brightness;
518 }
519
520 static struct platform_pwm_backlight_data rx1950_backlight_data = {
521 .pwm_id = 0,
522 .max_brightness = 24,
523 .dft_brightness = 4,
524 .pwm_period_ns = 48000,
525 .init = rx1950_backlight_init,
526 .notify = rx1950_backlight_notify,
527 .exit = rx1950_backlight_exit,
528 };
529
530 static struct platform_device rx1950_backlight = {
531 .name = "pwm-backlight",
532 .dev = {
533 .parent = &s3c_device_timer[0].dev,
534 .platform_data = &rx1950_backlight_data,
535 },
536 };
537
538 static void rx1950_set_mmc_power(unsigned char power_mode, unsigned short vdd)
539 {
540 switch (power_mode) {
541 case MMC_POWER_OFF:
542 gpio_direction_output(S3C2410_GPJ(1), 0);
543 break;
544 case MMC_POWER_UP:
545 case MMC_POWER_ON:
546 gpio_direction_output(S3C2410_GPJ(1), 1);
547 break;
548 default:
549 break;
550 }
551 }
552
553 static struct s3c24xx_mci_pdata rx1950_mmc_cfg __initdata = {
554 .gpio_detect = S3C2410_GPF(5),
555 .gpio_wprotect = S3C2410_GPH(8),
556 .set_power = rx1950_set_mmc_power,
557 .ocr_avail = MMC_VDD_32_33,
558 };
559
560 static struct mtd_partition rx1950_nand_part[] = {
561 [0] = {
562 .name = "Boot0",
563 .offset = 0,
564 .size = 0x4000,
565 .mask_flags = MTD_WRITEABLE,
566 },
567 [1] = {
568 .name = "Boot1",
569 .offset = MTDPART_OFS_APPEND,
570 .size = 0x40000,
571 .mask_flags = MTD_WRITEABLE,
572 },
573 [2] = {
574 .name = "Kernel",
575 .offset = MTDPART_OFS_APPEND,
576 .size = 0x300000,
577 .mask_flags = 0,
578 },
579 [3] = {
580 .name = "Filesystem",
581 .offset = MTDPART_OFS_APPEND,
582 .size = MTDPART_SIZ_FULL,
583 .mask_flags = 0,
584 },
585 };
586
587 static struct s3c2410_nand_set rx1950_nand_sets[] = {
588 [0] = {
589 .name = "Internal",
590 .nr_chips = 1,
591 .nr_partitions = ARRAY_SIZE(rx1950_nand_part),
592 .partitions = rx1950_nand_part,
593 },
594 };
595
596 static struct s3c2410_platform_nand rx1950_nand_info = {
597 .tacls = 25,
598 .twrph0 = 50,
599 .twrph1 = 15,
600 .nr_sets = ARRAY_SIZE(rx1950_nand_sets),
601 .sets = rx1950_nand_sets,
602 };
603
604 static struct s3c2410_udc_mach_info rx1950_udc_cfg __initdata = {
605 .vbus_pin = S3C2410_GPG(5),
606 .vbus_pin_inverted = 1,
607 .pullup_pin = S3C2410_GPJ(5),
608 };
609
610 static struct s3c2410_ts_mach_info rx1950_ts_cfg __initdata = {
611 .delay = 10000,
612 .presc = 49,
613 .oversampling_shift = 3,
614 };
615
616 static struct gpio_keys_button rx1950_gpio_keys_table[] = {
617 {
618 .code = KEY_POWER,
619 .gpio = S3C2410_GPF(0),
620 .active_low = 1,
621 .desc = "Power button",
622 .wakeup = 1,
623 },
624 {
625 .code = KEY_F5,
626 .gpio = S3C2410_GPF(7),
627 .active_low = 1,
628 .desc = "Record button",
629 },
630 {
631 .code = KEY_F1,
632 .gpio = S3C2410_GPG(0),
633 .active_low = 1,
634 .desc = "Calendar button",
635 },
636 {
637 .code = KEY_F2,
638 .gpio = S3C2410_GPG(2),
639 .active_low = 1,
640 .desc = "Contacts button",
641 },
642 {
643 .code = KEY_F3,
644 .gpio = S3C2410_GPG(3),
645 .active_low = 1,
646 .desc = "Mail button",
647 },
648 {
649 .code = KEY_F4,
650 .gpio = S3C2410_GPG(7),
651 .active_low = 1,
652 .desc = "WLAN button",
653 },
654 {
655 .code = KEY_LEFT,
656 .gpio = S3C2410_GPG(10),
657 .active_low = 1,
658 .desc = "Left button",
659 },
660 {
661 .code = KEY_RIGHT,
662 .gpio = S3C2410_GPG(11),
663 .active_low = 1,
664 .desc = "Right button",
665 },
666 {
667 .code = KEY_UP,
668 .gpio = S3C2410_GPG(4),
669 .active_low = 1,
670 .desc = "Up button",
671 },
672 {
673 .code = KEY_DOWN,
674 .gpio = S3C2410_GPG(6),
675 .active_low = 1,
676 .desc = "Down button",
677 },
678 {
679 .code = KEY_ENTER,
680 .gpio = S3C2410_GPG(9),
681 .active_low = 1,
682 .desc = "Ok button"
683 },
684 };
685
686 static struct gpio_keys_platform_data rx1950_gpio_keys_data = {
687 .buttons = rx1950_gpio_keys_table,
688 .nbuttons = ARRAY_SIZE(rx1950_gpio_keys_table),
689 };
690
691 static struct platform_device rx1950_device_gpiokeys = {
692 .name = "gpio-keys",
693 .dev.platform_data = &rx1950_gpio_keys_data,
694 };
695
696 static struct uda1380_platform_data uda1380_info = {
697 .gpio_power = S3C2410_GPJ(0),
698 .gpio_reset = S3C2410_GPD(0),
699 .dac_clk = UDA1380_DAC_CLK_SYSCLK,
700 };
701
702 static struct i2c_board_info rx1950_i2c_devices[] = {
703 {
704 I2C_BOARD_INFO("uda1380", 0x1a),
705 .platform_data = &uda1380_info,
706 },
707 };
708
709 static struct platform_device *rx1950_devices[] __initdata = {
710 &s3c_device_lcd,
711 &s3c_device_wdt,
712 &s3c_device_i2c0,
713 &s3c_device_iis,
714 &s3c_device_usbgadget,
715 &s3c_device_rtc,
716 &s3c_device_nand,
717 &s3c_device_sdi,
718 &s3c_device_adc,
719 &s3c_device_ts,
720 &s3c_device_timer[0],
721 &s3c_device_timer[1],
722 &rx1950_backlight,
723 &rx1950_device_gpiokeys,
724 &power_supply,
725 &rx1950_battery,
726 &rx1950_leds,
727 };
728
729 static struct clk *rx1950_clocks[] __initdata = {
730 &s3c24xx_clkout0,
731 &s3c24xx_clkout1,
732 };
733
734 static void __init rx1950_map_io(void)
735 {
736 s3c24xx_clkout0.parent = &clk_h;
737 s3c24xx_clkout1.parent = &clk_f;
738
739 s3c24xx_register_clocks(rx1950_clocks, ARRAY_SIZE(rx1950_clocks));
740
741 s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
742 s3c24xx_init_clocks(16934000);
743 s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
744 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
745
746 /* setup PM */
747
748 #ifdef CONFIG_PM_H1940
749 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 8);
750 #endif
751
752 s3c_pm_init();
753 }
754
755 static void __init rx1950_init_machine(void)
756 {
757 int i;
758
759 s3c24xx_fb_set_platdata(&rx1950_lcd_cfg);
760 s3c24xx_udc_set_platdata(&rx1950_udc_cfg);
761 s3c24xx_ts_set_platdata(&rx1950_ts_cfg);
762 s3c24xx_mci_set_platdata(&rx1950_mmc_cfg);
763 s3c_i2c0_set_platdata(NULL);
764 s3c_nand_set_platdata(&rx1950_nand_info);
765
766 /* Turn off suspend on both USB ports, and switch the
767 * selectable USB port to USB device mode. */
768 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
769 S3C2410_MISCCR_USBSUSPND0 |
770 S3C2410_MISCCR_USBSUSPND1, 0x0);
771
772 /* mmc power is disabled by default */
773 WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power"));
774 gpio_direction_output(S3C2410_GPJ(1), 0);
775
776 for (i = 0; i < 8; i++)
777 WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power"));
778
779 for (i = 10; i < 16; i++)
780 WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power"));
781
782 for (i = 2; i < 8; i++)
783 WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power"));
784
785 for (i = 11; i < 16; i++)
786 WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power"));
787
788 WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power"));
789
790 WARN_ON(gpio_request(S3C2410_GPA(3), "Red blink"));
791 WARN_ON(gpio_request(S3C2410_GPA(4), "Green blink"));
792 WARN_ON(gpio_request(S3C2410_GPJ(6), "LED blink"));
793 gpio_direction_output(S3C2410_GPA(3), 0);
794 gpio_direction_output(S3C2410_GPA(4), 0);
795 gpio_direction_output(S3C2410_GPJ(6), 0);
796
797 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
798
799 i2c_register_board_info(0, rx1950_i2c_devices,
800 ARRAY_SIZE(rx1950_i2c_devices));
801 }
802
803 /* H1940 and RX3715 need to reserve this for suspend */
804 static void __init rx1950_reserve(void)
805 {
806 memblock_reserve(0x30003000, 0x1000);
807 memblock_reserve(0x30081000, 0x1000);
808 }
809
810 MACHINE_START(RX1950, "HP iPAQ RX1950")
811 /* Maintainers: Vasily Khoruzhick */
812 .atag_offset = 0x100,
813 .map_io = rx1950_map_io,
814 .reserve = rx1950_reserve,
815 .init_irq = s3c2442_init_irq,
816 .init_machine = rx1950_init_machine,
817 .init_time = samsung_timer_init,
818 .restart = s3c244x_restart,
819 MACHINE_END