gateway7001-setup.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * arch/arm/mach-ixp4xx/gateway7001-setup.c
  3. *
  4. * Board setup for the Gateway 7001 board
  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. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/device.h>
  16. #include <linux/serial.h>
  17. #include <linux/tty.h>
  18. #include <linux/serial_8250.h>
  19. #include <linux/slab.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 gateway7001_flash_data = {
  29. .map_name = "cfi_probe",
  30. .width = 2,
  31. };
  32. static struct resource gateway7001_flash_resource = {
  33. .flags = IORESOURCE_MEM,
  34. };
  35. static struct platform_device gateway7001_flash = {
  36. .name = "IXP4XX-Flash",
  37. .id = 0,
  38. .dev = {
  39. .platform_data = &gateway7001_flash_data,
  40. },
  41. .num_resources = 1,
  42. .resource = &gateway7001_flash_resource,
  43. };
  44. static struct resource gateway7001_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 gateway7001_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 gateway7001_uart = {
  62. .name = "serial8250",
  63. .id = PLAT8250_DEV_PLATFORM,
  64. .dev = {
  65. .platform_data = gateway7001_uart_data,
  66. },
  67. .num_resources = 1,
  68. .resource = &gateway7001_uart_resource,
  69. };
  70. static struct platform_device *gateway7001_devices[] __initdata = {
  71. &gateway7001_flash,
  72. &gateway7001_uart
  73. };
  74. static void __init gateway7001_init(void)
  75. {
  76. ixp4xx_sys_init();
  77. gateway7001_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  78. gateway7001_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(gateway7001_devices, ARRAY_SIZE(gateway7001_devices));
  82. }
  83. #ifdef CONFIG_MACH_GATEWAY7001
  84. MACHINE_START(GATEWAY7001, "Gateway 7001 AP")
  85. /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
  86. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  87. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
  88. .map_io = ixp4xx_map_io,
  89. .init_irq = ixp4xx_init_irq,
  90. .timer = &ixp4xx_timer,
  91. .boot_params = 0x0100,
  92. .init_machine = gateway7001_init,
  93. MACHINE_END
  94. #endif