vulcan-setup.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*
  2. * arch/arm/mach-ixp4xx/vulcan-setup.c
  3. *
  4. * Arcom/Eurotech Vulcan board-setup
  5. *
  6. * Copyright (C) 2010 Marc Zyngier <maz@misterjones.org>
  7. *
  8. * based on fsg-setup.c:
  9. * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au>
  10. */
  11. #include <linux/if_ether.h>
  12. #include <linux/irq.h>
  13. #include <linux/serial.h>
  14. #include <linux/serial_8250.h>
  15. #include <linux/io.h>
  16. #include <linux/w1-gpio.h>
  17. #include <linux/mtd/plat-ram.h>
  18. #include <asm/mach-types.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach/flash.h>
  21. static struct flash_platform_data vulcan_flash_data = {
  22. .map_name = "cfi_probe",
  23. .width = 2,
  24. };
  25. static struct resource vulcan_flash_resource = {
  26. .flags = IORESOURCE_MEM,
  27. };
  28. static struct platform_device vulcan_flash = {
  29. .name = "IXP4XX-Flash",
  30. .id = 0,
  31. .dev = {
  32. .platform_data = &vulcan_flash_data,
  33. },
  34. .resource = &vulcan_flash_resource,
  35. .num_resources = 1,
  36. };
  37. static struct platdata_mtd_ram vulcan_sram_data = {
  38. .mapname = "Vulcan SRAM",
  39. .bankwidth = 1,
  40. };
  41. static struct resource vulcan_sram_resource = {
  42. .flags = IORESOURCE_MEM,
  43. };
  44. static struct platform_device vulcan_sram = {
  45. .name = "mtd-ram",
  46. .id = 0,
  47. .dev = {
  48. .platform_data = &vulcan_sram_data,
  49. },
  50. .resource = &vulcan_sram_resource,
  51. .num_resources = 1,
  52. };
  53. static struct resource vulcan_uart_resources[] = {
  54. [0] = {
  55. .start = IXP4XX_UART1_BASE_PHYS,
  56. .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  57. .flags = IORESOURCE_MEM,
  58. },
  59. [1] = {
  60. .start = IXP4XX_UART2_BASE_PHYS,
  61. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  62. .flags = IORESOURCE_MEM,
  63. },
  64. [2] = {
  65. .flags = IORESOURCE_MEM,
  66. },
  67. };
  68. static struct plat_serial8250_port vulcan_uart_data[] = {
  69. [0] = {
  70. .mapbase = IXP4XX_UART1_BASE_PHYS,
  71. .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  72. .irq = IRQ_IXP4XX_UART1,
  73. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  74. .iotype = UPIO_MEM,
  75. .regshift = 2,
  76. .uartclk = IXP4XX_UART_XTAL,
  77. },
  78. [1] = {
  79. .mapbase = IXP4XX_UART2_BASE_PHYS,
  80. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  81. .irq = IRQ_IXP4XX_UART2,
  82. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  83. .iotype = UPIO_MEM,
  84. .regshift = 2,
  85. .uartclk = IXP4XX_UART_XTAL,
  86. },
  87. [2] = {
  88. .irq = IXP4XX_GPIO_IRQ(4),
  89. .irqflags = IRQF_TRIGGER_LOW,
  90. .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  91. .iotype = UPIO_MEM,
  92. .uartclk = 1843200,
  93. },
  94. [3] = {
  95. .irq = IXP4XX_GPIO_IRQ(4),
  96. .irqflags = IRQF_TRIGGER_LOW,
  97. .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  98. .iotype = UPIO_MEM,
  99. .uartclk = 1843200,
  100. },
  101. { }
  102. };
  103. static struct platform_device vulcan_uart = {
  104. .name = "serial8250",
  105. .id = PLAT8250_DEV_PLATFORM,
  106. .dev = {
  107. .platform_data = vulcan_uart_data,
  108. },
  109. .resource = vulcan_uart_resources,
  110. .num_resources = ARRAY_SIZE(vulcan_uart_resources),
  111. };
  112. static struct eth_plat_info vulcan_plat_eth[] = {
  113. [0] = {
  114. .phy = 0,
  115. .rxq = 3,
  116. .txreadyq = 20,
  117. },
  118. [1] = {
  119. .phy = 1,
  120. .rxq = 4,
  121. .txreadyq = 21,
  122. },
  123. };
  124. static struct platform_device vulcan_eth[] = {
  125. [0] = {
  126. .name = "ixp4xx_eth",
  127. .id = IXP4XX_ETH_NPEB,
  128. .dev = {
  129. .platform_data = &vulcan_plat_eth[0],
  130. },
  131. },
  132. [1] = {
  133. .name = "ixp4xx_eth",
  134. .id = IXP4XX_ETH_NPEC,
  135. .dev = {
  136. .platform_data = &vulcan_plat_eth[1],
  137. },
  138. },
  139. };
  140. static struct resource vulcan_max6369_resource = {
  141. .flags = IORESOURCE_MEM,
  142. };
  143. static struct platform_device vulcan_max6369 = {
  144. .name = "max6369_wdt",
  145. .id = -1,
  146. .resource = &vulcan_max6369_resource,
  147. .num_resources = 1,
  148. };
  149. static struct w1_gpio_platform_data vulcan_w1_gpio_pdata = {
  150. .pin = 14,
  151. .ext_pullup_enable_pin = -EINVAL,
  152. };
  153. static struct platform_device vulcan_w1_gpio = {
  154. .name = "w1-gpio",
  155. .id = 0,
  156. .dev = {
  157. .platform_data = &vulcan_w1_gpio_pdata,
  158. },
  159. };
  160. static struct platform_device *vulcan_devices[] __initdata = {
  161. &vulcan_uart,
  162. &vulcan_flash,
  163. &vulcan_sram,
  164. &vulcan_max6369,
  165. &vulcan_eth[0],
  166. &vulcan_eth[1],
  167. &vulcan_w1_gpio,
  168. };
  169. static void __init vulcan_init(void)
  170. {
  171. ixp4xx_sys_init();
  172. /* Flash is spread over both CS0 and CS1 */
  173. vulcan_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  174. vulcan_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
  175. *IXP4XX_EXP_CS0 = IXP4XX_EXP_BUS_CS_EN |
  176. IXP4XX_EXP_BUS_STROBE_T(3) |
  177. IXP4XX_EXP_BUS_SIZE(0xF) |
  178. IXP4XX_EXP_BUS_BYTE_RD16 |
  179. IXP4XX_EXP_BUS_WR_EN;
  180. *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
  181. /* SRAM on CS2, (256kB, 8bit, writable) */
  182. vulcan_sram_resource.start = IXP4XX_EXP_BUS_BASE(2);
  183. vulcan_sram_resource.end = IXP4XX_EXP_BUS_BASE(2) + SZ_256K - 1;
  184. *IXP4XX_EXP_CS2 = IXP4XX_EXP_BUS_CS_EN |
  185. IXP4XX_EXP_BUS_STROBE_T(1) |
  186. IXP4XX_EXP_BUS_HOLD_T(2) |
  187. IXP4XX_EXP_BUS_SIZE(9) |
  188. IXP4XX_EXP_BUS_SPLT_EN |
  189. IXP4XX_EXP_BUS_WR_EN |
  190. IXP4XX_EXP_BUS_BYTE_EN;
  191. /* XR16L2551 on CS3 (Moto style, 512 bytes, 8bits, writable) */
  192. vulcan_uart_resources[2].start = IXP4XX_EXP_BUS_BASE(3);
  193. vulcan_uart_resources[2].end = IXP4XX_EXP_BUS_BASE(3) + 16 - 1;
  194. vulcan_uart_data[2].mapbase = vulcan_uart_resources[2].start;
  195. vulcan_uart_data[3].mapbase = vulcan_uart_data[2].mapbase + 8;
  196. *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN |
  197. IXP4XX_EXP_BUS_STROBE_T(3) |
  198. IXP4XX_EXP_BUS_CYCLES(IXP4XX_EXP_BUS_CYCLES_MOTOROLA)|
  199. IXP4XX_EXP_BUS_WR_EN |
  200. IXP4XX_EXP_BUS_BYTE_EN;
  201. /* GPIOS on CS4 (512 bytes, 8bits, writable) */
  202. *IXP4XX_EXP_CS4 = IXP4XX_EXP_BUS_CS_EN |
  203. IXP4XX_EXP_BUS_WR_EN |
  204. IXP4XX_EXP_BUS_BYTE_EN;
  205. /* max6369 on CS5 (512 bytes, 8bits, writable) */
  206. vulcan_max6369_resource.start = IXP4XX_EXP_BUS_BASE(5);
  207. vulcan_max6369_resource.end = IXP4XX_EXP_BUS_BASE(5);
  208. *IXP4XX_EXP_CS5 = IXP4XX_EXP_BUS_CS_EN |
  209. IXP4XX_EXP_BUS_WR_EN |
  210. IXP4XX_EXP_BUS_BYTE_EN;
  211. platform_add_devices(vulcan_devices, ARRAY_SIZE(vulcan_devices));
  212. }
  213. MACHINE_START(ARCOM_VULCAN, "Arcom/Eurotech Vulcan")
  214. /* Maintainer: Marc Zyngier <maz@misterjones.org> */
  215. .map_io = ixp4xx_map_io,
  216. .init_early = ixp4xx_init_early,
  217. .init_irq = ixp4xx_init_irq,
  218. .init_time = ixp4xx_timer_init,
  219. .atag_offset = 0x100,
  220. .init_machine = vulcan_init,
  221. #if defined(CONFIG_PCI)
  222. .dma_zone_size = SZ_64M,
  223. #endif
  224. .restart = ixp4xx_restart,
  225. MACHINE_END