]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: nand: raw: denali: Wait for reset completion status
authorLey Foon Tan <ley.foon.tan@intel.com>
Fri, 10 Jul 2020 06:58:15 +0000 (14:58 +0800)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Sat, 11 Jul 2020 12:30:21 +0000 (21:30 +0900)
Fixed delay 200us is not working in certain platforms. Change to
poll for reset completion status to have more reliable reset process.

Controller will set the rst_comp bit in intr_status register after
controller has completed its reset and initialization process.

Tested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Radu Bacrau <radu.bacrau@intel.com>
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
drivers/mtd/nand/raw/denali.c
drivers/mtd/nand/raw/denali.h
drivers/mtd/nand/raw/denali_dt.c

index 15e90291de0932bbd6fc748b6d74367dd3608235..ab91db85467d90e33fa9eba60a95a5b0b16a7aa2 100644 (file)
@@ -1220,6 +1220,17 @@ static int denali_multidev_fixup(struct denali_nand_info *denali)
        return 0;
 }
 
+int denali_wait_reset_complete(struct denali_nand_info *denali)
+{
+       u32 irq_status;
+
+       irq_status = denali_wait_for_irq(denali, INTR__RST_COMP);
+       if (!(irq_status & INTR__RST_COMP))
+               return -EIO;
+
+       return 0;
+}
+
 int denali_init(struct denali_nand_info *denali)
 {
        struct nand_chip *chip = &denali->nand;
index 019deda094e5de952ad9725d4d4968aad9df764a..6cd02b2e26ee2d2d811c972579b8c661eba5fa2b 100644 (file)
@@ -321,6 +321,7 @@ struct denali_nand_info {
 #define DENALI_CAP_DMA_64BIT                   BIT(1)
 
 int denali_calc_ecc_bytes(int step_size, int strength);
+int denali_wait_reset_complete(struct denali_nand_info *denali);
 int denali_init(struct denali_nand_info *denali);
 
 #endif /* __DENALI_H__ */
index 75ad15b0758cb5a2d104345a872dd0eb7b86675a..8318ff507f37b19b774e01b9c1668547272df56d 100644 (file)
@@ -157,7 +157,11 @@ static int denali_dt_probe(struct udevice *dev)
                 * kicked (bootstrap process). The driver must wait until it is
                 * finished. Otherwise, it will result in unpredictable behavior.
                 */
-               udelay(200);
+               ret = denali_wait_reset_complete(denali);
+               if (ret) {
+                       dev_err(denali->dev, "reset not completed.\n");
+                       return ret;
+               }
        }
 
        return denali_init(denali);