io.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /*
  2. * linux/arch/arm/mach-omap2/io.c
  3. *
  4. * OMAP2 I/O mapping code
  5. *
  6. * Copyright (C) 2005 Nokia Corporation
  7. * Copyright (C) 2007 Texas Instruments
  8. *
  9. * Author:
  10. * Juha Yrjola <juha.yrjola@nokia.com>
  11. * Syed Khasim <x0khasim@ti.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. */
  17. #include <linux/module.h>
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/io.h>
  21. #include <asm/tlb.h>
  22. #include <asm/mach/map.h>
  23. #include <mach/mux.h>
  24. #include <mach/omapfb.h>
  25. #include <mach/sram.h>
  26. #include "memory.h"
  27. #include "clock.h"
  28. #include <mach/powerdomain.h>
  29. #include "powerdomains.h"
  30. #include <mach/clockdomain.h>
  31. #include "clockdomains.h"
  32. /*
  33. * The machine specific code may provide the extra mapping besides the
  34. * default mapping provided here.
  35. */
  36. #ifdef CONFIG_ARCH_OMAP24XX
  37. static struct map_desc omap24xx_io_desc[] __initdata = {
  38. {
  39. .virtual = L3_24XX_VIRT,
  40. .pfn = __phys_to_pfn(L3_24XX_PHYS),
  41. .length = L3_24XX_SIZE,
  42. .type = MT_DEVICE
  43. },
  44. {
  45. .virtual = L4_24XX_VIRT,
  46. .pfn = __phys_to_pfn(L4_24XX_PHYS),
  47. .length = L4_24XX_SIZE,
  48. .type = MT_DEVICE
  49. },
  50. };
  51. #ifdef CONFIG_ARCH_OMAP2420
  52. static struct map_desc omap242x_io_desc[] __initdata = {
  53. {
  54. .virtual = DSP_MEM_24XX_VIRT,
  55. .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS),
  56. .length = DSP_MEM_24XX_SIZE,
  57. .type = MT_DEVICE
  58. },
  59. {
  60. .virtual = DSP_IPI_24XX_VIRT,
  61. .pfn = __phys_to_pfn(DSP_IPI_24XX_PHYS),
  62. .length = DSP_IPI_24XX_SIZE,
  63. .type = MT_DEVICE
  64. },
  65. {
  66. .virtual = DSP_MMU_24XX_VIRT,
  67. .pfn = __phys_to_pfn(DSP_MMU_24XX_PHYS),
  68. .length = DSP_MMU_24XX_SIZE,
  69. .type = MT_DEVICE
  70. },
  71. };
  72. #endif
  73. #ifdef CONFIG_ARCH_OMAP2430
  74. static struct map_desc omap243x_io_desc[] __initdata = {
  75. {
  76. .virtual = L4_WK_243X_VIRT,
  77. .pfn = __phys_to_pfn(L4_WK_243X_PHYS),
  78. .length = L4_WK_243X_SIZE,
  79. .type = MT_DEVICE
  80. },
  81. {
  82. .virtual = OMAP243X_GPMC_VIRT,
  83. .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS),
  84. .length = OMAP243X_GPMC_SIZE,
  85. .type = MT_DEVICE
  86. },
  87. {
  88. .virtual = OMAP243X_SDRC_VIRT,
  89. .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS),
  90. .length = OMAP243X_SDRC_SIZE,
  91. .type = MT_DEVICE
  92. },
  93. {
  94. .virtual = OMAP243X_SMS_VIRT,
  95. .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS),
  96. .length = OMAP243X_SMS_SIZE,
  97. .type = MT_DEVICE
  98. },
  99. };
  100. #endif
  101. #endif
  102. #ifdef CONFIG_ARCH_OMAP34XX
  103. static struct map_desc omap34xx_io_desc[] __initdata = {
  104. {
  105. .virtual = L3_34XX_VIRT,
  106. .pfn = __phys_to_pfn(L3_34XX_PHYS),
  107. .length = L3_34XX_SIZE,
  108. .type = MT_DEVICE
  109. },
  110. {
  111. .virtual = L4_34XX_VIRT,
  112. .pfn = __phys_to_pfn(L4_34XX_PHYS),
  113. .length = L4_34XX_SIZE,
  114. .type = MT_DEVICE
  115. },
  116. {
  117. .virtual = L4_WK_34XX_VIRT,
  118. .pfn = __phys_to_pfn(L4_WK_34XX_PHYS),
  119. .length = L4_WK_34XX_SIZE,
  120. .type = MT_DEVICE
  121. },
  122. {
  123. .virtual = OMAP34XX_GPMC_VIRT,
  124. .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS),
  125. .length = OMAP34XX_GPMC_SIZE,
  126. .type = MT_DEVICE
  127. },
  128. {
  129. .virtual = OMAP343X_SMS_VIRT,
  130. .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS),
  131. .length = OMAP343X_SMS_SIZE,
  132. .type = MT_DEVICE
  133. },
  134. {
  135. .virtual = OMAP343X_SDRC_VIRT,
  136. .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS),
  137. .length = OMAP343X_SDRC_SIZE,
  138. .type = MT_DEVICE
  139. },
  140. {
  141. .virtual = L4_PER_34XX_VIRT,
  142. .pfn = __phys_to_pfn(L4_PER_34XX_PHYS),
  143. .length = L4_PER_34XX_SIZE,
  144. .type = MT_DEVICE
  145. },
  146. {
  147. .virtual = L4_EMU_34XX_VIRT,
  148. .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS),
  149. .length = L4_EMU_34XX_SIZE,
  150. .type = MT_DEVICE
  151. },
  152. };
  153. #endif
  154. void __init omap2_map_common_io(void)
  155. {
  156. #if defined(CONFIG_ARCH_OMAP2420)
  157. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  158. iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
  159. #endif
  160. #if defined(CONFIG_ARCH_OMAP2430)
  161. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  162. iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
  163. #endif
  164. #if defined(CONFIG_ARCH_OMAP34XX)
  165. iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
  166. #endif
  167. /* Normally devicemaps_init() would flush caches and tlb after
  168. * mdesc->map_io(), but we must also do it here because of the CPU
  169. * revision check below.
  170. */
  171. local_flush_tlb_all();
  172. flush_cache_all();
  173. omap2_check_revision();
  174. omap_sram_init();
  175. omapfb_reserve_sdram();
  176. }
  177. void __init omap2_init_common_hw(void)
  178. {
  179. omap2_mux_init();
  180. pwrdm_init(powerdomains_omap);
  181. clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
  182. omap2_clk_init();
  183. omap2_init_memory();
  184. gpmc_init();
  185. }