From 1d0ed69ddd714b6e2a974f42896463366923ded6 Mon Sep 17 00:00:00 2001 From: Huang Shijie Date: Wed, 25 Sep 2013 14:58:10 +0800 Subject: mtd: nand: add a helper to check the SLC/MLC nand chip Add a helper to check if a nand chip is SLC or MLC. This helper makes the code more readable. Signed-off-by: Huang Shijie Signed-off-by: Brian Norris --- include/linux/mtd/nand.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/linux/mtd') diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 129548169400..5c05bab0ad89 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -795,4 +795,13 @@ static inline int onfi_get_sync_timing_mode(struct nand_chip *chip) return le16_to_cpu(chip->onfi_params.src_sync_timing_mode); } +/* + * Check if it is a SLC nand. + * The !nand_is_slc() can be used to check the MLC/TLC nand chips. + * We do not distinguish the MLC and TLC now. + */ +static inline bool nand_is_slc(struct nand_chip *chip) +{ + return !(chip->cellinfo & NAND_CI_CELLTYPE_MSK); +} #endif /* __LINUX_MTD_NAND_H */ -- cgit v1.2.3