Patch "Revert "mtd: spi-nor: core: replace dummy buswidth from addr to data"" has been added to the 6.12-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

    Revert "mtd: spi-nor: core: replace dummy buswidth from addr to data"

to the 6.12-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:
     revert-mtd-spi-nor-core-replace-dummy-buswidth-from-.patch
and it can be found in the queue-6.12 subdirectory.

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



commit 58a291eeacdf39ff055b4e62f9607643dd6fc6f3
Author: Pratyush Yadav <pratyush@xxxxxxxxxx>
Date:   Wed Jan 15 13:41:56 2025 +0000

    Revert "mtd: spi-nor: core: replace dummy buswidth from addr to data"
    
    [ Upstream commit d15638bf76ad47874ecb5dc386f0945fc0b2a875 ]
    
    This reverts commit 98d1fb94ce75f39febd456d6d3cbbe58b6678795.
    
    The commit uses data nbits instead of addr nbits for dummy phase. This
    causes a regression for all boards where spi-tx-bus-width is smaller
    than spi-rx-bus-width. It is a common pattern for boards to have
    spi-tx-bus-width == 1 and spi-rx-bus-width > 1. The regression causes
    all reads with a dummy phase to become unavailable for such boards,
    leading to a usually slower 0-dummy-cycle read being selected.
    
    Most controllers' supports_op hooks call spi_mem_default_supports_op().
    In spi_mem_default_supports_op(), spi_mem_check_buswidth() is called to
    check if the buswidths for the op can actually be supported by the
    board's wiring. This wiring information comes from (among other things)
    the spi-{tx,rx}-bus-width DT properties. Based on these properties,
    SPI_TX_* or SPI_RX_* flags are set by of_spi_parse_dt().
    spi_mem_check_buswidth() then uses these flags to make the decision
    whether an op can be supported by the board's wiring (in a way,
    indirectly checking against spi-{rx,tx}-bus-width).
    
    Now the tricky bit here is that spi_mem_check_buswidth() does:
    
            if (op->dummy.nbytes &&
                spi_check_buswidth_req(mem, op->dummy.buswidth, true))
                    return false;
    
    The true argument to spi_check_buswidth_req() means the op is treated as
    a TX op. For a board that has say 1-bit TX and 4-bit RX, a 4-bit dummy
    TX is considered as unsupported, and the op gets rejected.
    
    The commit being reverted uses the data buswidth for dummy buswidth. So
    for reads, the RX buswidth gets used for the dummy phase, uncovering
    this issue. In reality, a dummy phase is neither RX nor TX. As the name
    suggests, these are just dummy cycles that send or receive no data, and
    thus don't really need to have any buswidth at all.
    
    Ideally, dummy phases should not be checked against the board's wiring
    capabilities at all, and should only be sanity-checked for having a sane
    buswidth value. Since we are now at rc7 and such a change might
    introduce many unexpected bugs, revert the commit for now. It can be
    sent out later along with the spi_mem_check_buswidth() fix.
    
    Fixes: 98d1fb94ce75 ("mtd: spi-nor: core: replace dummy buswidth from addr to data")
    Reported-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx>
    Closes: https://lore.kernel.org/linux-mtd/3342163.44csPzL39Z@steina-w/
    Tested-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx>
    Reviewed-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>
    Signed-off-by: Pratyush Yadav <pratyush@xxxxxxxxxx>
    Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 8c57df44c40fe..9d6e85bf227b9 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -89,7 +89,7 @@ void spi_nor_spimem_setup_op(const struct spi_nor *nor,
 		op->addr.buswidth = spi_nor_get_protocol_addr_nbits(proto);
 
 	if (op->dummy.nbytes)
-		op->dummy.buswidth = spi_nor_get_protocol_data_nbits(proto);
+		op->dummy.buswidth = spi_nor_get_protocol_addr_nbits(proto);
 
 	if (op->data.nbytes)
 		op->data.buswidth = spi_nor_get_protocol_data_nbits(proto);




[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