[PATCH v2 02/11] mtd: nand: sandbox: forbid sub-page writes

Daniel Golle <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <c5c51ef5afcb79782b03ba63f131e715ccfda429.1787673209.git.daniel@makrotopia.org>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.