ccf84b313c994f3a38b912ec6c2a94bd86e884ea
[openwrt/staging/ansuel.git] /
1 From 247099050b2b7b6f704393cda65bc54cd0610908 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 5 Dec 2023 18:29:34 +0000
4 Subject: [PATCH 0763/1085] drm/vc4: Mop and moplet have different register
5 offsets for high addr
6
7 MOP uses register offset 0x24 for the high bits of the address,
8 whilst Moplet uses 0x1c.
9
10 Handle this difference between the block types.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 drivers/gpu/drm/vc4/vc4_drv.h | 1 +
15 drivers/gpu/drm/vc4/vc4_txp.c | 8 ++++++--
16 2 files changed, 7 insertions(+), 2 deletions(-)
17
18 --- a/drivers/gpu/drm/vc4/vc4_drv.h
19 +++ b/drivers/gpu/drm/vc4/vc4_drv.h
20 @@ -549,6 +549,7 @@ struct vc4_crtc_data {
21 struct vc4_txp_data {
22 struct vc4_crtc_data base;
23 enum vc4_encoder_type encoder_type;
24 + unsigned int high_addr_ptr_reg;
25 unsigned int has_byte_enable:1;
26 unsigned int size_minus_one:1;
27 unsigned int supports_40bit_addresses:1;
28 --- a/drivers/gpu/drm/vc4/vc4_txp.c
29 +++ b/drivers/gpu/drm/vc4/vc4_txp.c
30 @@ -145,7 +145,8 @@
31 /* Number of lines received and committed to memory. */
32 #define TXP_PROGRESS 0x10
33
34 -#define TXP_DST_PTR_HIGH 0x1c
35 +#define TXP_DST_PTR_HIGH_MOPLET 0x1c
36 +#define TXP_DST_PTR_HIGH_MOP 0x24
37
38 #define TXP_READ(offset) \
39 ({ \
40 @@ -334,10 +335,11 @@ static void vc4_txp_connector_atomic_com
41
42 gem = drm_fb_dma_get_gem_obj(fb, 0);
43 addr = gem->dma_addr + fb->offsets[0];
44 +
45 TXP_WRITE(TXP_DST_PTR, lower_32_bits(addr));
46
47 if (txp_data->supports_40bit_addresses)
48 - TXP_WRITE(TXP_DST_PTR_HIGH, upper_32_bits(addr) & 0xff);
49 + TXP_WRITE(txp_data->high_addr_ptr_reg, upper_32_bits(addr) & 0xff);
50
51 TXP_WRITE(TXP_DST_PITCH, fb->pitches[0]);
52
53 @@ -516,6 +518,7 @@ const struct vc4_txp_data bcm2712_mop_da
54 .hvs_output = 2,
55 },
56 .encoder_type = VC4_ENCODER_TYPE_TXP0,
57 + .high_addr_ptr_reg = TXP_DST_PTR_HIGH_MOP,
58 .has_byte_enable = true,
59 .size_minus_one = true,
60 .supports_40bit_addresses = true,
61 @@ -529,6 +532,7 @@ const struct vc4_txp_data bcm2712_moplet
62 .hvs_output = 4,
63 },
64 .encoder_type = VC4_ENCODER_TYPE_TXP1,
65 + .high_addr_ptr_reg = TXP_DST_PTR_HIGH_MOPLET,
66 .size_minus_one = true,
67 .supports_40bit_addresses = true,
68 };