wg302v2-setup.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * arch/arm/mach-ixp4xx/wg302-setup.c
  3. *
  4. * Board setup for the Netgear WG302 v2 and WAG302 v2
  5. *
  6. * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
  7. *
  8. * based on coyote-setup.c:
  9. * Copyright (C) 2003-2005 MontaVista Software, Inc.
  10. *
  11. * Author: Imre Kaloz <kaloz@openwrt.org>
  12. *
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/device.h>
  17. #include <linux/serial.h>
  18. #include <linux/tty.h>
  19. #include <linux/serial_8250.h>
  20. #include <asm/types.h>
  21. #include <asm/setup.h>
  22. #include <asm/memory.h>
  23. #include <mach/hardware.h>
  24. #include <asm/irq.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/flash.h>
  28. static struct flash_platform_data wg302v2_flash_data = {
  29. .map_name = "cfi_probe",
  30. .width = 2,
  31. };
  32. static struct resource wg302v2_flash_resource = {
  33. .flags = IORESOURCE_MEM,
  34. };
  35. static struct platform_device wg302v2_flash = {
  36. .name = "IXP4XX-Flash",
  37. .id = 0,
  38. .dev = {
  39. .platform_data = &wg302v2_flash_data,
  40. },
  41. .num_resources = 1,
  42. .resource = &wg302v2_flash_resource,
  43. };
  44. static struct resource wg302v2_uart_resource = {
  45. .start = IXP4XX_UART2_BASE_PHYS,
  46. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  47. .flags = IORESOURCE_MEM,
  48. };
  49. static struct plat_serial8250_port wg302v2_uart_data[] = {
  50. {
  51. .mapbase = IXP4XX_UART2_BASE_PHYS,
  52. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  53. .irq = IRQ_IXP4XX_UART2,
  54. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  55. .iotype = UPIO_MEM,
  56. .regshift = 2,
  57. .uartclk = IXP4XX_UART_XTAL,
  58. },
  59. { },
  60. };
  61. static struct platform_device wg302v2_uart = {
  62. .name = "serial8250",
  63. .id = PLAT8250_DEV_PLATFORM,
  64. .dev = {
  65. .platform_data = wg302v2_uart_data,
  66. },
  67. .num_resources = 1,
  68. .resource = &wg302v2_uart_resource,
  69. };
  70. static struct platform_device *wg302v2_devices[] __initdata = {
  71. &wg302v2_flash,
  72. &wg302v2_uart,
  73. };
  74. static void __init wg302v2_init(void)
  75. {
  76. ixp4xx_sys_init();
  77. wg302v2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  78. wg302v2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
  79. *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
  80. *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
  81. platform_add_devices(wg302v2_devices, ARRAY_SIZE(wg302v2_devices));
  82. }
  83. #ifdef CONFIG_MACH_WG302V2
  84. MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2")
  85. /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
  86. .map_io = ixp4xx_map_io,
  87. .init_early = ixp4xx_init_early,
  88. .init_irq = ixp4xx_init_irq,
  89. .init_time = ixp4xx_timer_init,
  90. .atag_offset = 0x100,
  91. .init_machine = wg302v2_init,
  92. #if defined(CONFIG_PCI)
  93. .dma_zone_size = SZ_64M,
  94. #endif
  95. .restart = ixp4xx_restart,
  96. MACHINE_END
  97. #endif