All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked
@ 2022-11-22  5:18 Ashok Reddy Soma
  2022-11-22  5:25 ` Dhruva Gole
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ashok Reddy Soma @ 2022-11-22  5:18 UTC (permalink / raw)
  To: u-boot
  Cc: jagan, vigneshr, jan.kiszka, michal.simek, git, git,
	Algapally Santosh Sagar, Ashok Reddy Soma

From: Algapally Santosh Sagar <santoshsagar.algapally@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@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@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,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked
  2022-11-22  5:18 [PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked Ashok Reddy Soma
@ 2022-11-22  5:25 ` Dhruva Gole
  2022-11-22  6:34 ` Jan Kiszka
  2022-12-05  9:02 ` Michal Simek
  2 siblings, 0 replies; 5+ messages in thread
From: Dhruva Gole @ 2022-11-22  5:25 UTC (permalink / raw)
  To: Ashok Reddy Soma, u-boot
  Cc: jagan, vigneshr, jan.kiszka, michal.simek, git, git,
	Algapally Santosh Sagar

These changes make sense to me,

On 22/11/22 10:48, Ashok Reddy Soma wrote:
> From: Algapally Santosh Sagar <santoshsagar.algapally@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@amd.com>
> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
> ---
Reviewed-by: Dhruva Gole <d-gole@ti.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,

-- 
Thanks and Regards,
Dhruva Gole

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked
  2022-11-22  5:18 [PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked Ashok Reddy Soma
  2022-11-22  5:25 ` Dhruva Gole
@ 2022-11-22  6:34 ` Jan Kiszka
  2022-11-22  6:55   ` Soma, Ashok Reddy
  2022-12-05  9:02 ` Michal Simek
  2 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2022-11-22  6:34 UTC (permalink / raw)
  To: Ashok Reddy Soma, u-boot
  Cc: jagan, vigneshr, michal.simek, git, git, Algapally Santosh Sagar

On 22.11.22 06:18, Ashok Reddy Soma wrote:
> From: Algapally Santosh Sagar <santoshsagar.algapally@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@amd.com>
> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@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@siemens.com>

Hope you were also able to test this on real HW (which I wasn't).

Thanks,
Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked
  2022-11-22  6:34 ` Jan Kiszka
@ 2022-11-22  6:55   ` Soma, Ashok Reddy
  0 siblings, 0 replies; 5+ messages in thread
From: Soma, Ashok Reddy @ 2022-11-22  6:55 UTC (permalink / raw)
  To: Jan Kiszka, u-boot
  Cc: jagan, vigneshr, Simek, Michal, git, git (AMD-Xilinx),
	Algapally, Santosh Sagar

[-- Attachment #1: Type: text/plain, Size: 2170 bytes --]

Hi Jan,

> -----Original Message-----
> From: Jan Kiszka <jan.kiszka@siemens.com>
> Sent: Tuesday, November 22, 2022 12:05 PM
> To: Soma, Ashok Reddy <ashok.reddy.soma@amd.com>; u-
> boot@lists.denx.de
> Cc: jagan@amarulasolutions.com; vigneshr@ti.com; Simek, Michal
> <michal.simek@amd.com>; git@xilinx.com; git (AMD-Xilinx)
> <git@amd.com>; Algapally, Santosh Sagar
> <SantoshSagar.Algapally@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@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@amd.com>
> > Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@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@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


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 15252 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked
  2022-11-22  5:18 [PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked Ashok Reddy Soma
  2022-11-22  5:25 ` Dhruva Gole
  2022-11-22  6:34 ` Jan Kiszka
@ 2022-12-05  9:02 ` Michal Simek
  2 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2022-12-05  9:02 UTC (permalink / raw)
  To: Ashok Reddy Soma
  Cc: u-boot, jagan, vigneshr, jan.kiszka, michal.simek, git, git,
	Algapally Santosh Sagar

út 22. 11. 2022 v 6:19 odesílatel Ashok Reddy Soma
<ashok.reddy.soma@amd.com> napsal:
>
> From: Algapally Santosh Sagar <santoshsagar.algapally@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@amd.com>
> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@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,
> --
> 2.17.1
>

Applied.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-05  9:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22  5:18 [PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked Ashok Reddy Soma
2022-11-22  5:25 ` Dhruva Gole
2022-11-22  6:34 ` Jan Kiszka
2022-11-22  6:55   ` Soma, Ashok Reddy
2022-12-05  9:02 ` Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.