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