summaryrefslogtreecommitdiff
path: root/drivers/cache/cache-sifive-ccache.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cache/cache-sifive-ccache.c')
-rw-r--r--drivers/cache/cache-sifive-ccache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/cache/cache-sifive-ccache.c b/drivers/cache/cache-sifive-ccache.c
index a4889f1bc5..5177f45216 100644
--- a/drivers/cache/cache-sifive-ccache.c
+++ b/drivers/cache/cache-sifive-ccache.c
@@ -35,6 +35,10 @@ static int sifive_ccache_enable(struct udevice *dev)
config = readl(priv->base + SIFIVE_CCACHE_CONFIG);
ways = FIELD_GET(SIFIVE_CCACHE_CONFIG_WAYS, config);
+#if CONFIG_IS_ENABLED(SIFIVE_CCACHE_WAYENABLE_OPT)
+ if (CONFIG_SIFIVE_CCACHE_WAYENABLE_NUM < ways)
+ ways = CONFIG_SIFIVE_CCACHE_WAYENABLE_NUM;
+#endif
writel(ways - 1, priv->base + SIFIVE_CCACHE_WAY_ENABLE);
return 0;