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