wg302v2-setup.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 <linux/slab.h>
  21. #include <asm/types.h>
  22. #include <asm/setup.h>
  23. #include <asm/memory.h>
  24. #include <mach/hardware.h>
  25. #include <asm/irq.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/flash.h>
  29. static struct flash_platform_data wg302v2_flash_data = {
  30. .map_name = "cfi_probe",
  31. .width = 2,
  32. };
  33. static struct resource wg302v2_flash_resource = {
  34. .flags = IORESOURCE_MEM,
  35. };
  36. static struct platform_device wg302v2_flash = {
  37. .name = "IXP4XX-Flash",
  38. .id = 0,
  39. .dev = {
  40. .platform_data = &wg302v2_flash_data,
  41. },
  42. .num_resources = 1,
  43. .resource = &wg302v2_flash_resource,
  44. };
  45. static struct resource wg302v2_uart_resource = {
  46. .start = IXP4XX_UART2_BASE_PHYS,
  47. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  48. .flags = IORESOURCE_MEM,
  49. };
  50. static struct plat_serial8250_port wg302v2_uart_data[] = {
  51. {
  52. .mapbase = IXP4XX_UART2_BASE_PHYS,
  53. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  54. .irq = IRQ_IXP4XX_UART2,
  55. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  56. .iotype = UPIO_MEM,
  57. .regshift = 2,
  58. .uartclk = IXP4XX_UART_XTAL,
  59. },
  60. { },
  61. };
  62. static struct platform_device wg302v2_uart = {
  63. .name = "serial8250",
  64. .id = PLAT8250_DEV_PLATFORM,
  65. .dev = {
  66. .platform_data = wg302v2_uart_data,
  67. },
  68. .num_resources = 1,
  69. .resource = &wg302v2_uart_resource,
  70. };
  71. static struct platform_device *wg302v2_devices[] __initdata = {
  72. &wg302v2_flash,
  73. &wg302v2_uart,
  74. };
  75. static void __init wg302v2_init(void)
  76. {
  77. ixp4xx_sys_init();
  78. wg302v2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  79. wg302v2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
  80. *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
  81. *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
  82. platform_add_devices(wg302v2_devices, ARRAY_SIZE(wg302v2_devices));
  83. }
  84. #ifdef CONFIG_MACH_WG302V2
  85. MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2")
  86. /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
  87. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  88. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
  89. .map_io = ixp4xx_map_io,
  90. .init_irq = ixp4xx_init_irq,
  91. .timer = &ixp4xx_timer,
  92. .boot_params = 0x0100,
  93. .init_machine = wg302v2_init,
  94. MACHINE_END
  95. #endif