Message ID | 20240821105943.230281-9-ada@thorsis.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Microchip OTPC driver on SAM9X60 exposing UIDxR as additional nvmem device | expand |
On 21.08.2024 13:59, Alexander Dahl wrote: > These conditions could affect correct function of the driver. Can you please detail why this has been added, what was the issue you identified etc? > > Signed-off-by: Alexander Dahl <ada@thorsis.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); There are many status bits in WPSR. Some of these bits suggests warnings even when their values are zero (e.g., ECLASS, SWETYP). I don't know how accurate is this message. > + > + 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)
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)
These conditions could affect correct function of the driver. Signed-off-by: Alexander Dahl <ada@thorsis.com> --- drivers/nvmem/microchip-otpc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)