palmt5.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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 "pxa27x.h"
  34. #include <mach/audio.h>
  35. #include "palmt5.h"
  36. #include <linux/platform_data/mmc-pxamci.h>
  37. #include <linux/platform_data/video-pxafb.h>
  38. #include <linux/platform_data/irda-pxaficp.h>
  39. #include <linux/platform_data/keypad-pxa27x.h>
  40. #include "udc.h"
  41. #include <linux/platform_data/asoc-palm27x.h>
  42. #include "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 const 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 matrix_keymap_data palmt5_matrix_keymap_data = {
  110. .keymap = palmt5_matrix_keys,
  111. .keymap_size = ARRAY_SIZE(palmt5_matrix_keys),
  112. };
  113. static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
  114. .matrix_key_rows = 4,
  115. .matrix_key_cols = 3,
  116. .matrix_keymap_data = &palmt5_matrix_keymap_data,
  117. .debounce_interval = 30,
  118. };
  119. static void __init palmt5_kpc_init(void)
  120. {
  121. pxa_set_keypad_info(&palmt5_keypad_platform_data);
  122. }
  123. #else
  124. static inline void palmt5_kpc_init(void) {}
  125. #endif
  126. /******************************************************************************
  127. * GPIO keys
  128. ******************************************************************************/
  129. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  130. static struct gpio_keys_button palmt5_pxa_buttons[] = {
  131. {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
  132. };
  133. static struct gpio_keys_platform_data palmt5_pxa_keys_data = {
  134. .buttons = palmt5_pxa_buttons,
  135. .nbuttons = ARRAY_SIZE(palmt5_pxa_buttons),
  136. };
  137. static struct platform_device palmt5_pxa_keys = {
  138. .name = "gpio-keys",
  139. .id = -1,
  140. .dev = {
  141. .platform_data = &palmt5_pxa_keys_data,
  142. },
  143. };
  144. static void __init palmt5_keys_init(void)
  145. {
  146. platform_device_register(&palmt5_pxa_keys);
  147. }
  148. #else
  149. static inline void palmt5_keys_init(void) {}
  150. #endif
  151. /******************************************************************************
  152. * Machine init
  153. ******************************************************************************/
  154. static void __init palmt5_reserve(void)
  155. {
  156. memblock_reserve(0xa0200000, 0x1000);
  157. }
  158. static void __init palmt5_init(void)
  159. {
  160. pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
  161. pxa_set_ffuart_info(NULL);
  162. pxa_set_btuart_info(NULL);
  163. pxa_set_stuart_info(NULL);
  164. palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY,
  165. GPIO_NR_PALMT5_SD_POWER, 0);
  166. palm27x_pm_init(PALMT5_STR_BASE);
  167. palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
  168. palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
  169. GPIO_NR_PALMT5_USB_PULLUP, 1);
  170. palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE);
  171. palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE,
  172. GPIO_NR_PALMT5_EARPHONE_DETECT, 95);
  173. palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER);
  174. palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1);
  175. palm27x_pmic_init();
  176. palmt5_kpc_init();
  177. palmt5_keys_init();
  178. }
  179. MACHINE_START(PALMT5, "Palm Tungsten|T5")
  180. .atag_offset = 0x100,
  181. .map_io = pxa27x_map_io,
  182. .reserve = palmt5_reserve,
  183. .nr_irqs = PXA_NR_IRQS,
  184. .init_irq = pxa27x_init_irq,
  185. .handle_irq = pxa27x_handle_irq,
  186. .init_time = pxa_timer_init,
  187. .init_machine = palmt5_init,
  188. .restart = pxa_restart,
  189. MACHINE_END