io.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. { IO_VIRT, IO_PHYS, IO_SIZE, MT_DEVICE },
  26. };
  27. #ifdef CONFIG_ARCH_OMAP730
  28. static struct map_desc omap730_io_desc[] __initdata = {
  29. { OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE },
  30. { OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE },
  31. };
  32. #endif
  33. #ifdef CONFIG_ARCH_OMAP1510
  34. static struct map_desc omap1510_io_desc[] __initdata = {
  35. { OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE },
  36. { OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE },
  37. };
  38. #endif
  39. #if defined(CONFIG_ARCH_OMAP16XX)
  40. static struct map_desc omap16xx_io_desc[] __initdata = {
  41. { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
  42. { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
  43. };
  44. #endif
  45. static int initialized = 0;
  46. static void __init _omap_map_io(void)
  47. {
  48. initialized = 1;
  49. /* We have to initialize the IO space mapping before we can run
  50. * cpu_is_omapxxx() macros. */
  51. iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
  52. omap_check_revision();
  53. #ifdef CONFIG_ARCH_OMAP730
  54. if (cpu_is_omap730()) {
  55. iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
  56. }
  57. #endif
  58. #ifdef CONFIG_ARCH_OMAP1510
  59. if (cpu_is_omap1510()) {
  60. iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
  61. }
  62. #endif
  63. #if defined(CONFIG_ARCH_OMAP16XX)
  64. if (cpu_is_omap16xx()) {
  65. iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
  66. }
  67. #endif
  68. omap_sram_init();
  69. /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
  70. * on a Posted Write in the TIPB Bridge".
  71. */
  72. omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
  73. omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
  74. /* Must init clocks early to assure that timer interrupt works
  75. */
  76. clk_init();
  77. }
  78. /*
  79. * This should only get called from board specific init
  80. */
  81. void __init omap_map_common_io(void)
  82. {
  83. if (!initialized)
  84. _omap_map_io();
  85. }