[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221106225406.o36syeso4prdi7yn@yadavpratyush.com>
Date: Sun, 6 Nov 2022 23:54:06 +0100
From: Pratyush Yadav <pratyush@...nel.org>
To: Allen-KH Cheng <allen-kh.cheng@...iatek.com>
Cc: Tudor Ambarus <tudor.ambarus@...rochip.com>,
Michael Walle <michael@...le.cc>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Matthias Brugger <matthias.bgg@...il.com>,
linux-mtd@...ts.infradead.org, linux-spi@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
Project_Global_Chrome_Upstream_Group@...iatek.com,
Bayi Cheng <bayi.cheng@...iatek.com>
Subject: Re: [PATCH] mtd: spi-nor: Fix the number of bytes for the dummy
cycles
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@...iatek.com>
> Signed-off-by: Bayi Cheng <bayi.cheng@...iatek.com>
> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@...iatek.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@...nel.org>
> if (spi_nor_protocol_is_dtr(nor->read_proto))
> op.dummy.nbytes *= 2;
>
> --
> 2.18.0
>
--
Regards,
Pratyush Yadav
Powered by blists - more mailing lists