synchronousMemoryDatabase.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /*
  2. * linux/arch/arm/mach-omap1/board-innovator.c
  3. *
  4. * Board specific inits for OMAP-1510 and OMAP-1610 Innovator
  5. *
  6. * Copyright (C) 2001 RidgeRun, Inc.
  7. * Author: Greg Lonnon <glonnon@ridgerun.com>
  8. *
  9. * Copyright (C) 2002 MontaVista Software, Inc.
  10. *
  11. * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6
  12. * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com>
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License version 2 as
  16. * published by the Free Software Foundation.
  17. */
  18. #include <linux/gpio.h>
  19. #include <linux/kernel.h>
  20. #include <linux/init.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/delay.h>
  23. #include <linux/mtd/mtd.h>
  24. #include <linux/mtd/partitions.h>
  25. #include <linux/mtd/physmap.h>
  26. #include <linux/input.h>
  27. #include <linux/smc91x.h>
  28. #include <linux/omapfb.h>
  29. #include <asm/mach-types.h>
  30. #include <asm/mach/arch.h>
  31. #include <asm/mach/map.h>
  32. #include <mach/mux.h>
  33. #include <mach/flash.h>
  34. #include <mach/tc.h>
  35. #include <linux/platform_data/keypad-omap.h>
  36. #include <mach/hardware.h>
  37. #include <mach/usb.h>
  38. #include "iomap.h"
  39. #include "common.h"
  40. #include "mmc.h"
  41. /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
  42. #define INNOVATOR1610_ETHR_START 0x04000300
  43. static const unsigned int innovator_keymap[] = {
  44. KEY(0, 0, KEY_F1),
  45. KEY(3, 0, KEY_DOWN),
  46. KEY(1, 1, KEY_F2),
  47. KEY(2, 1, KEY_RIGHT),
  48. KEY(0, 2, KEY_F3),
  49. KEY(1, 2, KEY_F4),
  50. KEY(2, 2, KEY_UP),
  51. KEY(2, 3, KEY_ENTER),
  52. KEY(3, 3, KEY_LEFT),
  53. };
  54. static struct mtd_partition innovator_partitions[] = {
  55. /* bootloader (U-Boot, etc) in first sector */
  56. {
  57. .name = "bootloader",
  58. .offset = 0,
  59. .size = SZ_128K,
  60. .mask_flags = MTD_WRITEABLE, /* force read-only */
  61. },
  62. /* bootloader params in the next sector */
  63. {
  64. .name = "params",
  65. .offset = MTDPART_OFS_APPEND,
  66. .size = SZ_128K,
  67. .mask_flags = 0,
  68. },
  69. /* kernel */
  70. {
  71. .name = "kernel",
  72. .offset = MTDPART_OFS_APPEND,
  73. .size = SZ_2M,
  74. .mask_flags = 0
  75. },
  76. /* rest of flash1 is a file system */
  77. {
  78. .name = "rootfs",
  79. .offset = MTDPART_OFS_APPEND,
  80. .size = SZ_16M - SZ_2M - 2 * SZ_128K,
  81. .mask_flags = 0
  82. },
  83. /* file system */
  84. {
  85. .name = "filesystem",
  86. .offset = MTDPART_OFS_APPEND,
  87. .size = MTDPART_SIZ_FULL,
  88. .mask_flags = 0
  89. }
  90. };
  91. static struct physmap_flash_data innovator_flash_data = {
  92. .width = 2,
  93. .set_vpp = omap1_set_vpp,
  94. .parts = innovator_partitions,
  95. .nr_parts = ARRAY_SIZE(innovator_partitions),
  96. };
  97. static struct resource innovator_flash_resource = {
  98. .start = OMAP_CS0_PHYS,
  99. .end = OMAP_CS0_PHYS + SZ_32M - 1,
  100. .flags = IORESOURCE_MEM,
  101. };
  102. static struct platform_device innovator_flash_device = {
  103. .name = "physmap-flash",
  104. .id = 0,
  105. .dev = {
  106. .platform_data = &innovator_flash_data,
  107. },
  108. .num_resources = 1,
  109. .resource = &innovator_flash_resource,
  110. };
  111. static struct resource innovator_kp_resources[] = {
  112. [0] = {
  113. .start = INT_KEYBOARD,
  114. .end = INT_KEYBOARD,
  115. .flags = IORESOURCE_IRQ,
  116. },
  117. };
  118. static const struct matrix_keymap_data innovator_keymap_data = {
  119. .keymap = innovator_keymap,
  120. .keymap_size = ARRAY_SIZE(innovator_keymap),
  121. };
  122. static struct omap_kp_platform_data innovator_kp_data = {
  123. .rows = 8,
  124. .cols = 8,
  125. .keymap_data = &innovator_keymap_data,
  126. .delay = 4,
  127. };
  128. static struct platform_device innovator_kp_device = {
  129. .name = "omap-keypad",
  130. .id = -1,
  131. .dev = {
  132. .platform_data = &innovator_kp_data,
  133. },
  134. .num_resources = ARRAY_SIZE(innovator_kp_resources),
  135. .resource = innovator_kp_resources,
  136. };
  137. static struct smc91x_platdata innovator_smc91x_info = {
  138. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  139. .leda = RPC_LED_100_10,
  140. .ledb = RPC_LED_TX_RX,
  141. };
  142. #ifdef CONFIG_ARCH_OMAP15XX
  143. #include <linux/spi/spi.h>
  144. #include <linux/spi/ads7846.h>
  145. /* Only FPGA needs to be mapped here. All others are done with ioremap */
  146. static struct map_desc innovator1510_io_desc[] __initdata = {
  147. {
  148. .virtual = OMAP1510_FPGA_BASE,
  149. .pfn = __phys_to_pfn(OMAP1510_FPGA_START),
  150. .length = OMAP1510_FPGA_SIZE,
  151. .type = MT_DEVICE
  152. }
  153. };
  154. static struct resource innovator1510_smc91x_resources[] = {
  155. [0] = {
  156. .start = OMAP1510_FPGA_ETHR_START, /* Physical */
  157. .end = OMAP1510_FPGA_ETHR_START + 0xf,
  158. .flags = IORESOURCE_MEM,
  159. },
  160. [1] = {
  161. .start = OMAP1510_INT_ETHER,
  162. .end = OMAP1510_INT_ETHER,
  163. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  164. },
  165. };
  166. static struct platform_device innovator1510_smc91x_device = {
  167. .name = "smc91x",
  168. .id = 0,
  169. .dev = {
  170. .platform_data = &innovator_smc91x_info,
  171. },
  172. .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources),
  173. .resource = innovator1510_smc91x_resources,
  174. };
  175. static struct platform_device innovator1510_lcd_device = {
  176. .name = "lcd_inn1510",
  177. .id = -1,
  178. };
  179. static struct platform_device innovator1510_spi_device = {
  180. .name = "spi_inn1510",
  181. .id = -1,
  182. };
  183. static struct platform_device *innovator1510_devices[] __initdata = {
  184. &innovator_flash_device,
  185. &innovator1510_smc91x_device,
  186. &innovator_kp_device,
  187. &innovator1510_lcd_device,
  188. &innovator1510_spi_device,
  189. };
  190. static int innovator_get_pendown_state(void)
  191. {
  192. return !(__raw_readb(OMAP1510_FPGA_TOUCHSCREEN) & (1 << 5));
  193. }
  194. static const struct ads7846_platform_data innovator1510_ts_info = {
  195. .model = 7846,
  196. .vref_delay_usecs = 100, /* internal, no capacitor */
  197. .x_plate_ohms = 419,
  198. .y_plate_ohms = 486,
  199. .get_pendown_state = innovator_get_pendown_state,
  200. };
  201. static struct spi_board_info __initdata innovator1510_boardinfo[] = { {
  202. /* FPGA (bus "10") CS0 has an ads7846e */
  203. .modalias = "ads7846",
  204. .platform_data = &innovator1510_ts_info,
  205. .irq = OMAP1510_INT_FPGA_TS,
  206. .max_speed_hz = 120000 /* max sample rate at 3V */
  207. * 26 /* command + data + overhead */,
  208. .bus_num = 10,
  209. .chip_select = 0,
  210. } };
  211. #endif /* CONFIG_ARCH_OMAP15XX */
  212. #ifdef CONFIG_ARCH_OMAP16XX
  213. static struct resource innovator1610_smc91x_resources[] = {
  214. [0] = {
  215. .start = INNOVATOR1610_ETHR_START, /* Physical */
  216. .end = INNOVATOR1610_ETHR_START + 0xf,
  217. .flags = IORESOURCE_MEM,
  218. },
  219. [1] = {
  220. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
  221. },
  222. };
  223. static struct platform_device innovator1610_smc91x_device = {
  224. .name = "smc91x",
  225. .id = 0,
  226. .dev = {
  227. .platform_data = &innovator_smc91x_info,
  228. },
  229. .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources),
  230. .resource = innovator1610_smc91x_resources,
  231. };
  232. static struct platform_device innovator1610_lcd_device = {
  233. .name = "inn1610_lcd",
  234. .id = -1,
  235. };
  236. static struct platform_device *innovator1610_devices[] __initdata = {
  237. &innovator_flash_device,
  238. &innovator1610_smc91x_device,
  239. &innovator_kp_device,
  240. &innovator1610_lcd_device,
  241. };
  242. #endif /* CONFIG_ARCH_OMAP16XX */
  243. static void __init innovator_init_smc91x(void)
  244. {
  245. if (cpu_is_omap1510()) {
  246. __raw_writeb(__raw_readb(OMAP1510_FPGA_RST) & ~1,
  247. OMAP1510_FPGA_RST);
  248. udelay(750);
  249. } else {
  250. if (gpio_request(0, "SMC91x irq") < 0) {
  251. printk("Error requesting gpio 0 for smc91x irq\n");
  252. return;
  253. }
  254. }
  255. }
  256. #ifdef CONFIG_ARCH_OMAP15XX
  257. static struct omap_usb_config innovator1510_usb_config __initdata = {
  258. /* for bundled non-standard host and peripheral cables */
  259. .hmc_mode = 4,
  260. .register_host = 1,
  261. .pins[1] = 6,
  262. .pins[2] = 6, /* Conflicts with UART2 */