board-innovator.c 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/delay.h>
  22. #include <linux/mtd/mtd.h>
  23. #include <linux/mtd/partitions.h>
  24. #include <linux/input.h>
  25. #include <asm/hardware.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/flash.h>
  29. #include <asm/mach/map.h>
  30. #include <asm/arch/mux.h>
  31. #include <asm/arch/fpga.h>
  32. #include <asm/arch/gpio.h>
  33. #include <asm/arch/tc.h>
  34. #include <asm/arch/usb.h>
  35. #include <asm/arch/keypad.h>
  36. #include <asm/arch/common.h>
  37. static int innovator_keymap[] = {
  38. KEY(0, 0, KEY_F1),
  39. KEY(0, 3, KEY_DOWN),
  40. KEY(1, 1, KEY_F2),
  41. KEY(1, 2, KEY_RIGHT),
  42. KEY(2, 0, KEY_F3),
  43. KEY(2, 1, KEY_F4),
  44. KEY(2, 2, KEY_UP),
  45. KEY(3, 2, KEY_ENTER),
  46. KEY(3, 3, KEY_LEFT),
  47. 0
  48. };
  49. static struct mtd_partition innovator_partitions[] = {
  50. /* bootloader (U-Boot, etc) in first sector */
  51. {
  52. .name = "bootloader",
  53. .offset = 0,
  54. .size = SZ_128K,
  55. .mask_flags = MTD_WRITEABLE, /* force read-only */
  56. },
  57. /* bootloader params in the next sector */
  58. {
  59. .name = "params",
  60. .offset = MTDPART_OFS_APPEND,
  61. .size = SZ_128K,
  62. .mask_flags = 0,
  63. },
  64. /* kernel */
  65. {
  66. .name = "kernel",
  67. .offset = MTDPART_OFS_APPEND,
  68. .size = SZ_2M,
  69. .mask_flags = 0
  70. },
  71. /* rest of flash1 is a file system */
  72. {
  73. .name = "rootfs",
  74. .offset = MTDPART_OFS_APPEND,
  75. .size = SZ_16M - SZ_2M - 2 * SZ_128K,
  76. .mask_flags = 0
  77. },
  78. /* file system */
  79. {
  80. .name = "filesystem",
  81. .offset = MTDPART_OFS_APPEND,
  82. .size = MTDPART_SIZ_FULL,
  83. .mask_flags = 0
  84. }
  85. };
  86. static struct flash_platform_data innovator_flash_data = {
  87. .map_name = "cfi_probe",
  88. .width = 2,
  89. .parts = innovator_partitions,
  90. .nr_parts = ARRAY_SIZE(innovator_partitions),
  91. };
  92. static struct resource innovator_flash_resource = {
  93. .start = OMAP_CS0_PHYS,
  94. .end = OMAP_CS0_PHYS + SZ_32M - 1,
  95. .flags = IORESOURCE_MEM,
  96. };
  97. static struct platform_device innovator_flash_device = {
  98. .name = "omapflash",
  99. .id = 0,
  100. .dev = {
  101. .platform_data = &innovator_flash_data,
  102. },
  103. .num_resources = 1,
  104. .resource = &innovator_flash_resource,
  105. };
  106. static struct resource innovator_kp_resources[] = {
  107. [0] = {
  108. .start = INT_KEYBOARD,
  109. .end = INT_KEYBOARD,
  110. .flags = IORESOURCE_IRQ,
  111. },
  112. };
  113. static struct omap_kp_platform_data innovator_kp_data = {
  114. .rows = 8,
  115. .cols = 8,
  116. .keymap = innovator_keymap,
  117. };
  118. static struct platform_device innovator_kp_device = {
  119. .name = "omap-keypad",
  120. .id = -1,
  121. .dev = {
  122. .platform_data = &innovator_kp_data,
  123. },
  124. .num_resources = ARRAY_SIZE(innovator_kp_resources),
  125. .resource = innovator_kp_resources,
  126. };
  127. #ifdef CONFIG_ARCH_OMAP15XX
  128. /* Only FPGA needs to be mapped here. All others are done with ioremap */
  129. static struct map_desc innovator1510_io_desc[] __initdata = {
  130. {
  131. .virtual = OMAP1510_FPGA_BASE,
  132. .pfn = __phys_to_pfn(OMAP1510_FPGA_START),
  133. .length = OMAP1510_FPGA_SIZE,
  134. .type = MT_DEVICE
  135. }
  136. };
  137. static struct resource innovator1510_smc91x_resources[] = {
  138. [0] = {
  139. .start = OMAP1510_FPGA_ETHR_START, /* Physical */
  140. .end = OMAP1510_FPGA_ETHR_START + 0xf,
  141. .flags = IORESOURCE_MEM,
  142. },
  143. [1] = {
  144. .start = OMAP1510_INT_ETHER,
  145. .end = OMAP1510_INT_ETHER,
  146. .flags = IORESOURCE_IRQ,
  147. },
  148. };
  149. static struct platform_device innovator1510_smc91x_device = {
  150. .name = "smc91x",
  151. .id = 0,
  152. .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources),
  153. .resource = innovator1510_smc91x_resources,
  154. };
  155. static struct platform_device innovator1510_lcd_device = {
  156. .name = "lcd_inn1510",
  157. .id = -1,
  158. };
  159. static struct platform_device *innovator1510_devices[] __initdata = {
  160. &innovator_flash_device,
  161. &innovator1510_smc91x_device,
  162. &innovator_kp_device,
  163. &innovator1510_lcd_device,
  164. };
  165. #endif /* CONFIG_ARCH_OMAP15XX */
  166. #ifdef CONFIG_ARCH_OMAP16XX
  167. static struct resource innovator1610_smc91x_resources[] = {
  168. [0] = {
  169. .start = INNOVATOR1610_ETHR_START, /* Physical */
  170. .end = INNOVATOR1610_ETHR_START + 0xf,
  171. .flags = IORESOURCE_MEM,
  172. },
  173. [1] = {
  174. .start = OMAP_GPIO_IRQ(0),
  175. .end = OMAP_GPIO_IRQ(0),
  176. .flags = IORESOURCE_IRQ,
  177. },
  178. };
  179. static struct platform_device innovator1610_smc91x_device = {
  180. .name = "smc91x",
  181. .id = 0,
  182. .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources),
  183. .resource = innovator1610_smc91x_resources,
  184. };
  185. static struct platform_device innovator1610_lcd_device = {
  186. .name = "inn1610_lcd",
  187. .id = -1,
  188. };
  189. static struct platform_device *innovator1610_devices[] __initdata = {
  190. &innovator_flash_device,
  191. &innovator1610_smc91x_device,
  192. &innovator_kp_device,
  193. &innovator1610_lcd_device,
  194. };
  195. #endif /* CONFIG_ARCH_OMAP16XX */
  196. static void __init innovator_init_smc91x(void)
  197. {
  198. if (cpu_is_omap1510()) {
  199. fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1,
  200. OMAP1510_FPGA_RST);
  201. udelay(750);
  202. } else {
  203. if ((omap_request_gpio(0)) < 0) {
  204. printk("Error requesting gpio 0 for smc91x irq\n");
  205. return;
  206. }
  207. }
  208. }
  209. void innovator_init_irq(void)
  210. {
  211. omap1_init_common_hw();
  212. omap_init_irq();
  213. omap_gpio_init();
  214. #ifdef CONFIG_ARCH_OMAP15XX
  215. if (cpu_is_omap1510()) {
  216. omap1510_fpga_init_irq();
  217. }
  218. #endif
  219. innovator_init_smc91x();
  220. }
  221. #ifdef CONFIG_ARCH_OMAP15XX
  222. static struct omap_usb_config innovator1510_usb_config __initdata = {
  223. /* for bundled non-standard host and peripheral cables */
  224. .hmc_mode = 4,
  225. .register_host = 1,
  226. .pins[1] = 6,
  227. .pins[2] = 6, /* Conflicts with UART2 */
  228. .register_dev = 1,
  229. .pins[0] = 2,
  230. };
  231. static struct omap_lcd_config innovator1510_lcd_config __initdata = {
  232. .ctrl_name = "internal",
  233. };
  234. #endif
  235. #ifdef CONFIG_ARCH_OMAP16XX
  236. static struct omap_usb_config h2_usb_config __initdata = {
  237. /* usb1 has a Mini-AB port and external isp1301 transceiver */
  238. .otg = 2,
  239. #ifdef CONFIG_USB_GADGET_OMAP
  240. .hmc_mode = 19, // 0:host(off) 1:dev|otg 2:disabled
  241. // .hmc_mode = 21, // 0:host(off) 1:dev(loopback) 2:host(loopback)
  242. #elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  243. /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */
  244. .hmc_mode = 20, // 1:dev|otg(off) 1:host 2:disabled
  245. #endif
  246. .pins[1] = 3,
  247. };
  248. static struct omap_lcd_config innovator1610_lcd_config __initdata = {
  249. .ctrl_name = "internal",
  250. };
  251. #endif
  252. static struct omap_mmc_config innovator_mmc_config __initdata = {
  253. .mmc [0] = {
  254. .enabled = 1,
  255. .wire4 = 1,
  256. .wp_pin = OMAP_MPUIO(3),
  257. .power_pin = -1, /* FPGA F3 UIO42 */
  258. .switch_pin = -1, /* FPGA F4 UIO43 */
  259. },
  260. };
  261. static struct omap_uart_config innovator_uart_config __initdata = {
  262. .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
  263. };
  264. static struct omap_board_config_kernel innovator_config[] = {
  265. { OMAP_TAG_USB, NULL },
  266. { OMAP_TAG_LCD, NULL },
  267. { OMAP_TAG_MMC, &innovator_mmc_config },
  268. { OMAP_TAG_UART, &innovator_uart_config },
  269. };
  270. static void __init innovator_init(void)
  271. {
  272. #ifdef CONFIG_ARCH_OMAP15XX
  273. if (cpu_is_omap1510()) {
  274. platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
  275. }
  276. #endif
  277. #ifdef CONFIG_ARCH_OMAP16XX
  278. if (!cpu_is_omap1510()) {
  279. platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
  280. }
  281. #endif
  282. #ifdef CONFIG_ARCH_OMAP15XX
  283. if (cpu_is_omap1510()) {
  284. innovator_config[0].data = &innovator1510_usb_config;
  285. innovator_config[1].data = &innovator1510_lcd_config;
  286. }
  287. #endif
  288. #ifdef CONFIG_ARCH_OMAP16XX
  289. if (cpu_is_omap1610()) {
  290. innovator_config[0].data = &h2_usb_config;
  291. innovator_config[1].data = &innovator1610_lcd_config;
  292. }
  293. #endif
  294. omap_board_config = innovator_config;
  295. omap_board_config_size = ARRAY_SIZE(innovator_config);
  296. omap_serial_init();
  297. }
  298. static void __init innovator_map_io(void)
  299. {
  300. omap1_map_common_io();
  301. #ifdef CONFIG_ARCH_OMAP15XX
  302. if (cpu_is_omap1510()) {
  303. iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
  304. udelay(10); /* Delay needed for FPGA */
  305. /* Dump the Innovator FPGA rev early - useful info for support. */
  306. printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
  307. fpga_read(OMAP1510_FPGA_REV_HIGH),
  308. fpga_read(OMAP1510_FPGA_REV_LOW),
  309. fpga_read(OMAP1510_FPGA_BOARD_REV));
  310. }
  311. #endif
  312. }
  313. MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
  314. /* Maintainer: MontaVista Software, Inc. */
  315. .phys_io = 0xfff00000,
  316. .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
  317. .boot_params = 0x10000100,
  318. .map_io = innovator_map_io,
  319. .init_irq = innovator_init_irq,
  320. .init_machine = innovator_init,
  321. .timer = &omap_timer,
  322. MACHINE_END