[PATCH 1/3] mtd: rawnand: Partially revert 4114f97c41cd ("mtd: rawnand: Get rid of a few unused definitions")

Vadym Kochan vadym.kochan at plvision.eu
Wed Oct 19 01:20:38 PDT 2022


onfi_async_timing_mode_to_sdr_timings is required for ac5 support in marvell_nand.c

Signed-off-by: Vadym Kochan <vadym.kochan at plvision.eu>
---
 drivers/mtd/nand/raw/nand_timings.c | 14 ++++++++++++++
 include/linux/mtd/rawnand.h         |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/drivers/mtd/nand/raw/nand_timings.c b/drivers/mtd/nand/raw/nand_timings.c
index 7b41afc372d2..5604e3dc632c 100644
--- a/drivers/mtd/nand/raw/nand_timings.c
+++ b/drivers/mtd/nand/raw/nand_timings.c
@@ -642,6 +642,20 @@ onfi_find_closest_nvddr_mode(const struct nand_nvddr_timings *spec_timings)
 	return 0;
 }
 
+/**
+ * onfi_async_timing_mode_to_sdr_timings - [NAND Interface] Retrieve NAND
+ * timings according to the given ONFI timing mode
+ * @mode: ONFI timing mode
+ */
+const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode)
+{
+	if (mode < 0 || mode >= ARRAY_SIZE(onfi_sdr_timings))
+		return ERR_PTR(-EINVAL);
+
+	return &onfi_sdr_timings[mode].timings.sdr;
+}
+EXPORT_SYMBOL(onfi_async_timing_mode_to_sdr_timings);
+
 /*
  * onfi_fill_sdr_interface_config - Initialize a SDR interface config from a
  *                                  given ONFI mode
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index dcf90144d70b..7702abf9e1f0 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -1481,6 +1481,9 @@ int rawnand_sw_bch_correct(struct nand_chip *chip, unsigned char *buf,
 			   unsigned char *read_ecc, unsigned char *calc_ecc);
 void rawnand_sw_bch_cleanup(struct nand_chip *chip);
 
+/* get timing characteristics from ONFI timing mode. */
+const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode);
+
 int nand_check_erased_ecc_chunk(void *data, int datalen,
 				void *ecc, int ecclen,
 				void *extraoob, int extraooblen,
-- 
2.17.1




More information about the linux-mtd mailing list