realview_eb.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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/mach/arch.h>
  33. #include <asm/mach/map.h>
  34. #include <asm/mach/mmc.h>
  35. #include <asm/arch/irqs.h>
  36. #include "core.h"
  37. #include "clock.h"
  38. static struct map_desc realview_eb_io_desc[] __initdata = {
  39. {
  40. .virtual = IO_ADDRESS(REALVIEW_SYS_BASE),
  41. .pfn = __phys_to_pfn(REALVIEW_SYS_BASE),
  42. .length = SZ_4K,
  43. .type = MT_DEVICE,
  44. }, {
  45. .virtual = IO_ADDRESS(REALVIEW_GIC_CPU_BASE),
  46. .pfn = __phys_to_pfn(REALVIEW_GIC_CPU_BASE),
  47. .length = SZ_4K,
  48. .type = MT_DEVICE,
  49. }, {
  50. .virtual = IO_ADDRESS(REALVIEW_GIC_DIST_BASE),
  51. .pfn = __phys_to_pfn(REALVIEW_GIC_DIST_BASE),
  52. .length = SZ_4K,
  53. .type = MT_DEVICE,
  54. }, {
  55. .virtual = IO_ADDRESS(REALVIEW_SCTL_BASE),
  56. .pfn = __phys_to_pfn(REALVIEW_SCTL_BASE),
  57. .length = SZ_4K,
  58. .type = MT_DEVICE,
  59. }, {
  60. .virtual = IO_ADDRESS(REALVIEW_TIMER0_1_BASE),
  61. .pfn = __phys_to_pfn(REALVIEW_TIMER0_1_BASE),
  62. .length = SZ_4K,
  63. .type = MT_DEVICE,
  64. }, {
  65. .virtual = IO_ADDRESS(REALVIEW_TIMER2_3_BASE),
  66. .pfn = __phys_to_pfn(REALVIEW_TIMER2_3_BASE),
  67. .length = SZ_4K,
  68. .type = MT_DEVICE,
  69. },
  70. #ifdef CONFIG_DEBUG_LL
  71. {
  72. .virtual = IO_ADDRESS(REALVIEW_UART0_BASE),
  73. .pfn = __phys_to_pfn(REALVIEW_UART0_BASE),
  74. .length = SZ_4K,
  75. .type = MT_DEVICE,
  76. }
  77. #endif
  78. };
  79. static void __init realview_eb_map_io(void)
  80. {
  81. iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc));
  82. }
  83. /* FPGA Primecells */
  84. AMBA_DEVICE(aaci, "fpga:04", AACI, NULL);
  85. AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &realview_mmc0_plat_data);
  86. AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL);
  87. AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL);
  88. AMBA_DEVICE(uart3, "fpga:09", UART3, NULL);
  89. /* DevChip Primecells */
  90. AMBA_DEVICE(smc, "dev:00", SMC, NULL);
  91. AMBA_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data);
  92. AMBA_DEVICE(dmac, "dev:30", DMAC, NULL);
  93. AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL);
  94. AMBA_DEVICE(wdog, "dev:e1", WATCHDOG, NULL);
  95. AMBA_DEVICE(gpio0, "dev:e4", GPIO0, NULL);
  96. AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL);
  97. AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL);
  98. AMBA_DEVICE(rtc, "dev:e8", RTC, NULL);
  99. AMBA_DEVICE(sci0, "dev:f0", SCI, NULL);
  100. AMBA_DEVICE(uart0, "dev:f1", UART0, NULL);
  101. AMBA_DEVICE(uart1, "dev:f2", UART1, NULL);
  102. AMBA_DEVICE(uart2, "dev:f3", UART2, NULL);
  103. AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL);
  104. static struct amba_device *amba_devs[] __initdata = {
  105. &dmac_device,
  106. &uart0_device,
  107. &uart1_device,
  108. &uart2_device,
  109. &uart3_device,
  110. &smc_device,
  111. &clcd_device,
  112. &sctl_device,
  113. &wdog_device,
  114. &gpio0_device,
  115. &gpio1_device,
  116. &gpio2_device,
  117. &rtc_device,
  118. &sci0_device,
  119. &ssp0_device,
  120. &aaci_device,
  121. &mmc0_device,
  122. &kmi0_device,
  123. &kmi1_device,
  124. };
  125. static void __init gic_init_irq(void)
  126. {
  127. #ifdef CONFIG_REALVIEW_MPCORE
  128. unsigned int pldctrl;
  129. writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK));
  130. pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + 0xd8);
  131. pldctrl |= 0x00800000; /* New irq mode */
  132. writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + 0xd8);
  133. writel(0x00000000, __io_address(REALVIEW_SYS_LOCK));
  134. #endif
  135. gic_dist_init(__io_address(REALVIEW_GIC_DIST_BASE));
  136. gic_cpu_init(__io_address(REALVIEW_GIC_CPU_BASE));
  137. }
  138. static void __init realview_eb_init(void)
  139. {
  140. int i;
  141. clk_register(&realview_clcd_clk);
  142. platform_device_register(&realview_flash_device);
  143. platform_device_register(&realview_smc91x_device);
  144. for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
  145. struct amba_device *d = amba_devs[i];
  146. amba_device_register(d, &iomem_resource);
  147. }
  148. #ifdef CONFIG_LEDS
  149. leds_event = realview_leds_event;
  150. #endif
  151. }
  152. MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
  153. /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
  154. .phys_io = REALVIEW_UART0_BASE,
  155. .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc,
  156. .boot_params = 0x00000100,
  157. .map_io = realview_eb_map_io,
  158. .init_irq = gic_init_irq,
  159. .timer = &realview_timer,
  160. .init_machine = realview_eb_init,
  161. MACHINE_END