memoryCall.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*
  2. * Versatile Express V2M Motherboard Support
  3. */
  4. #include <linux/device.h>
  5. #include <linux/amba/bus.h>
  6. #include <linux/amba/mmci.h>
  7. #include <linux/io.h>
  8. #include <linux/smp.h>
  9. #include <linux/init.h>
  10. #include <linux/of_address.h>
  11. #include <linux/of_fdt.h>
  12. #include <linux/of_irq.h>
  13. #include <linux/of_platform.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/ata_platform.h>
  16. #include <linux/smsc911x.h>
  17. #include <linux/spinlock.h>
  18. #include <linux/usb/isp1760.h>
  19. #include <linux/mtd/physmap.h>
  20. #include <linux/regulator/fixed.h>
  21. #include <linux/regulator/machine.h>
  22. #include <linux/vexpress.h>
  23. #include <asm/arch_timer.h>
  24. #include <asm/mach-types.h>
  25. #include <asm/sizes.h>
  26. #include <asm/smp_twd.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/map.h>
  29. #include <asm/mach/time.h>
  30. #include <asm/hardware/arm_timer.h>
  31. #include <asm/hardware/cache-l2x0.h>
  32. #include <asm/hardware/gic.h>
  33. #include <asm/hardware/timer-sp.h>
  34. #include <mach/ct-ca9x4.h>
  35. #include <mach/motherboard.h>
  36. #include <plat/sched_clock.h>
  37. #include <plat/platsmp.h>
  38. #include "core.h"
  39. #define V2M_PA_CS0 0x40000000
  40. #define V2M_PA_CS1 0x44000000
  41. #define V2M_PA_CS2 0x48000000
  42. #define V2M_PA_CS3 0x4c000000
  43. #define V2M_PA_CS7 0x10000000
  44. static struct map_desc v2m_io_desc[] __initdata = {
  45. {
  46. .virtual = V2M_PERIPH,
  47. .pfn = __phys_to_pfn(V2M_PA_CS7),
  48. .length = SZ_128K,
  49. .type = MT_DEVICE,
  50. },
  51. };
  52. static void __init v2m_sp804_init(void __iomem *base, unsigned int irq)
  53. {
  54. if (WARN_ON(!base || irq == NO_IRQ))
  55. return;
  56. writel(0, base + TIMER_1_BASE + TIMER_CTRL);
  57. writel(0, base + TIMER_2_BASE + TIMER_CTRL);
  58. sp804_clocksource_init(base + TIMER_2_BASE, "v2m-timer1");
  59. sp804_clockevents_init(base + TIMER_1_BASE, irq, "v2m-timer0");
  60. }
  61. static struct resource v2m_pcie_i2c_resource = {
  62. .start = V2M_SERIAL_BUS_PCI,
  63. .end = V2M_SERIAL_BUS_PCI + SZ_4K - 1,
  64. .flags = IORESOURCE_MEM,
  65. };
  66. static struct platform_device v2m_pcie_i2c_device = {
  67. .name = "versatile-i2c",
  68. .id = 0,
  69. .num_resources = 1,
  70. .resource = &v2m_pcie_i2c_resource,
  71. };
  72. static struct resource v2m_ddc_i2c_resource = {
  73. .start = V2M_SERIAL_BUS_DVI,
  74. .end = V2M_SERIAL_BUS_DVI + SZ_4K - 1,
  75. .flags = IORESOURCE_MEM,
  76. };
  77. static struct platform_device v2m_ddc_i2c_device = {
  78. .name = "versatile-i2c",
  79. .id = 1,
  80. .num_resources = 1,
  81. .resource = &v2m_ddc_i2c_resource,
  82. };
  83. static struct resource v2m_eth_resources[] = {
  84. {
  85. .start = V2M_LAN9118,
  86. .end = V2M_LAN9118 + SZ_64K - 1,
  87. .flags = IORESOURCE_MEM,
  88. }, {
  89. .start = IRQ_V2M_LAN9118,
  90. .end = IRQ_V2M_LAN9118,
  91. .flags = IORESOURCE_IRQ,
  92. },
  93. };
  94. static struct smsc911x_platform_config v2m_eth_config = {
  95. .flags = SMSC911X_USE_32BIT,
  96. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
  97. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  98. .phy_interface = PHY_INTERFACE_MODE_MII,
  99. };
  100. static struct platform_device v2m_eth_device = {
  101. .name = "smsc911x",
  102. .id = -1,
  103. .resource = v2m_eth_resources,
  104. .num_resources = ARRAY_SIZE(v2m_eth_resources),
  105. .dev.platform_data = &v2m_eth_config,
  106. };
  107. static struct regulator_consumer_supply v2m_eth_supplies[] = {
  108. REGULATOR_SUPPLY("vddvario", "smsc911x"),
  109. REGULATOR_SUPPLY("vdd33a", "smsc911x"),
  110. };
  111. static struct resource v2m_usb_resources[] = {
  112. {
  113. .start = V2M_ISP1761,
  114. .end = V2M_ISP1761 + SZ_128K - 1,
  115. .flags = IORESOURCE_MEM,
  116. }, {
  117. .start = IRQ_V2M_ISP1761,
  118. .end = IRQ_V2M_ISP1761,
  119. .flags = IORESOURCE_IRQ,
  120. },
  121. };
  122. static struct isp1760_platform_data v2m_usb_config = {
  123. .is_isp1761 = true,
  124. .bus_width_16 = false,
  125. .port1_otg = true,
  126. .analog_oc = false,
  127. .dack_polarity_high = false,
  128. .dreq_polarity_high = false,
  129. };
  130. static struct platform_device v2m_usb_device = {
  131. .name = "isp1760",
  132. .id = -1,
  133. .resource = v2m_usb_resources,
  134. .num_resources = ARRAY_SIZE(v2m_usb_resources),
  135. .dev.platform_data = &v2m_usb_config,
  136. };
  137. static struct physmap_flash_data v2m_flash_data = {
  138. .width = 4,
  139. };
  140. static struct resource v2m_flash_resources[] = {
  141. {
  142. .start = V2M_NOR0,
  143. .end = V2M_NOR0 + SZ_64M - 1,
  144. .flags = IORESOURCE_MEM,
  145. }, {
  146. .start = V2M_NOR1,
  147. .end = V2M_NOR1 + SZ_64M - 1,
  148. .flags = IORESOURCE_MEM,
  149. },
  150. };
  151. static struct platform_device v2m_flash_device = {
  152. .name = "physmap-flash",
  153. .id = -1,
  154. .resource = v2m_flash_resources,
  155. .num_resources = ARRAY_SIZE(v2m_flash_resources),
  156. .dev.platform_data = &v2m_flash_data,
  157. };
  158. static struct pata_platform_info v2m_pata_data = {
  159. .ioport_shift = 2,
  160. };
  161. static struct resource v2m_pata_resources[] = {
  162. {
  163. .start = V2M_CF,
  164. .end = V2M_CF + 0xff,
  165. .flags = IORESOURCE_MEM,
  166. }, {
  167. .start = V2M_CF + 0x100,
  168. .end = V2M_CF + SZ_4K - 1,
  169. .flags = IORESOURCE_MEM,
  170. },
  171. };
  172. static struct platform_device v2m_cf_device = {
  173. .name = "pata_platform",
  174. .id = -1,
  175. .resource = v2m_pata_resources,
  176. .num_resources = ARRAY_SIZE(v2m_pata_resources),
  177. .dev.platform_data = &v2m_pata_data,
  178. };
  179. static struct mmci_platform_data v2m_mmci_data = {