iommu2.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * omap iommu: omap2 architecture specific definitions
  3. *
  4. * Copyright (C) 2008-2009 Nokia Corporation
  5. *
  6. * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __MACH_IOMMU2_H
  13. #define __MACH_IOMMU2_H
  14. #include <linux/io.h>
  15. /*
  16. * MMU Register offsets
  17. */
  18. #define MMU_REVISION 0x00
  19. #define MMU_SYSCONFIG 0x10
  20. #define MMU_SYSSTATUS 0x14
  21. #define MMU_IRQSTATUS 0x18
  22. #define MMU_IRQENABLE 0x1c
  23. #define MMU_WALKING_ST 0x40
  24. #define MMU_CNTL 0x44
  25. #define MMU_FAULT_AD 0x48
  26. #define MMU_TTB 0x4c
  27. #define MMU_LOCK 0x50
  28. #define MMU_LD_TLB 0x54
  29. #define MMU_CAM 0x58
  30. #define MMU_RAM 0x5c
  31. #define MMU_GFLUSH 0x60
  32. #define MMU_FLUSH_ENTRY 0x64
  33. #define MMU_READ_CAM 0x68
  34. #define MMU_READ_RAM 0x6c
  35. #define MMU_EMU_FAULT_AD 0x70
  36. #define MMU_REG_SIZE 256
  37. /*
  38. * MMU Register bit definitions
  39. */
  40. #define MMU_LOCK_BASE_SHIFT 10
  41. #define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT)
  42. #define MMU_LOCK_BASE(x) \
  43. ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
  44. #define MMU_LOCK_VICT_SHIFT 4
  45. #define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT)
  46. #define MMU_LOCK_VICT(x) \
  47. ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
  48. #define MMU_CAM_VATAG_SHIFT 12
  49. #define MMU_CAM_VATAG_MASK \
  50. ((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT)
  51. #define MMU_CAM_P (1 << 3)
  52. #define MMU_CAM_V (1 << 2)
  53. #define MMU_CAM_PGSZ_MASK 3
  54. #define MMU_CAM_PGSZ_1M (0 << 0)
  55. #define MMU_CAM_PGSZ_64K (1 << 0)
  56. #define MMU_CAM_PGSZ_4K (2 << 0)
  57. #define MMU_CAM_PGSZ_16M (3 << 0)
  58. #define MMU_RAM_PADDR_SHIFT 12
  59. #define MMU_RAM_PADDR_MASK \
  60. ((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT)
  61. #define MMU_RAM_ENDIAN_SHIFT 9
  62. #define MMU_RAM_ENDIAN_MASK (1 << MMU_RAM_ENDIAN_SHIFT)
  63. #define MMU_RAM_ENDIAN_BIG (1 << MMU_RAM_ENDIAN_SHIFT)
  64. #define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT)
  65. #define MMU_RAM_ELSZ_SHIFT 7
  66. #define MMU_RAM_ELSZ_MASK (3 << MMU_RAM_ELSZ_SHIFT)
  67. #define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT)
  68. #define MMU_RAM_ELSZ_16 (1 << MMU_RAM_ELSZ_SHIFT)
  69. #define MMU_RAM_ELSZ_32 (2 << MMU_RAM_ELSZ_SHIFT)
  70. #define MMU_RAM_ELSZ_NONE (3 << MMU_RAM_ELSZ_SHIFT)
  71. #define MMU_RAM_MIXED_SHIFT 6
  72. #define MMU_RAM_MIXED_MASK (1 << MMU_RAM_MIXED_SHIFT)
  73. #define MMU_RAM_MIXED MMU_RAM_MIXED_MASK
  74. /*
  75. * register accessors
  76. */
  77. static inline u32 iommu_read_reg(struct omap_iommu *obj, size_t offs)
  78. {
  79. return __raw_readl(obj->regbase + offs);
  80. }
  81. static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs)
  82. {
  83. __raw_writel(val, obj->regbase + offs);
  84. }
  85. #endif /* __MACH_IOMMU2_H */