120-compex_support.patch 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. From 24025a2dcf1248079dd3019fac6ed955252d277f Mon Sep 17 00:00:00 2001
  2. From: Imre Kaloz <kaloz@openwrt.org>
  3. Date: Mon, 14 Jul 2008 21:56:34 +0200
  4. Subject: [PATCH] Add support for the Compex WP18 / NP18A boards
  5. Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
  6. ---
  7. --- a/arch/arm/mach-ixp4xx/Kconfig
  8. +++ b/arch/arm/mach-ixp4xx/Kconfig
  9. @@ -85,6 +85,14 @@ config MACH_SIDEWINDER
  10. Engineering Sidewinder board. For more information on this
  11. platform, see http://www.adiengineering.com
  12. +config MACH_COMPEXWP18
  13. + bool "Compex WP18 / NP18A"
  14. + select PCI
  15. + help
  16. + Say 'Y' here if you want your kernel to support Compex'
  17. + WP18 or NP18A boards. For more information on this
  18. + platform, see http://www.compex.com.sg/home/OEM/product_ap.htm
  19. +
  20. config ARCH_IXDP425
  21. bool "IXDP425"
  22. help
  23. --- a/arch/arm/mach-ixp4xx/Makefile
  24. +++ b/arch/arm/mach-ixp4xx/Makefile
  25. @@ -21,6 +21,7 @@ obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
  26. obj-pci-$(CONFIG_MACH_ARCOM_VULCAN) += vulcan-pci.o
  27. obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o
  28. obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
  29. +obj-pci-$(CONFIG_MACH_COMPEXWP18) += ixdp425-pci.o
  30. obj-y += common.o
  31. @@ -43,6 +44,7 @@ obj-$(CONFIG_MACH_GORAMO_MLR) += goramo_
  32. obj-$(CONFIG_MACH_ARCOM_VULCAN) += vulcan-setup.o
  33. obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o
  34. obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
  35. +obj-$(CONFIG_MACH_COMPEXWP18) += compex42x-setup.o
  36. obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
  37. obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
  38. --- /dev/null
  39. +++ b/arch/arm/mach-ixp4xx/compex42x-setup.c
  40. @@ -0,0 +1,141 @@
  41. +/*
  42. + * arch/arm/mach-ixp4xx/compex-setup.c
  43. + *
  44. + * Compex WP18 / NP18A board-setup
  45. + *
  46. + * Copyright (C) 2008 Imre Kaloz <Kaloz@openwrt.org>
  47. + *
  48. + * based on coyote-setup.c:
  49. + * Copyright (C) 2003-2005 MontaVista Software, Inc.
  50. + *
  51. + * Author: Imre Kaloz <Kaloz@openwrt.org>
  52. + */
  53. +
  54. +#include <linux/kernel.h>
  55. +#include <linux/serial.h>
  56. +#include <linux/serial_8250.h>
  57. +#include <linux/dma-mapping.h>
  58. +
  59. +#include <asm/mach-types.h>
  60. +#include <asm/mach/arch.h>
  61. +#include <asm/mach/flash.h>
  62. +
  63. +static struct flash_platform_data compex42x_flash_data = {
  64. + .map_name = "cfi_probe",
  65. + .width = 2,
  66. +};
  67. +
  68. +static struct resource compex42x_flash_resource = {
  69. + .flags = IORESOURCE_MEM,
  70. +};
  71. +
  72. +static struct platform_device compex42x_flash = {
  73. + .name = "IXP4XX-Flash",
  74. + .id = 0,
  75. + .dev = {
  76. + .platform_data = &compex42x_flash_data,
  77. + },
  78. + .num_resources = 1,
  79. + .resource = &compex42x_flash_resource,
  80. +};
  81. +
  82. +static struct resource compex42x_uart_resources[] = {
  83. + {
  84. + .start = IXP4XX_UART1_BASE_PHYS,
  85. + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  86. + .flags = IORESOURCE_MEM
  87. + },
  88. + {
  89. + .start = IXP4XX_UART2_BASE_PHYS,
  90. + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  91. + .flags = IORESOURCE_MEM
  92. + }
  93. +};
  94. +
  95. +static struct plat_serial8250_port compex42x_uart_data[] = {
  96. + {
  97. + .mapbase = IXP4XX_UART1_BASE_PHYS,
  98. + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  99. + .irq = IRQ_IXP4XX_UART1,
  100. + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  101. + .iotype = UPIO_MEM,
  102. + .regshift = 2,
  103. + .uartclk = IXP4XX_UART_XTAL,
  104. + },
  105. + {
  106. + .mapbase = IXP4XX_UART2_BASE_PHYS,
  107. + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  108. + .irq = IRQ_IXP4XX_UART2,
  109. + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  110. + .iotype = UPIO_MEM,
  111. + .regshift = 2,
  112. + .uartclk = IXP4XX_UART_XTAL,
  113. + },
  114. + { },
  115. +};
  116. +
  117. +static struct platform_device compex42x_uart = {
  118. + .name = "serial8250",
  119. + .id = PLAT8250_DEV_PLATFORM,
  120. + .dev.platform_data = compex42x_uart_data,
  121. + .num_resources = 2,
  122. + .resource = compex42x_uart_resources,
  123. +};
  124. +
  125. +static struct eth_plat_info compex42x_plat_eth[] = {
  126. + {
  127. + .phy = IXP4XX_ETH_PHY_MAX_ADDR,
  128. + .phy_mask = 0xf0000,
  129. + .rxq = 3,
  130. + .txreadyq = 20,
  131. + }, {
  132. + .phy = 3,
  133. + .rxq = 4,
  134. + .txreadyq = 21,
  135. + }
  136. +};
  137. +
  138. +static struct platform_device compex42x_eth[] = {
  139. + {
  140. + .name = "ixp4xx_eth",
  141. + .id = IXP4XX_ETH_NPEB,
  142. + .dev.platform_data = compex42x_plat_eth,
  143. + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
  144. + }, {
  145. + .name = "ixp4xx_eth",
  146. + .id = IXP4XX_ETH_NPEC,
  147. + .dev.platform_data = compex42x_plat_eth + 1,
  148. + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
  149. + }
  150. +};
  151. +
  152. +static struct platform_device *compex42x_devices[] __initdata = {
  153. + &compex42x_flash,
  154. + &compex42x_uart,
  155. + &compex42x_eth[0],
  156. + &compex42x_eth[1],
  157. +};
  158. +
  159. +static void __init compex42x_init(void)
  160. +{
  161. + ixp4xx_sys_init();
  162. +
  163. + compex42x_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  164. + compex42x_flash_resource.end =
  165. + IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
  166. +
  167. + platform_add_devices(compex42x_devices, ARRAY_SIZE(compex42x_devices));
  168. +}
  169. +
  170. +MACHINE_START(COMPEXWP18, "Compex WP18 / NP18A")
  171. + /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */
  172. + .map_io = ixp4xx_map_io,
  173. + .init_irq = ixp4xx_init_irq,
  174. + .init_time = ixp4xx_timer_init,
  175. + .atag_offset = 0x0100,
  176. + .init_machine = compex42x_init,
  177. +#if defined(CONFIG_PCI)
  178. + .dma_zone_size = SZ_64M,
  179. +#endif
  180. + .restart = ixp4xx_restart,
  181. +MACHINE_END
  182. --- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
  183. +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
  184. @@ -69,7 +69,8 @@ struct hw_pci ixdp425_pci __initdata = {
  185. int __init ixdp425_pci_init(void)
  186. {
  187. if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
  188. - machine_is_ixdp465() || machine_is_kixrp435())
  189. + machine_is_ixdp465() || machine_is_kixrp435() ||
  190. + machine_is_compex42x())
  191. pci_common_init(&ixdp425_pci);
  192. return 0;
  193. }