[PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked

Soma, Ashok Reddy ashok.reddy.soma at amd.com
Tue Nov 22 07:55:18 CET 2022


Hi Jan,

> -----Original Message-----
> From: Jan Kiszka <jan.kiszka at siemens.com>
> Sent: Tuesday, November 22, 2022 12:05 PM
> To: Soma, Ashok Reddy <ashok.reddy.soma at amd.com>; u-
> boot at lists.denx.de
> Cc: jagan at amarulasolutions.com; vigneshr at ti.com; Simek, Michal
> <michal.simek at amd.com>; git at xilinx.com; git (AMD-Xilinx)
> <git at amd.com>; Algapally, Santosh Sagar
> <SantoshSagar.Algapally at amd.com>
> Subject: Re: [PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash
> unlocked
> 
> On 22.11.22 06:18, Ashok Reddy Soma wrote:
> > From: Algapally Santosh Sagar <santoshsagar.algapally at amd.com>
> >
> > flash_is_locked is changed to flash_is_unlocked with commit
> > 513c6071ce73
> > ("mtd: spi: Convert is_locked callback to is_unlocked").
> > sst26_is_locked() is also changed to sst26_is_unlocked() but the logic
> remained same.
> > Invert the logic for the flash lock/unlock to work properly.
> >
> > Signed-off-by: Algapally Santosh Sagar
> > <santoshsagar.algapally at amd.com>
> > Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma at amd.com>
> > ---
> >
> >  drivers/mtd/spi/spi-nor-core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/spi/spi-nor-core.c
> > b/drivers/mtd/spi/spi-nor-core.c index 78de3c5281..1ea8363d9f 100644
> > --- a/drivers/mtd/spi/spi-nor-core.c
> > +++ b/drivers/mtd/spi/spi-nor-core.c
> > @@ -1600,7 +1600,7 @@ static int sst26_is_unlocked(struct spi_nor *nor,
> loff_t ofs, uint64_t len)
> >  	ofs -= ofs & (SZ_64K - 1);
> >  	len = len & (SZ_64K - 1) ? (len & ~(SZ_64K - 1)) + SZ_64K : len;
> >
> > -	return sst26_lock_ctl(nor, ofs, len, SST26_CTL_CHECK);
> > +	return !sst26_lock_ctl(nor, ofs, len, SST26_CTL_CHECK);
> >  }
> >
> >  static int sst_write_byteprogram(struct spi_nor *nor, loff_t to,
> > size_t len,
> 
> Indeed...
> 
> Reviewed-by: Jan Kiszka <jan.kiszka at siemens.com>
> 
> Hope you were also able to test this on real HW (which I wasn't).

Thanks for the review. Yes, we tested on ZynqMP platform.

Thanks,
Ashok
> 
> Thanks,
> Jan
> 
> --
> Siemens AG, Technology
> Competence Center Embedded Linux

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 15252 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20221122/579bd940/attachment.bin>


More information about the U-Boot mailing list