summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Krause <joerg.krause@embedded.rocks>2018-01-14 19:26:40 +0100
committerStefano Babic <sbabic@denx.de>2018-06-27 12:20:55 +0200
commit4368f85359b947da7f151265d8969d6af1235357 (patch)
treedb56d562936d612462fbae39b9a50cf538ebeef9
parentf3f2af3bdf2af89d0621aa0fbd94a918e4447081 (diff)
mtd: nand: mxs_nand_spl: add mxs_flash_full_ident
For now, the existing SPL MXS NAND driver only supports to identify ONFi-compliant NAND chips. In order to allow identifying non-ONFi-compliant chips add `mxs_flash_full_ident()` which uses the `nand_get_flash_type()` functionality from `nand_base.c` to lookup for supported NAND chips in the chip ID list. For compatibility reason the full identification support is only available if the config option `CONFIG_SPL_NAND_IDENT` is enabled. The lookup was tested on a custom i.MX6ULL board with a Toshiba TC58NVG1S3HTAI0 NAND chip. Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
-rw-r--r--drivers/mtd/nand/mxs_nand_spl.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/mtd/nand/mxs_nand_spl.c b/drivers/mtd/nand/mxs_nand_spl.c
index adb12c531ec..2d7bbe83cce 100644
--- a/drivers/mtd/nand/mxs_nand_spl.c
+++ b/drivers/mtd/nand/mxs_nand_spl.c
@@ -49,6 +49,28 @@ static void mxs_nand_command(struct mtd_info *mtd, unsigned int command,
}
}
+#if defined (CONFIG_SPL_NAND_IDENT)
+
+/* Trying to detect the NAND flash using ONFi, JEDEC, and (extended) IDs */
+static int mxs_flash_full_ident(struct mtd_info *mtd)
+{
+ int nand_maf_id, nand_dev_id;
+ struct nand_chip *chip = mtd_to_nand(mtd);
+ struct nand_flash_dev *type;
+
+ type = nand_get_flash_type(mtd, chip, &nand_maf_id, &nand_dev_id, NULL);
+
+ if (IS_ERR(type)) {
+ chip->select_chip(mtd, -1);
+ return PTR_ERR(type);
+ }
+
+ return 0;
+}
+
+#else
+
+/* Trying to detect the NAND flash using ONFi only */
static int mxs_flash_onfi_ident(struct mtd_info *mtd)
{
register struct nand_chip *chip = mtd_to_nand(mtd);
@@ -109,10 +131,16 @@ 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);
+#endif
return ret;
}