board-innovator.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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/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. { OMAP1510_FPGA_BASE, OMAP1510_FPGA_START, OMAP1510_FPGA_SIZE,
  97. MT_DEVICE },
  98. };
  99. static struct resource innovator1510_smc91x_resources[] = {
  100. [0] = {
  101. .start = OMAP1510_FPGA_ETHR_START, /* Physical */
  102. .end = OMAP1510_FPGA_ETHR_START + 0xf,
  103. .flags = IORESOURCE_MEM,
  104. },
  105. [1] = {
  106. .start = OMAP1510_INT_ETHER,
  107. .end = OMAP1510_INT_ETHER,
  108. .flags = IORESOURCE_IRQ,
  109. },
  110. };
  111. static struct platform_device innovator1510_smc91x_device = {
  112. .name = "smc91x",
  113. .id = 0,
  114. .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources),
  115. .resource = innovator1510_smc91x_resources,
  116. };
  117. static struct platform_device *innovator1510_devices[] __initdata = {
  118. &innovator_flash_device,
  119. &innovator1510_smc91x_device,
  120. };
  121. #endif /* CONFIG_ARCH_OMAP1510 */
  122. #ifdef CONFIG_ARCH_OMAP16XX
  123. static struct resource innovator1610_smc91x_resources[] = {
  124. [0] = {
  125. .start = INNOVATOR1610_ETHR_START, /* Physical */
  126. .end = INNOVATOR1610_ETHR_START + 0xf,
  127. .flags = IORESOURCE_MEM,
  128. },
  129. [1] = {
  130. .start = OMAP_GPIO_IRQ(0),
  131. .end = OMAP_GPIO_IRQ(0),
  132. .flags = IORESOURCE_IRQ,
  133. },
  134. };
  135. static struct platform_device innovator1610_smc91x_device = {
  136. .name = "smc91x",
  137. .id = 0,
  138. .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources),
  139. .resource = innovator1610_smc91x_resources,
  140. };
  141. static struct platform_device *innovator1610_devices[] __initdata = {
  142. &innovator_flash_device,
  143. &innovator1610_smc91x_device,
  144. };
  145. #endif /* CONFIG_ARCH_OMAP16XX */
  146. static void __init innovator_init_smc91x(void)
  147. {
  148. if (cpu_is_omap1510()) {
  149. fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1,
  150. OMAP1510_FPGA_RST);
  151. udelay(750);
  152. } else {
  153. if ((omap_request_gpio(0)) < 0) {
  154. printk("Error requesting gpio 0 for smc91x irq\n");
  155. return;
  156. }
  157. }
  158. }
  159. void innovator_init_irq(void)
  160. {
  161. omap_init_irq();
  162. omap_gpio_init();
  163. #ifdef CONFIG_ARCH_OMAP1510
  164. if (cpu_is_omap1510()) {
  165. omap1510_fpga_init_irq();
  166. }
  167. #endif
  168. innovator_init_smc91x();
  169. }
  170. #ifdef CONFIG_ARCH_OMAP1510
  171. static struct omap_usb_config innovator1510_usb_config __initdata = {
  172. /* for bundled non-standard host and peripheral cables */
  173. .hmc_mode = 4,
  174. .register_host = 1,
  175. .pins[1] = 6,
  176. .pins[2] = 6, /* Conflicts with UART2 */
  177. .register_dev = 1,
  178. .pins[0] = 2,
  179. };
  180. #endif
  181. #ifdef CONFIG_ARCH_OMAP16XX
  182. static struct omap_usb_config h2_usb_config __initdata = {
  183. /* usb1 has a Mini-AB port and external isp1301 transceiver */
  184. .otg = 2,
  185. #ifdef CONFIG_USB_GADGET_OMAP
  186. .hmc_mode = 19, // 0:host(off) 1:dev|otg 2:disabled
  187. // .hmc_mode = 21, // 0:host(off) 1:dev(loopback) 2:host(loopback)
  188. #elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  189. /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */
  190. .hmc_mode = 20, // 1:dev|otg(off) 1:host 2:disabled
  191. #endif
  192. .pins[1] = 3,
  193. };
  194. #endif
  195. static struct omap_mmc_config innovator_mmc_config __initdata = {
  196. .mmc [0] = {
  197. .enabled = 1,
  198. .wire4 = 1,
  199. .wp_pin = OMAP_MPUIO(3),
  200. .power_pin = -1, /* FPGA F3 UIO42 */
  201. .switch_pin = -1, /* FPGA F4 UIO43 */
  202. },
  203. };
  204. static struct omap_board_config_kernel innovator_config[] = {
  205. { OMAP_TAG_USB, NULL },
  206. { OMAP_TAG_MMC, &innovator_mmc_config },
  207. };
  208. static void __init innovator_init(void)
  209. {
  210. #ifdef CONFIG_ARCH_OMAP1510
  211. if (cpu_is_omap1510()) {
  212. platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
  213. }
  214. #endif
  215. #ifdef CONFIG_ARCH_OMAP16XX
  216. if (!cpu_is_omap1510()) {
  217. platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
  218. }
  219. #endif
  220. #ifdef CONFIG_ARCH_OMAP1510
  221. if (cpu_is_omap1510())
  222. innovator_config[0].data = &innovator1510_usb_config;
  223. #endif
  224. #ifdef CONFIG_ARCH_OMAP16XX
  225. if (cpu_is_omap1610())
  226. innovator_config[0].data = &h2_usb_config;
  227. #endif
  228. omap_board_config = innovator_config;
  229. omap_board_config_size = ARRAY_SIZE(innovator_config);
  230. }
  231. static void __init innovator_map_io(void)
  232. {
  233. omap_map_common_io();
  234. #ifdef CONFIG_ARCH_OMAP1510
  235. if (cpu_is_omap1510()) {
  236. iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
  237. udelay(10); /* Delay needed for FPGA */
  238. /* Dump the Innovator FPGA rev early - useful info for support. */
  239. printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
  240. fpga_read(OMAP1510_FPGA_REV_HIGH),
  241. fpga_read(OMAP1510_FPGA_REV_LOW),
  242. fpga_read(OMAP1510_FPGA_BOARD_REV));
  243. }
  244. #endif
  245. omap_serial_init(innovator_serial_ports);
  246. }
  247. MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
  248. /* Maintainer: MontaVista Software, Inc. */
  249. .phys_ram = 0x10000000,
  250. .phys_io = 0xfff00000,
  251. .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
  252. .boot_params = 0x10000100,
  253. .map_io = innovator_map_io,
  254. .init_irq = innovator_init_irq,
  255. .init_machine = innovator_init,
  256. .timer = &omap_timer,
  257. MACHINE_END