palmt5.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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/pda_power.h>
  24. #include <linux/pwm_backlight.h>
  25. #include <linux/gpio.h>
  26. #include <linux/wm97xx.h>
  27. #include <linux/power_supply.h>
  28. #include <linux/usb/gpio_vbus.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/audio.h>
  34. #include <mach/palmt5.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/palmasoc.h>
  41. #include <mach/palm27x.h>
  42. #include "generic.h"
  43. #include "devices.h"
  44. /******************************************************************************
  45. * Pin configuration
  46. ******************************************************************************/
  47. static unsigned long palmt5_pin_config[] __initdata = {
  48. /* MMC */
  49. GPIO32_MMC_CLK,
  50. GPIO92_MMC_DAT_0,
  51. GPIO109_MMC_DAT_1,
  52. GPIO110_MMC_DAT_2,
  53. GPIO111_MMC_DAT_3,
  54. GPIO112_MMC_CMD,
  55. GPIO14_GPIO, /* SD detect */
  56. GPIO114_GPIO, /* SD power */
  57. GPIO115_GPIO, /* SD r/o switch */
  58. /* AC97 */
  59. GPIO28_AC97_BITCLK,
  60. GPIO29_AC97_SDATA_IN_0,
  61. GPIO30_AC97_SDATA_OUT,
  62. GPIO31_AC97_SYNC,
  63. GPIO89_AC97_SYSCLK,
  64. GPIO95_AC97_nRESET,
  65. /* IrDA */
  66. GPIO40_GPIO, /* ir disable */
  67. GPIO46_FICP_RXD,
  68. GPIO47_FICP_TXD,
  69. /* USB */
  70. GPIO15_GPIO, /* usb detect */
  71. GPIO93_GPIO, /* usb power */
  72. /* MATRIX KEYPAD */
  73. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  74. GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
  75. GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
  76. GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
  77. GPIO103_KP_MKOUT_0,
  78. GPIO104_KP_MKOUT_1,
  79. GPIO105_KP_MKOUT_2,
  80. /* LCD */
  81. GPIOxx_LCD_TFT_16BPP,
  82. /* PWM */
  83. GPIO16_PWM0_OUT,
  84. /* FFUART */
  85. GPIO34_FFUART_RXD,
  86. GPIO39_FFUART_TXD,
  87. /* MISC */
  88. GPIO10_GPIO, /* hotsync button */
  89. GPIO90_GPIO, /* power detect */
  90. GPIO107_GPIO, /* earphone detect */
  91. };
  92. /******************************************************************************
  93. * GPIO keyboard
  94. ******************************************************************************/
  95. #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
  96. static unsigned int palmt5_matrix_keys[] = {
  97. KEY(0, 0, KEY_POWER),
  98. KEY(0, 1, KEY_F1),
  99. KEY(0, 2, KEY_ENTER),
  100. KEY(1, 0, KEY_F2),
  101. KEY(1, 1, KEY_F3),
  102. KEY(1, 2, KEY_F4),
  103. KEY(2, 0, KEY_UP),
  104. KEY(2, 2, KEY_DOWN),
  105. KEY(3, 0, KEY_RIGHT),
  106. KEY(3, 2, KEY_LEFT),
  107. };
  108. static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
  109. .matrix_key_rows = 4,
  110. .matrix_key_cols = 3,
  111. .matrix_key_map = palmt5_matrix_keys,
  112. .matrix_key_map_size = ARRAY_SIZE(palmt5_matrix_keys),
  113. .debounce_interval = 30,
  114. };
  115. static void __init palmt5_kpc_init(void)
  116. {
  117. pxa_set_keypad_info(&palmt5_keypad_platform_data);
  118. }
  119. #else
  120. static inline void palmt5_kpc_init(void) {}
  121. #endif
  122. /******************************************************************************
  123. * GPIO keys
  124. ******************************************************************************/
  125. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  126. static struct gpio_keys_button palmt5_pxa_buttons[] = {
  127. {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
  128. };
  129. static struct gpio_keys_platform_data palmt5_pxa_keys_data = {
  130. .buttons = palmt5_pxa_buttons,
  131. .nbuttons = ARRAY_SIZE(palmt5_pxa_buttons),
  132. };
  133. static struct platform_device palmt5_pxa_keys = {
  134. .name = "gpio-keys",
  135. .id = -1,
  136. .dev = {
  137. .platform_data = &palmt5_pxa_keys_data,
  138. },
  139. };
  140. static void __init palmt5_keys_init(void)
  141. {
  142. platform_device_register(&palmt5_pxa_keys);
  143. }
  144. #else
  145. static inline void palmt5_keys_init(void) {}
  146. #endif
  147. /******************************************************************************
  148. * Machine init
  149. ******************************************************************************/
  150. static void __init palmt5_init(void)
  151. {
  152. pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
  153. pxa_set_ffuart_info(NULL);
  154. pxa_set_btuart_info(NULL);
  155. pxa_set_stuart_info(NULL);
  156. palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY,
  157. GPIO_NR_PALMT5_SD_POWER, 0);
  158. palm27x_pm_init(PALMT5_STR_BASE);
  159. palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
  160. palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
  161. GPIO_NR_PALMT5_USB_PULLUP, 1);
  162. palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE);
  163. palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE,
  164. GPIO_NR_PALMT5_EARPHONE_DETECT, 95);
  165. palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER);
  166. palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1);
  167. palm27x_pmic_init();
  168. palmt5_kpc_init();
  169. palmt5_keys_init();
  170. }
  171. MACHINE_START(PALMT5, "Palm Tungsten|T5")
  172. .phys_io = PALMT5_PHYS_IO_START,
  173. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  174. .boot_params = 0xa0000100,
  175. .map_io = pxa_map_io,
  176. .init_irq = pxa27x_init_irq,
  177. .timer = &pxa_timer,
  178. .init_machine = palmt5_init
  179. MACHINE_END