Files

67 lines
1.9 KiB
Diff

From a4c89e397838fbc6f107cc7083e0b0caf43b822a Mon Sep 17 00:00:00 2001
From: Paolo Sabatino <paolo.sabatino@gmail.com>
Date: Fri, 26 Sep 2025 21:28:46 +0200
Subject: [PATCH] attempt to fix missing HDMI in proper OS
---
drivers/video/rockchip/rk3328_vop.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/video/rockchip/rk3328_vop.c b/drivers/video/rockchip/rk3328_vop.c
index 55233f19ee..1924adaaa5 100644
--- a/drivers/video/rockchip/rk3328_vop.c
+++ b/drivers/video/rockchip/rk3328_vop.c
@@ -6,6 +6,8 @@
#include <dm.h>
+#include <linux/delay.h>
#include <video.h>
#include <asm/io.h>
+#include <reset.h>
#include "rk_vop.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -36,11 +37,21 @@ static int rk3328_vop_probe(struct udevice *dev)
return rk_vop_probe(dev);
}
+/*
+ * During remove phase we assert the resets and deassert them,
+ * so in practice we "turn off" the VOP resetting it and then
+ * "turn on" it. This is especially true for the dlck because
+ * this avoids iommu complaining later during kernel boot
+ * @see https://lore.kernel.org/linux-arm-kernel/20230330131746.1475514-1-jagan@amarulasolutions.com/
+ */
static int rk3328_vop_remove(struct udevice *dev)
{
struct rk_vop_priv *priv = dev_get_priv(dev);
struct rk3288_vop *regs = priv->regs;
struct rk3288_vop *win_regs = priv->regs + priv->win_offset;
+ struct reset_ctl_bulk resets;
+
+ int ret;
/* FIXME: Explicit disabling of WIN0 is needed to avoid iommu
* page-fault in Linux, better handling of iommu-address in
@@ -49,6 +60,18 @@ static int rk3328_vop_remove(struct udevice *dev)
clrbits_le32(&win_regs->win0_ctrl0, M_WIN0_EN);
writel(0x01, &regs->reg_cfg_done);
+ ret = reset_get_bulk(dev, &resets);
+ if (ret) {
+ printf("failed to get resets (ret=%d)\n", ret);
+ return ret;
+ }
+
+ reset_assert_bulk(&resets);
+ udelay(20);
+
+ reset_deassert_bulk(&resets);
+ udelay(20);
+
return 0;
}
--
2.43.0