base-files: define yes/no as valid boolean options
[openwrt.git] / target / linux / mvebu / patches-3.10 / 0162-mtd-nand-pxa3xx-Clear-need_wait-flag-when-starting-a.patch
1 From 7efaa8677ffd07d54d0122b5e92f29b74a36ad39 Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Thu, 19 Dec 2013 06:08:03 -0300
4 Subject: [PATCH 162/203] mtd: nand: pxa3xx: Clear need_wait flag when starting
5  a command
6
7 Currently the driver assumes all commands will eventually trigger a RnB
8 transition, and thus a "device is ready" IRQ.
9
10 This assumption means that on every issued command, the dev_ready completion
11 handler is init'ed and the need_wait flag is set.
12
13 However this is incorrect: some commands (such as NAND_CMD_STATUS) don't
14 make the device 'busy' and thus a RnB transition never occurs.
15 Given, the NAND core never calls waitfunc() after such commands, this
16 is not a problem.
17
18 Therefore, it's possible to only clear the need_wait flag on every command
19 that is started.
20
21 This fixes a current bug that can be reproduced on PXA boards by writing
22 blank (all 0xff'ed) to a page:
23
24   1. The kernel issues NAND_CMD_STATUS and sets need_wait=1. The flag
25      won't be cleared for this command since no RnB transition is
26      involved.
27
28   2. NAND_CMD_PAGEPROG is issued but since the data is blank, the driver
29      decides not to execute the command (and no IRQ activity is
30      involved).
31
32   3. The NAND core calls waitfunc() and waits for the dev_ready
33      completion, which will never end since the device _is_ already ready.
34
35 Tested-by: Arnaud Ebalard <arno@natisbad.org>
36 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
37 ---
38  drivers/mtd/nand/pxa3xx_nand.c | 1 +
39  1 file changed, 1 insertion(+)
40
41 --- a/drivers/mtd/nand/pxa3xx_nand.c
42 +++ b/drivers/mtd/nand/pxa3xx_nand.c
43 @@ -694,6 +694,7 @@ static void prepare_start_command(struct
44         info->retcode           = ERR_NONE;
45         info->ecc_err_cnt       = 0;
46         info->ndcb3             = 0;
47 +       info->need_wait         = 0;
48  
49         switch (command) {
50         case NAND_CMD_READ0: