Patch "mtd: rawnand: arasan: Prevent an unsupported configuration" has been added to the 5.14-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: rawnand: arasan: Prevent an unsupported configuration

to the 5.14-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-rawnand-arasan-prevent-an-unsupported-configurat.patch
and it can be found in the queue-5.14 subdirectory.

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



commit 7cda4797ced572e4d1204dc7c7eda77508b0ce78
Author: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
Date:   Fri Oct 8 18:36:40 2021 +0200

    mtd: rawnand: arasan: Prevent an unsupported configuration
    
    [ Upstream commit fc9e18f9e987ad46722dad53adab1c12148c213c ]
    
    Under the following conditions:
    * after rounding up by 4 the number of bytes to transfer (this is
      related to the controller's internal constraints),
    * if this (rounded) amount of data is situated beyond the end of the
      device,
    * and only in NV-DDR mode,
    the Arasan NAND controller timeouts.
    
    This currently can happen in a particular helper used when picking
    software ECC algorithms. Let's prevent this situation by refusing to use
    the NV-DDR interface with software engines.
    
    Fixes: 4edde6031458 ("mtd: rawnand: arasan: Support NV-DDR interface")
    Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
    Link: https://lore.kernel.org/linux-mtd/20211008163640.1753821-1-miquel.raynal@xxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mtd/nand/raw/arasan-nand-controller.c b/drivers/mtd/nand/raw/arasan-nand-controller.c
index 9cbcc698c64d8..53bd10738418b 100644
--- a/drivers/mtd/nand/raw/arasan-nand-controller.c
+++ b/drivers/mtd/nand/raw/arasan-nand-controller.c
@@ -973,6 +973,21 @@ static int anfc_setup_interface(struct nand_chip *chip, int target,
 		nvddr = nand_get_nvddr_timings(conf);
 		if (IS_ERR(nvddr))
 			return PTR_ERR(nvddr);
+
+		/*
+		 * The controller only supports data payload requests which are
+		 * a multiple of 4. In practice, most data accesses are 4-byte
+		 * aligned and this is not an issue. However, rounding up will
+		 * simply be refused by the controller if we reached the end of
+		 * the device *and* we are using the NV-DDR interface(!). In
+		 * this situation, unaligned data requests ending at the device
+		 * boundary will confuse the controller and cannot be performed.
+		 *
+		 * This is something that happens in nand_read_subpage() when
+		 * selecting software ECC support and must be avoided.
+		 */
+		if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_SOFT)
+			return -ENOTSUPP;
 	} else {
 		sdr = nand_get_sdr_timings(conf);
 		if (IS_ERR(sdr))



[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