gtwx5715-setup.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * arch/arm/mach-ixp4xx/gtwx5715-setup.c
  3. *
  4. * Gemtek GTWX5715 (Linksys WRV54G) board setup
  5. *
  6. * Copyright (C) 2004 George T. Joseph
  7. * Derived from Coyote
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. #include <linux/init.h>
  25. #include <linux/device.h>
  26. #include <linux/serial.h>
  27. #include <linux/tty.h>
  28. #include <linux/serial_8250.h>
  29. #include <linux/slab.h>
  30. #include <asm/types.h>
  31. #include <asm/setup.h>
  32. #include <asm/memory.h>
  33. #include <mach/hardware.h>
  34. #include <asm/irq.h>
  35. #include <asm/mach-types.h>
  36. #include <asm/mach/arch.h>
  37. #include <asm/mach/flash.h>
  38. #include <mach/gtwx5715.h>
  39. /*
  40. * Xscale UART registers are 32 bits wide with only the least
  41. * significant 8 bits having any meaning. From a configuration
  42. * perspective, this means 2 things...
  43. *
  44. * Setting .regshift = 2 so that the standard 16550 registers
  45. * line up on every 4th byte.
  46. *
  47. * Shifting the register start virtual address +3 bytes when
  48. * compiled big-endian. Since register writes are done on a
  49. * single byte basis, if the shift isn't done the driver will
  50. * write the value into the most significant byte of the register,
  51. * which is ignored, instead of the least significant.
  52. */
  53. #ifdef __ARMEB__
  54. #define REG_OFFSET 3
  55. #else
  56. #define REG_OFFSET 0
  57. #endif
  58. /*
  59. * Only the second or "console" uart is connected on the gtwx5715.
  60. */
  61. static struct resource gtwx5715_uart_resources[] = {
  62. {
  63. .start = IXP4XX_UART2_BASE_PHYS,
  64. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  65. .flags = IORESOURCE_MEM,
  66. },
  67. {
  68. .start = IRQ_IXP4XX_UART2,
  69. .end = IRQ_IXP4XX_UART2,
  70. .flags = IORESOURCE_IRQ,
  71. },
  72. { },
  73. };
  74. static struct plat_serial8250_port gtwx5715_uart_platform_data[] = {
  75. {
  76. .mapbase = IXP4XX_UART2_BASE_PHYS,
  77. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  78. .irq = IRQ_IXP4XX_UART2,
  79. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  80. .iotype = UPIO_MEM,
  81. .regshift = 2,
  82. .uartclk = IXP4XX_UART_XTAL,
  83. },
  84. { },
  85. };
  86. static struct platform_device gtwx5715_uart_device = {
  87. .name = "serial8250",
  88. .id = PLAT8250_DEV_PLATFORM,
  89. .dev = {
  90. .platform_data = gtwx5715_uart_platform_data,
  91. },
  92. .num_resources = 2,
  93. .resource = gtwx5715_uart_resources,
  94. };
  95. static struct flash_platform_data gtwx5715_flash_data = {
  96. .map_name = "cfi_probe",
  97. .width = 2,
  98. };
  99. static struct resource gtwx5715_flash_resource = {
  100. .flags = IORESOURCE_MEM,
  101. };
  102. static struct platform_device gtwx5715_flash = {
  103. .name = "IXP4XX-Flash",
  104. .id = 0,
  105. .dev = {
  106. .platform_data = &gtwx5715_flash_data,
  107. },
  108. .num_resources = 1,
  109. .resource = &gtwx5715_flash_resource,
  110. };
  111. static struct platform_device *gtwx5715_devices[] __initdata = {
  112. &gtwx5715_uart_device,
  113. &gtwx5715_flash,
  114. };
  115. static void __init gtwx5715_init(void)
  116. {
  117. ixp4xx_sys_init();
  118. gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  119. gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1;
  120. platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices));
  121. }
  122. MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)")
  123. /* Maintainer: George Joseph */
  124. .phys_io = IXP4XX_UART2_BASE_PHYS,
  125. .io_pg_offst = ((IXP4XX_UART2_BASE_VIRT) >> 18) & 0xfffc,
  126. .map_io = ixp4xx_map_io,
  127. .init_irq = ixp4xx_init_irq,
  128. .timer = &ixp4xx_timer,
  129. .boot_params = 0x0100,
  130. .init_machine = gtwx5715_init,
  131. MACHINE_END