board-innovator.c 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. /*
  2. * linux/arch/arm/mach-omap/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/fpga.h>
  30. #include <asm/arch/gpio.h>
  31. #include <asm/arch/tc.h>
  32. #include <asm/arch/usb.h>
  33. #include "common.h"
  34. static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
  35. static struct mtd_partition innovator_partitions[] = {
  36. /* bootloader (U-Boot, etc) in first sector */
  37. {
  38. .name = "bootloader",
  39. .offset = 0,
  40. .size = SZ_128K,
  41. .mask_flags = MTD_WRITEABLE, /* force read-only */
  42. },
  43. /* bootloader params in the next sector */
  44. {
  45. .name = "params",
  46. .offset = MTDPART_OFS_APPEND,
  47. .size = SZ_128K,
  48. .mask_flags = 0,
  49. },
  50. /* kernel */
  51. {
  52. .name = "kernel",
  53. .offset = MTDPART_OFS_APPEND,
  54. .size = SZ_2M,
  55. .mask_flags = 0
  56. },
  57. /* rest of flash1 is a file system */
  58. {
  59. .name = "rootfs",
  60. .offset = MTDPART_OFS_APPEND,
  61. .size = SZ_16M - SZ_2M - 2 * SZ_128K,
  62. .mask_flags = 0
  63. },
  64. /* file system */
  65. {
  66. .name = "filesystem",
  67. .offset = MTDPART_OFS_APPEND,
  68. .size = MTDPART_SIZ_FULL,
  69. .mask_flags = 0
  70. }
  71. };
  72. static struct flash_platform_data innovator_flash_data = {
  73. .map_name = "cfi_probe",
  74. .width = 2,
  75. .parts = innovator_partitions,
  76. .nr_parts = ARRAY_SIZE(innovator_partitions),
  77. };
  78. static struct resource innovator_flash_resource = {
  79. .start = OMAP_CS0_PHYS,
  80. .end = OMAP_CS0_PHYS + SZ_32M - 1,
  81. .flags = IORESOURCE_MEM,
  82. };
  83. static struct platform_device innovator_flash_device = {
  84. .name = "omapflash",
  85. .id = 0,
  86. .dev = {
  87. .platform_data = &innovator_flash_data,
  88. },
  89. .num_resources = 1,
  90. .resource = &innovator_flash_resource,
  91. };
  92. #ifdef CONFIG_ARCH_OMAP1510
  93. /* Only FPGA needs to be mapped here. All others are done with ioremap */
  94. static struct map_desc innovator1510_io_desc[] __initdata = {
  95. { OMAP1510_FPGA_BASE, OMAP1510_FPGA_START, OMAP1510_FPGA_SIZE,
  96. MT_DEVICE },
  97. };
  98. static struct resource innovator1510_smc91x_resources[] = {
  99. [0] = {
  100. .start = OMAP1510_FPGA_ETHR_START, /* Physical */
  101. .end = OMAP1510_FPGA_ETHR_START + 0xf,
  102. .flags = IORESOURCE_MEM,
  103. },
  104. [1] = {
  105. .start = OMAP1510_INT_ETHER,
  106. .end = OMAP1510_INT_ETHER,
  107. .flags = IORESOURCE_IRQ,
  108. },
  109. };
  110. static struct platform_device innovator1510_smc91x_device = {
  111. .name = "smc91x",
  112. .id = 0,
  113. .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources),
  114. .resource = innovator1510_smc91x_resources,
  115. };
  116. static struct platform_device *innovator1510_devices[] __initdata = {
  117. &innovator_flash_device,
  118. &innovator1510_smc91x_device,
  119. };
  120. #endif /* CONFIG_ARCH_OMAP1510 */
  121. #ifdef CONFIG_ARCH_OMAP16XX
  122. static struct resource innovator1610_smc91x_resources[] = {
  123. [0] = {
  124. .start = INNOVATOR1610_ETHR_START, /* Physical */
  125. .end = INNOVATOR1610_ETHR_START + 0xf,
  126. .flags = IORESOURCE_MEM,
  127. },
  128. [1] = {
  129. .start = OMAP_GPIO_IRQ(0),
  130. .end = OMAP_GPIO_IRQ(0),
  131. .flags = IORESOURCE_IRQ,
  132. },
  133. };
  134. static struct platform_device innovator1610_smc91x_device = {
  135. .name = "smc91x",
  136. .id = 0,
  137. .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources),
  138. .resource = innovator1610_smc91x_resources,
  139. };
  140. static struct platform_device *innovator1610_devices[] __initdata = {
  141. &innovator_flash_device,
  142. &innovator1610_smc91x_device,
  143. };
  144. #endif /* CONFIG_ARCH_OMAP16XX */
  145. static void __init innovator_init_smc91x(void)
  146. {
  147. if (cpu_is_omap1510()) {
  148. fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1,
  149. OMAP1510_FPGA_RST);
  150. udelay(750);
  151. } else {
  152. if ((omap_request_gpio(0)) < 0) {
  153. printk("Error requesting gpio 0 for smc91x irq\n");
  154. return;
  155. }
  156. omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
  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_board_config_kernel innovator_config[] = {
  196. { OMAP_TAG_USB, NULL },
  197. };
  198. static void __init innovator_init(void)
  199. {
  200. #ifdef CONFIG_ARCH_OMAP1510
  201. if (cpu_is_omap1510()) {
  202. platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
  203. }
  204. #endif
  205. #ifdef CONFIG_ARCH_OMAP16XX
  206. if (!cpu_is_omap1510()) {
  207. platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
  208. }
  209. #endif
  210. #ifdef CONFIG_ARCH_OMAP1510
  211. if (cpu_is_omap1510())
  212. innovator_config[0].data = &innovator1510_usb_config;
  213. #endif
  214. #ifdef CONFIG_ARCH_OMAP16XX
  215. if (cpu_is_omap1610())
  216. innovator_config[0].data = &h2_usb_config;
  217. #endif
  218. omap_board_config = innovator_config;
  219. omap_board_config_size = ARRAY_SIZE(innovator_config);
  220. }
  221. static void __init innovator_map_io(void)
  222. {
  223. omap_map_io();
  224. #ifdef CONFIG_ARCH_OMAP1510
  225. if (cpu_is_omap1510()) {
  226. iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
  227. udelay(10); /* Delay needed for FPGA */
  228. /* Dump the Innovator FPGA rev early - useful info for support. */
  229. printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
  230. fpga_read(OMAP1510_FPGA_REV_HIGH),
  231. fpga_read(OMAP1510_FPGA_REV_LOW),
  232. fpga_read(OMAP1510_FPGA_BOARD_REV));
  233. }
  234. #endif
  235. omap_serial_init(innovator_serial_ports);
  236. }
  237. MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
  238. /* Maintainer: MontaVista Software, Inc. */
  239. .phys_ram = 0x10000000,
  240. .phys_io = 0xfff00000,
  241. .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
  242. .boot_params = 0x10000100,
  243. .map_io = innovator_map_io,
  244. .init_irq = innovator_init_irq,
  245. .init_machine = innovator_init,
  246. .timer = &omap_timer,
  247. MACHINE_END