palmtreo.c 17 KB

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