avila-setup.c 4.6 KB

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