board-palmte.c 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /*
  2. * linux/arch/arm/mach-omap1/board-palmte.c
  3. *
  4. * Modified from board-generic.c
  5. *
  6. * Support for the Palm Tungsten E PDA.
  7. *
  8. * Original version : Laurent Gonzalez
  9. *
  10. * Maintainers : http://palmtelinux.sf.net
  11. * palmtelinux-developpers@lists.sf.net
  12. *
  13. * Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org>
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License version 2 as
  17. * published by the Free Software Foundation.
  18. */
  19. #include <linux/kernel.h>
  20. #include <linux/init.h>
  21. #include <linux/input.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/mtd/mtd.h>
  24. #include <linux/mtd/partitions.h>
  25. #include <linux/mtd/physmap.h>
  26. #include <linux/spi/spi.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/apm-emulation.h>
  29. #include <mach/hardware.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/map.h>
  33. #include <mach/gpio.h>
  34. #include <plat/flash.h>
  35. #include <plat/mux.h>
  36. #include <plat/usb.h>
  37. #include <plat/tc.h>
  38. #include <plat/dma.h>
  39. #include <plat/board.h>
  40. #include <plat/irda.h>
  41. #include <plat/keypad.h>
  42. #include <plat/common.h>
  43. #define PALMTE_USBDETECT_GPIO 0
  44. #define PALMTE_USB_OR_DC_GPIO 1
  45. #define PALMTE_TSC_GPIO 4
  46. #define PALMTE_PINTDAV_GPIO 6
  47. #define PALMTE_MMC_WP_GPIO 8
  48. #define PALMTE_MMC_POWER_GPIO 9
  49. #define PALMTE_HDQ_GPIO 11
  50. #define PALMTE_HEADPHONES_GPIO 14
  51. #define PALMTE_SPEAKER_GPIO 15
  52. #define PALMTE_DC_GPIO OMAP_MPUIO(2)
  53. #define PALMTE_MMC_SWITCH_GPIO OMAP_MPUIO(4)
  54. #define PALMTE_MMC1_GPIO OMAP_MPUIO(6)
  55. #define PALMTE_MMC2_GPIO OMAP_MPUIO(7)
  56. #define PALMTE_MMC3_GPIO OMAP_MPUIO(11)
  57. static void __init omap_palmte_init_irq(void)
  58. {
  59. omap1_init_common_hw();
  60. omap_init_irq();
  61. }
  62. static const unsigned int palmte_keymap[] = {
  63. KEY(0, 0, KEY_F1), /* Calendar */
  64. KEY(1, 0, KEY_F2), /* Contacts */
  65. KEY(2, 0, KEY_F3), /* Tasks List */
  66. KEY(3, 0, KEY_F4), /* Note Pad */
  67. KEY(4, 0, KEY_POWER),
  68. KEY(0, 1, KEY_LEFT),
  69. KEY(1, 1, KEY_DOWN),
  70. KEY(2, 1, KEY_UP),
  71. KEY(3, 1, KEY_RIGHT),
  72. KEY(4, 1, KEY_ENTER),
  73. };
  74. static const struct matrix_keymap_data palmte_keymap_data = {
  75. .keymap = palmte_keymap,
  76. .keymap_size = ARRAY_SIZE(palmte_keymap),
  77. };
  78. static struct omap_kp_platform_data palmte_kp_data = {
  79. .rows = 8,
  80. .cols = 8,
  81. .keymap_data = &palmte_keymap_data,
  82. .rep = true,
  83. .delay = 12,
  84. };
  85. static struct resource palmte_kp_resources[] = {
  86. [0] = {
  87. .start = INT_KEYBOARD,
  88. .end = INT_KEYBOARD,
  89. .flags = IORESOURCE_IRQ,
  90. },
  91. };
  92. static struct platform_device palmte_kp_device = {
  93. .name = "omap-keypad",
  94. .id = -1,
  95. .dev = {
  96. .platform_data = &palmte_kp_data,
  97. },
  98. .num_resources = ARRAY_SIZE(palmte_kp_resources),
  99. .resource = palmte_kp_resources,
  100. };
  101. static struct mtd_partition palmte_rom_partitions[] = {
  102. /* PalmOS "Small ROM", contains the bootloader and the debugger */
  103. {
  104. .name = "smallrom",
  105. .offset = 0,
  106. .size = 0xa000,
  107. .mask_flags = MTD_WRITEABLE,
  108. },
  109. /* PalmOS "Big ROM", a filesystem with all the OS code and data */
  110. {
  111. .name = "bigrom",
  112. .offset = SZ_128K,
  113. /*
  114. * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
  115. * 0x7b0000 bytes in the English-only ("enUS") version.
  116. */
  117. .size = 0x7b0000,
  118. .mask_flags = MTD_WRITEABLE,
  119. },
  120. };
  121. static struct physmap_flash_data palmte_rom_data = {
  122. .width = 2,
  123. .set_vpp = omap1_set_vpp,
  124. .parts = palmte_rom_partitions,
  125. .nr_parts = ARRAY_SIZE(palmte_rom_partitions),
  126. };
  127. static struct resource palmte_rom_resource = {
  128. .start = OMAP_CS0_PHYS,
  129. .end = OMAP_CS0_PHYS + SZ_8M - 1,
  130. .flags = IORESOURCE_MEM,
  131. };
  132. static struct platform_device palmte_rom_device = {
  133. .name = "physmap-flash",
  134. .id = -1,
  135. .dev = {
  136. .platform_data = &palmte_rom_data,
  137. },
  138. .num_resources = 1,
  139. .resource = &palmte_rom_resource,
  140. };
  141. static struct platform_device palmte_lcd_device = {
  142. .name = "lcd_palmte",
  143. .id = -1,
  144. };
  145. static struct omap_backlight_config palmte_backlight_config = {
  146. .default_intensity = 0xa0,
  147. };
  148. static struct platform_device palmte_backlight_device = {
  149. .name = "omap-bl",
  150. .id = -1,
  151. .dev = {
  152. .platform_data = &palmte_backlight_config,
  153. },
  154. };
  155. static struct omap_irda_config palmte_irda_config = {
  156. .transceiver_cap = IR_SIRMODE,
  157. .rx_channel = OMAP_DMA_UART3_RX,
  158. .tx_channel = OMAP_DMA_UART3_TX,
  159. .dest_start = UART3_THR,
  160. .src_start = UART3_RHR,
  161. .tx_trigger = 0,
  162. .rx_trigger = 0,
  163. };
  164. static struct resource palmte_irda_resources[] = {
  165. [0] = {
  166. .start = INT_UART3,
  167. .end = INT_UART3,
  168. .flags = IORESOURCE_IRQ,
  169. },
  170. };
  171. static struct platform_device palmte_irda_device = {
  172. .name = "omapirda",
  173. .id = -1,
  174. .dev = {
  175. .platform_data = &palmte_irda_config,
  176. },
  177. .num_resources = ARRAY_SIZE(palmte_irda_resources),
  178. .resource = palmte_irda_resources,
  179. };
  180. static struct platform_device *palmte_devices[] __initdata = {
  181. &palmte_rom_device,
  182. &palmte_kp_device,
  183. &palmte_lcd_device,
  184. &palmte_backlight_device,
  185. &palmte_irda_device,
  186. };
  187. static struct omap_usb_config palmte_usb_config __initdata = {
  188. .register_dev = 1, /* Mini-B only receptacle */
  189. .hmc_mode = 0,
  190. .pins[0] = 2,
  191. };
  192. static struct omap_lcd_config palmte_lcd_config __initdata = {
  193. .ctrl_name = "internal",
  194. };
  195. static struct omap_board_config_kernel palmte_config[] __initdata = {
  196. { OMAP_TAG_LCD, &palmte_lcd_config },
  197. };
  198. static struct spi_board_info palmte_spi_info[] __initdata = {
  199. {
  200. .modalias = "tsc2102",
  201. .bus_num = 2, /* uWire (officially) */
  202. .chip_select = 0, /* As opposed to 3 */
  203. .irq = OMAP_GPIO_IRQ(PALMTE_PINTDAV_GPIO),
  204. .max_speed_hz = 8000000,
  205. },
  206. };
  207. static void __init palmte_misc_gpio_setup(void)
  208. {
  209. /* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
  210. if (gpio_request(PALMTE_PINTDAV_GPIO, "TSC2102 PINTDAV") < 0) {
  211. printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
  212. return;
  213. }
  214. gpio_direction_input(PALMTE_PINTDAV_GPIO);
  215. /* Set USB-or-DC-IN pin as input (unused) */
  216. if (gpio_request(PALMTE_USB_OR_DC_GPIO, "USB/DC-IN") < 0) {
  217. printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
  218. return;
  219. }
  220. gpio_direction_input(PALMTE_USB_OR_DC_GPIO);
  221. }
  222. static void __init omap_palmte_init(void)
  223. {
  224. /* mux pins for uarts */
  225. omap_cfg_reg(UART1_TX);
  226. omap_cfg_reg(UART1_RTS);
  227. omap_cfg_reg(UART2_TX);
  228. omap_cfg_reg(UART2_RTS);
  229. omap_cfg_reg(UART3_TX);
  230. omap_cfg_reg(UART3_RX);
  231. omap_board_config = palmte_config;
  232. omap_board_config_size = ARRAY_SIZE(palmte_config);
  233. platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices));
  234. spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
  235. palmte_misc_gpio_setup();
  236. omap_serial_init();
  237. omap1_usb_init(&palmte_usb_config);
  238. omap_register_i2c_bus(1, 100, NULL, 0);
  239. }
  240. static void __init omap_palmte_map_io(void)
  241. {
  242. omap1_map_common_io();
  243. }
  244. MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
  245. .boot_params = 0x10000100,
  246. .map_io = omap_palmte_map_io,
  247. .reserve = omap_reserve,
  248. .init_irq = omap_palmte_init_irq,
  249. .init_machine = omap_palmte_init,
  250. .timer = &omap_timer,
  251. MACHINE_END