[PATCH 0/3] mtd: rawnand: sunxi: support the Allwinner randomized OOB format
James Hilliard <[email protected]>
| Newsgroups | dev.linux.lists.linux-sunxi,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-mtd,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260810-submit-sunxi-nand-vendor-oob-layout-v1-v1-0-463853a14ad9@gmail.com> |
The sunxi NAND controller randomizes normal pages, including their OOB data. The mainline driver compensates the bad block marker so that it remains plain on flash. On H6 and H616 it also fills the OOB space left after ECC with protected user data. These choices produce a different physical OOB format from the one used by Allwinner NAND firmware. Add allwinner,randomized-oob to select the Allwinner randomized OOB format. The property enables page randomization unconditionally, keeps the bad block marker in the randomizer data stream, and selects the controller-specific protected user-data placement. H6 and H616 use four protected bytes per 1 KiB ECC step, capped at 16 bytes, with the complete protected region placed before the first ECC step. Older controllers retain their existing fixed user-data placement. When the property is absent, retain the existing mainline marker handling and H6/H616 maximized OOB layout. The series first documents the opt-in format, then implements randomized marker handling for all supported controllers and finally selects the packed H6/H616 protected user-data layout. Tested on an H616 board with a Toshiba TC58NVG1S3H NAND using matching Linux and U-Boot implementations. Linux initialized the NAND, SPL and U-Boot cold-booted from it, U-Boot loaded the FIT from UBI, and Linux attached the same UBI with 2004 good PEBs, two bad PEBs and no corrupted PEBs. A target-timed 64 MiB raw-MTD read completed without ECC, timeout or I/O errors. Validation completed with strict checkpatch, dt_binding_check and an arm64 W=1 object build. Assisted-by: OpenAI Codex (gpt-5.6-sol, max) Signed-off-by: James Hilliard <[email protected]> --- James Hilliard (3): dt-bindings: mtd: sunxi: Add randomized OOB flag mtd: rawnand: sunxi: support randomized OOB formats mtd: rawnand: sunxi: select the packed H6/H616 OOB layout .../bindings/mtd/allwinner,sun4i-a10-nand.yaml | 9 +++++ drivers/mtd/nand/raw/sunxi_nand.c | 46 ++++++++++++++++++---- 2 files changed, 47 insertions(+), 8 deletions(-) --- base-commit: 15a3cbce32994141252bb4ecfe3ff3a5d22d0b4f change-id: 20260810-submit-sunxi-nand-vendor-oob-layout-v1-e3114d10cc9c Best regards, -- James Hilliard <[email protected]>