io.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 <mach/mux.h>
  17. #include <mach/tc.h>
  18. extern int omap1_clk_init(void);
  19. extern void omap_check_revision(void);
  20. extern void omap_sram_init(void);
  21. extern void omapfb_reserve_sdram(void);
  22. /*
  23. * The machine specific code may provide the extra mapping besides the
  24. * default mapping provided here.
  25. */
  26. static struct map_desc omap_io_desc[] __initdata = {
  27. {
  28. .virtual = IO_VIRT,
  29. .pfn = __phys_to_pfn(IO_PHYS),
  30. .length = IO_SIZE,
  31. .type = MT_DEVICE
  32. }
  33. };
  34. #ifdef CONFIG_ARCH_OMAP730
  35. static struct map_desc omap730_io_desc[] __initdata = {
  36. {
  37. .virtual = OMAP730_DSP_BASE,
  38. .pfn = __phys_to_pfn(OMAP730_DSP_START),
  39. .length = OMAP730_DSP_SIZE,
  40. .type = MT_DEVICE
  41. }, {
  42. .virtual = OMAP730_DSPREG_BASE,
  43. .pfn = __phys_to_pfn(OMAP730_DSPREG_START),
  44. .length = OMAP730_DSPREG_SIZE,
  45. .type = MT_DEVICE
  46. }
  47. };
  48. #endif
  49. #ifdef CONFIG_ARCH_OMAP15XX
  50. static struct map_desc omap1510_io_desc[] __initdata = {
  51. {
  52. .virtual = OMAP1510_DSP_BASE,
  53. .pfn = __phys_to_pfn(OMAP1510_DSP_START),
  54. .length = OMAP1510_DSP_SIZE,
  55. .type = MT_DEVICE
  56. }, {
  57. .virtual = OMAP1510_DSPREG_BASE,
  58. .pfn = __phys_to_pfn(OMAP1510_DSPREG_START),
  59. .length = OMAP1510_DSPREG_SIZE,
  60. .type = MT_DEVICE
  61. }
  62. };
  63. #endif
  64. #if defined(CONFIG_ARCH_OMAP16XX)
  65. static struct map_desc omap16xx_io_desc[] __initdata = {
  66. {
  67. .virtual = OMAP16XX_DSP_BASE,
  68. .pfn = __phys_to_pfn(OMAP16XX_DSP_START),
  69. .length = OMAP16XX_DSP_SIZE,
  70. .type = MT_DEVICE
  71. }, {
  72. .virtual = OMAP16XX_DSPREG_BASE,
  73. .pfn = __phys_to_pfn(OMAP16XX_DSPREG_START),
  74. .length = OMAP16XX_DSPREG_SIZE,
  75. .type = MT_DEVICE
  76. }
  77. };
  78. #endif
  79. /*
  80. * Maps common IO regions for omap1. This should only get called from
  81. * board specific init.
  82. */
  83. void __init omap1_map_common_io(void)
  84. {
  85. iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
  86. /* Normally devicemaps_init() would flush caches and tlb after
  87. * mdesc->map_io(), but we must also do it here because of the CPU
  88. * revision check below.
  89. */
  90. local_flush_tlb_all();
  91. flush_cache_all();
  92. /* We want to check CPU revision early for cpu_is_omapxxxx() macros.
  93. * IO space mapping must be initialized before we can do that.
  94. */
  95. omap_check_revision();
  96. #ifdef CONFIG_ARCH_OMAP730
  97. if (cpu_is_omap730()) {
  98. iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
  99. }
  100. #endif
  101. #ifdef CONFIG_ARCH_OMAP15XX
  102. if (cpu_is_omap15xx()) {
  103. iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
  104. }
  105. #endif
  106. #if defined(CONFIG_ARCH_OMAP16XX)
  107. if (cpu_is_omap16xx()) {
  108. iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
  109. }
  110. #endif
  111. omap_sram_init();
  112. omapfb_reserve_sdram();
  113. }
  114. /*
  115. * Common low-level hardware init for omap1. This should only get called from
  116. * board specific init.
  117. */
  118. void __init omap1_init_common_hw(void)
  119. {
  120. /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
  121. * on a Posted Write in the TIPB Bridge".
  122. */
  123. omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
  124. omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
  125. /* Must init clocks early to assure that timer interrupt works
  126. */
  127. omap1_clk_init();
  128. omap1_mux_init();
  129. }