board-innovator.c 7.7 KB

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