Patch "mtd: spi-nor: Fix the number of bytes for the dummy cycles" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mtd: spi-nor: Fix the number of bytes for the dummy cycles

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mtd-spi-nor-fix-the-number-of-bytes-for-the-dummy-cy.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c23db36ac29aa92d14215c22c484bd60dff1cf0d
Author: Allen-KH Cheng <allen-kh.cheng@xxxxxxxxxxxx>
Date:   Mon Oct 31 20:46:33 2022 +0800

    mtd: spi-nor: Fix the number of bytes for the dummy cycles
    
    [ Upstream commit fdc20370d93e8c6d2f448a539d08c2c064af7694 ]
    
    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@xxxxxxxxxxxx>
    Signed-off-by: Bayi Cheng <bayi.cheng@xxxxxxxxxxxx>
    Signed-off-by: Allen-KH Cheng <allen-kh.cheng@xxxxxxxxxxxx>
    Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx>
    Tested-by: Dhruva Gole <d-gole@xxxxxx>
    Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
    Reviewed-by: Pratyush Yadav <pratyush@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221031124633.13189-1-allen-kh.cheng@xxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index eb5d7b3d1860..aad7076ae020 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2155,7 +2155,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;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux