Skip to content

Commit 95f196f

Browse files
zongboxpalmer-dabbelt
authored andcommitted
soc: sifive: ccache: determine the cache level from dts
Composable cache could be L2 or L3 cache, use 'cache-level' property of device node to determine the level. Signed-off-by: Zong Li <zong.li@sifive.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20220913061817.22564-4-zong.li@sifive.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent ca120a7 commit 95f196f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/soc/sifive/sifive_ccache.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
static void __iomem *ccache_base;
3939
static int g_irq[SIFIVE_CCACHE_MAX_ECCINTR];
4040
static struct riscv_cacheinfo_ops ccache_cache_ops;
41+
static int level;
4142

4243
enum {
4344
DIR_CORR = 0,
@@ -144,7 +145,7 @@ static const struct attribute_group *ccache_get_priv_group(struct cacheinfo
144145
*this_leaf)
145146
{
146147
/* We want to use private group for composable cache only */
147-
if (this_leaf->level == 2)
148+
if (this_leaf->level == level)
148149
return &priv_attr_group;
149150
else
150151
return NULL;
@@ -215,6 +216,9 @@ static int __init sifive_ccache_init(void)
215216
if (!ccache_base)
216217
return -ENOMEM;
217218

219+
if (of_property_read_u32(np, "cache-level", &level))
220+
return -ENOENT;
221+
218222
intr_num = of_property_count_u32_elems(np, "interrupts");
219223
if (!intr_num) {
220224
pr_err("CCACHE: no interrupts property\n");

0 commit comments

Comments
 (0)