diff mbox series

[v1,01/12] nvmem: microchip-otpc: Avoid writing a write-only register

Message ID 20240821105943.230281-2-ada@thorsis.com (mailing list archive)
State New, archived
Headers show
Series Microchip OTPC driver on SAM9X60 exposing UIDxR as additional nvmem device | expand

Commit Message

Alexander Dahl Aug. 21, 2024, 10:59 a.m. UTC
The OTPC Control Register (OTPC_CR) has just write-only members.
Reading from that register leads to a warning in OTPC Write Protection
Status Register (OTPC_WPSR) in field Software Error Type (SWETYP) of
type READ_WO (A write-only register has been read (warning).)

Just create the register write content from scratch is sufficient here.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 drivers/nvmem/microchip-otpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Claudiu Beznea Aug. 24, 2024, 3:51 p.m. UTC | #1
Hi, ALexander,

On 21.08.2024 13:59, Alexander Dahl wrote:
> The OTPC Control Register (OTPC_CR) has just write-only members.
> Reading from that register leads to a warning in OTPC Write Protection
> Status Register (OTPC_WPSR) in field Software Error Type (SWETYP) of
> type READ_WO (A write-only register has been read (warning).)
> 
> Just create the register write content from scratch is sufficient here.
> 
> Signed-off-by: Alexander Dahl <ada@thorsis.com>

Maybe worth a Fixes tag here.

> ---
>  drivers/nvmem/microchip-otpc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c
> index 7cf81738a3e0..03e60b99f2c9 100644
> --- a/drivers/nvmem/microchip-otpc.c
> +++ b/drivers/nvmem/microchip-otpc.c
> @@ -82,7 +82,7 @@ static int mchp_otpc_prepare_read(struct mchp_otpc *otpc,
>  	writel_relaxed(tmp, otpc->base + MCHP_OTPC_MR);
>  
>  	/* Set read. */
> -	tmp = readl_relaxed(otpc->base + MCHP_OTPC_CR);
> +	tmp = 0;
>  	tmp |= MCHP_OTPC_CR_READ;
>  	writel_relaxed(tmp, otpc->base + MCHP_OTPC_CR);

	writel_relaxed(MCHP_OTPC_CR_READ, otpc->base + MCHP_OTPC_CR);

should be enough here.

Thank you,
Claudiu Beznea

>
diff mbox series

Patch

diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c
index 7cf81738a3e0..03e60b99f2c9 100644
--- a/drivers/nvmem/microchip-otpc.c
+++ b/drivers/nvmem/microchip-otpc.c
@@ -82,7 +82,7 @@  static int mchp_otpc_prepare_read(struct mchp_otpc *otpc,
 	writel_relaxed(tmp, otpc->base + MCHP_OTPC_MR);
 
 	/* Set read. */
-	tmp = readl_relaxed(otpc->base + MCHP_OTPC_CR);
+	tmp = 0;
 	tmp |= MCHP_OTPC_CR_READ;
 	writel_relaxed(tmp, otpc->base + MCHP_OTPC_CR);