mach-rx1950.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  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. DEFINE_SPINLOCK(rx1950_blink_spin);
  235. static int rx1950_led_blink_set(unsigned gpio, int state,
  236. unsigned long *delay_on, unsigned long *delay_off)
  237. {
  238. int blink_gpio, check_gpio;
  239. switch (gpio) {
  240. case S3C2410_GPA(6):
  241. blink_gpio = S3C2410_GPA(4);
  242. check_gpio = S3C2410_GPA(3);
  243. break;
  244. case S3C2410_GPA(7):
  245. blink_gpio = S3C2410_GPA(3);
  246. check_gpio = S3C2410_GPA(4);
  247. break;
  248. default:
  249. return -EINVAL;
  250. break;
  251. }
  252. if (delay_on && delay_off && !*delay_on && !*delay_off)
  253. *delay_on = *delay_off = 500;
  254. spin_lock(&rx1950_blink_spin);
  255. switch (state) {
  256. case GPIO_LED_NO_BLINK_LOW:
  257. case GPIO_LED_NO_BLINK_HIGH:
  258. if (!gpio_get_value(check_gpio))
  259. gpio_set_value(S3C2410_GPJ(6), 0);
  260. gpio_set_value(blink_gpio, 0);
  261. gpio_set_value(gpio, state);
  262. break;
  263. case GPIO_LED_BLINK:
  264. gpio_set_value(gpio, 0);
  265. gpio_set_value(S3C2410_GPJ(6), 1);
  266. gpio_set_value(blink_gpio, 1);
  267. break;
  268. }
  269. spin_unlock(&rx1950_blink_spin);
  270. return 0;
  271. }
  272. static struct gpio_led rx1950_leds_desc[] = {
  273. {
  274. .name = "Green",
  275. .default_trigger = "main-battery-full",
  276. .gpio = S3C2410_GPA(6),
  277. .retain_state_suspended = 1,
  278. },
  279. {
  280. .name = "Red",
  281. .default_trigger
  282. = "main-battery-charging-blink-full-solid",
  283. .gpio = S3C2410_GPA(7),
  284. .retain_state_suspended = 1,
  285. },
  286. {
  287. .name = "Blue",
  288. .default_trigger = "rx1950-acx-mem",
  289. .gpio = S3C2410_GPA(11),
  290. .retain_state_suspended = 1,
  291. },
  292. };
  293. static struct gpio_led_platform_data rx1950_leds_pdata = {
  294. .num_leds = ARRAY_SIZE(rx1950_leds_desc),
  295. .leds = rx1950_leds_desc,
  296. .gpio_blink_set = rx1950_led_blink_set,
  297. };
  298. static struct platform_device rx1950_leds = {
  299. .name = "leds-gpio",
  300. .id = -1,
  301. .dev = {
  302. .platform_data = &rx1950_leds_pdata,
  303. },
  304. };
  305. static struct s3c_adc_bat_pdata rx1950_bat_cfg = {
  306. .init = rx1950_bat_init,
  307. .exit = rx1950_bat_exit,
  308. .enable_charger = rx1950_enable_charger,
  309. .disable_charger = rx1950_disable_charger,
  310. .gpio_charge_finished = S3C2410_GPF(3),
  311. .lut_noac = bat_lut_noac,
  312. .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac),
  313. .lut_acin = bat_lut_acin,
  314. .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin),
  315. .volt_channel = 0,
  316. .current_channel = 1,
  317. .volt_mult = 4235,
  318. .current_mult = 2900,
  319. .internal_impedance = 200,
  320. };
  321. static struct platform_device rx1950_battery = {
  322. .name = "s3c-adc-battery",
  323. .id = -1,
  324. .dev = {
  325. .parent = &s3c_device_adc.dev,
  326. .platform_data = &rx1950_bat_cfg,
  327. },
  328. };
  329. static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
  330. .displays = &rx1950_display,
  331. .num_displays = 1,
  332. .default_display = 0,
  333. .lpcsel = 0x02,
  334. .gpccon = 0xaa9556a9,
  335. .gpccon_mask = 0xffc003fc,
  336. .gpcup = 0x0000ffff,
  337. .gpcup_mask = 0xffffffff,
  338. .gpdcon = 0xaa90aaa1,
  339. .gpdcon_mask = 0xffc0fff0,
  340. .gpdup = 0x0000fcfd,
  341. .gpdup_mask = 0xffffffff,
  342. };
  343. static struct pwm_device *lcd_pwm;
  344. void rx1950_lcd_power(int enable)
  345. {
  346. int i;
  347. static int enabled;
  348. if (enabled == enable)
  349. return;
  350. if (!enable) {
  351. /* GPC11-GPC15->OUTPUT */
  352. for (i = 11; i < 16; i++)
  353. gpio_direction_output(S3C2410_GPC(i), 1);
  354. /* Wait a bit here... */
  355. mdelay(100);
  356. /* GPD2-GPD7->OUTPUT */
  357. /* GPD11-GPD15->OUTPUT */
  358. /* GPD2-GPD7->1, GPD11-GPD15->1 */
  359. for (i = 2; i < 8; i++)
  360. gpio_direction_output(S3C2410_GPD(i), 1);
  361. for (i = 11; i < 16; i++)
  362. gpio_direction_output(S3C2410_GPD(i), 1);
  363. /* Wait a bit here...*/
  364. mdelay(100);
  365. /* GPB0->OUTPUT, GPB0->0 */
  366. gpio_direction_output(S3C2410_GPB(0), 0);
  367. /* GPC1-GPC4->OUTPUT, GPC1-4->0 */
  368. for (i = 1; i < 5; i++)
  369. gpio_direction_output(S3C2410_GPC(i), 0);
  370. /* GPC15-GPC11->0 */
  371. for (i = 11; i < 16; i++)
  372. gpio_direction_output(S3C2410_GPC(i), 0);
  373. /* GPD15-GPD11->0, GPD2->GPD7->0 */
  374. for (i = 11; i < 16; i++)
  375. gpio_direction_output(S3C2410_GPD(i), 0);
  376. for (i = 2; i < 8; i++)
  377. gpio_direction_output(S3C2410_GPD(i), 0);
  378. /* GPC6->0, GPC7->0, GPC5->0 */
  379. gpio_direction_output(S3C2410_GPC(6), 0);
  380. gpio_direction_output(S3C2410_GPC(7), 0);
  381. gpio_direction_output(S3C2410_GPC(5), 0);
  382. /* GPB1->OUTPUT, GPB1->0 */
  383. gpio_direction_output(S3C2410_GPB(1), 0);
  384. pwm_config(lcd_pwm, 0, LCD_PWM_PERIOD);
  385. pwm_disable(lcd_pwm);
  386. /* GPC0->0, GPC10->0 */
  387. gpio_direction_output(S3C2410_GPC(0), 0);
  388. gpio_direction_output(S3C2410_GPC(10), 0);
  389. } else {
  390. pwm_config(lcd_pwm, LCD_PWM_DUTY, LCD_PWM_PERIOD);
  391. pwm_enable(lcd_pwm);
  392. gpio_direction_output(S3C2410_GPC(0), 1);
  393. gpio_direction_output(S3C2410_GPC(5), 1);
  394. s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPB1_TOUT1);
  395. gpio_direction_output(S3C2410_GPC(7), 1);
  396. for (i = 1; i < 5; i++)
  397. s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2));
  398. for (i = 11; i < 16; i++)
  399. s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2));
  400. for (i = 2; i < 8; i++)
  401. s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2));
  402. for (i = 11; i < 16; i++)
  403. s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2));
  404. gpio_direction_output(S3C2410_GPC(10), 1);
  405. gpio_direction_output(S3C2410_GPC(6), 1);
  406. }
  407. enabled = enable;
  408. }
  409. static void rx1950_bl_power(int enable)
  410. {
  411. static int enabled;
  412. if (enabled == enable)
  413. return;
  414. if (!enable) {
  415. gpio_direction_output(S3C2410_GPB(0), 0);
  416. } else {
  417. /* LED driver need a "push" to power on */
  418. gpio_direction_output(S3C2410_GPB(0), 1);
  419. /* Warm up backlight for one period of PWM.
  420. * Without this trick its almost impossible to
  421. * enable backlight with low brightness value
  422. */
  423. ndelay(48000);
  424. s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
  425. }
  426. enabled = enable;
  427. }
  428. static int rx1950_backlight_init(struct device *dev)
  429. {
  430. WARN_ON(gpio_request(S3C2410_GPB(0), "Backlight"));
  431. lcd_pwm = pwm_request(1, "RX1950 LCD");
  432. if (IS_ERR(lcd_pwm)) {
  433. dev_err(dev, "Unable to request PWM for LCD power!\n");
  434. return PTR_ERR(lcd_pwm);
  435. }
  436. rx1950_lcd_power(1);
  437. rx1950_bl_power(1);
  438. return 0;
  439. }
  440. static void rx1950_backlight_exit(struct device *dev)
  441. {
  442. rx1950_bl_power(0);
  443. rx1950_lcd_power(0);
  444. pwm_free(lcd_pwm);
  445. gpio_free(S3C2410_GPB(0));
  446. }
  447. static int rx1950_backlight_notify(struct device *dev, int brightness)
  448. {
  449. if (!brightness) {
  450. rx1950_bl_power(0);
  451. rx1950_lcd_power(0);
  452. } else {
  453. rx1950_lcd_power(1);
  454. rx1950_bl_power(1);
  455. }
  456. return brightness;
  457. }
  458. static struct platform_pwm_backlight_data rx1950_backlight_data = {
  459. .pwm_id = 0,
  460. .max_brightness = 24,
  461. .dft_brightness = 4,
  462. .pwm_period_ns = 48000,
  463. .init = rx1950_backlight_init,
  464. .notify = rx1950_backlight_notify,
  465. .exit = rx1950_backlight_exit,
  466. };
  467. static struct platform_device rx1950_backlight = {
  468. .name = "pwm-backlight",
  469. .dev = {
  470. .parent = &s3c_device_timer[0].dev,
  471. .platform_data = &rx1950_backlight_data,
  472. },
  473. };
  474. static void rx1950_set_mmc_power(unsigned char power_mode, unsigned short vdd)
  475. {
  476. switch (power_mode) {
  477. case MMC_POWER_OFF:
  478. gpio_direction_output(S3C2410_GPJ(1), 0);
  479. break;
  480. case MMC_POWER_UP:
  481. case MMC_POWER_ON:
  482. gpio_direction_output(S3C2410_GPJ(1), 1);
  483. break;
  484. default:
  485. break;
  486. }
  487. }
  488. static struct s3c24xx_mci_pdata rx1950_mmc_cfg __initdata = {
  489. .gpio_detect = S3C2410_GPF(5),
  490. .gpio_wprotect = S3C2410_GPH(8),
  491. .set_power = rx1950_set_mmc_power,
  492. .ocr_avail = MMC_VDD_32_33,
  493. };
  494. static struct mtd_partition rx1950_nand_part[] = {
  495. [0] = {
  496. .name = "Boot0",
  497. .offset = 0,
  498. .size = 0x4000,
  499. .mask_flags = MTD_WRITEABLE,
  500. },
  501. [1] = {
  502. .name = "Boot1",
  503. .offset = MTDPART_OFS_APPEND,
  504. .size = 0x40000,
  505. .mask_flags = MTD_WRITEABLE,
  506. },
  507. [2] = {
  508. .name = "Kernel",
  509. .offset = MTDPART_OFS_APPEND,
  510. .size = 0x300000,
  511. .mask_flags = 0,
  512. },
  513. [3] = {
  514. .name = "Filesystem",
  515. .offset = MTDPART_OFS_APPEND,
  516. .size = MTDPART_SIZ_FULL,
  517. .mask_flags = 0,
  518. },
  519. };
  520. static struct s3c2410_nand_set rx1950_nand_sets[] = {
  521. [0] = {
  522. .name = "Internal",
  523. .nr_chips = 1,
  524. .nr_partitions = ARRAY_SIZE(rx1950_nand_part),
  525. .partitions = rx1950_nand_part,
  526. },
  527. };
  528. static struct s3c2410_platform_nand rx1950_nand_info = {
  529. .tacls = 25,
  530. .twrph0 = 50,
  531. .twrph1 = 15,
  532. .nr_sets = ARRAY_SIZE(rx1950_nand_sets),
  533. .sets = rx1950_nand_sets,
  534. };
  535. static struct s3c2410_udc_mach_info rx1950_udc_cfg __initdata = {
  536. .vbus_pin = S3C2410_GPG(5),
  537. .vbus_pin_inverted = 1,
  538. .pullup_pin = S3C2410_GPJ(5),
  539. };
  540. static struct s3c2410_ts_mach_info rx1950_ts_cfg __initdata = {
  541. .delay = 10000,
  542. .presc = 49,
  543. .oversampling_shift = 3,
  544. };
  545. static struct gpio_keys_button rx1950_gpio_keys_table[] = {
  546. {
  547. .code = KEY_POWER,
  548. .gpio = S3C2410_GPF(0),
  549. .active_low = 1,
  550. .desc = "Power button",
  551. .wakeup = 1,
  552. },
  553. {
  554. .code = KEY_F5,
  555. .gpio = S3C2410_GPF(7),
  556. .active_low = 1,
  557. .desc = "Record button",
  558. },
  559. {
  560. .code = KEY_F1,
  561. .gpio = S3C2410_GPG(0),
  562. .active_low = 1,
  563. .desc = "Calendar button",
  564. },
  565. {
  566. .code = KEY_F2,
  567. .gpio = S3C2410_GPG(2),
  568. .active_low = 1,
  569. .desc = "Contacts button",
  570. },
  571. {
  572. .code = KEY_F3,
  573. .gpio = S3C2410_GPG(3),
  574. .active_low = 1,
  575. .desc = "Mail button",
  576. },
  577. {
  578. .code = KEY_F4,
  579. .gpio = S3C2410_GPG(7),
  580. .active_low = 1,
  581. .desc = "WLAN button",
  582. },
  583. {
  584. .code = KEY_LEFT,
  585. .gpio = S3C2410_GPG(10),
  586. .active_low = 1,
  587. .desc = "Left button",
  588. },
  589. {
  590. .code = KEY_RIGHT,
  591. .gpio = S3C2410_GPG(11),
  592. .active_low = 1,
  593. .desc = "Right button",
  594. },
  595. {
  596. .code = KEY_UP,
  597. .gpio = S3C2410_GPG(4),
  598. .active_low = 1,
  599. .desc = "Up button",
  600. },
  601. {
  602. .code = KEY_DOWN,
  603. .gpio = S3C2410_GPG(6),
  604. .active_low = 1,
  605. .desc = "Down button",
  606. },
  607. {
  608. .code = KEY_ENTER,
  609. .gpio = S3C2410_GPG(9),
  610. .active_low = 1,
  611. .desc = "Ok button"
  612. },
  613. };
  614. static struct gpio_keys_platform_data rx1950_gpio_keys_data = {
  615. .buttons = rx1950_gpio_keys_table,
  616. .nbuttons = ARRAY_SIZE(rx1950_gpio_keys_table),
  617. };
  618. static struct platform_device rx1950_device_gpiokeys = {
  619. .name = "gpio-keys",
  620. .dev.platform_data = &rx1950_gpio_keys_data,
  621. };
  622. static struct uda1380_platform_data uda1380_info = {
  623. .gpio_power = S3C2410_GPJ(0),
  624. .gpio_reset = S3C2410_GPD(0),
  625. .dac_clk = UDA1380_DAC_CLK_SYSCLK,
  626. };
  627. static struct i2c_board_info rx1950_i2c_devices[] = {
  628. {
  629. I2C_BOARD_INFO("uda1380", 0x1a),
  630. .platform_data = &uda1380_info,
  631. },
  632. };
  633. static struct platform_device *rx1950_devices[] __initdata = {
  634. &s3c_device_lcd,
  635. &s3c_device_wdt,
  636. &s3c_device_i2c0,
  637. &s3c_device_iis,
  638. &samsung_asoc_dma,
  639. &s3c_device_usbgadget,
  640. &s3c_device_rtc,
  641. &s3c_device_nand,
  642. &s3c_device_sdi,
  643. &s3c_device_adc,
  644. &s3c_device_ts,
  645. &s3c_device_timer[0],
  646. &s3c_device_timer[1],
  647. &rx1950_backlight,
  648. &rx1950_device_gpiokeys,
  649. &power_supply,
  650. &rx1950_battery,
  651. &rx1950_leds,
  652. };
  653. static struct clk *rx1950_clocks[] __initdata = {
  654. &s3c24xx_clkout0,
  655. &s3c24xx_clkout1,
  656. };
  657. static void __init rx1950_map_io(void)
  658. {
  659. s3c24xx_clkout0.parent = &clk_h;
  660. s3c24xx_clkout1.parent = &clk_f;
  661. s3c24xx_register_clocks(rx1950_clocks, ARRAY_SIZE(rx1950_clocks));
  662. s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
  663. s3c24xx_init_clocks(16934000);
  664. s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
  665. /* setup PM */
  666. #ifdef CONFIG_PM_H1940
  667. memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 8);
  668. #endif
  669. s3c_pm_init();
  670. }
  671. static void __init rx1950_init_machine(void)
  672. {
  673. int i;
  674. s3c24xx_fb_set_platdata(&rx1950_lcd_cfg);
  675. s3c24xx_udc_set_platdata(&rx1950_udc_cfg);
  676. s3c24xx_ts_set_platdata(&rx1950_ts_cfg);
  677. s3c24xx_mci_set_platdata(&rx1950_mmc_cfg);
  678. s3c_i2c0_set_platdata(NULL);
  679. s3c_nand_set_platdata(&rx1950_nand_info);
  680. /* Turn off suspend on both USB ports, and switch the
  681. * selectable USB port to USB device mode. */
  682. s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
  683. S3C2410_MISCCR_USBSUSPND0 |
  684. S3C2410_MISCCR_USBSUSPND1, 0x0);
  685. /* mmc power is disabled by default */
  686. WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power"));
  687. gpio_direction_output(S3C2410_GPJ(1), 0);
  688. for (i = 0; i < 8; i++)
  689. WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power"));
  690. for (i = 10; i < 16; i++)
  691. WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power"));
  692. for (i = 2; i < 8; i++)
  693. WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power"));
  694. for (i = 11; i < 16; i++)
  695. WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power"));
  696. WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power"));
  697. WARN_ON(gpio_request(S3C2410_GPA(3), "Red blink"));
  698. WARN_ON(gpio_request(S3C2410_GPA(4), "Green blink"));
  699. WARN_ON(gpio_request(S3C2410_GPJ(6), "LED blink"));
  700. gpio_direction_output(S3C2410_GPA(3), 0);
  701. gpio_direction_output(S3C2410_GPA(4), 0);
  702. gpio_direction_output(S3C2410_GPJ(6), 0);
  703. platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
  704. i2c_register_board_info(0, rx1950_i2c_devices,
  705. ARRAY_SIZE(rx1950_i2c_devices));
  706. }
  707. /* H1940 and RX3715 need to reserve this for suspend */
  708. static void __init rx1950_reserve(void)
  709. {
  710. memblock_reserve(0x30003000, 0x1000);
  711. memblock_reserve(0x30081000, 0x1000);
  712. }
  713. MACHINE_START(RX1950, "HP iPAQ RX1950")
  714. /* Maintainers: Vasily Khoruzhick */
  715. .boot_params = S3C2410_SDRAM_PA + 0x100,
  716. .map_io = rx1950_map_io,
  717. .reserve = rx1950_reserve,
  718. .init_irq = s3c24xx_init_irq,
  719. .init_machine = rx1950_init_machine,
  720. .timer = &s3c24xx_timer,
  721. MACHINE_END