]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/etnaviv: Read some FE registers twice
authorDerek Foreman <derek.foreman@collabora.com>
Fri, 3 May 2024 19:11:58 +0000 (14:11 -0500)
committerLucas Stach <l.stach@pengutronix.de>
Wed, 19 Jun 2024 18:35:14 +0000 (20:35 +0200)
On some hardware (such at the GC7000 rev 6009), these registers need to be
read twice to return the correct value. Hide that in gpu_read().

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
drivers/gpu/drm/etnaviv/etnaviv_gpu.h

index 197e0037732ec84998aba60b1769a2fc305ea1bf..31322195b9e410c09e8dfcc8373f383446c14b3d 100644 (file)
@@ -11,6 +11,7 @@
 #include "etnaviv_mmu.h"
 #include "etnaviv_drv.h"
 #include "common.xml.h"
+#include "state.xml.h"
 
 struct etnaviv_gem_submit;
 struct etnaviv_vram_mapping;
@@ -170,6 +171,13 @@ static inline void gpu_write(struct etnaviv_gpu *gpu, u32 reg, u32 data)
 
 static inline u32 gpu_read(struct etnaviv_gpu *gpu, u32 reg)
 {
+       /* On some variants, such as the GC7000r6009, some FE registers
+        * need two reads to be consistent. Do that extra read here and
+        * throw away the result.
+        */
+       if (reg >= VIVS_FE_DMA_STATUS && reg <= VIVS_FE_AUTO_FLUSH)
+               readl(gpu->mmio + reg);
+
        return readl(gpu->mmio + reg);
 }