io.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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/tc.h>
  17. extern int clk_init(void);
  18. extern void omap_check_revision(void);
  19. extern void omap_sram_init(void);
  20. /*
  21. * The machine specific code may provide the extra mapping besides the
  22. * default mapping provided here.
  23. */
  24. static struct map_desc omap_io_desc[] __initdata = {
  25. {
  26. .virtual = IO_VIRT,
  27. .pfn = __phys_to_pfn(IO_PHYS),
  28. .length = IO_SIZE,
  29. .type = MT_DEVICE
  30. }
  31. };
  32. #ifdef CONFIG_ARCH_OMAP730
  33. static struct map_desc omap730_io_desc[] __initdata = {
  34. {
  35. .virtual = OMAP730_DSP_BASE,
  36. .pfn = __phys_to_pfn(OMAP730_DSP_START),
  37. .length = OMAP730_DSP_SIZE,
  38. .type = MT_DEVICE
  39. }, {
  40. .virtual = OMAP730_DSPREG_BASE,
  41. .pfn = __phys_to_pfn(OMAP730_DSPREG_START),
  42. .length = OMAP730_DSPREG_SIZE,
  43. .type = MT_DEVICE
  44. }
  45. };
  46. #endif
  47. #ifdef CONFIG_ARCH_OMAP1510
  48. static struct map_desc omap1510_io_desc[] __initdata = {
  49. {
  50. .virtual = OMAP1510_DSP_BASE,
  51. .pfn = __phys_to_pfn(OMAP1510_DSP_START),
  52. .length = OMAP1510_DSP_SIZE,
  53. .type = MT_DEVICE
  54. }, {
  55. .virtual = OMAP1510_DSPREG_BASE,
  56. .pfn = __phys_to_pfn(OMAP1510_DSPREG_START),
  57. .length = OMAP1510_DSPREG_SIZE,
  58. .type = MT_DEVICE
  59. }
  60. };
  61. #endif
  62. #if defined(CONFIG_ARCH_OMAP16XX)
  63. static struct map_desc omap16xx_io_desc[] __initdata = {
  64. {
  65. .virtual = OMAP16XX_DSP_BASE,
  66. .pfn = __phys_to_pfn(OMAP16XX_DSP_START),
  67. .length = OMAP16XX_DSP_SIZE,
  68. .type = MT_DEVICE
  69. }, {
  70. .virtual = OMAP16XX_DSPREG_BASE,
  71. .pfn = __phys_to_pfn(OMAP16XX_DSPREG_START),
  72. .length = OMAP16XX_DSPREG_SIZE,
  73. .type = MT_DEVICE
  74. }
  75. };
  76. #endif
  77. static int initialized = 0;
  78. static void __init _omap_map_io(void)
  79. {
  80. initialized = 1;
  81. /* We have to initialize the IO space mapping before we can run
  82. * cpu_is_omapxxx() macros. */
  83. iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
  84. omap_check_revision();
  85. #ifdef CONFIG_ARCH_OMAP730
  86. if (cpu_is_omap730()) {
  87. iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
  88. }
  89. #endif
  90. #ifdef CONFIG_ARCH_OMAP1510
  91. if (cpu_is_omap1510()) {
  92. iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
  93. }
  94. #endif
  95. #if defined(CONFIG_ARCH_OMAP16XX)
  96. if (cpu_is_omap16xx()) {
  97. iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
  98. }
  99. #endif
  100. omap_sram_init();
  101. /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
  102. * on a Posted Write in the TIPB Bridge".
  103. */
  104. omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
  105. omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
  106. /* Must init clocks early to assure that timer interrupt works
  107. */
  108. clk_init();
  109. }
  110. /*
  111. * This should only get called from board specific init
  112. */
  113. void __init omap_map_common_io(void)
  114. {
  115. if (!initialized)
  116. _omap_map_io();
  117. }