platform: generic: allwinner: sun20i-d1: Remove duplicated CSR definitions
authorChristoph Müllner <christoph.muellner@vrull.eu>
Tue, 19 Mar 2024 09:26:42 +0000 (10:26 +0100)
committerAnup Patel <anup@brainfault.org>
Wed, 20 Mar 2024 05:35:13 +0000 (11:05 +0530)
All T-Head CSRs are already defined in thead/c9xx_encoding.h.
Let's reuse the values from there instead of redefining them with
a slightly different name.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Reviewed-by: Anup Patel <anup@brainfault.org>
platform/generic/allwinner/sun20i-d1.c

index e9388dba76baaa6bee75db59d3f51a953eb69ef5..ed19d5d427c7fbdb3c37f314b12442bc94e313cc 100644 (file)
 #define RISCV_CFG_BGR_REG              0xd0c
 #define PPU_BGR_REG                    0x1ac
 
-/*
- * CSRs
- */
-
-#define CSR_MXSTATUS                   0x7c0
-#define CSR_MHCR                       0x7c1
-#define CSR_MCOR                       0x7c2
-#define CSR_MHINT                      0x7c5
-
 static unsigned long csr_mxstatus;
 static unsigned long csr_mhcr;
 static unsigned long csr_mhint;
@@ -49,24 +40,24 @@ static unsigned long csr_mhint;
 static void sun20i_d1_csr_save(void)
 {
        /* Save custom CSRs. */
-       csr_mxstatus    = csr_read(CSR_MXSTATUS);
-       csr_mhcr        = csr_read(CSR_MHCR);
-       csr_mhint       = csr_read(CSR_MHINT);
+       csr_mxstatus    = csr_read(THEAD_C9XX_CSR_MXSTATUS);
+       csr_mhcr        = csr_read(THEAD_C9XX_CSR_MHCR);
+       csr_mhint       = csr_read(THEAD_C9XX_CSR_MHINT);
 
        /* Flush and disable caches. */
-       csr_write(CSR_MCOR, 0x22);
-       csr_write(CSR_MHCR, 0x0);
+       csr_write(THEAD_C9XX_CSR_MCOR, 0x22);
+       csr_write(THEAD_C9XX_CSR_MHCR, 0x0);
 }
 
 static void sun20i_d1_csr_restore(void)
 {
        /* Invalidate caches and the branch predictor. */
-       csr_write(CSR_MCOR, 0x70013);
+       csr_write(THEAD_C9XX_CSR_MCOR, 0x70013);
 
        /* Restore custom CSRs, including the cache state. */
-       csr_write(CSR_MXSTATUS, csr_mxstatus);
-       csr_write(CSR_MHCR,     csr_mhcr);
-       csr_write(CSR_MHINT,    csr_mhint);
+       csr_write(THEAD_C9XX_CSR_MXSTATUS, csr_mxstatus);
+       csr_write(THEAD_C9XX_CSR_MHCR, csr_mhcr);
+       csr_write(THEAD_C9XX_CSR_MHINT, csr_mhint);
 }
 
 /*