omixp-setup.c 6.2 KB

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