mach-rx1950.c 18 KB

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