150-lanready_ap1000_support.patch 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. --- a/arch/arm/mach-ixp4xx/Kconfig
  2. +++ b/arch/arm/mach-ixp4xx/Kconfig
  3. @@ -101,6 +101,14 @@ config MACH_WRT300NV2
  4. WRT300N v2 router. For more information on this
  5. platform, see http://openwrt.org
  6. +config MACH_AP1000
  7. + bool "Lanready AP-1000"
  8. + select PCI
  9. + help
  10. + Say 'Y' here if you want your kernel to support Lanready's
  11. + AP1000 board. 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. @@ -23,6 +23,7 @@ obj-pci-$(CONFIG_MACH_PRONGHORN) += pron
  20. obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
  21. obj-pci-$(CONFIG_MACH_COMPEXWP18) += ixdp425-pci.o
  22. obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o
  23. +obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o
  24. obj-y += common.o
  25. @@ -47,6 +48,7 @@ obj-$(CONFIG_MACH_PRONGHORN) += pronghor
  26. obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
  27. obj-$(CONFIG_MACH_COMPEXWP18) += compex42x-setup.o
  28. obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o
  29. +obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o
  30. obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
  31. obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
  32. --- /dev/null
  33. +++ b/arch/arm/mach-ixp4xx/ap1000-setup.c
  34. @@ -0,0 +1,154 @@
  35. +/*
  36. + * arch/arm/mach-ixp4xx/ap1000-setup.c
  37. + *
  38. + * Lanready AP-1000
  39. + *
  40. + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
  41. + *
  42. + * based on ixdp425-setup.c:
  43. + * Copyright (C) 2003-2005 MontaVista Software, Inc.
  44. + *
  45. + * Author: Imre Kaloz <Kaloz@openwrt.org>
  46. + */
  47. +
  48. +#include <linux/kernel.h>
  49. +#include <linux/init.h>
  50. +#include <linux/device.h>
  51. +#include <linux/serial.h>
  52. +#include <linux/tty.h>
  53. +#include <linux/serial_8250.h>
  54. +#include <linux/slab.h>
  55. +#include <linux/dma-mapping.h>
  56. +
  57. +#include <asm/types.h>
  58. +#include <asm/setup.h>
  59. +#include <asm/memory.h>
  60. +#include <mach/hardware.h>
  61. +#include <asm/mach-types.h>
  62. +#include <asm/irq.h>
  63. +#include <asm/mach/arch.h>
  64. +#include <asm/mach/flash.h>
  65. +
  66. +static struct flash_platform_data ap1000_flash_data = {
  67. + .map_name = "cfi_probe",
  68. + .width = 2,
  69. +};
  70. +
  71. +static struct resource ap1000_flash_resource = {
  72. + .flags = IORESOURCE_MEM,
  73. +};
  74. +
  75. +static struct platform_device ap1000_flash = {
  76. + .name = "IXP4XX-Flash",
  77. + .id = 0,
  78. + .dev = {
  79. + .platform_data = &ap1000_flash_data,
  80. + },
  81. + .num_resources = 1,
  82. + .resource = &ap1000_flash_resource,
  83. +};
  84. +
  85. +static struct resource ap1000_uart_resources[] = {
  86. + {
  87. + .start = IXP4XX_UART1_BASE_PHYS,
  88. + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  89. + .flags = IORESOURCE_MEM
  90. + },
  91. + {
  92. + .start = IXP4XX_UART2_BASE_PHYS,
  93. + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  94. + .flags = IORESOURCE_MEM
  95. + }
  96. +};
  97. +
  98. +static struct plat_serial8250_port ap1000_uart_data[] = {
  99. + {
  100. + .mapbase = IXP4XX_UART1_BASE_PHYS,
  101. + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  102. + .irq = IRQ_IXP4XX_UART1,
  103. + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  104. + .iotype = UPIO_MEM,
  105. + .regshift = 2,
  106. + .uartclk = IXP4XX_UART_XTAL,
  107. + },
  108. + {
  109. + .mapbase = IXP4XX_UART2_BASE_PHYS,
  110. + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  111. + .irq = IRQ_IXP4XX_UART2,
  112. + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  113. + .iotype = UPIO_MEM,
  114. + .regshift = 2,
  115. + .uartclk = IXP4XX_UART_XTAL,
  116. + },
  117. + { },
  118. +};
  119. +
  120. +static struct platform_device ap1000_uart = {
  121. + .name = "serial8250",
  122. + .id = PLAT8250_DEV_PLATFORM,
  123. + .dev.platform_data = ap1000_uart_data,
  124. + .num_resources = 2,
  125. + .resource = ap1000_uart_resources
  126. +};
  127. +
  128. +static struct platform_device *ap1000_devices[] __initdata = {
  129. + &ap1000_flash,
  130. + &ap1000_uart
  131. +};
  132. +
  133. +static char ap1000_mem_fixup[] __initdata = "mem=64M ";
  134. +
  135. +static void __init ap1000_fixup(struct machine_desc *desc,
  136. + struct tag *tags, char **cmdline, struct meminfo *mi)
  137. +
  138. +{
  139. + struct tag *t = tags;
  140. + char *p = *cmdline;
  141. +
  142. + /* Find the end of the tags table, taking note of any cmdline tag. */
  143. + for (; t->hdr.size; t = tag_next(t)) {
  144. + if (t->hdr.tag == ATAG_CMDLINE) {
  145. + p = t->u.cmdline.cmdline;
  146. + }
  147. + }
  148. +
  149. + /* Overwrite the end of the table with a new cmdline tag. */
  150. + t->hdr.tag = ATAG_CMDLINE;
  151. + t->hdr.size = (sizeof (struct tag_header) +
  152. + strlen(ap1000_mem_fixup) + strlen(p) + 1 + 4) >> 2;
  153. + strlcpy(t->u.cmdline.cmdline, ap1000_mem_fixup, COMMAND_LINE_SIZE);
  154. + strlcpy(t->u.cmdline.cmdline + strlen(ap1000_mem_fixup), p,
  155. + COMMAND_LINE_SIZE - strlen(ap1000_mem_fixup));
  156. +
  157. + /* Terminate the table. */
  158. + t = tag_next(t);
  159. + t->hdr.tag = ATAG_NONE;
  160. + t->hdr.size = 0;
  161. +}
  162. +
  163. +static void __init ap1000_init(void)
  164. +{
  165. + ixp4xx_sys_init();
  166. +
  167. + ap1000_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  168. + ap1000_flash_resource.end =
  169. + IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
  170. +
  171. + platform_add_devices(ap1000_devices, ARRAY_SIZE(ap1000_devices));
  172. +}
  173. +
  174. +#ifdef CONFIG_MACH_AP1000
  175. +MACHINE_START(AP1000, "Lanready AP-1000")
  176. + /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */
  177. + .fixup = ap1000_fixup,
  178. + .map_io = ixp4xx_map_io,
  179. + .init_irq = ixp4xx_init_irq,
  180. + .init_time = ixp4xx_timer_init,
  181. + .atag_offset = 0x0100,
  182. + .init_machine = ap1000_init,
  183. +#if defined(CONFIG_PCI)
  184. + .dma_zone_size = SZ_64M,
  185. +#endif
  186. + .restart = ixp4xx_restart,
  187. +MACHINE_END
  188. +#endif
  189. --- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
  190. +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
  191. @@ -70,7 +70,7 @@ int __init ixdp425_pci_init(void)
  192. {
  193. if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
  194. machine_is_ixdp465() || machine_is_kixrp435() ||
  195. - machine_is_compex42x())
  196. + machine_is_compex42x() || machine_is_ap1000())
  197. pci_common_init(&ixdp425_pci);
  198. return 0;
  199. }