io.c 3.4 KB

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