[PATCH v2 13/16] riscv: Enable AI ram on K210

Sean Anderson seanga2 at gmail.com
Mon Oct 12 20:13:42 CEST 2020


CONFIG_SYS_SDRAM_{BASE,SIZE} are no longer necessary. The default
get_effective_memsize will also work. The clock driver creates a bunch of
devices, so we need to increase the pre-reloc malloc arena.

Signed-off-by: Sean Anderson <seanga2 at gmail.com>
---

(no changes since v1)

 board/sipeed/maix/Kconfig          |  2 ++
 board/sipeed/maix/maix.c           | 26 --------------------------
 configs/sipeed_maix_bitm_defconfig |  1 +
 include/configs/sipeed-maix.h      |  4 ----
 4 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/board/sipeed/maix/Kconfig b/board/sipeed/maix/Kconfig
index 4c42dd2087..ba61810079 100644
--- a/board/sipeed/maix/Kconfig
+++ b/board/sipeed/maix/Kconfig
@@ -42,6 +42,8 @@ config BOARD_SPECIFIC_OPTIONS
 	imply CLK_K210
 	imply DM_RESET
 	imply RESET_SYSCON
+	imply RAM
+	imply K210_SRAM
 	imply SYSRESET
 	imply SYSRESET_SYSCON
 	imply PINCTRL
diff --git a/board/sipeed/maix/maix.c b/board/sipeed/maix/maix.c
index cbcb23cf5c..1b6f8a5115 100644
--- a/board/sipeed/maix/maix.c
+++ b/board/sipeed/maix/maix.c
@@ -9,33 +9,7 @@
 #include <fdt_support.h>
 #include <asm/io.h>
 
-phys_size_t get_effective_memsize(void)
-{
-	return CONFIG_SYS_SDRAM_SIZE;
-}
-
 int board_init(void)
 {
-	int ret, i;
-	const char * const banks[] = { "sram0", "sram1", "airam" };
-	ofnode memory;
-	struct clk clk;
-
-	/* Enable RAM clocks */
-	memory = ofnode_by_compatible(ofnode_null(), "kendryte,k210-sram");
-	if (ofnode_equal(memory, ofnode_null()))
-		return -ENOENT;
-
-	for (i = 0; i < ARRAY_SIZE(banks); i++) {
-		ret = clk_get_by_name_nodev(memory, banks[i], &clk);
-		if (ret)
-			continue;
-
-		ret = clk_enable(&clk);
-		clk_free(&clk);
-		if (ret)
-			return ret;
-	}
-
 	return 0;
 }
diff --git a/configs/sipeed_maix_bitm_defconfig b/configs/sipeed_maix_bitm_defconfig
index 459bf0d530..d0100ad9e9 100644
--- a/configs/sipeed_maix_bitm_defconfig
+++ b/configs/sipeed_maix_bitm_defconfig
@@ -1,4 +1,5 @@
 CONFIG_RISCV=y
+CONFIG_SYS_MALLOC_F_LEN=0x10000
 CONFIG_TARGET_SIPEED_MAIX=y
 CONFIG_ARCH_RV64I=y
 CONFIG_STACK_SIZE=0x100000
diff --git a/include/configs/sipeed-maix.h b/include/configs/sipeed-maix.h
index 36ff522e4b..81956cccfd 100644
--- a/include/configs/sipeed-maix.h
+++ b/include/configs/sipeed-maix.h
@@ -14,10 +14,6 @@
 #define CONFIG_SYS_MALLOC_LEN SZ_128K
 #define CONFIG_SYS_CACHELINE_SIZE 64
 
-#define CONFIG_SYS_SDRAM_BASE 0x80000000
-/* Don't relocate into AI ram since it isn't set up yet */
-#define CONFIG_SYS_SDRAM_SIZE (SZ_4M + SZ_2M)
-
 /* For early init */
 #define K210_SYSCTL_BASE 0x50440000
 
-- 
2.28.0



More information about the U-Boot mailing list