All of lore.kernel.org
 help / color / mirror / Atom feed
From: Green Wan <green.wan@sifive.com>
To: u-boot@lists.denx.de
Subject: [PATCH v11 8/8] riscv: cpu: fu740: clear feature disable CSR
Date: Thu, 20 May 2021 00:40:33 -0700	[thread overview]
Message-ID: <20210520074033.370234-9-green.wan@sifive.com> (raw)
In-Reply-To: <20210520074033.370234-1-green.wan@sifive.com>

Clear feature disable CSR to turn on all features of hart. The detail
is specified at section, 'SiFive Feature Disable CSR', in user manual

https://sifive.cdn.prismic.io/sifive/aee0dd4c-d156-496e-a6c4-db0cf54bbe68_sifive_U74MC_rtl_full_20G1.03.00_manual.pdf

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
---
 arch/riscv/cpu/fu740/spl.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/riscv/cpu/fu740/spl.c b/arch/riscv/cpu/fu740/spl.c
index ea0b2283a2..55e30346ff 100644
--- a/arch/riscv/cpu/fu740/spl.c
+++ b/arch/riscv/cpu/fu740/spl.c
@@ -6,6 +6,9 @@
 
 #include <dm.h>
 #include <log.h>
+#include <asm/csr.h>
+
+#define CSR_U74_FEATURE_DISABLE	0x7c1
 
 int spl_soc_init(void)
 {
@@ -21,3 +24,15 @@ int spl_soc_init(void)
 
 	return 0;
 }
+
+void harts_early_init(void)
+{
+	/*
+	 * Feature Disable CSR
+	 *
+	 * Clear feature disable CSR to '0' to turn on all features for
+	 * each core. This operation must be in M-mode.
+	 */
+	if (CONFIG_IS_ENABLED(RISCV_MMODE))
+		csr_write(CSR_U74_FEATURE_DISABLE, 0);
+}
-- 
2.31.0

      parent reply	other threads:[~2021-05-20  7:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20  7:40 [PATCH v11 0/8] Add FU740 chip and HiFive Unmatched board support Green Wan
2021-05-20  7:40 ` [PATCH v11 1/8] riscv: cpu: fu740: Add support for cpu fu740 Green Wan
2021-05-20  7:40 ` [PATCH v11 2/8] drivers: clk: add fu740 support Green Wan
2021-05-24 10:31   ` Leo Liang
2021-05-20  7:40 ` [PATCH v11 3/8] drivers: ram: sifive: rename fu540_ddr and " Green Wan
2021-05-20  7:40 ` [PATCH v11 4/8] drivers: pci: add pcie support for fu740 Green Wan
2021-05-20  7:40 ` [PATCH v11 5/8] riscv: dts: add fu740 support Green Wan
2021-05-20  7:40 ` [PATCH v11 6/8] riscv: dts: add SiFive Unmatched board support Green Wan
2021-05-20  8:25   ` Bin Meng
2021-05-20  7:40 ` [PATCH v11 7/8] board: sifive: add HiFive " Green Wan
2021-05-20  7:40 ` Green Wan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210520074033.370234-9-green.wan@sifive.com \
    --to=green.wan@sifive.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.