io.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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-2009 Texas Instruments
  8. *
  9. * Author:
  10. * Juha Yrjola <juha.yrjola@nokia.com>
  11. * Syed Khasim <x0khasim@ti.com>
  12. *
  13. * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License version 2 as
  17. * published by the Free Software Foundation.
  18. */
  19. #include <linux/module.h>
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/io.h>
  23. #include <asm/tlb.h>
  24. #include <asm/mach/map.h>
  25. #include <mach/mux.h>
  26. #include <mach/omapfb.h>
  27. #include <mach/sram.h>
  28. #include <mach/sdrc.h>
  29. #include <mach/gpmc.h>
  30. #ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once clkdev is ready */
  31. #include "clock.h"
  32. #include <mach/powerdomain.h>
  33. #include "powerdomains.h"
  34. #include <mach/clockdomain.h>
  35. #include "clockdomains.h"
  36. #endif
  37. /*
  38. * The machine specific code may provide the extra mapping besides the
  39. * default mapping provided here.
  40. */
  41. #ifdef CONFIG_ARCH_OMAP24XX
  42. static struct map_desc omap24xx_io_desc[] __initdata = {
  43. {
  44. .virtual = L3_24XX_VIRT,
  45. .pfn = __phys_to_pfn(L3_24XX_PHYS),
  46. .length = L3_24XX_SIZE,
  47. .type = MT_DEVICE
  48. },
  49. {
  50. .virtual = L4_24XX_VIRT,
  51. .pfn = __phys_to_pfn(L4_24XX_PHYS),
  52. .length = L4_24XX_SIZE,
  53. .type = MT_DEVICE
  54. },
  55. };
  56. #ifdef CONFIG_ARCH_OMAP2420
  57. static struct map_desc omap242x_io_desc[] __initdata = {
  58. {
  59. .virtual = DSP_MEM_24XX_VIRT,
  60. .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS),
  61. .length = DSP_MEM_24XX_SIZE,
  62. .type = MT_DEVICE
  63. },
  64. {
  65. .virtual = DSP_IPI_24XX_VIRT,
  66. .pfn = __phys_to_pfn(DSP_IPI_24XX_PHYS),
  67. .length = DSP_IPI_24XX_SIZE,
  68. .type = MT_DEVICE
  69. },
  70. {
  71. .virtual = DSP_MMU_24XX_VIRT,
  72. .pfn = __phys_to_pfn(DSP_MMU_24XX_PHYS),
  73. .length = DSP_MMU_24XX_SIZE,
  74. .type = MT_DEVICE
  75. },
  76. };
  77. #endif
  78. #ifdef CONFIG_ARCH_OMAP2430
  79. static struct map_desc omap243x_io_desc[] __initdata = {
  80. {
  81. .virtual = L4_WK_243X_VIRT,
  82. .pfn = __phys_to_pfn(L4_WK_243X_PHYS),
  83. .length = L4_WK_243X_SIZE,
  84. .type = MT_DEVICE
  85. },
  86. {
  87. .virtual = OMAP243X_GPMC_VIRT,
  88. .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS),
  89. .length = OMAP243X_GPMC_SIZE,
  90. .type = MT_DEVICE
  91. },
  92. {
  93. .virtual = OMAP243X_SDRC_VIRT,
  94. .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS),
  95. .length = OMAP243X_SDRC_SIZE,
  96. .type = MT_DEVICE
  97. },
  98. {
  99. .virtual = OMAP243X_SMS_VIRT,
  100. .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS),
  101. .length = OMAP243X_SMS_SIZE,
  102. .type = MT_DEVICE
  103. },
  104. };
  105. #endif
  106. #endif
  107. #ifdef CONFIG_ARCH_OMAP34XX
  108. static struct map_desc omap34xx_io_desc[] __initdata = {
  109. {
  110. .virtual = L3_34XX_VIRT,
  111. .pfn = __phys_to_pfn(L3_34XX_PHYS),
  112. .length = L3_34XX_SIZE,
  113. .type = MT_DEVICE
  114. },
  115. {
  116. .virtual = L4_34XX_VIRT,
  117. .pfn = __phys_to_pfn(L4_34XX_PHYS),
  118. .length = L4_34XX_SIZE,
  119. .type = MT_DEVICE
  120. },
  121. {
  122. .virtual = L4_WK_34XX_VIRT,
  123. .pfn = __phys_to_pfn(L4_WK_34XX_PHYS),
  124. .length = L4_WK_34XX_SIZE,
  125. .type = MT_DEVICE
  126. },
  127. {
  128. .virtual = OMAP34XX_GPMC_VIRT,
  129. .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS),
  130. .length = OMAP34XX_GPMC_SIZE,
  131. .type = MT_DEVICE
  132. },
  133. {
  134. .virtual = OMAP343X_SMS_VIRT,
  135. .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS),
  136. .length = OMAP343X_SMS_SIZE,
  137. .type = MT_DEVICE
  138. },
  139. {
  140. .virtual = OMAP343X_SDRC_VIRT,
  141. .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS),
  142. .length = OMAP343X_SDRC_SIZE,
  143. .type = MT_DEVICE
  144. },
  145. {
  146. .virtual = L4_PER_34XX_VIRT,
  147. .pfn = __phys_to_pfn(L4_PER_34XX_PHYS),
  148. .length = L4_PER_34XX_SIZE,
  149. .type = MT_DEVICE
  150. },
  151. {
  152. .virtual = L4_EMU_34XX_VIRT,
  153. .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS),
  154. .length = L4_EMU_34XX_SIZE,
  155. .type = MT_DEVICE
  156. },
  157. };
  158. #endif
  159. #ifdef CONFIG_ARCH_OMAP4
  160. static struct map_desc omap44xx_io_desc[] __initdata = {
  161. {
  162. .virtual = L3_44XX_VIRT,
  163. .pfn = __phys_to_pfn(L3_44XX_PHYS),
  164. .length = L3_44XX_SIZE,
  165. .type = MT_DEVICE,
  166. },
  167. {
  168. .virtual = L4_44XX_VIRT,
  169. .pfn = __phys_to_pfn(L4_44XX_PHYS),
  170. .length = L4_44XX_SIZE,
  171. .type = MT_DEVICE,
  172. },
  173. {
  174. .virtual = L4_WK_44XX_VIRT,
  175. .pfn = __phys_to_pfn(L4_WK_44XX_PHYS),
  176. .length = L4_WK_44XX_SIZE,
  177. .type = MT_DEVICE,
  178. },
  179. {
  180. .virtual = OMAP44XX_GPMC_VIRT,
  181. .pfn = __phys_to_pfn(OMAP44XX_GPMC_PHYS),
  182. .length = OMAP44XX_GPMC_SIZE,
  183. .type = MT_DEVICE,
  184. },
  185. {
  186. .virtual = L4_PER_44XX_VIRT,
  187. .pfn = __phys_to_pfn(L4_PER_44XX_PHYS),
  188. .length = L4_PER_44XX_SIZE,
  189. .type = MT_DEVICE,
  190. },
  191. {
  192. .virtual = L4_EMU_44XX_VIRT,
  193. .pfn = __phys_to_pfn(L4_EMU_44XX_PHYS),
  194. .length = L4_EMU_44XX_SIZE,
  195. .type = MT_DEVICE,
  196. },
  197. };
  198. #endif
  199. void __init omap2_map_common_io(void)
  200. {
  201. #if defined(CONFIG_ARCH_OMAP2420)
  202. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  203. iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
  204. #endif
  205. #if defined(CONFIG_ARCH_OMAP2430)
  206. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  207. iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
  208. #endif
  209. #if defined(CONFIG_ARCH_OMAP34XX)
  210. iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
  211. #endif
  212. #if defined(CONFIG_ARCH_OMAP4)
  213. iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
  214. #endif
  215. /* Normally devicemaps_init() would flush caches and tlb after
  216. * mdesc->map_io(), but we must also do it here because of the CPU
  217. * revision check below.
  218. */
  219. local_flush_tlb_all();
  220. flush_cache_all();
  221. omap2_check_revision();
  222. omap_sram_init();
  223. omapfb_reserve_sdram();
  224. }
  225. void __init omap2_init_common_hw(struct omap_sdrc_params *sp)
  226. {
  227. omap2_mux_init();
  228. #ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once the clkdev is ready */
  229. pwrdm_init(powerdomains_omap);
  230. clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
  231. omap2_clk_init();
  232. omap2_sdrc_init(sp);
  233. #endif
  234. gpmc_init();
  235. }