avila-setup.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * arch/arm/mach-ixp4xx/avila-setup.c
  3. *
  4. * Gateworks Avila board-setup
  5. *
  6. * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
  7. *
  8. * Based on ixdp-setup.c
  9. * Copyright (C) 2003-2005 MontaVista Software, Inc.
  10. *
  11. * Author: Deepak Saxena <dsaxena@plexity.net>
  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 <linux/i2c-gpio.h>
  21. #include <asm/types.h>
  22. #include <asm/setup.h>
  23. #include <asm/memory.h>
  24. #include <mach/hardware.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/irq.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/flash.h>
  29. static struct flash_platform_data avila_flash_data = {
  30. .map_name = "cfi_probe",
  31. .width = 2,
  32. };
  33. static struct resource avila_flash_resource = {
  34. .flags = IORESOURCE_MEM,
  35. };
  36. static struct platform_device avila_flash = {
  37. .name = "IXP4XX-Flash",
  38. .id = 0,
  39. .dev = {
  40. .platform_data = &avila_flash_data,
  41. },
  42. .num_resources = 1,
  43. .resource = &avila_flash_resource,
  44. };
  45. static struct i2c_gpio_platform_data avila_i2c_gpio_data = {
  46. .sda_pin = AVILA_SDA_PIN,
  47. .scl_pin = AVILA_SCL_PIN,
  48. };
  49. static struct platform_device avila_i2c_gpio = {
  50. .name = "i2c-gpio",
  51. .id = 0,
  52. .dev = {
  53. .platform_data = &avila_i2c_gpio_data,
  54. },
  55. };
  56. static struct resource avila_uart_resources[] = {
  57. {
  58. .start = IXP4XX_UART1_BASE_PHYS,
  59. .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  60. .flags = IORESOURCE_MEM
  61. },
  62. {
  63. .start = IXP4XX_UART2_BASE_PHYS,
  64. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  65. .flags = IORESOURCE_MEM
  66. }
  67. };
  68. static struct plat_serial8250_port avila_uart_data[] = {
  69. {
  70. .mapbase = IXP4XX_UART1_BASE_PHYS,
  71. .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  72. .irq = IRQ_IXP4XX_UART1,
  73. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  74. .iotype = UPIO_MEM,
  75. .regshift = 2,
  76. .uartclk = IXP4XX_UART_XTAL,
  77. },
  78. {
  79. .mapbase = IXP4XX_UART2_BASE_PHYS,
  80. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  81. .irq = IRQ_IXP4XX_UART2,
  82. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  83. .iotype = UPIO_MEM,
  84. .regshift = 2,
  85. .uartclk = IXP4XX_UART_XTAL,
  86. },
  87. { },
  88. };
  89. static struct platform_device avila_uart = {
  90. .name = "serial8250",
  91. .id = PLAT8250_DEV_PLATFORM,
  92. .dev.platform_data = avila_uart_data,
  93. .num_resources = 2,
  94. .resource = avila_uart_resources
  95. };
  96. static struct resource avila_pata_resources[] = {
  97. {
  98. .flags = IORESOURCE_MEM
  99. },
  100. {
  101. .flags = IORESOURCE_MEM,
  102. },
  103. {
  104. .name = "intrq",
  105. .start = IRQ_IXP4XX_GPIO12,
  106. .end = IRQ_IXP4XX_GPIO12,
  107. .flags = IORESOURCE_IRQ,
  108. },
  109. };
  110. static struct ixp4xx_pata_data avila_pata_data = {
  111. .cs0_bits = 0xbfff0043,
  112. .cs1_bits = 0xbfff0043,
  113. };
  114. static struct platform_device avila_pata = {
  115. .name = "pata_ixp4xx_cf",
  116. .id = 0,
  117. .dev.platform_data = &avila_pata_data,
  118. .num_resources = ARRAY_SIZE(avila_pata_resources),
  119. .resource = avila_pata_resources,
  120. };
  121. static struct platform_device *avila_devices[] __initdata = {
  122. &avila_i2c_gpio,
  123. &avila_flash,
  124. &avila_uart
  125. };
  126. static void __init avila_init(void)
  127. {
  128. ixp4xx_sys_init();
  129. avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  130. avila_flash_resource.end =
  131. IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
  132. platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
  133. avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
  134. avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
  135. avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
  136. avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
  137. avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
  138. avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
  139. platform_device_register(&avila_pata);
  140. }
  141. MACHINE_START(AVILA, "Gateworks Avila Network Platform")
  142. /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
  143. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  144. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
  145. .map_io = ixp4xx_map_io,
  146. .init_irq = ixp4xx_init_irq,
  147. .timer = &ixp4xx_timer,
  148. .boot_params = 0x0100,
  149. .init_machine = avila_init,
  150. MACHINE_END
  151. /*
  152. * Loft is functionally equivalent to Avila except that it has a
  153. * different number for the maximum PCI devices. The MACHINE
  154. * structure below is identical to Avila except for the comment.
  155. */
  156. #ifdef CONFIG_MACH_LOFT
  157. MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")
  158. /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
  159. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  160. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
  161. .map_io = ixp4xx_map_io,
  162. .init_irq = ixp4xx_init_irq,
  163. .timer = &ixp4xx_timer,
  164. .boot_params = 0x0100,
  165. .init_machine = avila_init,
  166. MACHINE_END
  167. #endif