io.c 4.5 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 <mach/sdrc.h>
  27. #include <mach/gpmc.h>
  28. #include "clock.h"
  29. #include <mach/powerdomain.h>
  30. #include "powerdomains.h"
  31. #include <mach/clockdomain.h>
  32. #include "clockdomains.h"
  33. /*
  34. * The machine specific code may provide the extra mapping besides the
  35. * default mapping provided here.
  36. */
  37. #ifdef CONFIG_ARCH_OMAP24XX
  38. static struct map_desc omap24xx_io_desc[] __initdata = {
  39. {
  40. .virtual = L3_24XX_VIRT,
  41. .pfn = __phys_to_pfn(L3_24XX_PHYS),
  42. .length = L3_24XX_SIZE,
  43. .type = MT_DEVICE
  44. },
  45. {
  46. .virtual = L4_24XX_VIRT,
  47. .pfn = __phys_to_pfn(L4_24XX_PHYS),
  48. .length = L4_24XX_SIZE,
  49. .type = MT_DEVICE
  50. },
  51. };
  52. #ifdef CONFIG_ARCH_OMAP2420
  53. static struct map_desc omap242x_io_desc[] __initdata = {
  54. {
  55. .virtual = DSP_MEM_24XX_VIRT,
  56. .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS),
  57. .length = DSP_MEM_24XX_SIZE,
  58. .type = MT_DEVICE
  59. },
  60. {
  61. .virtual = DSP_IPI_24XX_VIRT,
  62. .pfn = __phys_to_pfn(DSP_IPI_24XX_PHYS),
  63. .length = DSP_IPI_24XX_SIZE,
  64. .type = MT_DEVICE
  65. },
  66. {
  67. .virtual = DSP_MMU_24XX_VIRT,
  68. .pfn = __phys_to_pfn(DSP_MMU_24XX_PHYS),
  69. .length = DSP_MMU_24XX_SIZE,
  70. .type = MT_DEVICE
  71. },
  72. };
  73. #endif
  74. #ifdef CONFIG_ARCH_OMAP2430
  75. static struct map_desc omap243x_io_desc[] __initdata = {
  76. {
  77. .virtual = L4_WK_243X_VIRT,
  78. .pfn = __phys_to_pfn(L4_WK_243X_PHYS),
  79. .length = L4_WK_243X_SIZE,
  80. .type = MT_DEVICE
  81. },
  82. {
  83. .virtual = OMAP243X_GPMC_VIRT,
  84. .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS),
  85. .length = OMAP243X_GPMC_SIZE,
  86. .type = MT_DEVICE
  87. },
  88. {
  89. .virtual = OMAP243X_SDRC_VIRT,
  90. .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS),
  91. .length = OMAP243X_SDRC_SIZE,
  92. .type = MT_DEVICE
  93. },
  94. {
  95. .virtual = OMAP243X_SMS_VIRT,
  96. .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS),
  97. .length = OMAP243X_SMS_SIZE,
  98. .type = MT_DEVICE
  99. },
  100. };
  101. #endif
  102. #endif
  103. #ifdef CONFIG_ARCH_OMAP34XX
  104. static struct map_desc omap34xx_io_desc[] __initdata = {
  105. {
  106. .virtual = L3_34XX_VIRT,
  107. .pfn = __phys_to_pfn(L3_34XX_PHYS),
  108. .length = L3_34XX_SIZE,
  109. .type = MT_DEVICE
  110. },
  111. {
  112. .virtual = L4_34XX_VIRT,
  113. .pfn = __phys_to_pfn(L4_34XX_PHYS),
  114. .length = L4_34XX_SIZE,
  115. .type = MT_DEVICE
  116. },
  117. {
  118. .virtual = L4_WK_34XX_VIRT,
  119. .pfn = __phys_to_pfn(L4_WK_34XX_PHYS),
  120. .length = L4_WK_34XX_SIZE,
  121. .type = MT_DEVICE
  122. },
  123. {
  124. .virtual = OMAP34XX_GPMC_VIRT,
  125. .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS),
  126. .length = OMAP34XX_GPMC_SIZE,
  127. .type = MT_DEVICE
  128. },
  129. {
  130. .virtual = OMAP343X_SMS_VIRT,
  131. .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS),
  132. .length = OMAP343X_SMS_SIZE,
  133. .type = MT_DEVICE
  134. },
  135. {
  136. .virtual = OMAP343X_SDRC_VIRT,
  137. .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS),
  138. .length = OMAP343X_SDRC_SIZE,
  139. .type = MT_DEVICE
  140. },
  141. {
  142. .virtual = L4_PER_34XX_VIRT,
  143. .pfn = __phys_to_pfn(L4_PER_34XX_PHYS),
  144. .length = L4_PER_34XX_SIZE,
  145. .type = MT_DEVICE
  146. },
  147. {
  148. .virtual = L4_EMU_34XX_VIRT,
  149. .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS),
  150. .length = L4_EMU_34XX_SIZE,
  151. .type = MT_DEVICE
  152. },
  153. };
  154. #endif
  155. void __init omap2_map_common_io(void)
  156. {
  157. #if defined(CONFIG_ARCH_OMAP2420)
  158. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  159. iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
  160. #endif
  161. #if defined(CONFIG_ARCH_OMAP2430)
  162. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  163. iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
  164. #endif
  165. #if defined(CONFIG_ARCH_OMAP34XX)
  166. iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
  167. #endif
  168. /* Normally devicemaps_init() would flush caches and tlb after
  169. * mdesc->map_io(), but we must also do it here because of the CPU
  170. * revision check below.
  171. */
  172. local_flush_tlb_all();
  173. flush_cache_all();
  174. omap2_check_revision();
  175. omap_sram_init();
  176. omapfb_reserve_sdram();
  177. }
  178. void __init omap2_init_common_hw(struct omap_sdrc_params *sp)
  179. {
  180. omap2_mux_init();
  181. pwrdm_init(powerdomains_omap);
  182. clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
  183. omap2_clk_init();
  184. omap2_sdrc_init(sp);
  185. gpmc_init();
  186. }