board-palmte.c 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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/gpio.h>
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/input.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/mtd/mtd.h>
  25. #include <linux/mtd/partitions.h>
  26. #include <linux/mtd/physmap.h>
  27. #include <linux/spi/spi.h>
  28. #include <linux/interrupt.h>
  29. #include <linux/apm-emulation.h>
  30. #include <mach/hardware.h>
  31. #include <asm/mach-types.h>
  32. #include <asm/mach/arch.h>
  33. #include <asm/mach/map.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 const unsigned int palmte_keymap[] = {
  58. KEY(0, 0, KEY_F1), /* Calendar */
  59. KEY(1, 0, KEY_F2), /* Contacts */
  60. KEY(2, 0, KEY_F3), /* Tasks List */
  61. KEY(3, 0, KEY_F4), /* Note Pad */
  62. KEY(4, 0, KEY_POWER),
  63. KEY(0, 1, KEY_LEFT),
  64. KEY(1, 1, KEY_DOWN),
  65. KEY(2, 1, KEY_UP),
  66. KEY(3, 1, KEY_RIGHT),
  67. KEY(4, 1, KEY_ENTER),
  68. };
  69. static const struct matrix_keymap_data palmte_keymap_data = {
  70. .keymap = palmte_keymap,
  71. .keymap_size = ARRAY_SIZE(palmte_keymap),
  72. };
  73. static struct omap_kp_platform_data palmte_kp_data = {
  74. .rows = 8,
  75. .cols = 8,
  76. .keymap_data = &palmte_keymap_data,
  77. .rep = true,
  78. .delay = 12,
  79. };
  80. static struct resource palmte_kp_resources[] = {
  81. [0] = {
  82. .start = INT_KEYBOARD,
  83. .end = INT_KEYBOARD,
  84. .flags = IORESOURCE_IRQ,
  85. },
  86. };
  87. static struct platform_device palmte_kp_device = {
  88. .name = "omap-keypad",
  89. .id = -1,
  90. .dev = {
  91. .platform_data = &palmte_kp_data,
  92. },
  93. .num_resources = ARRAY_SIZE(palmte_kp_resources),
  94. .resource = palmte_kp_resources,
  95. };
  96. static struct mtd_partition palmte_rom_partitions[] = {
  97. /* PalmOS "Small ROM", contains the bootloader and the debugger */
  98. {
  99. .name = "smallrom",
  100. .offset = 0,
  101. .size = 0xa000,
  102. .mask_flags = MTD_WRITEABLE,
  103. },
  104. /* PalmOS "Big ROM", a filesystem with all the OS code and data */
  105. {
  106. .name = "bigrom",
  107. .offset = SZ_128K,
  108. /*
  109. * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
  110. * 0x7b0000 bytes in the English-only ("enUS") version.
  111. */
  112. .size = 0x7b0000,
  113. .mask_flags = MTD_WRITEABLE,
  114. },
  115. };
  116. static struct physmap_flash_data palmte_rom_data = {
  117. .width = 2,
  118. .set_vpp = omap1_set_vpp,
  119. .parts = palmte_rom_partitions,
  120. .nr_parts = ARRAY_SIZE(palmte_rom_partitions),
  121. };
  122. static struct resource palmte_rom_resource = {
  123. .start = OMAP_CS0_PHYS,
  124. .end = OMAP_CS0_PHYS + SZ_8M - 1,
  125. .flags = IORESOURCE_MEM,
  126. };
  127. static struct platform_device palmte_rom_device = {
  128. .name = "physmap-flash",
  129. .id = -1,
  130. .dev = {
  131. .platform_data = &palmte_rom_data,
  132. },
  133. .num_resources = 1,
  134. .resource = &palmte_rom_resource,
  135. };
  136. static struct platform_device palmte_lcd_device = {
  137. .name = "lcd_palmte",
  138. .id = -1,
  139. };
  140. static struct omap_backlight_config palmte_backlight_config = {
  141. .default_intensity = 0xa0,
  142. };
  143. static struct platform_device palmte_backlight_device = {
  144. .name = "omap-bl",
  145. .id = -1,
  146. .dev = {
  147. .platform_data = &palmte_backlight_config,
  148. },
  149. };
  150. static struct omap_irda_config palmte_irda_config = {
  151. .transceiver_cap = IR_SIRMODE,
  152. .rx_channel = OMAP_DMA_UART3_RX,
  153. .tx_channel = OMAP_DMA_UART3_TX,
  154. .dest_start = UART3_THR,
  155. .src_start = UART3_RHR,
  156. .tx_trigger = 0,
  157. .rx_trigger = 0,
  158. };
  159. static struct resource palmte_irda_resources[] = {
  160. [0] = {
  161. .start = INT_UART3,
  162. .end = INT_UART3,
  163. .flags = IORESOURCE_IRQ,
  164. },
  165. };
  166. static struct platform_device palmte_irda_device = {
  167. .name = "omapirda",
  168. .id = -1,
  169. .dev = {
  170. .platform_data = &palmte_irda_config,
  171. },
  172. .num_resources = ARRAY_SIZE(palmte_irda_resources),
  173. .resource = palmte_irda_resources,
  174. };
  175. static struct platform_device *palmte_devices[] __initdata = {
  176. &palmte_rom_device,
  177. &palmte_kp_device,
  178. &palmte_lcd_device,
  179. &palmte_backlight_device,
  180. &palmte_irda_device,
  181. };
  182. static struct omap_usb_config palmte_usb_config __initdata = {
  183. .register_dev = 1, /* Mini-B only receptacle */
  184. .hmc_mode = 0,
  185. .pins[0] = 2,
  186. };
  187. static struct omap_lcd_config palmte_lcd_config __initdata = {
  188. .ctrl_name = "internal",
  189. };
  190. static struct omap_board_config_kernel palmte_config[] __initdata = {
  191. { OMAP_TAG_LCD, &palmte_lcd_config },
  192. };
  193. static struct spi_board_info palmte_spi_info[] __initdata = {
  194. {
  195. .modalias = "tsc2102",
  196. .bus_num = 2, /* uWire (officially) */
  197. .chip_select = 0, /* As opposed to 3 */
  198. .irq = OMAP_GPIO_IRQ(PALMTE_PINTDAV_GPIO),
  199. .max_speed_hz = 8000000,
  200. },
  201. };
  202. static void __init palmte_misc_gpio_setup(void)
  203. {
  204. /* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
  205. if (gpio_request(PALMTE_PINTDAV_GPIO, "TSC2102 PINTDAV") < 0) {
  206. printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
  207. return;
  208. }
  209. gpio_direction_input(PALMTE_PINTDAV_GPIO);
  210. /* Set USB-or-DC-IN pin as input (unused) */
  211. if (gpio_request(PALMTE_USB_OR_DC_GPIO, "USB/DC-IN") < 0) {
  212. printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
  213. return;
  214. }
  215. gpio_direction_input(PALMTE_USB_OR_DC_GPIO);
  216. }
  217. static void __init omap_palmte_init(void)
  218. {
  219. /* mux pins for uarts */
  220. omap_cfg_reg(UART1_TX);
  221. omap_cfg_reg(UART1_RTS);
  222. omap_cfg_reg(UART2_TX);
  223. omap_cfg_reg(UART2_RTS);
  224. omap_cfg_reg(UART3_TX);
  225. omap_cfg_reg(UART3_RX);
  226. omap_board_config = palmte_config;
  227. omap_board_config_size = ARRAY_SIZE(palmte_config);
  228. platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices));
  229. spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
  230. palmte_misc_gpio_setup();
  231. omap_serial_init();
  232. omap1_usb_init(&palmte_usb_config);
  233. omap_register_i2c_bus(1, 100, NULL, 0);
  234. }
  235. MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
  236. .atag_offset = 0x100,
  237. .map_io = omap15xx_map_io,
  238. .init_early = omap1_init_early,
  239. .reserve = omap_reserve,
  240. .init_irq = omap1_init_irq,
  241. .init_machine = omap_palmte_init,
  242. .timer = &omap1_timer,
  243. MACHINE_END