From: Artem Bityutskiy Date: Fri, 20 Oct 2006 08:23:56 +0000 (+0300) Subject: [MTD] NAND: nandsim: support subpage write X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=82810b7b6cc7a74c68881a13b0eb66c7a6370fcc;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [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 Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index 28ee78544ff2..abebcab47631 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c @@ -852,6 +852,7 @@ static void erase_sector(struct nandsim *ns) */ 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, int num) } 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; }