* Re: [EXTERNAL] [PATCH] mtd: spi-nor: Fix the number of bytes for the dummy cycles
2022-10-31 12:46 [PATCH] mtd: spi-nor: Fix the number of bytes for the dummy cycles Allen-KH Cheng
@ 2022-10-31 14:42 ` Dhruva Gole
2022-11-02 12:21 ` AngeloGioacchino Del Regno
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Dhruva Gole @ 2022-10-31 14:42 UTC (permalink / raw)
To: Allen-KH Cheng, Tudor Ambarus, Pratyush Yadav, Michael Walle,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Matthias Brugger, linux-mtd
Cc: linux-spi, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Bayi Cheng
On 31/10/22 18:16, Allen-KH Cheng wrote:
> The number of bytes used by spi_nor_spimem_check_readop() may be
> incorrect for the dummy cycles. Since nor->read_dummy is not initialized
> before spi_nor_spimem_adjust_hwcaps().
>
> We use both mode and wait state clock cycles instead of nor->read_dummy.
>
> Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol")
> Co-developed-by: Bayi Cheng <bayi.cheng@mediatek.com>
> Signed-off-by: Bayi Cheng <bayi.cheng@mediatek.com>
> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> ---
Tested-by: Dhruva Gole <d-gole@ti.com>
> drivers/mtd/spi-nor/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 6c921eb3fadb..8b9c318a0ad4 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -1914,7 +1914,8 @@ static int spi_nor_spimem_check_readop(struct spi_nor *nor,
> spi_nor_spimem_setup_op(nor, &op, read->proto);
>
> /* convert the dummy cycles to the number of bytes */
> - op.dummy.nbytes = (nor->read_dummy * op.dummy.buswidth) / 8;
> + op.dummy.nbytes = (read->num_mode_clocks + read->num_wait_states) *
> + op.dummy.buswidth / 8;
> if (spi_nor_protocol_is_dtr(nor->read_proto))
> op.dummy.nbytes *= 2;
>
Tested on my AM625 SK EVM having spi nor flash and no obvious
regressions observed :)
--
Best regards,
Dhruva Gole
Texas Instruments Incorporated
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spi-nor: Fix the number of bytes for the dummy cycles
2022-10-31 12:46 [PATCH] mtd: spi-nor: Fix the number of bytes for the dummy cycles Allen-KH Cheng
2022-10-31 14:42 ` [EXTERNAL] " Dhruva Gole
@ 2022-11-02 12:21 ` AngeloGioacchino Del Regno
2022-11-06 22:54 ` Pratyush Yadav
2022-11-21 14:59 ` Tudor Ambarus
3 siblings, 0 replies; 5+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-11-02 12:21 UTC (permalink / raw)
To: Allen-KH Cheng, Tudor Ambarus, Pratyush Yadav, Michael Walle,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Matthias Brugger, linux-mtd
Cc: linux-spi, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Bayi Cheng
Il 31/10/22 13:46, Allen-KH Cheng ha scritto:
> The number of bytes used by spi_nor_spimem_check_readop() may be
> incorrect for the dummy cycles. Since nor->read_dummy is not initialized
> before spi_nor_spimem_adjust_hwcaps().
>
> We use both mode and wait state clock cycles instead of nor->read_dummy.
>
> Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol")
> Co-developed-by: Bayi Cheng <bayi.cheng@mediatek.com>
> Signed-off-by: Bayi Cheng <bayi.cheng@mediatek.com>
> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> Tested-by: Dhruva Gole <d-gole@ti.com>
On MT8195 Tomato Chromebook:
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spi-nor: Fix the number of bytes for the dummy cycles
2022-10-31 12:46 [PATCH] mtd: spi-nor: Fix the number of bytes for the dummy cycles Allen-KH Cheng
2022-10-31 14:42 ` [EXTERNAL] " Dhruva Gole
2022-11-02 12:21 ` AngeloGioacchino Del Regno
@ 2022-11-06 22:54 ` Pratyush Yadav
2022-11-21 14:59 ` Tudor Ambarus
3 siblings, 0 replies; 5+ messages in thread
From: Pratyush Yadav @ 2022-11-06 22:54 UTC (permalink / raw)
To: Allen-KH Cheng
Cc: Tudor Ambarus, Michael Walle, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Matthias Brugger, linux-mtd, linux-spi,
linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Bayi Cheng
On 31/10/22 08:46PM, Allen-KH Cheng wrote:
> The number of bytes used by spi_nor_spimem_check_readop() may be
> incorrect for the dummy cycles. Since nor->read_dummy is not initialized
> before spi_nor_spimem_adjust_hwcaps().
>
> We use both mode and wait state clock cycles instead of nor->read_dummy.
>
> Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol")
> Co-developed-by: Bayi Cheng <bayi.cheng@mediatek.com>
> Signed-off-by: Bayi Cheng <bayi.cheng@mediatek.com>
> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> ---
> drivers/mtd/spi-nor/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 6c921eb3fadb..8b9c318a0ad4 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -1914,7 +1914,8 @@ static int spi_nor_spimem_check_readop(struct spi_nor *nor,
> spi_nor_spimem_setup_op(nor, &op, read->proto);
>
> /* convert the dummy cycles to the number of bytes */
> - op.dummy.nbytes = (nor->read_dummy * op.dummy.buswidth) / 8;
> + op.dummy.nbytes = (read->num_mode_clocks + read->num_wait_states) *
> + op.dummy.buswidth / 8;
Good catch!
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
> if (spi_nor_protocol_is_dtr(nor->read_proto))
> op.dummy.nbytes *= 2;
>
> --
> 2.18.0
>
--
Regards,
Pratyush Yadav
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: spi-nor: Fix the number of bytes for the dummy cycles
2022-10-31 12:46 [PATCH] mtd: spi-nor: Fix the number of bytes for the dummy cycles Allen-KH Cheng
` (2 preceding siblings ...)
2022-11-06 22:54 ` Pratyush Yadav
@ 2022-11-21 14:59 ` Tudor Ambarus
3 siblings, 0 replies; 5+ messages in thread
From: Tudor Ambarus @ 2022-11-21 14:59 UTC (permalink / raw)
To: richard, matthias.bgg, linux-mtd, miquel.raynal, pratyush,
allen-kh.cheng, vigneshr, michael
Cc: Tudor Ambarus, linux-mediatek, linux-spi, linux-arm-kernel,
Project_Global_Chrome_Upstream_Group, linux-kernel, bayi.cheng
On Mon, 31 Oct 2022 20:46:33 +0800, Allen-KH Cheng wrote:
> The number of bytes used by spi_nor_spimem_check_readop() may be
> incorrect for the dummy cycles. Since nor->read_dummy is not initialized
> before spi_nor_spimem_adjust_hwcaps().
>
> We use both mode and wait state clock cycles instead of nor->read_dummy.
>
>
> [...]
Applied to spi-nor/next, thanks!
[1/1] mtd: spi-nor: Fix the number of bytes for the dummy cycles
https://git.kernel.org/mtd/c/fdc20370d93e
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] 5+ messages in thread