board-innovator.c 7.3 KB

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