The sandbox NAND model programs each page in a single operation and
rejects a second write to an already-programmed page. UBI writes the
EC and VID headers into the first page in two separate sub-page
operations, which the model fails with -EIO, so UBI cannot attach to a
sandbox NAND.

Advertise NAND_NO_SUBPAGE_WRITE so callers place each header in its
own page, matching what the model can actually do. This lets the
imagemap UBI-volume unit test attach UBI on the sandbox NAND.

Signed-off-by: Daniel Golle <[email protected]>
---
 drivers/mtd/nand/raw/sand_nand.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/raw/sand_nand.c b/drivers/mtd/nand/raw/sand_nand.c
index 3678bb8a41b..5c48b43a882 100644
--- a/drivers/mtd/nand/raw/sand_nand.c
+++ b/drivers/mtd/nand/raw/sand_nand.c
@@ -602,6 +602,8 @@ static int sand_nand_probe(struct udevice *dev)
 
                nand = &chip->nand;
                nand->options = not_xpl() ? 0 : NAND_SKIP_BBTSCAN;
+               /* Each page is programmed in a single operation only */
+               nand->options |= NAND_NO_SUBPAGE_WRITE;
                nand->flash_node = np;
                nand->dev_ready = sand_nand_dev_ready;
                nand->cmdfunc = sand_nand_command;
-- 
2.55.0

Reply via email to