summaryrefslogtreecommitdiff
path: root/arch/riscv/cpu/jh7110/spl.c
diff options
context:
space:
mode:
authoryanhong.wang <yanhong.wang@starfivetech.com>2022-04-13 10:08:47 +0300
committerYanhong Wang <yanhong.wang@linux.starfivetech.com>2022-10-18 11:24:34 +0300
commitef888a4df1dd200a95e8eb7aa90d0b08b89a1964 (patch)
tree4805e0d21889a1d8c64945c4f5bad404a0869cc4 /arch/riscv/cpu/jh7110/spl.c
parente9cef6c8ce31ff51099f23e2d628483cf762d728 (diff)
downloadu-boot-ef888a4df1dd200a95e8eb7aa90d0b08b89a1964.tar.xz
riscv:soc:jh7110: Add support jh7110 soc.
Add StarFive JH7110 soc to support RISC-V arch Signed-off-by: yanhong.wang <yanhong.wang@starfivetech.com>
Diffstat (limited to 'arch/riscv/cpu/jh7110/spl.c')
-rw-r--r--arch/riscv/cpu/jh7110/spl.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/arch/riscv/cpu/jh7110/spl.c b/arch/riscv/cpu/jh7110/spl.c
new file mode 100644
index 0000000000..cb6ef2fda5
--- /dev/null
+++ b/arch/riscv/cpu/jh7110/spl.c
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022 Starfive, Inc.
+ * Author: yanhong <yanhong.wang@starfivetech.com>
+ *
+ */
+
+#include <dm.h>
+#include <log.h>
+#include <asm/csr.h>
+
+#define CSR_U74_FEATURE_DISABLE 0x7c1
+
+int spl_soc_init(void)
+{
+ int ret;
+ struct udevice *dev;
+
+ /* DDR init */
+ ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+ if (ret) {
+ debug("DRAM init failed: %d\n", ret);
+ return ret;
+ }
+
+ /*flash init*/
+ ret = uclass_get_device(UCLASS_SPI_FLASH, 0, &dev);
+ if (ret) {
+ debug("SPI init failed: %d\n", ret);
+ return ret;
+ }
+ 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);
+}