[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240821105943.230281-9-ada@thorsis.com>
Date: Wed, 21 Aug 2024 12:59:39 +0200
From: Alexander Dahl <ada@...rsis.com>
To: Claudiu Beznea <claudiu.beznea@...on.dev>
Cc: Christian Melki <christian.melki@...ata.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
linux-arm-kernel@...ts.infradead.org (moderated list:MICROCHIP OTPC DRIVER),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH v1 08/12] nvmem: microchip-otpc: Add warnings for bad OTPC conditions on probe
These conditions could affect correct function of the driver.
Signed-off-by: Alexander Dahl <ada@...rsis.com>
---
drivers/nvmem/microchip-otpc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c
index 4630e96243ac..a80535c3d162 100644
--- a/drivers/nvmem/microchip-otpc.c
+++ b/drivers/nvmem/microchip-otpc.c
@@ -8,6 +8,7 @@
*/
#include <linux/bitfield.h>
+#include <linux/dev_printk.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
@@ -260,6 +261,7 @@ static int mchp_otpc_probe(struct platform_device *pdev)
struct nvmem_device *nvmem;
struct mchp_otpc *otpc;
u32 size;
+ u32 reg;
int ret;
otpc = devm_kzalloc(&pdev->dev, sizeof(*otpc), GFP_KERNEL);
@@ -270,6 +272,16 @@ static int mchp_otpc_probe(struct platform_device *pdev)
if (IS_ERR(otpc->base))
return PTR_ERR(otpc->base);
+ reg = readl_relaxed(otpc->base + MCHP_OTPC_WPSR);
+ if (reg)
+ dev_warn(&pdev->dev,
+ "Write Protection Status Register Bit set: 0x%08x\n", reg);
+
+ reg = readl_relaxed(otpc->base + MCHP_OTPC_ISR);
+ if (reg & MCHP_OTPC_ISR_COERR)
+ dev_warn(&pdev->dev,
+ "A corruption occurred since the last read of OTPC_ISR.\n");
+
otpc->dev = &pdev->dev;
ret = mchp_otpc_init_packets_list(otpc, &size);
if (ret)
--
2.39.2
Powered by blists - more mailing lists