hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/video/rockchip/rga3/include/rga_iommu.h
....@@ -4,6 +4,42 @@
44
55 #include "rga_drv.h"
66
7
+/* RGA_IOMMU register offsets */
8
+#define RGA_IOMMU_BASE 0xf00
9
+#define RGA_IOMMU_DTE_ADDR (RGA_IOMMU_BASE + 0x00) /* Directory table address */
10
+#define RGA_IOMMU_STATUS (RGA_IOMMU_BASE + 0x04)
11
+#define RGA_IOMMU_COMMAND (RGA_IOMMU_BASE + 0x08)
12
+#define RGA_IOMMU_PAGE_FAULT_ADDR (RGA_IOMMU_BASE + 0x0C) /* IOVA of last page fault */
13
+#define RGA_IOMMU_ZAP_ONE_LINE (RGA_IOMMU_BASE + 0x10) /* Shootdown one IOTLB entry */
14
+#define RGA_IOMMU_INT_RAWSTAT (RGA_IOMMU_BASE + 0x14) /* IRQ status ignoring mask */
15
+#define RGA_IOMMU_INT_CLEAR (RGA_IOMMU_BASE + 0x18) /* Acknowledge and re-arm irq */
16
+#define RGA_IOMMU_INT_MASK (RGA_IOMMU_BASE + 0x1C) /* IRQ enable */
17
+#define RGA_IOMMU_INT_STATUS (RGA_IOMMU_BASE + 0x20) /* IRQ status after masking */
18
+#define RGA_IOMMU_AUTO_GATING (RGA_IOMMU_BASE + 0x24)
19
+
20
+/* RGA_IOMMU_STATUS fields */
21
+#define RGA_IOMMU_STATUS_PAGING_ENABLED BIT(0)
22
+#define RGA_IOMMU_STATUS_PAGE_FAULT_ACTIVE BIT(1)
23
+#define RGA_IOMMU_STATUS_STALL_ACTIVE BIT(2)
24
+#define RGA_IOMMU_STATUS_IDLE BIT(3)
25
+#define RGA_IOMMU_STATUS_REPLAY_BUFFER_EMPTY BIT(4)
26
+#define RGA_IOMMU_STATUS_PAGE_FAULT_IS_WRITE BIT(5)
27
+#define RGA_IOMMU_STATUS_STALL_NOT_ACTIVE BIT(31)
28
+
29
+/* RGA_IOMMU_COMMAND command values */
30
+#define RGA_IOMMU_CMD_ENABLE_PAGING 0 /* Enable memory translation */
31
+#define RGA_IOMMU_CMD_DISABLE_PAGING 1 /* Disable memory translation */
32
+#define RGA_IOMMU_CMD_ENABLE_STALL 2 /* Stall paging to allow other cmds */
33
+#define RGA_IOMMU_CMD_DISABLE_STALL 3 /* Stop stall re-enables paging */
34
+#define RGA_IOMMU_CMD_ZAP_CACHE 4 /* Shoot down entire IOTLB */
35
+#define RGA_IOMMU_CMD_PAGE_FAULT_DONE 5 /* Clear page fault */
36
+#define RGA_IOMMU_CMD_FORCE_RESET 6 /* Reset all registers */
37
+
38
+/* RGA_IOMMU_INT_* register fields */
39
+#define RGA_IOMMU_IRQ_PAGE_FAULT 0x01 /* page fault */
40
+#define RGA_IOMMU_IRQ_BUS_ERROR 0x02 /* bus read error */
41
+#define RGA_IOMMU_IRQ_MASK (RGA_IOMMU_IRQ_PAGE_FAULT | RGA_IOMMU_IRQ_BUS_ERROR)
42
+
743 /*
844 * The maximum input is 8192*8192, the maximum output is 4096*4096
945 * The size of physical pages requested is: