palmt5.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. * Hardware definitions for Palm Tungsten|T5
  3. *
  4. * Author: Marek Vasut <marek.vasut@gmail.com>
  5. *
  6. * Based on work of:
  7. * Ales Snuparek <snuparek@atlas.cz>
  8. * Justin Kendrick <twilightsentry@gmail.com>
  9. * RichardT5 <richard_t5@users.sourceforge.net>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. *
  15. * (find more info at www.hackndev.com)
  16. *
  17. */
  18. #include <linux/platform_device.h>
  19. #include <linux/delay.h>
  20. #include <linux/irq.h>
  21. #include <linux/gpio_keys.h>
  22. #include <linux/input.h>
  23. #include <linux/memblock.h>
  24. #include <linux/pda_power.h>
  25. #include <linux/pwm_backlight.h>
  26. #include <linux/gpio.h>
  27. #include <linux/wm97xx.h>
  28. #include <linux/power_supply.h>
  29. #include <linux/usb/gpio_vbus.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/audio.h>
  35. #include <mach/palmt5.h>
  36. #include <mach/mmc.h>
  37. #include <mach/pxafb.h>
  38. #include <mach/irda.h>
  39. #include <plat/pxa27x_keypad.h>
  40. #include <mach/udc.h>
  41. #include <mach/palmasoc.h>
  42. #include <mach/palm27x.h>
  43. #include "generic.h"
  44. #include "devices.h"
  45. /******************************************************************************
  46. * Pin configuration
  47. ******************************************************************************/
  48. static unsigned long palmt5_pin_config[] __initdata = {
  49. /* MMC */
  50. GPIO32_MMC_CLK,
  51. GPIO92_MMC_DAT_0,
  52. GPIO109_MMC_DAT_1,
  53. GPIO110_MMC_DAT_2,
  54. GPIO111_MMC_DAT_3,
  55. GPIO112_MMC_CMD,
  56. GPIO14_GPIO, /* SD detect */
  57. GPIO114_GPIO, /* SD power */
  58. GPIO115_GPIO, /* SD r/o switch */
  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. GPIO40_GPIO, /* ir disable */
  68. GPIO46_FICP_RXD,
  69. GPIO47_FICP_TXD,
  70. /* USB */
  71. GPIO15_GPIO, /* usb detect */
  72. GPIO93_GPIO, /* usb power */
  73. /* MATRIX KEYPAD */
  74. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  75. GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
  76. GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
  77. GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
  78. GPIO103_KP_MKOUT_0,
  79. GPIO104_KP_MKOUT_1,
  80. GPIO105_KP_MKOUT_2,
  81. /* LCD */
  82. GPIOxx_LCD_TFT_16BPP,
  83. /* PWM */
  84. GPIO16_PWM0_OUT,
  85. /* FFUART */
  86. GPIO34_FFUART_RXD,
  87. GPIO39_FFUART_TXD,
  88. /* MISC */
  89. GPIO10_GPIO, /* hotsync button */
  90. GPIO90_GPIO, /* power detect */
  91. GPIO107_GPIO, /* earphone detect */
  92. };
  93. /******************************************************************************
  94. * GPIO keyboard
  95. ******************************************************************************/
  96. #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
  97. static unsigned int palmt5_matrix_keys[] = {
  98. KEY(0, 0, KEY_POWER),
  99. KEY(0, 1, KEY_F1),
  100. KEY(0, 2, KEY_ENTER),
  101. KEY(1, 0, KEY_F2),
  102. KEY(1, 1, KEY_F3),
  103. KEY(1, 2, KEY_F4),
  104. KEY(2, 0, KEY_UP),
  105. KEY(2, 2, KEY_DOWN),
  106. KEY(3, 0, KEY_RIGHT),
  107. KEY(3, 2, KEY_LEFT),
  108. };
  109. static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
  110. .matrix_key_rows = 4,
  111. .matrix_key_cols = 3,
  112. .matrix_key_map = palmt5_matrix_keys,
  113. .matrix_key_map_size = ARRAY_SIZE(palmt5_matrix_keys),
  114. .debounce_interval = 30,
  115. };
  116. static void __init palmt5_kpc_init(void)
  117. {
  118. pxa_set_keypad_info(&palmt5_keypad_platform_data);
  119. }
  120. #else
  121. static inline void palmt5_kpc_init(void) {}
  122. #endif
  123. /******************************************************************************
  124. * GPIO keys
  125. ******************************************************************************/
  126. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  127. static struct gpio_keys_button palmt5_pxa_buttons[] = {
  128. {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
  129. };
  130. static struct gpio_keys_platform_data palmt5_pxa_keys_data = {
  131. .buttons = palmt5_pxa_buttons,
  132. .nbuttons = ARRAY_SIZE(palmt5_pxa_buttons),
  133. };
  134. static struct platform_device palmt5_pxa_keys = {
  135. .name = "gpio-keys",
  136. .id = -1,
  137. .dev = {
  138. .platform_data = &palmt5_pxa_keys_data,
  139. },
  140. };
  141. static void __init palmt5_keys_init(void)
  142. {
  143. platform_device_register(&palmt5_pxa_keys);
  144. }
  145. #else
  146. static inline void palmt5_keys_init(void) {}
  147. #endif
  148. /******************************************************************************
  149. * Machine init
  150. ******************************************************************************/
  151. static void __init palmt5_reserve(void)
  152. {
  153. memblock_reserve(0xa0200000, 0x1000);
  154. }
  155. static void __init palmt5_init(void)
  156. {
  157. pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
  158. pxa_set_ffuart_info(NULL);
  159. pxa_set_btuart_info(NULL);
  160. pxa_set_stuart_info(NULL);
  161. palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY,
  162. GPIO_NR_PALMT5_SD_POWER, 0);
  163. palm27x_pm_init(PALMT5_STR_BASE);
  164. palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
  165. palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
  166. GPIO_NR_PALMT5_USB_PULLUP, 1);
  167. palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE);
  168. palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE,
  169. GPIO_NR_PALMT5_EARPHONE_DETECT, 95);
  170. palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER);
  171. palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1);
  172. palm27x_pmic_init();
  173. palmt5_kpc_init();
  174. palmt5_keys_init();
  175. }
  176. MACHINE_START(PALMT5, "Palm Tungsten|T5")
  177. .boot_params = 0xa0000100,
  178. .map_io = pxa27x_map_io,
  179. .reserve = palmt5_reserve,
  180. .init_irq = pxa27x_init_irq,
  181. .handle_irq = pxa27x_handle_irq,
  182. .timer = &pxa_timer,
  183. .init_machine = palmt5_init
  184. MACHINE_END