omixp-setup.c 6.2 KB

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