All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] mtd: vf610_nfc: mark page as dirty on block erase
@ 2015-03-24 16:54 Stefan Agner
  2015-03-24 16:54 ` [U-Boot] [PATCH 2/2] mtd: vf610_nfc: specify transfer size before each transfer Stefan Agner
  2015-03-30 17:02 ` [U-Boot] [PATCH 1/2] mtd: vf610_nfc: mark page as dirty on block erase Bill Pringlemeir
  0 siblings, 2 replies; 23+ messages in thread
From: Stefan Agner @ 2015-03-24 16:54 UTC (permalink / raw)
  To: u-boot

The driver tries to re-use the page buffer by storing the page
number of the current page in the buffer. The page is only read
if the requested page number is not currently in the buffer. When
a block is erased, the page number is marked as invalid if the
erased page equals the one currently in the cache. However, since
a erase block consists of multiple pages, also other page numbers
could be affected.

The commands to reproduce this issue (on a written page):
> nand dump 0x800
> nand erase 0x0 0x20000
> nand dump 0x800

The second nand dump command returns the data from the buffer,
while in fact the page is erased (0xff).

Avoid the hassle to calculate whether the page is affected or not,
but set the page buffer unconditionally to invalid instead.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
This are two bug fixes which would be nice if they would still
make it into 2015.04...

 drivers/mtd/nand/vf610_nfc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
index 928d58b..9de971c 100644
--- a/drivers/mtd/nand/vf610_nfc.c
+++ b/drivers/mtd/nand/vf610_nfc.c
@@ -369,8 +369,7 @@ static void vf610_nfc_command(struct mtd_info *mtd, unsigned command,
 		break;
 
 	case NAND_CMD_ERASE1:
-		if (nfc->page == page)
-			nfc->page = -1;
+		nfc->page = -1;
 		vf610_nfc_send_commands(nfc->regs, command,
 					NAND_CMD_ERASE2, ERASE_CMD_CODE);
 		vf610_nfc_addr_cycle(mtd, column, page);
-- 
2.3.3

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2015-04-07 21:09 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-24 16:54 [U-Boot] [PATCH 1/2] mtd: vf610_nfc: mark page as dirty on block erase Stefan Agner
2015-03-24 16:54 ` [U-Boot] [PATCH 2/2] mtd: vf610_nfc: specify transfer size before each transfer Stefan Agner
2015-03-30 17:02 ` [U-Boot] [PATCH 1/2] mtd: vf610_nfc: mark page as dirty on block erase Bill Pringlemeir
2015-03-30 20:14   ` Stefan Agner
2015-03-30 20:46     ` Scott Wood
2015-03-30 20:34   ` Scott Wood
2015-03-30 20:40     ` Stefan Agner
2015-03-30 20:48       ` Scott Wood
2015-03-30 21:26         ` Stefan Agner
2015-03-30 22:15           ` Scott Wood
2015-03-30 22:24             ` Stefan Agner
2015-03-31  4:34               ` Scott Wood
2015-03-31 15:02                 ` Bill Pringlemeir
2015-04-02 23:48                   ` Scott Wood
2015-04-03 18:09                     ` Stefan Agner
2015-04-03 20:15                       ` Scott Wood
2015-04-03 20:28                         ` Stefan Agner
2015-04-03 21:03                           ` Scott Wood
2015-04-07 14:06                             ` Bill Pringlemeir
2015-04-07 16:02                               ` Scott Wood
2015-04-07 17:54                                 ` Bill Pringlemeir
2015-04-07 21:09                                   ` Scott Wood
2015-03-30 21:35         ` Bill Pringlemeir

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.