From e3e12f52b214121840b44c91de5b3e5af5d3eb84 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 06 Nov 2023 03:04:41 +0000
Subject: [PATCH] rk3568 rt init

---
 kernel/drivers/video/rockchip/rga3/include/rga_iommu.h |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/kernel/drivers/video/rockchip/rga3/include/rga_iommu.h b/kernel/drivers/video/rockchip/rga3/include/rga_iommu.h
index fd37377..b80a1f4 100644
--- a/kernel/drivers/video/rockchip/rga3/include/rga_iommu.h
+++ b/kernel/drivers/video/rockchip/rga3/include/rga_iommu.h
@@ -4,6 +4,42 @@
 
 #include "rga_drv.h"
 
+/* RGA_IOMMU register offsets */
+#define RGA_IOMMU_BASE				0xf00
+#define RGA_IOMMU_DTE_ADDR			(RGA_IOMMU_BASE + 0x00) /* Directory table address */
+#define RGA_IOMMU_STATUS			(RGA_IOMMU_BASE + 0x04)
+#define RGA_IOMMU_COMMAND			(RGA_IOMMU_BASE + 0x08)
+#define RGA_IOMMU_PAGE_FAULT_ADDR		(RGA_IOMMU_BASE + 0x0C) /* IOVA of last page fault */
+#define RGA_IOMMU_ZAP_ONE_LINE			(RGA_IOMMU_BASE + 0x10) /* Shootdown one IOTLB entry */
+#define RGA_IOMMU_INT_RAWSTAT			(RGA_IOMMU_BASE + 0x14) /* IRQ status ignoring mask */
+#define RGA_IOMMU_INT_CLEAR			(RGA_IOMMU_BASE + 0x18) /* Acknowledge and re-arm irq */
+#define RGA_IOMMU_INT_MASK			(RGA_IOMMU_BASE + 0x1C) /* IRQ enable */
+#define RGA_IOMMU_INT_STATUS			(RGA_IOMMU_BASE + 0x20) /* IRQ status after masking */
+#define RGA_IOMMU_AUTO_GATING			(RGA_IOMMU_BASE + 0x24)
+
+/* RGA_IOMMU_STATUS fields */
+#define RGA_IOMMU_STATUS_PAGING_ENABLED		BIT(0)
+#define RGA_IOMMU_STATUS_PAGE_FAULT_ACTIVE	BIT(1)
+#define RGA_IOMMU_STATUS_STALL_ACTIVE		BIT(2)
+#define RGA_IOMMU_STATUS_IDLE			BIT(3)
+#define RGA_IOMMU_STATUS_REPLAY_BUFFER_EMPTY	BIT(4)
+#define RGA_IOMMU_STATUS_PAGE_FAULT_IS_WRITE	BIT(5)
+#define RGA_IOMMU_STATUS_STALL_NOT_ACTIVE	BIT(31)
+
+/* RGA_IOMMU_COMMAND command values */
+#define RGA_IOMMU_CMD_ENABLE_PAGING		0 /* Enable memory translation */
+#define RGA_IOMMU_CMD_DISABLE_PAGING		1 /* Disable memory translation */
+#define RGA_IOMMU_CMD_ENABLE_STALL		2 /* Stall paging to allow other cmds */
+#define RGA_IOMMU_CMD_DISABLE_STALL		3 /* Stop stall re-enables paging */
+#define RGA_IOMMU_CMD_ZAP_CACHE			4 /* Shoot down entire IOTLB */
+#define RGA_IOMMU_CMD_PAGE_FAULT_DONE		5 /* Clear page fault */
+#define RGA_IOMMU_CMD_FORCE_RESET		6 /* Reset all registers */
+
+/* RGA_IOMMU_INT_* register fields */
+#define RGA_IOMMU_IRQ_PAGE_FAULT		0x01 /* page fault */
+#define RGA_IOMMU_IRQ_BUS_ERROR			0x02 /* bus read error */
+#define RGA_IOMMU_IRQ_MASK			(RGA_IOMMU_IRQ_PAGE_FAULT | RGA_IOMMU_IRQ_BUS_ERROR)
+
 /*
  * The maximum input is 8192*8192, the maximum output is 4096*4096
  * The size of physical pages requested is:

--
Gitblit v1.6.2