vulcan-setup.c 6.3 KB

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