]> git.ipfire.org Git - thirdparty/u-boot.git/commit
riscv: Access CSRs using CSR numbers
authorBin Meng <bmeng.cn@gmail.com>
Thu, 11 Jul 2019 06:43:13 +0000 (23:43 -0700)
committerAndes <uboot@andestech.com>
Thu, 15 Aug 2019 05:42:28 +0000 (13:42 +0800)
commit4d2583dba13f9313f21fb58fb3a4c51b11770e44
tree26cf69a122a61b2a54ff75b6489414353cff1348
parent268753f8e6e7e201966763c53acfea84941ed544
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 <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
arch/riscv/cpu/cpu.c
arch/riscv/cpu/start.S
arch/riscv/include/asm/csr.h
arch/riscv/include/asm/encoding.h