summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTekkamanV <tekkamanv@starfivetech.com>2021-08-07 12:30:21 +0300
committerTekkaman Ninja <tekkamanninja@163.com>2021-08-31 16:06:43 +0300
commit99e391012d775a56d245febaac61d8062453b3c6 (patch)
treef57b72115441f051fdfaf3234de9eab1b7e19793
parentd7698efa3dc9440653f85d18355506930c264adc (diff)
downloadu-boot-99e391012d775a56d245febaac61d8062453b3c6.tar.xz
fu740: make WayEnable can be configured by menuconfig
Signed-off-by:TekkamanV <tekkamanv@starfivetech.com>
-rw-r--r--arch/riscv/cpu/fu740/Kconfig20
-rw-r--r--arch/riscv/cpu/fu740/cache.c7
2 files changed, 24 insertions, 3 deletions
diff --git a/arch/riscv/cpu/fu740/Kconfig b/arch/riscv/cpu/fu740/Kconfig
index a3e239f8b0..392a789806 100644
--- a/arch/riscv/cpu/fu740/Kconfig
+++ b/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
diff --git a/arch/riscv/cpu/fu740/cache.c b/arch/riscv/cpu/fu740/cache.c
index f2070f84a7..501fc26275 100644
--- a/arch/riscv/cpu/fu740/cache.c
+++ b/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;