mtd: rawnand: Choose the best timings, NV-DDR included
authorMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 5 May 2021 21:37:46 +0000 (23:37 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 26 May 2021 08:52:43 +0000 (10:52 +0200)
commita9ecc8c814e9600836e00cb592f1cb5378393126
tree5fe00e8225ca4bc7d010cac6145f47f277600a58
parent9d3194bf2aef81c04177ab6bbe50406aa8d550dc
mtd: rawnand: Choose the best timings, NV-DDR included

Now that the necessary peaces to support the NV-DDR interface type have
been contributed, let's add the relevant logic to make use of it. In
particular, the core does not choose the best SDR timings anymore but
calls a more generic helper instead.

This helper checks if NV-DDR is supported by trying to find the best
NV-DDR supported mode through a logic very close to what is being done
for SDR timings. If no NV-DDR mode in common between the NAND controller
and the NAND chip is found, the core will fallback to SDR.

Side note: theoretically, the data clock speed in NV-DDR mode 0 is
slower than in SDR mode 5. In the situation where we would get a working
NV-DDR mode 0, we could also try if SDR mode 5 is supported and
eventually fallback to it in order to get the fastest possible
throughput. However, in the field, it looks like most of the devices
supporting NV-DDR avoid implementing the fastest SDR modes (like 4 and 5
EDO modes, which are a bit more complicated to handle than the other SDR
modes). So, we will stick to the simplest logic: try NV-DDR otherwise
fallback to SDR. If someone else experiences strong differences because
of that we may still implement the logic defined above.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210505213750.257417-19-miquel.raynal@bootlin.com
drivers/mtd/nand/raw/internals.h
drivers/mtd/nand/raw/nand_base.c