avila-setup.c 4.5 KB

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