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