소스 검색

fu740: make WayEnable can be configured by menuconfig

Signed-off-by:TekkamanV <tekkamanv@starfivetech.com>
TekkamanV 2 년 전
부모
커밋
99e391012d
2개의 변경된 파일24개의 추가작업 그리고 3개의 파일을 삭제
  1. 18 2
      arch/riscv/cpu/fu740/Kconfig
  2. 6 1
      arch/riscv/cpu/fu740/cache.c

+ 18 - 2
arch/riscv/cpu/fu740/Kconfig

@@ -42,7 +42,8 @@ config SIFIVE_FU740
 config SIFIVE_FU740_L2CC_FLUSH
 	bool "Support Level 2 Cache Controller Flush operation of SiFive fu740"
 
-if SIFIVE_FU740_L2CC_FLUSH
+menu "Level 2 Cache Controller Flush range"
+	depends on SIFIVE_FU740_L2CC_FLUSH
 
 config SIFIVE_FU740_L2CC_FLUSH_START
 	hex "Level 2 Cache Flush operation start"
@@ -52,4 +53,19 @@ config SIFIVE_FU740_L2CC_FLUSH_SIZE
 	hex "Level 2 Cache Flush operation size"
 	default 0x800000000
 
-endif # SIFIVE_FU740_L2CC_FLUSH
+endmenu # SIFIVE_FU740_L2CC_FLUSH
+
+config SIFIVE_FU740_L2CC_WAYENABLE_DIY
+	bool "Config Level 2 Cache Controller: the largest way which has been enabled"
+
+menu "The index of the largest way"
+	depends on SIFIVE_FU740_L2CC_WAYENABLE_DIY
+
+config SIFIVE_FU740_L2CC_WAYENABLE_DIY_NUM
+	int "The index of the largest way which has been enabled for level 2 Cache "
+	default 1
+	range 0 255
+	help
+	  Range[0, 255]. The index of the largest way which has been enabled.
+
+endmenu # SIFIVE_FU740_L2CC_WAYENABLE_DIY

+ 6 - 1
arch/riscv/cpu/fu740/cache.c

@@ -52,7 +52,12 @@ int cache_enable_ways(void)
 
 	/* memory barrier */
 	mb();
-	(*enable) = ways - 1;
+#if CONFIG_IS_ENABLED(SIFIVE_FU740_L2CC_WAYENABLE_DIY)
+	if (CONFIG_SIFIVE_FU740_L2CC_WAYENABLE_DIY_NUM < ways)
+		(*enable) = CONFIG_SIFIVE_FU740_L2CC_WAYENABLE_DIY_NUM;
+	else
+#endif //SIFIVE_FU740_L2CC_WAYENABLE_DIY
+		(*enable) = ways - 1;
 	/* memory barrier */
 	mb();
 	return 0;