palmtreo.c 17 KB

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