* mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}()
@ 2022-06-29 13:30 patrice.chotard
2022-07-05 7:36 ` Pratyush Yadav
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: patrice.chotard @ 2022-06-29 13:30 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, linux-mtd, inux-kernel
Cc: patrice.chotard, christophe.kerello
From: Patrice Chotard <patrice.chotard@foss.st.com>
For erase operations, reg_proto must be used as indicated in
struct spi_nor description in spi-nor.h.
This issue was found when DT property spi-tx-bus-width is set to 4.
In this case the spi_mem_op->addr.buswidth is set to 4 for erase command
which is not correct.
Tested on stm32mp157c-ev1 board with mx66l51235f spi-nor.
Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol")
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
---
drivers/mtd/spi-nor/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 502967c76c5f..61027330848f 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -972,7 +972,7 @@ static int spi_nor_erase_chip(struct spi_nor *nor)
if (nor->spimem) {
struct spi_mem_op op = SPI_NOR_CHIP_ERASE_OP;
- spi_nor_spimem_setup_op(nor, &op, nor->write_proto);
+ spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
ret = spi_mem_exec_op(nor->spimem, &op);
} else {
@@ -1115,7 +1115,7 @@ int spi_nor_erase_sector(struct spi_nor *nor, u32 addr)
SPI_NOR_SECTOR_ERASE_OP(nor->erase_opcode,
nor->addr_width, addr);
- spi_nor_spimem_setup_op(nor, &op, nor->write_proto);
+ spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
return spi_mem_exec_op(nor->spimem, &op);
} else if (nor->controller_ops->erase) {
--
2.25.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}()
2022-06-29 13:30 mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}() patrice.chotard
@ 2022-07-05 7:36 ` Pratyush Yadav
2022-07-18 16:47 ` Tudor.Ambarus
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Pratyush Yadav @ 2022-07-05 7:36 UTC (permalink / raw)
To: patrice.chotard
Cc: Tudor Ambarus, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, linux-mtd, inux-kernel, christophe.kerello
On 29/06/22 03:30PM, patrice.chotard@foss.st.com wrote:
> From: Patrice Chotard <patrice.chotard@foss.st.com>
>
> For erase operations, reg_proto must be used as indicated in
> struct spi_nor description in spi-nor.h.
>
> This issue was found when DT property spi-tx-bus-width is set to 4.
> In this case the spi_mem_op->addr.buswidth is set to 4 for erase command
> which is not correct.
>
> Tested on stm32mp157c-ev1 board with mx66l51235f spi-nor.
>
> Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol")
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}()
2022-06-29 13:30 mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}() patrice.chotard
2022-07-05 7:36 ` Pratyush Yadav
@ 2022-07-18 16:47 ` Tudor.Ambarus
2022-07-25 14:50 ` Alexander Sverdlin
2022-07-28 2:38 ` Tudor Ambarus
3 siblings, 0 replies; 6+ messages in thread
From: Tudor.Ambarus @ 2022-07-18 16:47 UTC (permalink / raw)
To: patrice.chotard, p.yadav, miquel.raynal, richard, vigneshr,
linux-mtd, inux-kernel
Cc: christophe.kerello
On 6/29/22 16:30, patrice.chotard@foss.st.com wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> From: Patrice Chotard <patrice.chotard@foss.st.com>
>
> For erase operations, reg_proto must be used as indicated in
> struct spi_nor description in spi-nor.h.
>
> This issue was found when DT property spi-tx-bus-width is set to 4.
> In this case the spi_mem_op->addr.buswidth is set to 4 for erase command
> which is not correct.
>
> Tested on stm32mp157c-ev1 board with mx66l51235f spi-nor.
>
> Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol")
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> ---
> drivers/mtd/spi-nor/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 502967c76c5f..61027330848f 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -972,7 +972,7 @@ static int spi_nor_erase_chip(struct spi_nor *nor)
> if (nor->spimem) {
> struct spi_mem_op op = SPI_NOR_CHIP_ERASE_OP;
>
> - spi_nor_spimem_setup_op(nor, &op, nor->write_proto);
> + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
>
> ret = spi_mem_exec_op(nor->spimem, &op);
> } else {
> @@ -1115,7 +1115,7 @@ int spi_nor_erase_sector(struct spi_nor *nor, u32 addr)
> SPI_NOR_SECTOR_ERASE_OP(nor->erase_opcode,
> nor->addr_width, addr);
>
> - spi_nor_spimem_setup_op(nor, &op, nor->write_proto);
> + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
>
> return spi_mem_exec_op(nor->spimem, &op);
> } else if (nor->controller_ops->erase) {
> --
> 2.25.1
>
should you also update the following?
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index ce5d69317d46..23487e9a9282 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -177,7 +177,7 @@ int spi_nor_controller_ops_write_reg(struct spi_nor *nor, u8 opcode,
static int spi_nor_controller_ops_erase(struct spi_nor *nor, loff_t offs)
{
- if (spi_nor_protocol_is_dtr(nor->write_proto))
+ if (spi_nor_protocol_is_dtr(nor->reg_proto))
return -EOPNOTSUPP;
return nor->controller_ops->erase(nor, offs);
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}()
2022-06-29 13:30 mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}() patrice.chotard
2022-07-05 7:36 ` Pratyush Yadav
2022-07-18 16:47 ` Tudor.Ambarus
@ 2022-07-25 14:50 ` Alexander Sverdlin
2022-07-28 2:38 ` Tudor Ambarus
3 siblings, 0 replies; 6+ messages in thread
From: Alexander Sverdlin @ 2022-07-25 14:50 UTC (permalink / raw)
To: patrice.chotard, Tudor Ambarus, Pratyush Yadav, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, linux-mtd, inux-kernel
Cc: christophe.kerello
Hello Patrice,
thanks for the patch!
It fixes mt25qu256a erase in my tests.
On 29/06/2022 15:30, patrice.chotard@foss.st.com wrote:
> From: Patrice Chotard <patrice.chotard@foss.st.com>
>
> For erase operations, reg_proto must be used as indicated in
> struct spi_nor description in spi-nor.h.
>
> This issue was found when DT property spi-tx-bus-width is set to 4.
> In this case the spi_mem_op->addr.buswidth is set to 4 for erase command
> which is not correct.
>
> Tested on stm32mp157c-ev1 board with mx66l51235f spi-nor.
>
> Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol")
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Tested-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> ---
> drivers/mtd/spi-nor/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 502967c76c5f..61027330848f 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -972,7 +972,7 @@ static int spi_nor_erase_chip(struct spi_nor *nor)
> if (nor->spimem) {
> struct spi_mem_op op = SPI_NOR_CHIP_ERASE_OP;
>
> - spi_nor_spimem_setup_op(nor, &op, nor->write_proto);
> + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
>
> ret = spi_mem_exec_op(nor->spimem, &op);
> } else {
> @@ -1115,7 +1115,7 @@ int spi_nor_erase_sector(struct spi_nor *nor, u32 addr)
> SPI_NOR_SECTOR_ERASE_OP(nor->erase_opcode,
> nor->addr_width, addr);
>
> - spi_nor_spimem_setup_op(nor, &op, nor->write_proto);
> + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
>
> return spi_mem_exec_op(nor->spimem, &op);
> } else if (nor->controller_ops->erase) {
--
Best regards,
Alexander Sverdlin.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}()
2022-06-29 13:30 mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}() patrice.chotard
` (2 preceding siblings ...)
2022-07-25 14:50 ` Alexander Sverdlin
@ 2022-07-28 2:38 ` Tudor Ambarus
2022-07-28 2:47 ` Tudor.Ambarus
3 siblings, 1 reply; 6+ messages in thread
From: Tudor Ambarus @ 2022-07-28 2:38 UTC (permalink / raw)
To: linux-mtd, p.yadav, inux-kernel, miquel.raynal, patrice.chotard,
vigneshr, richard
Cc: Tudor Ambarus, christophe.kerello
On Wed, 29 Jun 2022 15:30:13 +0200, patrice.chotard@foss.st.com wrote:
> From: Patrice Chotard <patrice.chotard@foss.st.com>
>
> For erase operations, reg_proto must be used as indicated in
> struct spi_nor description in spi-nor.h.
>
> This issue was found when DT property spi-tx-bus-width is set to 4.
> In this case the spi_mem_op->addr.buswidth is set to 4 for erase command
> which is not correct.
>
> [...]
Used nor->reg_proto in spi_nor_controller_ops_erase() and applied to
spi-nor/next, thanks!
[1/1] mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}()
https://git.kernel.org/mtd/c/7f5ee1a113a9
Best regards,
--
Tudor Ambarus <tudor.ambarus@microchip.com>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}()
2022-07-28 2:38 ` Tudor Ambarus
@ 2022-07-28 2:47 ` Tudor.Ambarus
0 siblings, 0 replies; 6+ messages in thread
From: Tudor.Ambarus @ 2022-07-28 2:47 UTC (permalink / raw)
To: linux-mtd, p.yadav, inux-kernel, miquel.raynal, patrice.chotard,
vigneshr, richard
Cc: christophe.kerello
On 7/28/22 05:38, Tudor Ambarus wrote:
> On Wed, 29 Jun 2022 15:30:13 +0200, patrice.chotard@foss.st.com wrote:
>> From: Patrice Chotard <patrice.chotard@foss.st.com>
>>
>> For erase operations, reg_proto must be used as indicated in
>> struct spi_nor description in spi-nor.h.
>>
>> This issue was found when DT property spi-tx-bus-width is set to 4.
>> In this case the spi_mem_op->addr.buswidth is set to 4 for erase command
>> which is not correct.
>>
>> [...]
>
> Used nor->reg_proto in spi_nor_controller_ops_erase() and applied to
> spi-nor/next, thanks!
>
> [1/1] mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}()
> https://git.kernel.org/mtd/c/7f5ee1a113a9
here's the correct link to the patch:
https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?h=spi-nor/next&id=f8cd9f632f4415b1e8838bdca8ab42cfb37a6584
>
> Best regards,
--
Cheers,
ta
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-28 2:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 13:30 mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}() patrice.chotard
2022-07-05 7:36 ` Pratyush Yadav
2022-07-18 16:47 ` Tudor.Ambarus
2022-07-25 14:50 ` Alexander Sverdlin
2022-07-28 2:38 ` Tudor Ambarus
2022-07-28 2:47 ` Tudor.Ambarus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).