Re: [PATCH v2] mtd: rawnand: cadence: Add support for NV-DDR interface mode
From: Niravkumar L Rabara
Date: Fri Oct 24 2025 - 22:20:44 EST
On 24/10/2025 7:16 pm, Miquel Raynal wrote:
Hi,
+ if (nand_interface_is_sdr(conf)) {
+ const struct nand_sdr_timings *sdr = nand_get_sdr_timings(conf);
+
+ if (IS_ERR(sdr))
+ return PTR_ERR(sdr);
+
+ ret = cadence_nand_setup_sdr_interface(chip, sdr);
+ } else {
+ if (chipnr < 0)
+ return ret;
I still think this is incorrect. The chipnr value shall not be treated
differently from the SDR path.
Thanks,
Miquèl
You are right — the chipnr check should be common, irrespective of SDR
or NVDDR.
Just to share some background on why I initially added the check only
for NVDDR:
While enabling NVDDR support, I noticed that the setup_interface()
callback is invoked once with chipnr = 0 for SDR, but twice for NVDDR —
first with chipnr = -1 (NAND_DATA_IFACE_CHECK_ONLY) and then with chipnr
= 0.
Because of this difference, I added the check only for the NVDDR path.
After your comment, I rechecked the NAND framework and realized that the
behavior I observed occurs because NAND flash on my board supports NVDDR
and the framework first checks for NVDDR mode, followed by SDR.
If the flash supports only SDR, the setup_interface() callback would
also be called with chipnr = NAND_DATA_IFACE_CHECK_ONLY for SDR.
I’ll move the chipnr check before the if() in the v3 patch.
Thanks,
Nirav