io.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * linux/arch/arm/mach-omap1/io.c
  4. *
  5. * OMAP1 I/O mapping code
  6. */
  7. #include <linux/module.h>
  8. #include <linux/kernel.h>
  9. #include <linux/init.h>
  10. #include <linux/io.h>
  11. #include <linux/omap-dma.h>
  12. #include <asm/tlb.h>
  13. #include <asm/mach/map.h>
  14. #include "tc.h"
  15. #include "iomap.h"
  16. #include "common.h"
  17. /*
  18. * The machine specific code may provide the extra mapping besides the
  19. * default mapping provided here.
  20. */
  21. static struct map_desc omap1_io_desc[] __initdata = {
  22. {
  23. .virtual = OMAP1_IO_VIRT,
  24. .pfn = __phys_to_pfn(OMAP1_IO_PHYS),
  25. .length = OMAP1_IO_SIZE,
  26. .type = MT_DEVICE
  27. }, {
  28. .virtual = OMAP1_DSP_BASE,
  29. .pfn = __phys_to_pfn(OMAP1_DSP_START),
  30. .length = OMAP1_DSP_SIZE,
  31. .type = MT_DEVICE
  32. }, {
  33. .virtual = OMAP1_DSPREG_BASE,
  34. .pfn = __phys_to_pfn(OMAP1_DSPREG_START),
  35. .length = OMAP1_DSPREG_SIZE,
  36. .type = MT_DEVICE
  37. }
  38. };
  39. /*
  40. * Maps common IO regions for omap1
  41. */
  42. void __init omap1_map_io(void)
  43. {
  44. iotable_init(omap1_io_desc, ARRAY_SIZE(omap1_io_desc));
  45. }
  46. /*
  47. * Common low-level hardware init for omap1.
  48. */
  49. void __init omap1_init_early(void)
  50. {
  51. omap_check_revision();
  52. /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
  53. * on a Posted Write in the TIPB Bridge".
  54. */
  55. omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
  56. omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
  57. }
  58. void __init omap1_init_late(void)
  59. {
  60. omap_serial_wakeup_init();
  61. }
  62. /*
  63. * NOTE: Please use ioremap + __raw_read/write where possible instead of these
  64. */
  65. u8 omap_readb(u32 pa)
  66. {
  67. return __raw_readb(OMAP1_IO_ADDRESS(pa));
  68. }
  69. EXPORT_SYMBOL(omap_readb);
  70. u16 omap_readw(u32 pa)
  71. {
  72. return __raw_readw(OMAP1_IO_ADDRESS(pa));
  73. }
  74. EXPORT_SYMBOL(omap_readw);
  75. u32 omap_readl(u32 pa)
  76. {
  77. return __raw_readl(OMAP1_IO_ADDRESS(pa));
  78. }
  79. EXPORT_SYMBOL(omap_readl);
  80. void omap_writeb(u8 v, u32 pa)
  81. {
  82. __raw_writeb(v, OMAP1_IO_ADDRESS(pa));
  83. }
  84. EXPORT_SYMBOL(omap_writeb);
  85. void omap_writew(u16 v, u32 pa)
  86. {
  87. __raw_writew(v, OMAP1_IO_ADDRESS(pa));
  88. }
  89. EXPORT_SYMBOL(omap_writew);
  90. void omap_writel(u32 v, u32 pa)
  91. {
  92. __raw_writel(v, OMAP1_IO_ADDRESS(pa));
  93. }
  94. EXPORT_SYMBOL(omap_writel);