palmld.c 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. /*
  2. * Hardware definitions for Palm LifeDrive
  3. *
  4. * Author: Marek Vasut <marek.vasut@gmail.com>
  5. *
  6. * Based on work of:
  7. * Alex Osborne <ato@meshy.org>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * (find more info at www.hackndev.com)
  14. *
  15. */
  16. #include <linux/platform_device.h>
  17. #include <linux/delay.h>
  18. #include <linux/irq.h>
  19. #include <linux/gpio_keys.h>
  20. #include <linux/input.h>
  21. #include <linux/pda_power.h>
  22. #include <linux/pwm_backlight.h>
  23. #include <linux/gpio.h>
  24. #include <linux/wm97xx.h>
  25. #include <linux/power_supply.h>
  26. #include <linux/mtd/mtd.h>
  27. #include <linux/mtd/partitions.h>
  28. #include <linux/mtd/physmap.h>
  29. #include <asm/mach-types.h>
  30. #include <asm/mach/arch.h>
  31. #include <asm/mach/map.h>
  32. #include "pxa27x.h"
  33. #include <mach/audio.h>
  34. #include <mach/palmld.h>
  35. #include <linux/platform_data/mmc-pxamci.h>
  36. #include <linux/platform_data/video-pxafb.h>
  37. #include <linux/platform_data/irda-pxaficp.h>
  38. #include <linux/platform_data/keypad-pxa27x.h>
  39. #include <linux/platform_data/asoc-palm27x.h>
  40. #include "palm27x.h"
  41. #include "generic.h"
  42. #include "devices.h"
  43. /******************************************************************************
  44. * Pin configuration
  45. ******************************************************************************/
  46. static unsigned long palmld_pin_config[] __initdata = {
  47. /* MMC */
  48. GPIO32_MMC_CLK,
  49. GPIO92_MMC_DAT_0,
  50. GPIO109_MMC_DAT_1,
  51. GPIO110_MMC_DAT_2,
  52. GPIO111_MMC_DAT_3,
  53. GPIO112_MMC_CMD,
  54. GPIO14_GPIO, /* SD detect */
  55. GPIO114_GPIO, /* SD power */
  56. GPIO116_GPIO, /* SD r/o switch */
  57. /* AC97 */
  58. GPIO28_AC97_BITCLK,
  59. GPIO29_AC97_SDATA_IN_0,
  60. GPIO30_AC97_SDATA_OUT,
  61. GPIO31_AC97_SYNC,
  62. GPIO89_AC97_SYSCLK,
  63. GPIO95_AC97_nRESET,
  64. /* IrDA */
  65. GPIO108_GPIO, /* ir disable */
  66. GPIO46_FICP_RXD,
  67. GPIO47_FICP_TXD,
  68. /* MATRIX KEYPAD */
  69. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  70. GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
  71. GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
  72. GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
  73. GPIO103_KP_MKOUT_0,
  74. GPIO104_KP_MKOUT_1,
  75. GPIO105_KP_MKOUT_2,
  76. /* LCD */
  77. GPIOxx_LCD_TFT_16BPP,
  78. /* PWM */
  79. GPIO16_PWM0_OUT,
  80. /* GPIO KEYS */
  81. GPIO10_GPIO, /* hotsync button */
  82. GPIO12_GPIO, /* power switch */
  83. GPIO15_GPIO, /* lock switch */
  84. /* LEDs */
  85. GPIO52_GPIO, /* green led */
  86. GPIO94_GPIO, /* orange led */
  87. /* PCMCIA */
  88. GPIO48_nPOE,
  89. GPIO49_nPWE,
  90. GPIO50_nPIOR,
  91. GPIO51_nPIOW,
  92. GPIO85_nPCE_1,
  93. GPIO54_nPCE_2,
  94. GPIO79_PSKTSEL,
  95. GPIO55_nPREG,
  96. GPIO56_nPWAIT,
  97. GPIO57_nIOIS16,
  98. GPIO36_GPIO, /* wifi power */
  99. GPIO38_GPIO, /* wifi ready */
  100. GPIO81_GPIO, /* wifi reset */
  101. /* FFUART */
  102. GPIO34_FFUART_RXD,
  103. GPIO39_FFUART_TXD,
  104. /* HDD */
  105. GPIO98_GPIO, /* HDD reset */
  106. GPIO115_GPIO, /* HDD power */
  107. /* MISC */
  108. GPIO13_GPIO, /* earphone detect */
  109. };
  110. /******************************************************************************
  111. * NOR Flash
  112. ******************************************************************************/
  113. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  114. static struct mtd_partition palmld_partitions[] = {
  115. {
  116. .name = "Flash",
  117. .offset = 0x00000000,
  118. .size = MTDPART_SIZ_FULL,
  119. .mask_flags = 0
  120. }
  121. };
  122. static struct physmap_flash_data palmld_flash_data[] = {
  123. {
  124. .width = 2, /* bankwidth in bytes */
  125. .parts = palmld_partitions,
  126. .nr_parts = ARRAY_SIZE(palmld_partitions)
  127. }
  128. };
  129. static struct resource palmld_flash_resource = {
  130. .start = PXA_CS0_PHYS,
  131. .end = PXA_CS0_PHYS + SZ_4M - 1,
  132. .flags = IORESOURCE_MEM,
  133. };
  134. static struct platform_device palmld_flash = {
  135. .name = "physmap-flash",
  136. .id = 0,
  137. .resource = &palmld_flash_resource,
  138. .num_resources = 1,
  139. .dev = {
  140. .platform_data = palmld_flash_data,
  141. },
  142. };
  143. static void __init palmld_nor_init(void)
  144. {
  145. platform_device_register(&palmld_flash);
  146. }
  147. #else
  148. static inline void palmld_nor_init(void) {}
  149. #endif
  150. /******************************************************************************
  151. * GPIO keyboard
  152. ******************************************************************************/
  153. #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
  154. static const unsigned int palmld_matrix_keys[] = {
  155. KEY(0, 1, KEY_F2),
  156. KEY(0, 2, KEY_UP),
  157. KEY(1, 0, KEY_F3),
  158. KEY(1, 1, KEY_F4),
  159. KEY(1, 2, KEY_RIGHT),
  160. KEY(2, 0, KEY_F1),
  161. KEY(2, 1, KEY_F5),
  162. KEY(2, 2, KEY_DOWN),
  163. KEY(3, 0, KEY_F6),
  164. KEY(3, 1, KEY_ENTER),
  165. KEY(3, 2, KEY_LEFT),
  166. };
  167. static struct matrix_keymap_data palmld_matrix_keymap_data = {
  168. .keymap = palmld_matrix_keys,
  169. .keymap_size = ARRAY_SIZE(palmld_matrix_keys),
  170. };
  171. static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
  172. .matrix_key_rows = 4,
  173. .matrix_key_cols = 3,
  174. .matrix_keymap_data = &palmld_matrix_keymap_data,
  175. .debounce_interval = 30,
  176. };
  177. static void __init palmld_kpc_init(void)
  178. {
  179. pxa_set_keypad_info(&palmld_keypad_platform_data);
  180. }
  181. #else
  182. static inline void palmld_kpc_init(void) {}
  183. #endif
  184. /******************************************************************************
  185. * GPIO keys
  186. ******************************************************************************/
  187. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  188. static struct gpio_keys_button palmld_pxa_buttons[] = {
  189. {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
  190. {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
  191. {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" },
  192. };
  193. static struct gpio_keys_platform_data palmld_pxa_keys_data = {
  194. .buttons = palmld_pxa_buttons,
  195. .nbuttons = ARRAY_SIZE(palmld_pxa_buttons),
  196. };
  197. static struct platform_device palmld_pxa_keys = {
  198. .name = "gpio-keys",
  199. .id = -1,
  200. .dev = {
  201. .platform_data = &palmld_pxa_keys_data,
  202. },
  203. };
  204. static void __init palmld_keys_init(void)
  205. {
  206. platform_device_register(&palmld_pxa_keys);
  207. }
  208. #else
  209. static inline void palmld_keys_init(void) {}
  210. #endif
  211. /******************************************************************************
  212. * LEDs
  213. ******************************************************************************/
  214. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  215. struct gpio_led gpio_leds[] = {
  216. {
  217. .name = "palmld:green:led",
  218. .default_trigger = "none",
  219. .gpio = GPIO_NR_PALMLD_LED_GREEN,
  220. }, {
  221. .name = "palmld:amber:led",
  222. .default_trigger = "none",
  223. .gpio = GPIO_NR_PALMLD_LED_AMBER,
  224. },
  225. };
  226. static struct gpio_led_platform_data gpio_led_info = {
  227. .leds = gpio_leds,
  228. .num_leds = ARRAY_SIZE(gpio_leds),
  229. };
  230. static struct platform_device palmld_leds = {
  231. .name = "leds-gpio",
  232. .id = -1,
  233. .dev = {
  234. .platform_data = &gpio_led_info,
  235. }
  236. };
  237. static void __init palmld_leds_init(void)
  238. {
  239. platform_device_register(&palmld_leds);
  240. }
  241. #else
  242. static inline void palmld_leds_init(void) {}
  243. #endif
  244. /******************************************************************************
  245. * HDD
  246. ******************************************************************************/
  247. #if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
  248. static struct platform_device palmld_ide_device = {
  249. .name = "pata_palmld",
  250. .id = -1,
  251. };
  252. static void __init palmld_ide_init(void)
  253. {
  254. platform_device_register(&palmld_ide_device);
  255. }
  256. #else
  257. static inline void palmld_ide_init(void) {}
  258. #endif
  259. /******************************************************************************
  260. * Machine init
  261. ******************************************************************************/
  262. static struct map_desc palmld_io_desc[] __initdata = {
  263. {
  264. .virtual = PALMLD_IDE_VIRT,
  265. .pfn = __phys_to_pfn(PALMLD_IDE_PHYS),
  266. .length = PALMLD_IDE_SIZE,
  267. .type = MT_DEVICE
  268. },
  269. {
  270. .virtual = PALMLD_USB_VIRT,
  271. .pfn = __phys_to_pfn(PALMLD_USB_PHYS),
  272. .length = PALMLD_USB_SIZE,
  273. .type = MT_DEVICE
  274. },
  275. };
  276. static void __init palmld_map_io(void)
  277. {
  278. pxa27x_map_io();
  279. iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
  280. }
  281. static void __init palmld_init(void)
  282. {
  283. pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
  284. pxa_set_ffuart_info(NULL);
  285. pxa_set_btuart_info(NULL);
  286. pxa_set_stuart_info(NULL);
  287. palm27x_mmc_init(GPIO_NR_PALMLD_SD_DETECT_N, GPIO_NR_PALMLD_SD_READONLY,
  288. GPIO_NR_PALMLD_SD_POWER, 0);
  289. palm27x_pm_init(PALMLD_STR_BASE);
  290. palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
  291. palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
  292. palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE, PALMLD_BAT_MAX_VOLTAGE,
  293. GPIO_NR_PALMLD_EARPHONE_DETECT, 95);
  294. palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER, GPIO_NR_PALMLD_LCD_POWER);
  295. palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT,
  296. GPIO_NR_PALMLD_USB_DETECT_N);
  297. palm27x_pmic_init();
  298. palmld_kpc_init();
  299. palmld_keys_init();
  300. palmld_nor_init();
  301. palmld_leds_init();
  302. palmld_ide_init();
  303. }
  304. MACHINE_START(PALMLD, "Palm LifeDrive")
  305. .atag_offset = 0x100,
  306. .map_io = palmld_map_io,
  307. .nr_irqs = PXA_NR_IRQS,
  308. .init_irq = pxa27x_init_irq,
  309. .handle_irq = pxa27x_handle_irq,
  310. .init_time = pxa_timer_init,
  311. .init_machine = palmld_init,
  312. .restart = pxa_restart,
  313. MACHINE_END