[U-Boot] [PATCH 2/2] mtd: mxs_nand_spl: use legacy probe only if ONFI fails

Andrea Scian andrea.scian at dave.eu
Tue Jan 29 14:33:31 UTC 2019


This updates mxs_flash_ident() to always use ONFI NAND detection and, if
enabled using CONFIG_SPL_NAND_IDENT, fallback into legacy full NAND ids
detection if ONFI fails.

This allows to have a single binary to support ONFI and non-ONFI NAND,
without the need to always use legacy full NAND ids detection.

Signed-off-by: Andrea Scian <andrea.scian at dave.eu>
CC: Stefano Babic <sbabic at denx.de>
---
 drivers/mtd/nand/raw/mxs_nand_spl.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
index ad3b7ade64..41b3e0d9d5 100644
--- a/drivers/mtd/nand/raw/mxs_nand_spl.c
+++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
@@ -80,7 +80,7 @@ static int mxs_flash_full_ident(struct mtd_info *mtd)
 	return 0;
 }
 
-#else
+#endif /* CONFIG_SPL_NAND_IDENT */
 
 /* Trying to detect the NAND flash using ONFi only */
 static int mxs_flash_onfi_ident(struct mtd_info *mtd)
@@ -143,15 +143,15 @@ static int mxs_flash_onfi_ident(struct mtd_info *mtd)
 	return 0;
 }
 
-#endif /* CONFIG_SPL_NAND_IDENT */
-
 static int mxs_flash_ident(struct mtd_info *mtd)
 {
 	int ret;
-#if defined (CONFIG_SPL_NAND_IDENT)
-	ret = mxs_flash_full_ident(mtd);
-#else
 	ret = mxs_flash_onfi_ident(mtd);
+#if defined (CONFIG_SPL_NAND_IDENT)
+	if (ret) {
+		puts("NAND: ONFI probe failed, trying legacy ident\n");
+		ret = mxs_flash_full_ident(mtd);
+	}
 #endif
 	return ret;
 }
-- 
2.19.2



More information about the U-Boot mailing list