From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Date: Sat, 23 Jul 2022 13:23:19 +0200
Subject: [PATCH 4/6] rockchip: rk3328: Set VOP QoS to high priority

The default priority for the quality of service for the video
output results in unsightly glitches on the output whenever there
is memory pressure on the system, which happens a lot.

This sets the VOP QoS to high priority, which fixes this issue.

Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
---
 arch/arm/mach-rockchip/rk3328/rk3328.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3328/rk3328.c b/arch/arm/mach-rockchip/rk3328/rk3328.c
index de17b88682..58300bdf3f 100644
--- a/arch/arm/mach-rockchip/rk3328/rk3328.c
+++ b/arch/arm/mach-rockchip/rk3328/rk3328.c
@@ -16,6 +16,8 @@ DECLARE_GLOBAL_DATA_PTR;
 #define GRF_BASE		0xFF100000
 #define UART2_BASE		0xFF130000
 #define FW_DDR_CON_REG		0xFF7C0040
+#define QOS_VOP_OFFSET		0xFF760080
+#define QOS_VOP_PRIORITY	0x8
 #define EFUSE_NS_BASE		0xFF260000
 
 #define EFUSE_MOD		0x0000
@@ -54,6 +56,9 @@ int arch_cpu_init(void)
 	writel(EFUSE_TIMING(1, 4), EFUSE_NS_BASE + EFUSE_T_LOAD_R);
 	writel(EFUSE_TIMING(1, 4), EFUSE_NS_BASE + EFUSE_T_ADDR_R);
 	writel(EFUSE_TIMING(2, 3), EFUSE_NS_BASE + EFUSE_T_STROBE_R);
+#else
+	printf("Setting VOP QoS\n");
+	rk_setreg(QOS_VOP_OFFSET + QOS_VOP_PRIORITY, 0xF);
 #endif
 	return 0;
 }
