diff mbox series

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

Message ID 20230908133707.104592-1-ben.dooks@codethink.co.uk
State Rejected
Delegated to: Andes
Headers show
Series [1/2] cache: sifive: clear out the error irqs on init | expand

Commit Message

Ben Dooks Sept. 8, 2023, 1:37 p.m. UTC
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@codethink.co.uk>
[ben.dooks@codethink.co.uk: changed from sifive.com address]
---
 drivers/cache/cache-sifive-ccache.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Ben Dooks Sept. 8, 2023, 1:55 p.m. UTC | #1
On 08/09/2023 14:37, Ben Dooks wrote:
> 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@codethink.co.uk>
> [ben.dooks@codethink.co.uk: changed from sifive.com address]

As a follow-up, this hasn't been checked to see if it fixes the
unmatched or other fuXXX cores. If someone could test it on
others and see if it removes the issues, then it would be more
than worth getting this merged.
diff mbox series

Patch

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;
 }