palmtreo.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. /*
  2. * Hardware definitions for Palm Treo smartphones
  3. *
  4. * currently supported:
  5. * Palm Treo 680 (GSM)
  6. * Palm Centro 685 (GSM)
  7. *
  8. * Author: Tomas Cech <sleep_walker@suse.cz>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. *
  14. * (find more info at www.hackndev.com)
  15. *
  16. */
  17. #include <linux/platform_device.h>
  18. #include <linux/delay.h>
  19. #include <linux/irq.h>
  20. #include <linux/gpio_keys.h>
  21. #include <linux/input.h>
  22. #include <linux/pda_power.h>
  23. #include <linux/pwm_backlight.h>
  24. #include <linux/gpio.h>
  25. #include <linux/wm97xx_batt.h>
  26. #include <linux/power_supply.h>
  27. #include <linux/sysdev.h>
  28. #include <linux/w1-gpio.h>
  29. #include <asm/mach-types.h>
  30. #include <asm/mach/arch.h>
  31. #include <asm/mach/map.h>
  32. #include <mach/pxa27x.h>
  33. #include <mach/pxa27x-udc.h>
  34. #include <mach/audio.h>
  35. #include <mach/palmtreo.h>
  36. #include <mach/mmc.h>
  37. #include <mach/pxafb.h>
  38. #include <mach/irda.h>
  39. #include <mach/pxa27x_keypad.h>
  40. #include <mach/udc.h>
  41. #include <mach/ohci.h>
  42. #include <mach/pxa2xx-regs.h>
  43. #include <mach/palmasoc.h>
  44. #include <mach/camera.h>
  45. #include <sound/pxa2xx-lib.h>
  46. #include "generic.h"
  47. #include "devices.h"
  48. /******************************************************************************
  49. * Pin configuration
  50. ******************************************************************************/
  51. static unsigned long treo_pin_config[] __initdata = {
  52. /* MMC */
  53. GPIO32_MMC_CLK,
  54. GPIO92_MMC_DAT_0,
  55. GPIO109_MMC_DAT_1,
  56. GPIO110_MMC_DAT_2,
  57. GPIO111_MMC_DAT_3,
  58. GPIO112_MMC_CMD,
  59. GPIO113_GPIO, /* SD detect */
  60. /* AC97 */
  61. GPIO28_AC97_BITCLK,
  62. GPIO29_AC97_SDATA_IN_0,
  63. GPIO30_AC97_SDATA_OUT,
  64. GPIO31_AC97_SYNC,
  65. GPIO89_AC97_SYSCLK,
  66. GPIO95_AC97_nRESET,
  67. /* IrDA */
  68. GPIO46_FICP_RXD,
  69. GPIO47_FICP_TXD,
  70. /* PWM */
  71. GPIO16_PWM0_OUT,
  72. /* USB */
  73. GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* usb detect */
  74. /* MATRIX KEYPAD */
  75. GPIO101_KP_MKIN_1,
  76. GPIO102_KP_MKIN_2,
  77. GPIO97_KP_MKIN_3,
  78. GPIO98_KP_MKIN_4,
  79. GPIO91_KP_MKIN_6,
  80. GPIO13_KP_MKIN_7,
  81. GPIO103_KP_MKOUT_0 | MFP_LPM_DRIVE_HIGH,
  82. GPIO104_KP_MKOUT_1,
  83. GPIO105_KP_MKOUT_2,
  84. GPIO106_KP_MKOUT_3,
  85. GPIO107_KP_MKOUT_4,
  86. GPIO108_KP_MKOUT_5,
  87. GPIO96_KP_MKOUT_6,
  88. GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, /* Hotsync button */
  89. /* LCD */
  90. GPIO58_LCD_LDD_0,
  91. GPIO59_LCD_LDD_1,
  92. GPIO60_LCD_LDD_2,
  93. GPIO61_LCD_LDD_3,
  94. GPIO62_LCD_LDD_4,
  95. GPIO63_LCD_LDD_5,
  96. GPIO64_LCD_LDD_6,
  97. GPIO65_LCD_LDD_7,
  98. GPIO66_LCD_LDD_8,
  99. GPIO67_LCD_LDD_9,
  100. GPIO68_LCD_LDD_10,
  101. GPIO69_LCD_LDD_11,
  102. GPIO70_LCD_LDD_12,
  103. GPIO71_LCD_LDD_13,
  104. GPIO72_LCD_LDD_14,
  105. GPIO73_LCD_LDD_15,
  106. GPIO74_LCD_FCLK,
  107. GPIO75_LCD_LCLK,
  108. GPIO76_LCD_PCLK,
  109. /* Quick Capture Interface */
  110. GPIO84_CIF_FV,
  111. GPIO85_CIF_LV,
  112. GPIO53_CIF_MCLK,
  113. GPIO54_CIF_PCLK,
  114. GPIO81_CIF_DD_0,
  115. GPIO55_CIF_DD_1,
  116. GPIO51_CIF_DD_2,
  117. GPIO50_CIF_DD_3,
  118. GPIO52_CIF_DD_4,
  119. GPIO48_CIF_DD_5,
  120. GPIO17_CIF_DD_6,
  121. GPIO12_CIF_DD_7,
  122. /* I2C */
  123. GPIO117_I2C_SCL,
  124. GPIO118_I2C_SDA,
  125. /* GSM */
  126. GPIO14_GPIO | WAKEUP_ON_EDGE_BOTH, /* GSM host wake up */
  127. GPIO34_FFUART_RXD,
  128. GPIO35_FFUART_CTS,
  129. GPIO39_FFUART_TXD,
  130. GPIO41_FFUART_RTS,
  131. /* MISC. */
  132. GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* external power detect */
  133. GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH, /* silent switch */
  134. GPIO116_GPIO, /* headphone detect */
  135. GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* bluetooth host wake up */
  136. };
  137. #ifdef CONFIG_MACH_TREO680
  138. static unsigned long treo680_pin_config[] __initdata = {
  139. GPIO33_GPIO, /* SD read only */
  140. /* MATRIX KEYPAD - different wake up source */
  141. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  142. GPIO99_KP_MKIN_5,
  143. };
  144. #endif /* CONFIG_MACH_TREO680 */
  145. #ifdef CONFIG_MACH_CENTRO
  146. static unsigned long centro685_pin_config[] __initdata = {
  147. /* Bluetooth attached to BT UART*/
  148. MFP_CFG_OUT(GPIO80, AF0, DRIVE_LOW), /* power: LOW = off */
  149. GPIO42_BTUART_RXD,
  150. GPIO43_BTUART_TXD,
  151. GPIO44_BTUART_CTS,
  152. GPIO45_BTUART_RTS,
  153. /* MATRIX KEYPAD - different wake up source */
  154. GPIO100_KP_MKIN_0,
  155. GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
  156. };
  157. #endif /* CONFIG_MACH_CENTRO */
  158. /******************************************************************************
  159. * SD/MMC card controller
  160. ******************************************************************************/
  161. #ifdef CONFIG_MACH_TREO680
  162. static struct pxamci_platform_data treo680_mci_platform_data = {
  163. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  164. .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N,
  165. .gpio_card_ro = GPIO_NR_TREO680_SD_READONLY,
  166. .gpio_power = GPIO_NR_TREO680_SD_POWER,
  167. };
  168. #endif /* CONFIG_MACH_TREO680 */
  169. #ifdef CONFIG_MACH_CENTRO
  170. static struct pxamci_platform_data centro_mci_platform_data = {
  171. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  172. .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N,
  173. .gpio_card_ro = -1,
  174. .gpio_power = GPIO_NR_CENTRO_SD_POWER,
  175. .gpio_power_invert = 1,
  176. };
  177. #endif /* CONFIG_MACH_CENTRO */
  178. /******************************************************************************
  179. * GPIO keyboard
  180. ******************************************************************************/
  181. #ifdef CONFIG_MACH_TREO680
  182. static unsigned int treo680_matrix_keys[] = {
  183. KEY(0, 0, KEY_F8), /* Red/Off/Power */
  184. KEY(0, 1, KEY_LEFT),
  185. KEY(0, 2, KEY_LEFTCTRL), /* Alternate */
  186. KEY(0, 3, KEY_L),
  187. KEY(0, 4, KEY_A),
  188. KEY(0, 5, KEY_Q),
  189. KEY(0, 6, KEY_P),
  190. KEY(1, 0, KEY_RIGHTCTRL), /* Menu */
  191. KEY(1, 1, KEY_RIGHT),
  192. KEY(1, 2, KEY_LEFTSHIFT), /* Left shift */
  193. KEY(1, 3, KEY_Z),
  194. KEY(1, 4, KEY_S),
  195. KEY(1, 5, KEY_W),
  196. KEY(2, 0, KEY_F1), /* Phone */
  197. KEY(2, 1, KEY_UP),
  198. KEY(2, 2, KEY_0),
  199. KEY(2, 3, KEY_X),
  200. KEY(2, 4, KEY_D),
  201. KEY(2, 5, KEY_E),
  202. KEY(3, 0, KEY_F10), /* Calendar */
  203. KEY(3, 1, KEY_DOWN),
  204. KEY(3, 2, KEY_SPACE),
  205. KEY(3, 3, KEY_C),
  206. KEY(3, 4, KEY_F),
  207. KEY(3, 5, KEY_R),
  208. KEY(4, 0, KEY_F12), /* Mail */
  209. KEY(4, 1, KEY_KPENTER),
  210. KEY(4, 2, KEY_RIGHTALT), /* Alt */
  211. KEY(4, 3, KEY_V),
  212. KEY(4, 4, KEY_G),
  213. KEY(4, 5, KEY_T),
  214. KEY(5, 0, KEY_F9), /* Home */
  215. KEY(5, 1, KEY_PAGEUP), /* Side up */
  216. KEY(5, 2, KEY_DOT),
  217. KEY(5, 3, KEY_B),
  218. KEY(5, 4, KEY_H),
  219. KEY(5, 5, KEY_Y),
  220. KEY(6, 0, KEY_TAB), /* Side Activate */
  221. KEY(6, 1, KEY_PAGEDOWN), /* Side down */
  222. KEY(6, 2, KEY_ENTER),
  223. KEY(6, 3, KEY_N),
  224. KEY(6, 4, KEY_J),
  225. KEY(6, 5, KEY_U),
  226. KEY(7, 0, KEY_F6), /* Green/Call */
  227. KEY(7, 1, KEY_O),
  228. KEY(7, 2, KEY_BACKSPACE),
  229. KEY(7, 3, KEY_M),
  230. KEY(7, 4, KEY_K),
  231. KEY(7, 5, KEY_I),
  232. };
  233. static struct pxa27x_keypad_platform_data treo680_keypad_platform_data = {
  234. .matrix_key_rows = 8,
  235. .matrix_key_cols = 7,
  236. .matrix_key_map = treo680_matrix_keys,
  237. .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
  238. .direct_key_map = { KEY_CONNECT },
  239. .direct_key_num = 1,
  240. .debounce_interval = 30,
  241. };
  242. #endif /* CONFIG_MACH_TREO680 */
  243. #ifdef CONFIG_MACH_CENTRO
  244. static unsigned int centro_matrix_keys[] = {
  245. KEY(0, 0, KEY_F9), /* Home */
  246. KEY(0, 1, KEY_LEFT),
  247. KEY(0, 2, KEY_LEFTCTRL), /* Alternate */
  248. KEY(0, 3, KEY_L),
  249. KEY(0, 4, KEY_A),
  250. KEY(0, 5, KEY_Q),
  251. KEY(0, 6, KEY_P),
  252. KEY(1, 0, KEY_RIGHTCTRL), /* Menu */
  253. KEY(1, 1, KEY_RIGHT),
  254. KEY(1, 2, KEY_LEFTSHIFT), /* Left shift */
  255. KEY(1, 3, KEY_Z),
  256. KEY(1, 4, KEY_S),
  257. KEY(1, 5, KEY_W),
  258. KEY(2, 0, KEY_F1), /* Phone */
  259. KEY(2, 1, KEY_UP),
  260. KEY(2, 2, KEY_0),
  261. KEY(2, 3, KEY_X),
  262. KEY(2, 4, KEY_D),
  263. KEY(2, 5, KEY_E),
  264. KEY(3, 0, KEY_F10), /* Calendar */
  265. KEY(3, 1, KEY_DOWN),
  266. KEY(3, 2, KEY_SPACE),
  267. KEY(3, 3, KEY_C),
  268. KEY(3, 4, KEY_F),
  269. KEY(3, 5, KEY_R),
  270. KEY(4, 0, KEY_F12), /* Mail */
  271. KEY(4, 1, KEY_KPENTER),
  272. KEY(4, 2, KEY_RIGHTALT), /* Alt */
  273. KEY(4, 3, KEY_V),
  274. KEY(4, 4, KEY_G),
  275. KEY(4, 5, KEY_T),
  276. KEY(5, 0, KEY_F8), /* Red/Off/Power */
  277. KEY(5, 1, KEY_PAGEUP), /* Side up */
  278. KEY(5, 2, KEY_DOT),
  279. KEY(5, 3, KEY_B),
  280. KEY(5, 4, KEY_H),
  281. KEY(5, 5, KEY_Y),
  282. KEY(6, 0, KEY_TAB), /* Side Activate */
  283. KEY(6, 1, KEY_PAGEDOWN), /* Side down */
  284. KEY(6, 2, KEY_ENTER),
  285. KEY(6, 3, KEY_N),
  286. KEY(6, 4, KEY_J),
  287. KEY(6, 5, KEY_U),
  288. KEY(7, 0, KEY_F6), /* Green/Call */
  289. KEY(7, 1, KEY_O),
  290. KEY(7, 2, KEY_BACKSPACE),
  291. KEY(7, 3, KEY_M),
  292. KEY(7, 4, KEY_K),
  293. KEY(7, 5, KEY_I),
  294. };
  295. static struct pxa27x_keypad_platform_data centro_keypad_platform_data = {
  296. .matrix_key_rows = 8,
  297. .matrix_key_cols = 7,
  298. .matrix_key_map = centro_matrix_keys,
  299. .matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys),
  300. .direct_key_map = { KEY_CONNECT },
  301. .direct_key_num = 1,
  302. .debounce_interval = 30,
  303. };
  304. #endif /* CONFIG_MACH_CENTRO */
  305. /******************************************************************************
  306. * aSoC audio
  307. ******************************************************************************/
  308. static pxa2xx_audio_ops_t treo_ac97_pdata = {
  309. .reset_gpio = 95,
  310. };
  311. /******************************************************************************
  312. * Backlight
  313. ******************************************************************************/
  314. static int treo_backlight_init(struct device *dev)
  315. {
  316. int ret;
  317. ret = gpio_request(GPIO_NR_TREO_BL_POWER, "BL POWER");
  318. if (ret)
  319. goto err;
  320. ret = gpio_direction_output(GPIO_NR_TREO_BL_POWER, 0);
  321. if (ret)
  322. goto err2;
  323. return 0;
  324. err2:
  325. gpio_free(GPIO_NR_TREO_BL_POWER);
  326. err:
  327. return ret;
  328. }
  329. static int treo_backlight_notify(struct device *dev, int brightness)
  330. {
  331. gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness);
  332. return TREO_MAX_INTENSITY - brightness;
  333. };
  334. static void treo_backlight_exit(struct device *dev)
  335. {
  336. gpio_free(GPIO_NR_TREO_BL_POWER);
  337. }
  338. static struct platform_pwm_backlight_data treo_backlight_data = {
  339. .pwm_id = 0,
  340. .max_brightness = TREO_MAX_INTENSITY,
  341. .dft_brightness = TREO_DEFAULT_INTENSITY,
  342. .pwm_period_ns = TREO_PERIOD_NS,
  343. .init = treo_backlight_init,
  344. .notify = treo_backlight_notify,
  345. .exit = treo_backlight_exit,
  346. };
  347. static struct platform_device treo_backlight = {
  348. .name = "pwm-backlight",
  349. .dev = {
  350. .parent = &pxa27x_device_pwm0.dev,
  351. .platform_data = &treo_backlight_data,
  352. },
  353. };
  354. /******************************************************************************
  355. * IrDA
  356. ******************************************************************************/
  357. static struct pxaficp_platform_data treo_ficp_info = {
  358. .gpio_pwdown = GPIO_NR_TREO_IR_EN,
  359. .transceiver_cap = IR_SIRMODE | IR_OFF,
  360. };
  361. /******************************************************************************
  362. * UDC
  363. ******************************************************************************/
  364. static struct pxa2xx_udc_mach_info treo_udc_info __initdata = {
  365. .gpio_vbus = GPIO_NR_TREO_USB_DETECT,
  366. .gpio_vbus_inverted = 1,
  367. .gpio_pullup = GPIO_NR_TREO_USB_PULLUP,
  368. };
  369. /******************************************************************************
  370. * USB host
  371. ******************************************************************************/
  372. #ifdef CONFIG_MACH_TREO680
  373. static struct pxaohci_platform_data treo680_ohci_info = {
  374. .port_mode = PMM_PERPORT_MODE,
  375. .flags = ENABLE_PORT1 | ENABLE_PORT3,
  376. .power_budget = 0,
  377. };
  378. #endif /* CONFIG_MACH_TREO680 */
  379. /******************************************************************************
  380. * Power supply
  381. ******************************************************************************/
  382. static int power_supply_init(struct device *dev)
  383. {
  384. int ret;
  385. ret = gpio_request(GPIO_NR_TREO_POWER_DETECT, "CABLE_STATE_AC");
  386. if (ret)
  387. goto err1;
  388. ret = gpio_direction_input(GPIO_NR_TREO_POWER_DETECT);
  389. if (ret)
  390. goto err2;
  391. return 0;
  392. err2:
  393. gpio_free(GPIO_NR_TREO_POWER_DETECT);
  394. err1:
  395. return ret;
  396. }
  397. static int treo_is_ac_online(void)
  398. {
  399. return gpio_get_value(GPIO_NR_TREO_POWER_DETECT);
  400. }
  401. static void power_supply_exit(struct device *dev)
  402. {
  403. gpio_free(GPIO_NR_TREO_POWER_DETECT);
  404. }
  405. static char *treo_supplicants[] = {
  406. "main-battery",
  407. };
  408. static struct pda_power_pdata power_supply_info = {
  409. .init = power_supply_init,
  410. .is_ac_online = treo_is_ac_online,
  411. .exit = power_supply_exit,
  412. .supplied_to = treo_supplicants,
  413. .num_supplicants = ARRAY_SIZE(treo_supplicants),
  414. };
  415. static struct platform_device power_supply = {
  416. .name = "pda-power",
  417. .id = -1,
  418. .dev = {
  419. .platform_data = &power_supply_info,
  420. },
  421. };
  422. /******************************************************************************
  423. * Vibra and LEDs
  424. ******************************************************************************/
  425. #ifdef CONFIG_MACH_TREO680
  426. static struct gpio_led treo680_gpio_leds[] = {
  427. {
  428. .name = "treo680:vibra:vibra",
  429. .default_trigger = "none",
  430. .gpio = GPIO_NR_TREO680_VIBRATE_EN,
  431. },
  432. {
  433. .name = "treo680:green:led",
  434. .default_trigger = "mmc0",
  435. .gpio = GPIO_NR_TREO_GREEN_LED,
  436. },
  437. {
  438. .name = "treo680:white:keybbl",
  439. .default_trigger = "none",
  440. .gpio = GPIO_NR_TREO680_KEYB_BL,
  441. },
  442. };
  443. static struct gpio_led_platform_data treo680_gpio_led_info = {
  444. .leds = treo680_gpio_leds,
  445. .num_leds = ARRAY_SIZE(treo680_gpio_leds),
  446. };
  447. static struct platform_device treo680_leds = {
  448. .name = "leds-gpio",
  449. .id = -1,
  450. .dev = {
  451. .platform_data = &treo680_gpio_led_info,
  452. }
  453. };
  454. #endif /* CONFIG_MACH_TREO680 */
  455. #ifdef CONFIG_MACH_CENTRO
  456. static struct gpio_led centro_gpio_leds[] = {
  457. {
  458. .name = "centro:vibra:vibra",
  459. .default_trigger = "none",
  460. .gpio = GPIO_NR_CENTRO_VIBRATE_EN,
  461. },
  462. {
  463. .name = "centro:green:led",
  464. .default_trigger = "mmc0",
  465. .gpio = GPIO_NR_TREO_GREEN_LED,
  466. },
  467. {
  468. .name = "centro:white:keybbl",
  469. .default_trigger = "none",
  470. .active_low = 1,
  471. .gpio = GPIO_NR_CENTRO_KEYB_BL,
  472. },
  473. };
  474. static struct gpio_led_platform_data centro_gpio_led_info = {
  475. .leds = centro_gpio_leds,
  476. .num_leds = ARRAY_SIZE(centro_gpio_leds),
  477. };
  478. static struct platform_device centro_leds = {
  479. .name = "leds-gpio",
  480. .id = -1,
  481. .dev = {
  482. .platform_data = &centro_gpio_led_info,
  483. }
  484. };
  485. #endif /* CONFIG_MACH_CENTRO */
  486. /******************************************************************************
  487. * Framebuffer
  488. ******************************************************************************/
  489. /* TODO: add support for 324x324 */
  490. static struct pxafb_mode_info treo_lcd_modes[] = {
  491. {
  492. .pixclock = 86538,
  493. .xres = 320,
  494. .yres = 320,
  495. .bpp = 16,
  496. .left_margin = 20,
  497. .right_margin = 8,
  498. .upper_margin = 8,
  499. .lower_margin = 5,
  500. .hsync_len = 4,
  501. .vsync_len = 1,
  502. },
  503. };
  504. static void treo_lcd_power(int on, struct fb_var_screeninfo *info)
  505. {
  506. gpio_set_value(GPIO_NR_TREO_BL_POWER, on);
  507. }
  508. static struct pxafb_mach_info treo_lcd_screen = {
  509. .modes = treo_lcd_modes,
  510. .num_modes = ARRAY_SIZE(treo_lcd_modes),
  511. .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
  512. };
  513. /******************************************************************************
  514. * Power management - standby
  515. ******************************************************************************/
  516. static void __init treo_pm_init(void)
  517. {
  518. static u32 resume[] = {
  519. 0xe3a00101, /* mov r0, #0x40000000 */
  520. 0xe380060f, /* orr r0, r0, #0x00f00000 */
  521. 0xe590f008, /* ldr pc, [r0, #0x08] */
  522. };
  523. /* this is where the bootloader jumps */
  524. memcpy(phys_to_virt(TREO_STR_BASE), resume, sizeof(resume));
  525. }
  526. /******************************************************************************
  527. * Machine init
  528. ******************************************************************************/
  529. static struct platform_device *treo_devices[] __initdata = {
  530. &treo_backlight,
  531. &power_supply,
  532. };
  533. #ifdef CONFIG_MACH_TREO680
  534. static struct platform_device *treo680_devices[] __initdata = {
  535. &treo680_leds,
  536. };
  537. #endif /* CONFIG_MACH_TREO680 */
  538. #ifdef CONFIG_MACH_CENTRO
  539. static struct platform_device *centro_devices[] __initdata = {
  540. &centro_leds,
  541. };
  542. #endif /* CONFIG_MACH_CENTRO */
  543. /* setup udc GPIOs initial state */
  544. static void __init treo_udc_init(void)
  545. {
  546. if (!gpio_request(GPIO_NR_TREO_USB_PULLUP, "UDC Vbus")) {
  547. gpio_direction_output(GPIO_NR_TREO_USB_PULLUP, 1);
  548. gpio_free(GPIO_NR_TREO_USB_PULLUP);
  549. }
  550. }
  551. static void __init treo_lcd_power_init(void)
  552. {
  553. int ret;
  554. ret = gpio_request(GPIO_NR_TREO_LCD_POWER, "LCD POWER");
  555. if (ret) {
  556. pr_err("Treo680: LCD power GPIO request failed!\n");
  557. return;
  558. }
  559. ret = gpio_direction_output(GPIO_NR_TREO_LCD_POWER, 0);
  560. if (ret) {
  561. pr_err("Treo680: setting LCD power GPIO direction failed!\n");
  562. gpio_free(GPIO_NR_TREO_LCD_POWER);
  563. return;
  564. }
  565. treo_lcd_screen.pxafb_lcd_power = treo_lcd_power;
  566. }
  567. static void __init treo_init(void)
  568. {
  569. pxa_set_ffuart_info(NULL);
  570. pxa_set_btuart_info(NULL);
  571. pxa_set_stuart_info(NULL);
  572. treo_pm_init();
  573. pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
  574. treo_lcd_power_init();
  575. set_pxa_fb_info(&treo_lcd_screen);
  576. treo_udc_init();
  577. pxa_set_udc_info(&treo_udc_info);
  578. pxa_set_ac97_info(&treo_ac97_pdata);
  579. pxa_set_ficp_info(&treo_ficp_info);
  580. platform_add_devices(ARRAY_AND_SIZE(treo_devices));
  581. }
  582. #ifdef CONFIG_MACH_TREO680
  583. static void __init treo680_init(void)
  584. {
  585. treo_init();
  586. pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
  587. pxa_set_mci_info(&treo680_mci_platform_data);
  588. pxa_set_keypad_info(&treo680_keypad_platform_data);
  589. pxa_set_ohci_info(&treo680_ohci_info);
  590. platform_add_devices(ARRAY_AND_SIZE(treo680_devices));
  591. }
  592. MACHINE_START(TREO680, "Palm Treo 680")
  593. .phys_io = TREO_PHYS_IO_START,
  594. .io_pg_offst = io_p2v(0x40000000),
  595. .boot_params = 0xa0000100,
  596. .map_io = pxa_map_io,
  597. .init_irq = pxa27x_init_irq,
  598. .timer = &pxa_timer,
  599. .init_machine = treo680_init,
  600. MACHINE_END
  601. #endif /* CONFIG_MACH_TREO680 */
  602. #ifdef CONFIG_MACH_CENTRO
  603. static void __init centro_init(void)
  604. {
  605. treo_init();
  606. pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
  607. pxa_set_mci_info(&centro_mci_platform_data);
  608. pxa_set_keypad_info(&centro_keypad_platform_data);
  609. platform_add_devices(ARRAY_AND_SIZE(centro_devices));
  610. }
  611. MACHINE_START(CENTRO, "Palm Centro 685")
  612. .phys_io = TREO_PHYS_IO_START,
  613. .io_pg_offst = io_p2v(0x40000000),
  614. .boot_params = 0xa0000100,
  615. .map_io = pxa_map_io,
  616. .init_irq = pxa27x_init_irq,
  617. .timer = &pxa_timer,
  618. .init_machine = centro_init,
  619. MACHINE_END
  620. #endif /* CONFIG_MACH_CENTRO */