500-usr8200_support.patch 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. --- a/arch/arm/mach-ixp4xx/Kconfig
  2. +++ b/arch/arm/mach-ixp4xx/Kconfig
  3. @@ -93,6 +93,14 @@ config MACH_SIDEWINDER
  4. Engineering Sidewinder board. For more information on this
  5. platform, see http://www.adiengineering.com
  6. +config MACH_USR8200
  7. + bool "USRobotics USR8200"
  8. + select PCI
  9. + help
  10. + Say 'Y' here if you want your kernel to support the USRobotics
  11. + USR8200 router board. For more information on this platform, see
  12. + http://openwrt.org
  13. +
  14. config MACH_COMPEXWP18
  15. bool "Compex WP18 / NP18A"
  16. select PCI
  17. --- a/arch/arm/mach-ixp4xx/Makefile
  18. +++ b/arch/arm/mach-ixp4xx/Makefile
  19. @@ -27,6 +27,7 @@ obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt
  20. obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o
  21. obj-pci-$(CONFIG_MACH_TW5334) += tw5334-pci.o
  22. obj-pci-$(CONFIG_MACH_MI424WR) += mi424wr-pci.o
  23. +obj-pci-$(CONFIG_MACH_USR8200) += usr8200-pci.o
  24. obj-y += common.o
  25. @@ -55,6 +56,7 @@ obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv
  26. obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o
  27. obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o
  28. obj-$(CONFIG_MACH_MI424WR) += mi424wr-setup.o
  29. +obj-$(CONFIG_MACH_USR8200) += usr8200-setup.o
  30. obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
  31. obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
  32. --- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h
  33. +++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
  34. @@ -44,7 +44,8 @@ static __inline__ void __arch_decomp_set
  35. machine_is_gateway7001() || machine_is_wg302v2() ||
  36. machine_is_devixp() || machine_is_miccpt() || machine_is_mic256() ||
  37. machine_is_pronghorn() || machine_is_pronghorn_metro() ||
  38. - machine_is_wrt300nv2() || machine_is_tw5334())
  39. + machine_is_wrt300nv2() || machine_is_tw5334() ||
  40. + machine_is_usr8200())
  41. uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
  42. else
  43. uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
  44. --- /dev/null
  45. +++ b/arch/arm/mach-ixp4xx/usr8200-pci.c
  46. @@ -0,0 +1,77 @@
  47. +/*
  48. + * arch/arch/mach-ixp4xx/usr8200-pci.c
  49. + *
  50. + * PCI setup routines for USRobotics USR8200
  51. + *
  52. + * Copyright (C) 2008 Peter Denison <openwrt@marshadder.org>
  53. + *
  54. + * based on pronghorn-pci.c
  55. + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  56. + * based on coyote-pci.c:
  57. + * Copyright (C) 2002 Jungo Software Technologies.
  58. + * Copyright (C) 2003 MontaVista Softwrae, Inc.
  59. + *
  60. + * Maintainer: Peter Denison <openwrt@marshadder.org>
  61. + *
  62. + * This program is free software; you can redistribute it and/or modify
  63. + * it under the terms of the GNU General Public License version 2 as
  64. + * published by the Free Software Foundation.
  65. + *
  66. + */
  67. +
  68. +#include <linux/kernel.h>
  69. +#include <linux/pci.h>
  70. +#include <linux/init.h>
  71. +#include <linux/irq.h>
  72. +
  73. +#include <asm/mach-types.h>
  74. +#include <mach/hardware.h>
  75. +
  76. +#include <asm/mach/pci.h>
  77. +
  78. +void __init usr8200_pci_preinit(void)
  79. +{
  80. + irq_set_irq_type(IRQ_IXP4XX_GPIO7, IRQ_TYPE_LEVEL_LOW);
  81. + irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
  82. + irq_set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);
  83. + irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
  84. + irq_set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);
  85. +
  86. + ixp4xx_pci_preinit();
  87. +}
  88. +
  89. +static int __init usr8200_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  90. +{
  91. + if (slot == 14)
  92. + return IRQ_IXP4XX_GPIO7;
  93. + else if (slot == 15)
  94. + return IRQ_IXP4XX_GPIO8;
  95. + else if (slot == 16) {
  96. + if (pin == 1)
  97. + return IRQ_IXP4XX_GPIO11;
  98. + else if (pin == 2)
  99. + return IRQ_IXP4XX_GPIO10;
  100. + else if (pin == 3)
  101. + return IRQ_IXP4XX_GPIO9;
  102. + else
  103. + return -1;
  104. + } else
  105. + return -1;
  106. +}
  107. +
  108. +struct hw_pci usr8200_pci __initdata = {
  109. + .nr_controllers = 1,
  110. + .preinit = usr8200_pci_preinit,
  111. + .ops = &ixp4xx_ops,
  112. + .setup = ixp4xx_setup,
  113. + .map_irq = usr8200_map_irq,
  114. +};
  115. +
  116. +int __init usr8200_pci_init(void)
  117. +{
  118. + if (machine_is_usr8200())
  119. + pci_common_init(&usr8200_pci);
  120. + return 0;
  121. +}
  122. +
  123. +subsys_initcall(usr8200_pci_init);
  124. --- /dev/null
  125. +++ b/arch/arm/mach-ixp4xx/usr8200-setup.c
  126. @@ -0,0 +1,217 @@
  127. +/*
  128. + * arch/arm/mach-ixp4xx/usr8200-setup.c
  129. + *
  130. + * Board setup for the USRobotics USR8200
  131. + *
  132. + * Copyright (C) 2008 Peter Denison <openwrt@marshadder.org>
  133. + *
  134. + * based on pronghorn-setup.c:
  135. + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  136. + * based on coyote-setup.c:
  137. + * Copyright (C) 2003-2005 MontaVista Software, Inc.
  138. + *
  139. + * Author: Peter Denison <openwrt@marshadder.org>
  140. + */
  141. +
  142. +#include <linux/kernel.h>
  143. +#include <linux/init.h>
  144. +#include <linux/device.h>
  145. +#include <linux/serial.h>
  146. +#include <linux/tty.h>
  147. +#include <linux/serial_8250.h>
  148. +#include <linux/slab.h>
  149. +#include <linux/types.h>
  150. +#include <linux/memory.h>
  151. +#include <linux/i2c-gpio.h>
  152. +#include <linux/leds.h>
  153. +#include <linux/dma-mapping.h>
  154. +
  155. +#include <asm/setup.h>
  156. +#include <mach/hardware.h>
  157. +#include <asm/irq.h>
  158. +#include <asm/mach-types.h>
  159. +#include <asm/mach/arch.h>
  160. +#include <asm/mach/flash.h>
  161. +
  162. +static struct flash_platform_data usr8200_flash_data = {
  163. + .map_name = "cfi_probe",
  164. + .width = 2,
  165. +};
  166. +
  167. +static struct resource usr8200_flash_resource = {
  168. + .flags = IORESOURCE_MEM,
  169. +};
  170. +
  171. +static struct platform_device usr8200_flash = {
  172. + .name = "IXP4XX-Flash",
  173. + .id = 0,
  174. + .dev = {
  175. + .platform_data = &usr8200_flash_data,
  176. + },
  177. + .num_resources = 1,
  178. + .resource = &usr8200_flash_resource,
  179. +};
  180. +
  181. +static struct resource usr8200_uart_resources [] = {
  182. + {
  183. + .start = IXP4XX_UART2_BASE_PHYS,
  184. + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  185. + .flags = IORESOURCE_MEM
  186. + },
  187. + {
  188. + .start = IXP4XX_UART1_BASE_PHYS,
  189. + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  190. + .flags = IORESOURCE_MEM
  191. + }
  192. +};
  193. +
  194. +static struct plat_serial8250_port usr8200_uart_data[] = {
  195. + {
  196. + .mapbase = IXP4XX_UART2_BASE_PHYS,
  197. + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  198. + .irq = IRQ_IXP4XX_UART2,
  199. + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  200. + .iotype = UPIO_MEM,
  201. + .regshift = 2,
  202. + .uartclk = IXP4XX_UART_XTAL,
  203. + },
  204. + {
  205. + .mapbase = IXP4XX_UART1_BASE_PHYS,
  206. + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  207. + .irq = IRQ_IXP4XX_UART1,
  208. + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  209. + .iotype = UPIO_MEM,
  210. + .regshift = 2,
  211. + .uartclk = IXP4XX_UART_XTAL,
  212. + },
  213. + { },
  214. +};
  215. +
  216. +static struct platform_device usr8200_uart = {
  217. + .name = "serial8250",
  218. + .id = PLAT8250_DEV_PLATFORM,
  219. + .dev = {
  220. + .platform_data = usr8200_uart_data,
  221. + },
  222. + .num_resources = 2,
  223. + .resource = usr8200_uart_resources,
  224. +};
  225. +
  226. +static struct gpio_led usr8200_led_pin[] = {
  227. + {
  228. + .name = "usr8200:usb1",
  229. + .gpio = 0,
  230. + .active_low = 1,
  231. + },
  232. + {
  233. + .name = "usr8200:usb2",
  234. + .gpio = 1,
  235. + .active_low = 1,
  236. + },
  237. + {
  238. + .name = "usr8200:ieee1394",
  239. + .gpio = 2,
  240. + .active_low = 1,
  241. + },
  242. + {
  243. + .name = "usr8200:internal",
  244. + .gpio = 3,
  245. + .active_low = 1,
  246. + },
  247. + {
  248. + .name = "usr8200:power",
  249. + .gpio = 14,
  250. + }
  251. +};
  252. +
  253. +static struct gpio_led_platform_data usr8200_led_data = {
  254. + .num_leds = ARRAY_SIZE(usr8200_led_pin),
  255. + .leds = usr8200_led_pin,
  256. +};
  257. +
  258. +static struct platform_device usr8200_led = {
  259. + .name = "leds-gpio",
  260. + .id = -1,
  261. + .dev.platform_data = &usr8200_led_data,
  262. +};
  263. +
  264. +static struct eth_plat_info usr8200_plat_eth[] = {
  265. + { /* NPEC - LAN with Marvell 88E6060 switch */
  266. + .phy = IXP4XX_ETH_PHY_MAX_ADDR,
  267. + .phy_mask = 0x0F0000,
  268. + .rxq = 4,
  269. + .txreadyq = 21,
  270. + }, { /* NPEB - WAN */
  271. + .phy = 9,
  272. + .rxq = 3,
  273. + .txreadyq = 20,
  274. + }
  275. +};
  276. +
  277. +static struct platform_device usr8200_eth[] = {
  278. + {
  279. + .name = "ixp4xx_eth",
  280. + .id = IXP4XX_ETH_NPEC,
  281. + .dev.platform_data = usr8200_plat_eth,
  282. + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
  283. + }, {
  284. + .name = "ixp4xx_eth",
  285. + .id = IXP4XX_ETH_NPEB,
  286. + .dev.platform_data = usr8200_plat_eth + 1,
  287. + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
  288. + }
  289. +};
  290. +
  291. +static struct resource usr8200_rtc_resources = {
  292. + .flags = IORESOURCE_MEM
  293. +};
  294. +
  295. +static struct platform_device usr8200_rtc = {
  296. + .name = "rtc7301",
  297. + .id = 0,
  298. + .num_resources = 1,
  299. + .resource = &usr8200_rtc_resources,
  300. +};
  301. +
  302. +static struct platform_device *usr8200_devices[] __initdata = {
  303. + &usr8200_flash,
  304. + &usr8200_uart,
  305. + &usr8200_led,
  306. + &usr8200_eth[0],
  307. + &usr8200_eth[1],
  308. + &usr8200_rtc,
  309. +};
  310. +
  311. +static void __init usr8200_init(void)
  312. +{
  313. + ixp4xx_sys_init();
  314. +
  315. + usr8200_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  316. + usr8200_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1;
  317. +
  318. + usr8200_rtc_resources.start = IXP4XX_EXP_BUS_BASE(2);
  319. + usr8200_rtc_resources.end = IXP4XX_EXP_BUS_BASE(2) + 0x01ff;
  320. +
  321. + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
  322. + *IXP4XX_EXP_CS2 = 0x3fff000 | IXP4XX_EXP_BUS_SIZE(0) | IXP4XX_EXP_BUS_WR_EN |
  323. + IXP4XX_EXP_BUS_CS_EN | IXP4XX_EXP_BUS_BYTE_EN;
  324. + *IXP4XX_GPIO_GPCLKR = 0x01100000;
  325. +
  326. + /* configure button as input */
  327. + gpio_line_config(12, IXP4XX_GPIO_IN);
  328. +
  329. + platform_add_devices(usr8200_devices, ARRAY_SIZE(usr8200_devices));
  330. +}
  331. +
  332. +MACHINE_START(USR8200, "USRobotics USR8200")
  333. + /* Maintainer: Peter Denison <openwrt@marshadder.org> */
  334. + .map_io = ixp4xx_map_io,
  335. + .init_irq = ixp4xx_init_irq,
  336. + .init_time = ixp4xx_timer_init,
  337. + .atag_offset = 0x0100,
  338. + .init_machine = usr8200_init,
  339. +#if defined(CONFIG_PCI)
  340. + .dma_zone_size = SZ_64M,
  341. +#endif
  342. + .restart = ixp4xx_restart,
  343. +MACHINE_END