iomap.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2010 Google, Inc.
  4. *
  5. * Author:
  6. * Colin Cross <[email protected]>
  7. * Erik Gilling <[email protected]>
  8. */
  9. #ifndef __MACH_TEGRA_IOMAP_H
  10. #define __MACH_TEGRA_IOMAP_H
  11. #include <linux/pgtable.h>
  12. #include <linux/sizes.h>
  13. #define TEGRA_IRAM_BASE 0x40000000
  14. #define TEGRA_IRAM_SIZE SZ_256K
  15. #define TEGRA_ARM_PERIF_BASE 0x50040000
  16. #define TEGRA_ARM_PERIF_SIZE SZ_8K
  17. #define TEGRA_ARM_INT_DIST_BASE 0x50041000
  18. #define TEGRA_ARM_INT_DIST_SIZE SZ_4K
  19. #define TEGRA_TMR1_BASE 0x60005000
  20. #define TEGRA_TMR1_SIZE SZ_8
  21. #define TEGRA_TMR2_BASE 0x60005008
  22. #define TEGRA_TMR2_SIZE SZ_8
  23. #define TEGRA_TMRUS_BASE 0x60005010
  24. #define TEGRA_TMRUS_SIZE SZ_64
  25. #define TEGRA_TMR3_BASE 0x60005050
  26. #define TEGRA_TMR3_SIZE SZ_8
  27. #define TEGRA_TMR4_BASE 0x60005058
  28. #define TEGRA_TMR4_SIZE SZ_8
  29. #define TEGRA_CLK_RESET_BASE 0x60006000
  30. #define TEGRA_CLK_RESET_SIZE SZ_4K
  31. #define TEGRA_FLOW_CTRL_BASE 0x60007000
  32. #define TEGRA_FLOW_CTRL_SIZE 20
  33. #define TEGRA_SB_BASE 0x6000C200
  34. #define TEGRA_SB_SIZE 256
  35. #define TEGRA_EXCEPTION_VECTORS_BASE 0x6000F000
  36. #define TEGRA_EXCEPTION_VECTORS_SIZE SZ_4K
  37. #define TEGRA_APB_MISC_BASE 0x70000000
  38. #define TEGRA_APB_MISC_SIZE SZ_4K
  39. #define TEGRA_UARTA_BASE 0x70006000
  40. #define TEGRA_UARTA_SIZE SZ_64
  41. #define TEGRA_UARTB_BASE 0x70006040
  42. #define TEGRA_UARTB_SIZE SZ_64
  43. #define TEGRA_UARTC_BASE 0x70006200
  44. #define TEGRA_UARTC_SIZE SZ_256
  45. #define TEGRA_UARTD_BASE 0x70006300
  46. #define TEGRA_UARTD_SIZE SZ_256
  47. #define TEGRA_UARTE_BASE 0x70006400
  48. #define TEGRA_UARTE_SIZE SZ_256
  49. #define TEGRA_PMC_BASE 0x7000E400
  50. #define TEGRA_PMC_SIZE SZ_256
  51. #define TEGRA_EMC_BASE 0x7000F400
  52. #define TEGRA_EMC_SIZE SZ_1K
  53. #define TEGRA_EMC0_BASE 0x7001A000
  54. #define TEGRA_EMC0_SIZE SZ_2K
  55. #define TEGRA_EMC1_BASE 0x7001A800
  56. #define TEGRA_EMC1_SIZE SZ_2K
  57. #define TEGRA124_EMC_BASE 0x7001B000
  58. #define TEGRA124_EMC_SIZE SZ_2K
  59. #define TEGRA_CSITE_BASE 0x70040000
  60. #define TEGRA_CSITE_SIZE SZ_256K
  61. /* On TEGRA, many peripherals are very closely packed in
  62. * two 256MB io windows (that actually only use about 64KB
  63. * at the start of each).
  64. *
  65. * We will just map the first MMU section of each window (to minimize
  66. * pt entries needed) and provide a macro to transform physical
  67. * io addresses to an appropriate void __iomem *.
  68. */
  69. #define IO_IRAM_PHYS 0x40000000
  70. #define IO_IRAM_VIRT IOMEM(0xFE400000)
  71. #define IO_IRAM_SIZE SZ_256K
  72. #define IO_CPU_PHYS 0x50040000
  73. #define IO_CPU_VIRT IOMEM(0xFE440000)
  74. #define IO_CPU_SIZE SZ_16K
  75. #define IO_PPSB_PHYS 0x60000000
  76. #define IO_PPSB_VIRT IOMEM(0xFE200000)
  77. #define IO_PPSB_SIZE SECTION_SIZE
  78. #define IO_APB_PHYS 0x70000000
  79. #define IO_APB_VIRT IOMEM(0xFE000000)
  80. #define IO_APB_SIZE SECTION_SIZE
  81. #define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
  82. #define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst)))
  83. #define IO_TO_VIRT(n) ( \
  84. IO_TO_VIRT_BETWEEN((n), IO_PPSB_PHYS, IO_PPSB_SIZE) ? \
  85. IO_TO_VIRT_XLATE((n), IO_PPSB_PHYS, IO_PPSB_VIRT) : \
  86. IO_TO_VIRT_BETWEEN((n), IO_APB_PHYS, IO_APB_SIZE) ? \
  87. IO_TO_VIRT_XLATE((n), IO_APB_PHYS, IO_APB_VIRT) : \
  88. IO_TO_VIRT_BETWEEN((n), IO_CPU_PHYS, IO_CPU_SIZE) ? \
  89. IO_TO_VIRT_XLATE((n), IO_CPU_PHYS, IO_CPU_VIRT) : \
  90. IO_TO_VIRT_BETWEEN((n), IO_IRAM_PHYS, IO_IRAM_SIZE) ? \
  91. IO_TO_VIRT_XLATE((n), IO_IRAM_PHYS, IO_IRAM_VIRT) : \
  92. NULL)
  93. #define IO_ADDRESS(n) (IO_TO_VIRT(n))
  94. #endif