board-palmte.c 6.3 KB

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