io.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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/mach/map.h>
  15. #include <asm/io.h>
  16. #include <asm/arch/mux.h>
  17. #include <asm/arch/tc.h>
  18. extern int omap1_clk_init(void);
  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 = IO_VIRT,
  28. .pfn = __phys_to_pfn(IO_PHYS),
  29. .length = IO_SIZE,
  30. .type = MT_DEVICE
  31. }
  32. };
  33. #ifdef CONFIG_ARCH_OMAP730
  34. static struct map_desc omap730_io_desc[] __initdata = {
  35. {
  36. .virtual = OMAP730_DSP_BASE,
  37. .pfn = __phys_to_pfn(OMAP730_DSP_START),
  38. .length = OMAP730_DSP_SIZE,
  39. .type = MT_DEVICE
  40. }, {
  41. .virtual = OMAP730_DSPREG_BASE,
  42. .pfn = __phys_to_pfn(OMAP730_DSPREG_START),
  43. .length = OMAP730_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. static int initialized = 0;
  79. static void __init _omap_map_io(void)
  80. {
  81. initialized = 1;
  82. /* We have to initialize the IO space mapping before we can run
  83. * cpu_is_omapxxx() macros. */
  84. iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
  85. omap_check_revision();
  86. #ifdef CONFIG_ARCH_OMAP730
  87. if (cpu_is_omap730()) {
  88. iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
  89. }
  90. #endif
  91. #ifdef CONFIG_ARCH_OMAP15XX
  92. if (cpu_is_omap1510()) {
  93. iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
  94. }
  95. #endif
  96. #if defined(CONFIG_ARCH_OMAP16XX)
  97. if (cpu_is_omap16xx()) {
  98. iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
  99. }
  100. #endif
  101. omap_sram_init();
  102. /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
  103. * on a Posted Write in the TIPB Bridge".
  104. */
  105. omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
  106. omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
  107. /* Must init clocks early to assure that timer interrupt works
  108. */
  109. omap1_clk_init();
  110. }
  111. /*
  112. * This should only get called from board specific init
  113. */
  114. void __init omap_map_common_io(void)
  115. {
  116. if (!initialized) {
  117. _omap_map_io();
  118. omap1_mux_init();
  119. }
  120. }