realview_eb.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*
  2. * linux/arch/arm/mach-realview/realview_eb.c
  3. *
  4. * Copyright (C) 2004 ARM Limited
  5. * Copyright (C) 2000 Deep Blue Solutions Ltd
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #include <linux/init.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/sysdev.h>
  24. #include <linux/amba/bus.h>
  25. #include <asm/hardware.h>
  26. #include <asm/io.h>
  27. #include <asm/irq.h>
  28. #include <asm/leds.h>
  29. #include <asm/mach-types.h>
  30. #include <asm/hardware/gic.h>
  31. #include <asm/hardware/icst307.h>
  32. #include <asm/hardware/cache-l2x0.h>
  33. #include <asm/mach/arch.h>
  34. #include <asm/mach/map.h>
  35. #include <asm/mach/mmc.h>
  36. #include <asm/arch/irqs.h>
  37. #include "core.h"
  38. #include "clock.h"
  39. static struct map_desc realview_eb_io_desc[] __initdata = {
  40. {
  41. .virtual = IO_ADDRESS(REALVIEW_SYS_BASE),
  42. .pfn = __phys_to_pfn(REALVIEW_SYS_BASE),
  43. .length = SZ_4K,
  44. .type = MT_DEVICE,
  45. }, {
  46. .virtual = IO_ADDRESS(REALVIEW_GIC_CPU_BASE),
  47. .pfn = __phys_to_pfn(REALVIEW_GIC_CPU_BASE),
  48. .length = SZ_4K,
  49. .type = MT_DEVICE,
  50. }, {
  51. .virtual = IO_ADDRESS(REALVIEW_GIC_DIST_BASE),
  52. .pfn = __phys_to_pfn(REALVIEW_GIC_DIST_BASE),
  53. .length = SZ_4K,
  54. .type = MT_DEVICE,
  55. },
  56. #ifdef CONFIG_REALVIEW_MPCORE
  57. {
  58. .virtual = IO_ADDRESS(REALVIEW_GIC1_CPU_BASE),
  59. .pfn = __phys_to_pfn(REALVIEW_GIC1_CPU_BASE),
  60. .length = SZ_4K,
  61. .type = MT_DEVICE,
  62. }, {
  63. .virtual = IO_ADDRESS(REALVIEW_GIC1_DIST_BASE),
  64. .pfn = __phys_to_pfn(REALVIEW_GIC1_DIST_BASE),
  65. .length = SZ_4K,
  66. .type = MT_DEVICE,
  67. }, {
  68. .virtual = IO_ADDRESS(REALVIEW_MPCORE_L220_BASE),
  69. .pfn = __phys_to_pfn(REALVIEW_MPCORE_L220_BASE),
  70. .length = SZ_8K,
  71. .type = MT_DEVICE,
  72. },
  73. #endif
  74. {
  75. .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE),
  76. .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE),
  77. .length = SZ_4K,
  78. .type = MT_DEVICE,
  79. }, {
  80. .virtual = IO_ADDRESS(REALVIEW_TIMER0_1_BASE),
  81. .pfn = __phys_to_pfn(REALVIEW_TIMER0_1_BASE),
  82. .length = SZ_4K,
  83. .type = MT_DEVICE,
  84. }, {
  85. .virtual = IO_ADDRESS(REALVIEW_TIMER2_3_BASE),
  86. .pfn = __phys_to_pfn(REALVIEW_TIMER2_3_BASE),
  87. .length = SZ_4K,
  88. .type = MT_DEVICE,
  89. },
  90. #ifdef CONFIG_DEBUG_LL
  91. {
  92. .virtual = IO_ADDRESS(REALVIEW_UART0_BASE),
  93. .pfn = __phys_to_pfn(REALVIEW_UART0_BASE),
  94. .length = SZ_4K,
  95. .type = MT_DEVICE,
  96. }
  97. #endif
  98. };
  99. static void __init realview_eb_map_io(void)
  100. {
  101. iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc));
  102. }
  103. /* FPGA Primecells */
  104. AMBA_DEVICE(aaci, "fpga:04", AACI, NULL);
  105. AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &realview_mmc0_plat_data);
  106. AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL);
  107. AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL);
  108. AMBA_DEVICE(uart3, "fpga:09", UART3, NULL);
  109. /* DevChip Primecells */
  110. AMBA_DEVICE(smc, "dev:00", SMC, NULL);
  111. AMBA_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data);
  112. AMBA_DEVICE(dmac, "dev:30", DMAC, NULL);
  113. AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL);
  114. AMBA_DEVICE(wdog, "dev:e1", WATCHDOG, NULL);
  115. AMBA_DEVICE(gpio0, "dev:e4", GPIO0, NULL);
  116. AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL);
  117. AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL);
  118. AMBA_DEVICE(rtc, "dev:e8", RTC, NULL);
  119. AMBA_DEVICE(sci0, "dev:f0", SCI, NULL);
  120. AMBA_DEVICE(uart0, "dev:f1", UART0, NULL);
  121. AMBA_DEVICE(uart1, "dev:f2", UART1, NULL);
  122. AMBA_DEVICE(uart2, "dev:f3", UART2, NULL);
  123. AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL);
  124. static struct amba_device *amba_devs[] __initdata = {
  125. &dmac_device,
  126. &uart0_device,
  127. &uart1_device,
  128. &uart2_device,
  129. &uart3_device,
  130. &smc_device,
  131. &clcd_device,
  132. &sctl_device,
  133. &wdog_device,
  134. &gpio0_device,
  135. &gpio1_device,
  136. &gpio2_device,
  137. &rtc_device,
  138. &sci0_device,
  139. &ssp0_device,
  140. &aaci_device,
  141. &mmc0_device,
  142. &kmi0_device,
  143. &kmi1_device,
  144. };
  145. static void __init gic_init_irq(void)
  146. {
  147. #ifdef CONFIG_REALVIEW_MPCORE
  148. unsigned int pldctrl;
  149. writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK));
  150. pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + REALVIEW_MPCORE_SYS_PLD_CTRL1);
  151. pldctrl |= 0x00800000; /* New irq mode */
  152. writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + REALVIEW_MPCORE_SYS_PLD_CTRL1);
  153. writel(0x00000000, __io_address(REALVIEW_SYS_LOCK));
  154. #endif
  155. gic_dist_init(0, __io_address(REALVIEW_GIC_DIST_BASE), 29);
  156. gic_cpu_init(0, __io_address(REALVIEW_GIC_CPU_BASE));
  157. #if defined(CONFIG_REALVIEW_MPCORE) && !defined(CONFIG_REALVIEW_MPCORE_REVB)
  158. gic_dist_init(1, __io_address(REALVIEW_GIC1_DIST_BASE), 64);
  159. gic_cpu_init(1, __io_address(REALVIEW_GIC1_CPU_BASE));
  160. gic_cascade_irq(1, IRQ_EB_IRQ1);
  161. #endif
  162. }
  163. static void __init realview_eb_init(void)
  164. {
  165. int i;
  166. #ifdef CONFIG_REALVIEW_MPCORE
  167. /* 1MB (128KB/way), 8-way associativity, evmon/parity/share enabled
  168. * Bits: .... ...0 0111 1001 0000 .... .... .... */
  169. l2x0_init(__io_address(REALVIEW_MPCORE_L220_BASE), 0x00790000, 0xfe000fff);
  170. #endif
  171. clk_register(&realview_clcd_clk);
  172. platform_device_register(&realview_flash_device);
  173. platform_device_register(&realview_smc91x_device);
  174. platform_device_register(&realview_i2c_device);
  175. for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
  176. struct amba_device *d = amba_devs[i];
  177. amba_device_register(d, &iomem_resource);
  178. }
  179. #ifdef CONFIG_LEDS
  180. leds_event = realview_leds_event;
  181. #endif
  182. }
  183. MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
  184. /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
  185. .phys_io = REALVIEW_UART0_BASE,
  186. .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc,
  187. .boot_params = 0x00000100,
  188. .map_io = realview_eb_map_io,
  189. .init_irq = gic_init_irq,
  190. .timer = &realview_timer,
  191. .init_machine = realview_eb_init,
  192. MACHINE_END