palmld.c 8.5 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/sysdev.h>
  27. #include <linux/mtd/mtd.h>
  28. #include <linux/mtd/partitions.h>
  29. #include <linux/mtd/physmap.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/palmld.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/palmasoc.h>
  41. #include <mach/palm27x.h>
  42. #include "generic.h"
  43. #include "devices.h"
  44. /******************************************************************************
  45. * Pin configuration
  46. ******************************************************************************/
  47. static unsigned long palmld_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. GPIO116_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. GPIO108_GPIO, /* ir disable */
  67. GPIO46_FICP_RXD,
  68. GPIO47_FICP_TXD,
  69. /* MATRIX KEYPAD */
  70. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  71. GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
  72. GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
  73. GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
  74. GPIO103_KP_MKOUT_0,
  75. GPIO104_KP_MKOUT_1,
  76. GPIO105_KP_MKOUT_2,
  77. /* LCD */
  78. GPIOxx_LCD_TFT_16BPP,
  79. /* PWM */
  80. GPIO16_PWM0_OUT,
  81. /* GPIO KEYS */
  82. GPIO10_GPIO, /* hotsync button */
  83. GPIO12_GPIO, /* power switch */
  84. GPIO15_GPIO, /* lock switch */
  85. /* LEDs */
  86. GPIO52_GPIO, /* green led */
  87. GPIO94_GPIO, /* orange led */
  88. /* PCMCIA */
  89. GPIO48_nPOE,
  90. GPIO49_nPWE,
  91. GPIO50_nPIOR,
  92. GPIO51_nPIOW,
  93. GPIO85_nPCE_1,
  94. GPIO54_nPCE_2,
  95. GPIO79_PSKTSEL,
  96. GPIO55_nPREG,
  97. GPIO56_nPWAIT,
  98. GPIO57_nIOIS16,
  99. GPIO36_GPIO, /* wifi power */
  100. GPIO38_GPIO, /* wifi ready */
  101. GPIO81_GPIO, /* wifi reset */
  102. /* FFUART */
  103. GPIO34_FFUART_RXD,
  104. GPIO39_FFUART_TXD,
  105. /* HDD */
  106. GPIO98_GPIO, /* HDD reset */
  107. GPIO115_GPIO, /* HDD power */
  108. /* MISC */
  109. GPIO13_GPIO, /* earphone detect */
  110. };
  111. /******************************************************************************
  112. * NOR Flash
  113. ******************************************************************************/
  114. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  115. static struct mtd_partition palmld_partitions[] = {
  116. {
  117. .name = "Flash",
  118. .offset = 0x00000000,
  119. .size = MTDPART_SIZ_FULL,
  120. .mask_flags = 0
  121. }
  122. };
  123. static struct physmap_flash_data palmld_flash_data[] = {
  124. {
  125. .width = 2, /* bankwidth in bytes */
  126. .parts = palmld_partitions,
  127. .nr_parts = ARRAY_SIZE(palmld_partitions)
  128. }
  129. };
  130. static struct resource palmld_flash_resource = {
  131. .start = PXA_CS0_PHYS,
  132. .end = PXA_CS0_PHYS + SZ_4M - 1,
  133. .flags = IORESOURCE_MEM,
  134. };
  135. static struct platform_device palmld_flash = {
  136. .name = "physmap-flash",
  137. .id = 0,
  138. .resource = &palmld_flash_resource,
  139. .num_resources = 1,
  140. .dev = {
  141. .platform_data = palmld_flash_data,
  142. },
  143. };
  144. static void __init palmld_nor_init(void)
  145. {
  146. platform_device_register(&palmld_flash);
  147. }
  148. #else
  149. static inline void palmld_nor_init(void) {}
  150. #endif
  151. /******************************************************************************
  152. * GPIO keyboard
  153. ******************************************************************************/
  154. #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
  155. static unsigned int palmld_matrix_keys[] = {
  156. KEY(0, 1, KEY_F2),
  157. KEY(0, 2, KEY_UP),
  158. KEY(1, 0, KEY_F3),
  159. KEY(1, 1, KEY_F4),
  160. KEY(1, 2, KEY_RIGHT),
  161. KEY(2, 0, KEY_F1),
  162. KEY(2, 1, KEY_F5),
  163. KEY(2, 2, KEY_DOWN),
  164. KEY(3, 0, KEY_F6),
  165. KEY(3, 1, KEY_ENTER),
  166. KEY(3, 2, KEY_LEFT),
  167. };
  168. static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
  169. .matrix_key_rows = 4,
  170. .matrix_key_cols = 3,
  171. .matrix_key_map = palmld_matrix_keys,
  172. .matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys),
  173. .debounce_interval = 30,
  174. };
  175. static void __init palmld_kpc_init(void)
  176. {
  177. pxa_set_keypad_info(&palmld_keypad_platform_data);
  178. }
  179. #else
  180. static inline void palmld_kpc_init(void) {}
  181. #endif
  182. /******************************************************************************
  183. * GPIO keys
  184. ******************************************************************************/
  185. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  186. static struct gpio_keys_button palmld_pxa_buttons[] = {
  187. {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
  188. {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
  189. {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" },
  190. };
  191. static struct gpio_keys_platform_data palmld_pxa_keys_data = {
  192. .buttons = palmld_pxa_buttons,
  193. .nbuttons = ARRAY_SIZE(palmld_pxa_buttons),
  194. };
  195. static struct platform_device palmld_pxa_keys = {
  196. .name = "gpio-keys",
  197. .id = -1,
  198. .dev = {
  199. .platform_data = &palmld_pxa_keys_data,
  200. },
  201. };
  202. static void __init palmld_keys_init(void)
  203. {
  204. platform_device_register(&palmld_pxa_keys);
  205. }
  206. #else
  207. static inline void palmld_keys_init(void) {}
  208. #endif
  209. /******************************************************************************
  210. * LEDs
  211. ******************************************************************************/
  212. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  213. struct gpio_led gpio_leds[] = {
  214. {
  215. .name = "palmld:green:led",
  216. .default_trigger = "none",
  217. .gpio = GPIO_NR_PALMLD_LED_GREEN,
  218. }, {
  219. .name = "palmld:amber:led",
  220. .default_trigger = "none",
  221. .gpio = GPIO_NR_PALMLD_LED_AMBER,
  222. },
  223. };
  224. static struct gpio_led_platform_data gpio_led_info = {
  225. .leds = gpio_leds,
  226. .num_leds = ARRAY_SIZE(gpio_leds),
  227. };
  228. static struct platform_device palmld_leds = {
  229. .name = "leds-gpio",
  230. .id = -1,
  231. .dev = {
  232. .platform_data = &gpio_led_info,
  233. }
  234. };
  235. static void __init palmld_leds_init(void)
  236. {
  237. platform_device_register(&palmld_leds);
  238. }
  239. #else
  240. static inline void palmld_leds_init(void) {}
  241. #endif
  242. /******************************************************************************
  243. * HDD
  244. ******************************************************************************/
  245. #if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
  246. static struct platform_device palmld_ide_device = {
  247. .name = "pata_palmld",
  248. .id = -1,
  249. };
  250. static void __init palmld_ide_init(void)
  251. {
  252. platform_device_register(&palmld_ide_device);
  253. }
  254. #else
  255. static inline void palmld_ide_init(void) {}
  256. #endif
  257. /******************************************************************************
  258. * Machine init
  259. ******************************************************************************/
  260. static struct map_desc palmld_io_desc[] __initdata = {
  261. {
  262. .virtual = PALMLD_IDE_VIRT,
  263. .pfn = __phys_to_pfn(PALMLD_IDE_PHYS),
  264. .length = PALMLD_IDE_SIZE,
  265. .type = MT_DEVICE
  266. },
  267. {
  268. .virtual = PALMLD_USB_VIRT,
  269. .pfn = __phys_to_pfn(PALMLD_USB_PHYS),
  270. .length = PALMLD_USB_SIZE,
  271. .type = MT_DEVICE
  272. },
  273. };
  274. static void __init palmld_map_io(void)
  275. {
  276. pxa27x_map_io();
  277. iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
  278. }
  279. static void __init palmld_init(void)
  280. {
  281. pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
  282. pxa_set_ffuart_info(NULL);
  283. pxa_set_btuart_info(NULL);
  284. pxa_set_stuart_info(NULL);
  285. palm27x_mmc_init(GPIO_NR_PALMLD_SD_DETECT_N, GPIO_NR_PALMLD_SD_READONLY,
  286. GPIO_NR_PALMLD_SD_POWER, 0);
  287. palm27x_pm_init(PALMLD_STR_BASE);
  288. palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
  289. palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
  290. palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE, PALMLD_BAT_MAX_VOLTAGE,
  291. GPIO_NR_PALMLD_EARPHONE_DETECT, 95);
  292. palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER, GPIO_NR_PALMLD_LCD_POWER);
  293. palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT,
  294. GPIO_NR_PALMLD_USB_DETECT_N);
  295. palm27x_pmic_init();
  296. palmld_kpc_init();
  297. palmld_keys_init();
  298. palmld_nor_init();
  299. palmld_leds_init();
  300. palmld_ide_init();
  301. }
  302. MACHINE_START(PALMLD, "Palm LifeDrive")
  303. .boot_params = 0xa0000100,
  304. .map_io = palmld_map_io,
  305. .init_irq = pxa27x_init_irq,
  306. .timer = &pxa_timer,
  307. .init_machine = palmld_init
  308. MACHINE_END