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