summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Gover <tim.gover@raspberrypi.com>2024-06-21 17:20:54 +0200
committerDave Stevenson <dave.stevenson@raspberrypi.com>2024-09-09 14:02:54 +0200
commit886a79237ecfd6c5376a1d76bef8209c486390b7 (patch)
tree2cfc2993bb46165d6db1d950b31235c64e317b6f
parentdrm/vc4: plane: Move the buffer offset out of the vc4_plane_state (diff)
downloadlinux-886a79237ecfd6c5376a1d76bef8209c486390b7.tar.xz
linux-886a79237ecfd6c5376a1d76bef8209c486390b7.zip
drm/vc4: hvs: Enable SCALER_CONTROL early in HVS init
Always enable SCALER_CONTROL before attempting other HVS operations. It's safe to write to some parts of the HVS but in general it's dangerous to do this because it can cause bus lockups. Signed-off-by: Tim Gover <tim.gover@raspberrypi.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-31-dave.stevenson@raspberrypi.com Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
-rw-r--r--drivers/gpu/drm/vc4/vc4_hvs.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index 8e6327910d9f..93e7edd8b084 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -860,6 +860,10 @@ static int vc4_hvs_hw_init(struct vc4_hvs *hvs)
struct vc4_dev *vc4 = hvs->vc4;
u32 dispctrl, reg;
+ dispctrl = HVS_READ(SCALER_DISPCTRL);
+ dispctrl |= SCALER_DISPCTRL_ENABLE;
+ HVS_WRITE(SCALER_DISPCTRL, dispctrl);
+
reg = HVS_READ(SCALER_DISPECTRL);
reg &= ~SCALER_DISPECTRL_DSP2_MUX_MASK;
HVS_WRITE(SCALER_DISPECTRL,
@@ -881,8 +885,6 @@ static int vc4_hvs_hw_init(struct vc4_hvs *hvs)
reg | VC4_SET_FIELD(3, SCALER_DISPDITHER_DSP5_MUX));
dispctrl = HVS_READ(SCALER_DISPCTRL);
-
- dispctrl |= SCALER_DISPCTRL_ENABLE;
dispctrl |= SCALER_DISPCTRL_DISPEIRQ(0) |
SCALER_DISPCTRL_DISPEIRQ(1) |
SCALER_DISPCTRL_DISPEIRQ(2);
@@ -1078,6 +1080,10 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
else
hvs->dlist = hvs->regs + SCALER5_DLIST_START;
+ ret = vc4_hvs_hw_init(hvs);
+ if (ret)
+ return ret;
+
/* Upload filter kernels. We only have the one for now, so we
* keep it around for the lifetime of the driver.
*/
@@ -1087,10 +1093,6 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
if (ret)
return ret;
- ret = vc4_hvs_hw_init(hvs);
- if (ret)
- return ret;
-
ret = vc4_hvs_cob_init(hvs);
if (ret)
return ret;