omixp-setup.c 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * arch/arm/mach-ixp4xx/omixp-setup.c
  4. *
  5. * omicron ixp4xx board setup
  6. * Copyright (C) 2009 OMICRON electronics GmbH
  7. *
  8. * based nslu2-setup.c, ixdp425-setup.c:
  9. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/serial.h>
  13. #include <linux/serial_8250.h>
  14. #include <linux/mtd/mtd.h>
  15. #include <linux/mtd/partitions.h>
  16. #include <linux/leds.h>
  17. #include <asm/setup.h>
  18. #include <asm/memory.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/mach/arch.h>
  21. #include <asm/mach/flash.h>
  22. #include <mach/hardware.h>
  23. #include "irqs.h"
  24. static struct resource omixp_flash_resources[] = {
  25. {
  26. .flags = IORESOURCE_MEM,
  27. }, {
  28. .flags = IORESOURCE_MEM,
  29. },
  30. };
  31. static struct mtd_partition omixp_partitions[] = {
  32. {
  33. .name = "Recovery Bootloader",
  34. .size = 0x00020000,
  35. .offset = 0,
  36. }, {
  37. .name = "Calibration Data",
  38. .size = 0x00020000,
  39. .offset = 0x00020000,
  40. }, {
  41. .name = "Recovery FPGA",
  42. .size = 0x00020000,
  43. .offset = 0x00040000,
  44. }, {
  45. .name = "Release Bootloader",
  46. .size = 0x00020000,
  47. .offset = 0x00060000,
  48. }, {
  49. .name = "Release FPGA",
  50. .size = 0x00020000,
  51. .offset = 0x00080000,
  52. }, {
  53. .name = "Kernel",
  54. .size = 0x00160000,
  55. .offset = 0x000a0000,
  56. }, {
  57. .name = "Filesystem",
  58. .size = 0x00C00000,
  59. .offset = 0x00200000,
  60. }, {
  61. .name = "Persistent Storage",
  62. .size = 0x00200000,
  63. .offset = 0x00E00000,
  64. },
  65. };
  66. static struct flash_platform_data omixp_flash_data[] = {
  67. {
  68. .map_name = "cfi_probe",
  69. .parts = omixp_partitions,
  70. .nr_parts = ARRAY_SIZE(omixp_partitions),
  71. }, {
  72. .map_name = "cfi_probe",
  73. .parts = NULL,
  74. .nr_parts = 0,
  75. },
  76. };
  77. static struct platform_device omixp_flash_device[] = {
  78. {
  79. .name = "IXP4XX-Flash",
  80. .id = 0,
  81. .dev = {
  82. .platform_data = &omixp_flash_data[0],
  83. },
  84. .resource = &omixp_flash_resources[0],
  85. .num_resources = 1,
  86. }, {
  87. .name = "IXP4XX-Flash",
  88. .id = 1,
  89. .dev = {
  90. .platform_data = &omixp_flash_data[1],
  91. },
  92. .resource = &omixp_flash_resources[1],
  93. .num_resources = 1,
  94. },
  95. };
  96. /* Swap UART's - These boards have the console on UART2. The following
  97. * configuration is used:
  98. * ttyS0 .. UART2
  99. * ttyS1 .. UART1
  100. * This way standard images can be used with the kernel that expect
  101. * the console on ttyS0.
  102. */
  103. static struct resource omixp_uart_resources[] = {
  104. {
  105. .start = IXP4XX_UART2_BASE_PHYS,
  106. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  107. .flags = IORESOURCE_MEM,
  108. }, {
  109. .start = IXP4XX_UART1_BASE_PHYS,
  110. .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  111. .flags = IORESOURCE_MEM,
  112. },
  113. };
  114. static struct plat_serial8250_port omixp_uart_data[] = {
  115. {
  116. .mapbase = IXP4XX_UART2_BASE_PHYS,
  117. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  118. .irq = IRQ_IXP4XX_UART2,
  119. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  120. .iotype = UPIO_MEM,
  121. .regshift = 2,
  122. .uartclk = IXP4XX_UART_XTAL,
  123. }, {
  124. .mapbase = IXP4XX_UART1_BASE_PHYS,
  125. .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  126. .irq = IRQ_IXP4XX_UART1,
  127. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  128. .iotype = UPIO_MEM,
  129. .regshift = 2,
  130. .uartclk = IXP4XX_UART_XTAL,
  131. }, {
  132. /* list termination */
  133. }
  134. };
  135. static struct platform_device omixp_uart = {
  136. .name = "serial8250",
  137. .id = PLAT8250_DEV_PLATFORM,
  138. .dev.platform_data = omixp_uart_data,
  139. .num_resources = 2,
  140. .resource = omixp_uart_resources,
  141. };
  142. static struct gpio_led mic256_led_pins[] = {
  143. {
  144. .name = "LED-A",
  145. .gpio = 7,
  146. },
  147. };
  148. static struct gpio_led_platform_data mic256_led_data = {
  149. .num_leds = ARRAY_SIZE(mic256_led_pins),
  150. .leds = mic256_led_pins,
  151. };
  152. static struct platform_device mic256_leds = {
  153. .name = "leds-gpio",
  154. .id = -1,
  155. .dev.platform_data = &mic256_led_data,
  156. };
  157. /* Built-in 10/100 Ethernet MAC interfaces */
  158. static struct resource ixp425_npeb_resources[] = {
  159. {
  160. .start = IXP4XX_EthB_BASE_PHYS,
  161. .end = IXP4XX_EthB_BASE_PHYS + 0x0fff,
  162. .flags = IORESOURCE_MEM,
  163. },
  164. };
  165. static struct resource ixp425_npec_resources[] = {
  166. {
  167. .start = IXP4XX_EthC_BASE_PHYS,
  168. .end = IXP4XX_EthC_BASE_PHYS + 0x0fff,
  169. .flags = IORESOURCE_MEM,
  170. },
  171. };
  172. static struct eth_plat_info ixdp425_plat_eth[] = {
  173. {
  174. .phy = 0,
  175. .rxq = 3,
  176. .txreadyq = 20,
  177. }, {
  178. .phy = 1,
  179. .rxq = 4,
  180. .txreadyq = 21,
  181. },
  182. };
  183. static struct platform_device ixdp425_eth[] = {
  184. {
  185. .name = "ixp4xx_eth",
  186. .id = IXP4XX_ETH_NPEB,
  187. .dev.platform_data = ixdp425_plat_eth,
  188. .num_resources = ARRAY_SIZE(ixp425_npeb_resources),
  189. .resource = ixp425_npeb_resources,
  190. }, {
  191. .name = "ixp4xx_eth",
  192. .id = IXP4XX_ETH_NPEC,
  193. .dev.platform_data = ixdp425_plat_eth + 1,
  194. .num_resources = ARRAY_SIZE(ixp425_npec_resources),
  195. .resource = ixp425_npec_resources,
  196. },
  197. };
  198. static struct platform_device *devixp_pldev[] __initdata = {
  199. &omixp_uart,
  200. &omixp_flash_device[0],
  201. &ixdp425_eth[0],
  202. &ixdp425_eth[1],
  203. };
  204. static struct platform_device *mic256_pldev[] __initdata = {
  205. &omixp_uart,
  206. &omixp_flash_device[0],
  207. &mic256_leds,
  208. &ixdp425_eth[0],
  209. &ixdp425_eth[1],
  210. };
  211. static struct platform_device *miccpt_pldev[] __initdata = {
  212. &omixp_uart,
  213. &omixp_flash_device[0],
  214. &omixp_flash_device[1],
  215. &ixdp425_eth[0],
  216. &ixdp425_eth[1],
  217. };
  218. static void __init omixp_init(void)
  219. {
  220. ixp4xx_sys_init();
  221. /* 16MiB Boot Flash */
  222. omixp_flash_resources[0].start = IXP4XX_EXP_BUS_BASE(0);
  223. omixp_flash_resources[0].end = IXP4XX_EXP_BUS_END(0);
  224. /* 32 MiB Data Flash */
  225. omixp_flash_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
  226. omixp_flash_resources[1].end = IXP4XX_EXP_BUS_END(2);
  227. if (machine_is_devixp())
  228. platform_add_devices(devixp_pldev, ARRAY_SIZE(devixp_pldev));
  229. else if (machine_is_miccpt())
  230. platform_add_devices(miccpt_pldev, ARRAY_SIZE(miccpt_pldev));
  231. else if (machine_is_mic256())
  232. platform_add_devices(mic256_pldev, ARRAY_SIZE(mic256_pldev));
  233. }
  234. #ifdef CONFIG_MACH_DEVIXP
  235. MACHINE_START(DEVIXP, "Omicron DEVIXP")
  236. .atag_offset = 0x100,
  237. .map_io = ixp4xx_map_io,
  238. .init_early = ixp4xx_init_early,
  239. .init_irq = ixp4xx_init_irq,
  240. .init_time = ixp4xx_timer_init,
  241. .init_machine = omixp_init,
  242. .restart = ixp4xx_restart,
  243. MACHINE_END
  244. #endif
  245. #ifdef CONFIG_MACH_MICCPT
  246. MACHINE_START(MICCPT, "Omicron MICCPT")
  247. .atag_offset = 0x100,
  248. .map_io = ixp4xx_map_io,
  249. .init_early = ixp4xx_init_early,
  250. .init_irq = ixp4xx_init_irq,
  251. .init_time = ixp4xx_timer_init,
  252. .init_machine = omixp_init,
  253. #if defined(CONFIG_PCI)
  254. .dma_zone_size = SZ_64M,
  255. #endif
  256. .restart = ixp4xx_restart,
  257. MACHINE_END
  258. #endif
  259. #ifdef CONFIG_MACH_MIC256
  260. MACHINE_START(MIC256, "Omicron MIC256")
  261. .atag_offset = 0x100,
  262. .map_io = ixp4xx_map_io,
  263. .init_early = ixp4xx_init_early,
  264. .init_irq = ixp4xx_init_irq,
  265. .init_time = ixp4xx_timer_init,
  266. .init_machine = omixp_init,
  267. .restart = ixp4xx_restart,
  268. MACHINE_END
  269. #endif