[PATCH 1/2] cache: sifive: clear out the error irqs on init

Ben Dooks ben.dooks at codethink.co.uk
Fri Sep 8 15:37:06 CEST 2023


We are getting a number of cache errors on starting an OS,
so to try and avoid this, clear the errors when we first
probe the cache.

Signed-off-by: Ben Dooks <ben.dooks at codethink.co.uk>
[ben.dooks at codethink.co.uk: changed from sifive.com address]
---
 drivers/cache/cache-sifive-ccache.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/cache/cache-sifive-ccache.c b/drivers/cache/cache-sifive-ccache.c
index 540e7df138..178bdcc82d 100644
--- a/drivers/cache/cache-sifive-ccache.c
+++ b/drivers/cache/cache-sifive-ccache.c
@@ -51,11 +51,18 @@ static const struct cache_ops sifive_ccache_ops = {
 static int sifive_ccache_probe(struct udevice *dev)
 {
 	struct sifive_ccache *priv = dev_get_priv(dev);
+	void __iomem *base;
 
-	priv->base = dev_read_addr_ptr(dev);
+	priv->base = base = dev_read_addr_ptr(dev);
 	if (!priv->base)
 		return -EINVAL;
 
+	/* read and clear any current errors, possilbly from reset */
+	(void)readl(base + 0x108);
+	(void)readl(base + 0x128);
+	(void)readl(base + 0x148);
+	(void)readl(base + 0x168);
+
 	return 0;
 }
 
-- 
2.40.1



More information about the U-Boot mailing list