[MTD] NAND: nandsim: support subpage write

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Oct 21 11:59:05 EDT 2006


Commit:     82810b7b6cc7a74c68881a13b0eb66c7a6370fcc
Parent:     a86aaa6ddf32b0401e64e74174042866e0fb3e20
commit 82810b7b6cc7a74c68881a13b0eb66c7a6370fcc
Author:     Artem Bityutskiy <dedekind at infradead.org>
AuthorDate: Fri Oct 20 11:23:56 2006 +0300
Commit:     David Woodhouse <dwmw2 at infradead.org>
CommitDate: Sat Oct 21 16:44:23 2006 +0100

    [MTD] NAND: nandsim: support subpage write
    
    As flash cannot do 0->1 bit transitions when programming, do not do this in
    the simulator too. This makes nandsim able to accept subpage writes.
    
    Signed-off-by: Artem Bityutskiy <dedekind at infradead.org>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/nand/nandsim.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 28ee785..abebcab 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -852,6 +852,7 @@ static void erase_sector(struct nandsim 
  */
 static int prog_page(struct nandsim *ns, int num)
 {
+	int i;
 	union ns_mem *mypage;
 	u_char *pg_off;
 
@@ -867,7 +868,8 @@ static int prog_page(struct nandsim *ns,
 	}
 
 	pg_off = NS_PAGE_BYTE_OFF(ns);
-	memcpy(pg_off, ns->buf.byte, num);
+	for (i = 0; i < num; i++)
+		pg_off[i] &= ns->buf.byte[i];
 
 	return 0;
 }



More information about the linux-mtd-cvs mailing list