130-wrt300nv2_support.patch 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. --- a/arch/arm/mach-ixp4xx/Kconfig
  2. +++ b/arch/arm/mach-ixp4xx/Kconfig
  3. @@ -93,6 +93,14 @@ config MACH_COMPEXWP18
  4. WP18 or NP18A boards. For more information on this
  5. platform, see http://www.compex.com.sg/home/OEM/product_ap.htm
  6. +config MACH_WRT300NV2
  7. + bool "Linksys WRT300N v2"
  8. + select PCI
  9. + help
  10. + Say 'Y' here if you want your kernel to support Linksys'
  11. + WRT300N v2 router. For more information on this
  12. + platform, see http://openwrt.org
  13. +
  14. config ARCH_IXDP425
  15. bool "IXDP425"
  16. help
  17. --- a/arch/arm/mach-ixp4xx/Makefile
  18. +++ b/arch/arm/mach-ixp4xx/Makefile
  19. @@ -22,6 +22,7 @@ obj-pci-$(CONFIG_MACH_ARCOM_VULCAN) += v
  20. obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o
  21. obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
  22. obj-pci-$(CONFIG_MACH_COMPEXWP18) += ixdp425-pci.o
  23. +obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o
  24. obj-y += common.o
  25. @@ -45,6 +46,7 @@ obj-$(CONFIG_MACH_ARCOM_VULCAN) += vulca
  26. obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o
  27. obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
  28. obj-$(CONFIG_MACH_COMPEXWP18) += compex42x-setup.o
  29. +obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-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. @@ -43,7 +43,8 @@ static __inline__ void __arch_decomp_set
  35. if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
  36. machine_is_gateway7001() || machine_is_wg302v2() ||
  37. machine_is_devixp() || machine_is_miccpt() || machine_is_mic256() ||
  38. - machine_is_pronghorn() || machine_is_pronghorn_metro())
  39. + machine_is_pronghorn() || machine_is_pronghorn_metro() ||
  40. + machine_is_wrt300nv2())
  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/wrt300nv2-pci.c
  46. @@ -0,0 +1,64 @@
  47. +/*
  48. + * arch/arch/mach-ixp4xx/wrt300nv2-pci.c
  49. + *
  50. + * PCI setup routines for Linksys WRT300N v2
  51. + *
  52. + * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org>
  53. + *
  54. + * based on coyote-pci.c:
  55. + * Copyright (C) 2002 Jungo Software Technologies.
  56. + * Copyright (C) 2003 MontaVista Softwrae, Inc.
  57. + *
  58. + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
  59. + *
  60. + * This program is free software; you can redistribute it and/or modify
  61. + * it under the terms of the GNU General Public License version 2 as
  62. + * published by the Free Software Foundation.
  63. + *
  64. + */
  65. +
  66. +#include <linux/kernel.h>
  67. +#include <linux/pci.h>
  68. +#include <linux/init.h>
  69. +#include <linux/irq.h>
  70. +
  71. +#include <asm/mach-types.h>
  72. +#include <mach/hardware.h>
  73. +#include <asm/irq.h>
  74. +
  75. +#include <asm/mach/pci.h>
  76. +
  77. +extern void ixp4xx_pci_preinit(void);
  78. +extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
  79. +extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
  80. +
  81. +void __init wrt300nv2_pci_preinit(void)
  82. +{
  83. + irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
  84. +
  85. + ixp4xx_pci_preinit();
  86. +}
  87. +
  88. +static int __init wrt300nv2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  89. +{
  90. + if (slot == 1)
  91. + return IRQ_IXP4XX_GPIO8;
  92. + else return -1;
  93. +}
  94. +
  95. +struct hw_pci wrt300nv2_pci __initdata = {
  96. + .nr_controllers = 1,
  97. + .preinit = wrt300nv2_pci_preinit,
  98. + .ops = &ixp4xx_ops,
  99. + .setup = ixp4xx_setup,
  100. + .map_irq = wrt300nv2_map_irq,
  101. +};
  102. +
  103. +int __init wrt300nv2_pci_init(void)
  104. +{
  105. + if (machine_is_wrt300nv2())
  106. + pci_common_init(&wrt300nv2_pci);
  107. + return 0;
  108. +}
  109. +
  110. +subsys_initcall(wrt300nv2_pci_init);
  111. --- /dev/null
  112. +++ b/arch/arm/mach-ixp4xx/wrt300nv2-setup.c
  113. @@ -0,0 +1,110 @@
  114. +/*
  115. + * arch/arm/mach-ixp4xx/wrt300nv2-setup.c
  116. + *
  117. + * Board setup for the Linksys WRT300N v2
  118. + *
  119. + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
  120. + *
  121. + * based on coyote-setup.c:
  122. + * Copyright (C) 2003-2005 MontaVista Software, Inc.
  123. + *
  124. + * Author: Imre Kaloz <Kaloz@openwrt.org>
  125. + */
  126. +
  127. +#include <linux/kernel.h>
  128. +#include <linux/init.h>
  129. +#include <linux/device.h>
  130. +#include <linux/serial.h>
  131. +#include <linux/tty.h>
  132. +#include <linux/serial_8250.h>
  133. +#include <linux/slab.h>
  134. +
  135. +#include <asm/types.h>
  136. +#include <asm/setup.h>
  137. +#include <asm/memory.h>
  138. +#include <mach/hardware.h>
  139. +#include <asm/irq.h>
  140. +#include <asm/mach-types.h>
  141. +#include <asm/mach/arch.h>
  142. +#include <asm/mach/flash.h>
  143. +
  144. +static struct flash_platform_data wrt300nv2_flash_data = {
  145. + .map_name = "cfi_probe",
  146. + .width = 2,
  147. +};
  148. +
  149. +static struct resource wrt300nv2_flash_resource = {
  150. + .flags = IORESOURCE_MEM,
  151. +};
  152. +
  153. +static struct platform_device wrt300nv2_flash = {
  154. + .name = "IXP4XX-Flash",
  155. + .id = 0,
  156. + .dev = {
  157. + .platform_data = &wrt300nv2_flash_data,
  158. + },
  159. + .num_resources = 1,
  160. + .resource = &wrt300nv2_flash_resource,
  161. +};
  162. +
  163. +static struct resource wrt300nv2_uart_resource = {
  164. + .start = IXP4XX_UART2_BASE_PHYS,
  165. + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  166. + .flags = IORESOURCE_MEM,
  167. +};
  168. +
  169. +static struct plat_serial8250_port wrt300nv2_uart_data[] = {
  170. + {
  171. + .mapbase = IXP4XX_UART2_BASE_PHYS,
  172. + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  173. + .irq = IRQ_IXP4XX_UART2,
  174. + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  175. + .iotype = UPIO_MEM,
  176. + .regshift = 2,
  177. + .uartclk = IXP4XX_UART_XTAL,
  178. + },
  179. + { },
  180. +};
  181. +
  182. +static struct platform_device wrt300nv2_uart = {
  183. + .name = "serial8250",
  184. + .id = PLAT8250_DEV_PLATFORM,
  185. + .dev = {
  186. + .platform_data = wrt300nv2_uart_data,
  187. + },
  188. + .num_resources = 1,
  189. + .resource = &wrt300nv2_uart_resource,
  190. +};
  191. +
  192. +static struct platform_device *wrt300nv2_devices[] __initdata = {
  193. + &wrt300nv2_flash,
  194. + &wrt300nv2_uart
  195. +};
  196. +
  197. +static void __init wrt300nv2_init(void)
  198. +{
  199. + ixp4xx_sys_init();
  200. +
  201. + wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  202. + wrt300nv2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
  203. +
  204. + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
  205. + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
  206. +
  207. + platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices));
  208. +}
  209. +
  210. +#ifdef CONFIG_MACH_WRT300NV2
  211. +MACHINE_START(WRT300NV2, "Linksys WRT300N v2")
  212. + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
  213. + .map_io = ixp4xx_map_io,
  214. + .init_irq = ixp4xx_init_irq,
  215. + .init_time = ixp4xx_timer_init,
  216. + .atag_offset = 0x0100,
  217. + .init_machine = wrt300nv2_init,
  218. +#if defined(CONFIG_PCI)
  219. + .dma_zone_size = SZ_64M,
  220. +#endif
  221. + .restart = ixp4xx_restart,
  222. +MACHINE_END
  223. +#endif