
Hello,
This patch series aims at adding support for NAND auto-detection to the sunxi SPL NAND driver.
As explained in patch 7, this auto-detection is nothing more than a dumb "trial and error" logic, but it allows one to use the same SPL binary for all kind of sunxi boards booting from NAND. Of course, this approach might increase a bit the boot-time, but this is something we could address by adding a "default NAND config", that would be tested before launching the auto-detection procedure.
Now let's detail a bit what's inside this patch-set. Patch 1 is a cleanup removing support for BootROM configs, which in my opinion are not only inefficient but also not reliable (at least the current implementation does not guarantee that you'll be using the correct configuration when reading the NAND).
Piotr, Hans, any comment? Is this a real problem if we get rid of syndrome/BootROM configs? I mean, are you really using this mode? If that's not the case, I'd prefer dropping support for this feature. ITOH, if you really need this mode, then I'd recommend adding Kconfig options to specify the exact config to be used rather than randomly testing configs (see my explanation in patch 1).
Patch 2 is reworking the SYS_NAND_U_BOOT_OFFS Kconfig dependency model to make it usable on all platforms (not only sunxi).
Patch 3 is adding generic support for redundant u-boot images, which is particularly useful on modern NANDs where corruptions is likely to happen. Patch 4 is just getting rid of the open-coded version of redundant u-boot image support in the sunxi NAND driver.
Patch 5 is a simple improvement of the NAND controller status polling loop, which is really important to make the "trial and error" approach efficient (we try to limit the impact on boot-time here). Patch 6 and 7 are implementing the auto-detection logic.
Best Regards,
Boris
Changes since v2: - rework the Kconfig options for SYS_U_BOOT_OFFS and SYS_U_BOOT_REDUND_OFFS
Changes since v1: - added Hans ack - fixed 2 typos in patch 7
Boris Brezillon (7): spl: nand: sunxi: remove support for so-called 'syndrome' mode spl: nand: rework SYS_NAND_U_BOOT_OFFS Kconfig option dependency spl: nand: support redundant u-boot image spl: nand: sunxi: stop guessing the redundant u-boot offset spl: nand: sunxi: rework status polling loop spl: nand: sunxi: split 'load page' and 'read page' logic spl: nand: sunxi: add support for NAND config auto-detection
common/spl/spl_nand.c | 5 + drivers/mtd/nand/Kconfig | 21 +- drivers/mtd/nand/sunxi_nand_spl.c | 480 ++++++++++++++++++++++++-------------- 3 files changed, 332 insertions(+), 174 deletions(-)