io.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * linux/arch/arm/mach-omap1/io.c
  3. *
  4. * OMAP1 I/O mapping code
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/module.h>
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/io.h>
  14. #include <asm/tlb.h>
  15. #include <asm/mach/map.h>
  16. #include <plat/mux.h>
  17. #include <plat/tc.h>
  18. #include "clock.h"
  19. extern void omap_check_revision(void);
  20. extern void omap_sram_init(void);
  21. /*
  22. * The machine specific code may provide the extra mapping besides the
  23. * default mapping provided here.
  24. */
  25. static struct map_desc omap_io_desc[] __initdata = {
  26. {
  27. .virtual = OMAP1_IO_VIRT,
  28. .pfn = __phys_to_pfn(OMAP1_IO_PHYS),
  29. .length = OMAP1_IO_SIZE,
  30. .type = MT_DEVICE
  31. }
  32. };
  33. #if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
  34. static struct map_desc omap7xx_io_desc[] __initdata = {
  35. {
  36. .virtual = OMAP7XX_DSP_BASE,
  37. .pfn = __phys_to_pfn(OMAP7XX_DSP_START),
  38. .length = OMAP7XX_DSP_SIZE,
  39. .type = MT_DEVICE
  40. }, {
  41. .virtual = OMAP7XX_DSPREG_BASE,
  42. .pfn = __phys_to_pfn(OMAP7XX_DSPREG_START),
  43. .length = OMAP7XX_DSPREG_SIZE,
  44. .type = MT_DEVICE
  45. }
  46. };
  47. #endif
  48. #ifdef CONFIG_ARCH_OMAP15XX
  49. static struct map_desc omap1510_io_desc[] __initdata = {
  50. {
  51. .virtual = OMAP1510_DSP_BASE,
  52. .pfn = __phys_to_pfn(OMAP1510_DSP_START),
  53. .length = OMAP1510_DSP_SIZE,
  54. .type = MT_DEVICE
  55. }, {
  56. .virtual = OMAP1510_DSPREG_BASE,
  57. .pfn = __phys_to_pfn(OMAP1510_DSPREG_START),
  58. .length = OMAP1510_DSPREG_SIZE,
  59. .type = MT_DEVICE
  60. }
  61. };
  62. #endif
  63. #if defined(CONFIG_ARCH_OMAP16XX)
  64. static struct map_desc omap16xx_io_desc[] __initdata = {
  65. {
  66. .virtual = OMAP16XX_DSP_BASE,
  67. .pfn = __phys_to_pfn(OMAP16XX_DSP_START),
  68. .length = OMAP16XX_DSP_SIZE,
  69. .type = MT_DEVICE
  70. }, {
  71. .virtual = OMAP16XX_DSPREG_BASE,
  72. .pfn = __phys_to_pfn(OMAP16XX_DSPREG_START),
  73. .length = OMAP16XX_DSPREG_SIZE,
  74. .type = MT_DEVICE
  75. }
  76. };
  77. #endif
  78. /*
  79. * Maps common IO regions for omap1. This should only get called from
  80. * board specific init.
  81. */
  82. void __init omap1_map_common_io(void)
  83. {
  84. iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
  85. /* Normally devicemaps_init() would flush caches and tlb after
  86. * mdesc->map_io(), but we must also do it here because of the CPU
  87. * revision check below.
  88. */
  89. local_flush_tlb_all();
  90. flush_cache_all();
  91. /* We want to check CPU revision early for cpu_is_omapxxxx() macros.
  92. * IO space mapping must be initialized before we can do that.
  93. */
  94. omap_check_revision();
  95. #if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
  96. if (cpu_is_omap7xx()) {
  97. iotable_init(omap7xx_io_desc, ARRAY_SIZE(omap7xx_io_desc));
  98. }
  99. #endif
  100. #ifdef CONFIG_ARCH_OMAP15XX
  101. if (cpu_is_omap15xx()) {
  102. iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
  103. }
  104. #endif
  105. #if defined(CONFIG_ARCH_OMAP16XX)
  106. if (cpu_is_omap16xx()) {
  107. iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
  108. }
  109. #endif
  110. omap_sram_init();
  111. }
  112. /*
  113. * Common low-level hardware init for omap1. This should only get called from
  114. * board specific init.
  115. */
  116. void __init omap1_init_common_hw(void)
  117. {
  118. /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
  119. * on a Posted Write in the TIPB Bridge".
  120. */
  121. omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
  122. omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
  123. /* Must init clocks early to assure that timer interrupt works
  124. */
  125. omap1_clk_init();
  126. omap1_mux_init();
  127. }