palmld.c 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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 <mach/pxa27x.h>
  33. #include <mach/audio.h>
  34. #include <mach/palmld.h>
  35. #include <mach/mmc.h>
  36. #include <mach/pxafb.h>
  37. #include <mach/irda.h>
  38. #include <plat/pxa27x_keypad.h>
  39. #include <mach/palmasoc.h>
  40. #include <mach/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 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 pxa27x_keypad_platform_data palmld_keypad_platform_data = {
  168. .matrix_key_rows = 4,
  169. .matrix_key_cols = 3,
  170. .matrix_key_map = palmld_matrix_keys,
  171. .matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys),
  172. .debounce_interval = 30,
  173. };
  174. static void __init palmld_kpc_init(void)
  175. {
  176. pxa_set_keypad_info(&palmld_keypad_platform_data);
  177. }
  178. #else
  179. static inline void palmld_kpc_init(void) {}
  180. #endif
  181. /******************************************************************************
  182. * GPIO keys
  183. ******************************************************************************/
  184. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  185. static struct gpio_keys_button palmld_pxa_buttons[] = {
  186. {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
  187. {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
  188. {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" },
  189. };
  190. static struct gpio_keys_platform_data palmld_pxa_keys_data = {
  191. .buttons = palmld_pxa_buttons,
  192. .nbuttons = ARRAY_SIZE(palmld_pxa_buttons),
  193. };
  194. static struct platform_device palmld_pxa_keys = {
  195. .name = "gpio-keys",
  196. .id = -1,
  197. .dev = {
  198. .platform_data = &palmld_pxa_keys_data,
  199. },
  200. };
  201. static void __init palmld_keys_init(void)
  202. {
  203. platform_device_register(&palmld_pxa_keys);
  204. }
  205. #else
  206. static inline void palmld_keys_init(void) {}
  207. #endif
  208. /******************************************************************************
  209. * LEDs
  210. ******************************************************************************/
  211. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  212. struct gpio_led gpio_leds[] = {
  213. {
  214. .name = "palmld:green:led",
  215. .default_trigger = "none",
  216. .gpio = GPIO_NR_PALMLD_LED_GREEN,
  217. }, {
  218. .name = "palmld:amber:led",
  219. .default_trigger = "none",
  220. .gpio = GPIO_NR_PALMLD_LED_AMBER,
  221. },
  222. };
  223. static struct gpio_led_platform_data gpio_led_info = {
  224. .leds = gpio_leds,
  225. .num_leds = ARRAY_SIZE(gpio_leds),
  226. };
  227. static struct platform_device palmld_leds = {
  228. .name = "leds-gpio",
  229. .id = -1,
  230. .dev = {
  231. .platform_data = &gpio_led_info,
  232. }
  233. };
  234. static void __init palmld_leds_init(void)
  235. {
  236. platform_device_register(&palmld_leds);
  237. }
  238. #else
  239. static inline void palmld_leds_init(void) {}
  240. #endif
  241. /******************************************************************************
  242. * HDD
  243. ******************************************************************************/
  244. #if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
  245. static struct platform_device palmld_ide_device = {
  246. .name = "pata_palmld",
  247. .id = -1,
  248. };
  249. static void __init palmld_ide_init(void)
  250. {
  251. platform_device_register(&palmld_ide_device);
  252. }
  253. #else
  254. static inline void palmld_ide_init(void) {}
  255. #endif
  256. /******************************************************************************
  257. * Machine init
  258. ******************************************************************************/
  259. static struct map_desc palmld_io_desc[] __initdata = {
  260. {
  261. .virtual = PALMLD_IDE_VIRT,
  262. .pfn = __phys_to_pfn(PALMLD_IDE_PHYS),
  263. .length = PALMLD_IDE_SIZE,
  264. .type = MT_DEVICE
  265. },
  266. {
  267. .virtual = PALMLD_USB_VIRT,
  268. .pfn = __phys_to_pfn(PALMLD_USB_PHYS),
  269. .length = PALMLD_USB_SIZE,
  270. .type = MT_DEVICE
  271. },
  272. };
  273. static void __init palmld_map_io(void)
  274. {
  275. pxa27x_map_io();
  276. iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
  277. }
  278. static void __init palmld_init(void)
  279. {
  280. pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
  281. pxa_set_ffuart_info(NULL);
  282. pxa_set_btuart_info(NULL);
  283. pxa_set_stuart_info(NULL);
  284. palm27x_mmc_init(GPIO_NR_PALMLD_SD_DETECT_N, GPIO_NR_PALMLD_SD_READONLY,
  285. GPIO_NR_PALMLD_SD_POWER, 0);
  286. palm27x_pm_init(PALMLD_STR_BASE);
  287. palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
  288. palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
  289. palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE, PALMLD_BAT_MAX_VOLTAGE,
  290. GPIO_NR_PALMLD_EARPHONE_DETECT, 95);
  291. palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER, GPIO_NR_PALMLD_LCD_POWER);
  292. palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT,
  293. GPIO_NR_PALMLD_USB_DETECT_N);
  294. palm27x_pmic_init();
  295. palmld_kpc_init();
  296. palmld_keys_init();
  297. palmld_nor_init();
  298. palmld_leds_init();
  299. palmld_ide_init();
  300. }
  301. MACHINE_START(PALMLD, "Palm LifeDrive")
  302. .boot_params = 0xa0000100,
  303. .map_io = palmld_map_io,
  304. .init_irq = pxa27x_init_irq,
  305. .timer = &pxa_timer,
  306. .init_machine = palmld_init
  307. MACHINE_END