[U-Boot] [PATCH v2 0/7] spl: nand: sunxi: implement auto-detection

Boris Brezillon
2016-06-01T11:23:17Z

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 renaming the SYS_NAND_U_BOOT_OFFS Kconfig option to make it
usable on all platforms (not only sunxi) and avoid conflicts when
one board is defining CONFIG_SYS_NAND_U_BOOT_OFFS in its
include/configs/<board>.h header.

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 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: rename the SYS_NAND_U_BOOT_OFFS Kconfig option
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 | 12 +
drivers/mtd/nand/Kconfig | 15 +-
drivers/mtd/nand/sunxi_nand_spl.c | 480 ++++++++++++++++++++++++--------------
3 files changed, 332 insertions(+), 175 deletions(-)

--
2.7.4