palmtreo.c 17 KB

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