From 4d2583dba13f9313f21fb58fb3a4c51b11770e44 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Wed, 10 Jul 2019 23:43:13 -0700 Subject: riscv: Access CSRs using CSR numbers We should prefer accessing CSRs using their CSR numbers because: 1. It compiles fine with older toolchains. 2. We can use latest CSR names in #define macro names of CSR numbers as-per RISC-V spec. 3. We can access newly added CSRs even if toolchain does not recognize newly added CSRs by name. This commit is inspired from Linux kernel commit a3182c91ef4e ("RISC-V: Access CSRs using CSR numbers"). Signed-off-by: Bin Meng Reviewed-by: Rick Chen Reviewed-by: Anup Patel Reviewed-by: Lukas Auer --- arch/riscv/cpu/start.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch/riscv/cpu/start.S') diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index 60ac8c621e..e06db404f5 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -13,7 +13,6 @@ #include #include #include -#include #include #include @@ -41,7 +40,7 @@ secondary_harts_relocation_error: .globl _start _start: #ifdef CONFIG_RISCV_MMODE - csrr a0, mhartid + csrr a0, CSR_MHARTID #endif /* save hart id and dtb pointer */ -- cgit