Hi

Am 25.03.26 um 17:03 schrieb Jocelyn Falempe:
On 23/03/2026 16:56, Thomas Zimmermann wrote:
AHBC is the Advanced High-Speed Bus Controller. AHBC registers are
located in the memory range within [0x1e600000, 0x1e61ffff]. Refer
to them with constants named AST_REG_AHBC<n>, where <n> is the byte
offset into the range.

I think adding a macro AST_REG_AHBC84 doesn't provide more information over using directly AST_REG_AHBC(0x84).

I thought about using the latter only. But then I choose the constants, such as AHBC84, as they are directly grep-able in the documentation. They also seem a bit safer against typos, such as AHBC84 vs AHBC48.

Best regards
Thomas




Reviewed-by: Jocelyn Falempe <[email protected]>


Signed-off-by: Thomas Zimmermann <[email protected]>
---
  drivers/gpu/drm/ast/ast_2500.c |  6 +++---
  drivers/gpu/drm/ast/ast_reg.h  | 11 +++++++++++
  2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_2500.c b/drivers/gpu/drm/ast/ast_2500.c
index 2a52af0ded56..f751a27e7eb3 100644
--- a/drivers/gpu/drm/ast/ast_2500.c
+++ b/drivers/gpu/drm/ast/ast_2500.c
@@ -109,9 +109,9 @@ void ast_2500_patch_ahb(void __iomem *regs)
      u32 data;
        /* Clear bus lock condition */
-    __ast_moutdwm(regs, 0x1e600000, 0xAEED1A03);
-    __ast_moutdwm(regs, 0x1e600084, 0x00010000);
-    __ast_moutdwm(regs, 0x1e600088, 0x00000000);
+    __ast_moutdwm(regs, AST_REG_AHBC00, AST_REG_AHBC00_PROTECT_KEY);
+    __ast_moutdwm(regs, AST_REG_AHBC84, 0x00010000);
+    __ast_moutdwm(regs, AST_REG_AHBC88, 0x00000000);
      __ast_moutdwm(regs, 0x1e6e2000, 0x1688A8A8);
        data = __ast_mindwm(regs, 0x1e6e2070);
diff --git a/drivers/gpu/drm/ast/ast_reg.h b/drivers/gpu/drm/ast/ast_reg.h
index ca9403efc7f9..0bc033dbac55 100644
--- a/drivers/gpu/drm/ast/ast_reg.h
+++ b/drivers/gpu/drm/ast/ast_reg.h
@@ -87,4 +87,15 @@
  #define AST_REG_P2A04                AST_REG_P2A(0xf004)
  #define AST_REG_P2A04_BASE_MASK            GENMASK(31, 16)
  +/*
+ * AHB Controller (0x1e600000 - 0x1e61ffff)
+ */
+
+#define AST_REG_AHBC_BASE            (0x1e600000)
+#define AST_REG_AHBC(__offset)            (AST_REG_AHBC_BASE + (__offset))
+#define AST_REG_AHBC00                AST_REG_AHBC(0x00)
+#define AST_REG_AHBC00_PROTECT_KEY        (0xaeed1a03)
+#define AST_REG_AHBC84                AST_REG_AHBC(0x84)
+#define AST_REG_AHBC88                AST_REG_AHBC(0x88)
+
  #endif


--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)


Reply via email to