bcm27xx: update 6.1 patches to latest version
[openwrt/staging/svanheule.git] / target / linux / bcm27xx / patches-6.1 / 950-0955-drm-vc4-Enable-SCALER_CONTROL-early-in-HVS-init.patch
1 From 542ba979b4fa1e07ff2ad2dabbdc12e92b80ed46 Mon Sep 17 00:00:00 2001
2 From: Tim Gover <tim.gover@raspberrypi.com>
3 Date: Thu, 13 Jul 2023 17:47:22 +0100
4 Subject: [PATCH] drm/vc4: Enable SCALER_CONTROL early in HVS init
5
6 Always enable SCALER_CONTROL before attempting other HVS
7 operations. It's safe to write to some parts of the HVS but
8 in general it's dangerous to do this because it can cause bus
9 lockups.
10
11 Signed-off-by: Tim Gover <tim.gover@raspberrypi.com>
12 ---
13 drivers/gpu/drm/vc4/vc4_hvs.c | 14 ++++++++------
14 1 file changed, 8 insertions(+), 6 deletions(-)
15
16 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
17 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
18 @@ -1303,6 +1303,10 @@ static int vc4_hvs_hw_init(struct vc4_hv
19 struct vc4_dev *vc4 = hvs->vc4;
20 u32 dispctrl, reg;
21
22 + dispctrl = HVS_READ(SCALER_DISPCTRL);
23 + dispctrl |= SCALER_DISPCTRL_ENABLE;
24 + HVS_WRITE(SCALER_DISPCTRL, dispctrl);
25 +
26 reg = HVS_READ(SCALER_DISPECTRL);
27 reg &= ~SCALER_DISPECTRL_DSP2_MUX_MASK;
28 HVS_WRITE(SCALER_DISPECTRL,
29 @@ -1324,8 +1328,6 @@ static int vc4_hvs_hw_init(struct vc4_hv
30 reg | VC4_SET_FIELD(3, SCALER_DISPDITHER_DSP5_MUX));
31
32 dispctrl = HVS_READ(SCALER_DISPCTRL);
33 -
34 - dispctrl |= SCALER_DISPCTRL_ENABLE;
35 dispctrl |= SCALER_DISPCTRL_DISPEIRQ(0) |
36 SCALER_DISPCTRL_DISPEIRQ(1) |
37 SCALER_DISPCTRL_DISPEIRQ(2);
38 @@ -1521,6 +1523,10 @@ static int vc4_hvs_bind(struct device *d
39 else
40 hvs->dlist = hvs->regs + SCALER5_DLIST_START;
41
42 + ret = vc4_hvs_hw_init(hvs);
43 + if (ret)
44 + return ret;
45 +
46 /* Upload filter kernels. We only have the one for now, so we
47 * keep it around for the lifetime of the driver.
48 */
49 @@ -1530,10 +1536,6 @@ static int vc4_hvs_bind(struct device *d
50 if (ret)
51 return ret;
52
53 - ret = vc4_hvs_hw_init(hvs);
54 - if (ret)
55 - return ret;
56 -
57 ret = vc4_hvs_cob_init(hvs);
58 if (ret)
59 return ret;