]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
mtd: rawnand: move calls to ->select_chip() in nand_setup_data_interface()
authorMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 19 Mar 2018 13:47:23 +0000 (14:47 +0100)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Tue, 20 Mar 2018 08:49:11 +0000 (09:49 +0100)
After a ->set_features(TIMINGS), the chip is supposed to be working at a
new speed. In order for all the transactions to be perperly handled, the
NAND controller should also be configured to this same speed. Calling
->setup_data_interface() is not enough and the chip should be
de-asserted/re-asserted through calls to ->select_chip().

Prepare the next change in nand_setup_data_interface() where timings
will be checked after being applied. Because assertions of the CS pin
will be needed from within this function, move the calls to
->select_chip() inside nand_setup_data_interface() for later
consistency.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
drivers/mtd/nand/raw/nand_base.c

index 2109fc223ff2dda2b966db02dcd8af4279f522b9..9d5c2739fe6dff4bbd32a0e1d89ba570bd340c3d 100644 (file)
@@ -1274,8 +1274,10 @@ static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
 
        /* Change the mode on the chip side (if supported by the NAND chip) */
        if (nand_supports_set_get_features(chip)) {
+               chip->select_chip(mtd, chipnr);
                ret = nand_set_features(chip, ONFI_FEATURE_ADDR_TIMING_MODE,
                                        tmode_param);
+               chip->select_chip(mtd, -1);
                if (ret)
                        return ret;
        }
@@ -2780,10 +2782,8 @@ int nand_reset(struct nand_chip *chip, int chipnr)
        if (ret)
                return ret;
 
-       chip->select_chip(mtd, chipnr);
        chip->data_interface = saved_data_intf;
        ret = nand_setup_data_interface(chip, chipnr);
-       chip->select_chip(mtd, -1);
        if (ret)
                return ret;
 
@@ -6505,10 +6505,7 @@ int nand_scan_tail(struct mtd_info *mtd)
 
        /* Enter fastest possible mode on all dies. */
        for (i = 0; i < chip->numchips; i++) {
-               chip->select_chip(mtd, i);
                ret = nand_setup_data_interface(chip, i);
-               chip->select_chip(mtd, -1);
-
                if (ret)
                        goto err_nand_manuf_cleanup;
        }