diff options
author | Wei Fu <wefu@redhat.com> | 2021-09-19 09:40:29 +0300 |
---|---|---|
committer | Tekkaman Ninja <tekkamanninja@163.com> | 2021-12-29 17:41:11 +0300 |
commit | 9ef4658aab61e69530233eda7e4912baac99ae0b (patch) | |
tree | e10369628c7e99a5153125b57846caa86903d9ac | |
parent | e9b56e55eecb9f5d59f16b566d810c1e05a31aaa (diff) | |
download | u-boot-9ef4658aab61e69530233eda7e4912baac99ae0b.tar.xz |
sifive: make WayEnable can be configured by menuconfig
Signed-off-by:Wei Fu <wefu@redhat.com>
-rw-r--r-- | drivers/cache/Kconfig | 12 | ||||
-rw-r--r-- | drivers/cache/cache-sifive-ccache.c | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/drivers/cache/Kconfig b/drivers/cache/Kconfig index 40f41a817c..259d6e154c 100644 --- a/drivers/cache/Kconfig +++ b/drivers/cache/Kconfig @@ -46,4 +46,16 @@ config SIFIVE_CCACHE This driver is for SiFive Composable L2/L3 cache. It enables cache ways of composable cache. +config SIFIVE_CCACHE_WAYENABLE_OPT + bool "SiFive composable cache: customized the largest way enabled." + depends on SIFIVE_CCACHE + +config SIFIVE_CCACHE_WAYENABLE_NUM + int "SiFive composable cache: the largest way which will be enabled" + depends on SIFIVE_CCACHE_WAYENABLE_OPT + default 1 + range 1 256 + help + Range[1, 256]. The index of the largest way which will be enabled. + endmenu 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; |