board-palmte.c 6.6 KB

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