mvebu: backport mainline patches from kernel 3.13
[openwrt/staging/chunkeey.git] / target / linux / mvebu / patches-3.10 / 0141-mtd-nand-pxa3xx-Use-waitfunc-to-wait-for-the-device-.patch
1 From 2a1254f505ca4d376eae81768e4d5d890b578d13 Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Thu, 14 Nov 2013 18:25:27 -0300
4 Subject: [PATCH 141/203] mtd: nand: pxa3xx: Use waitfunc() to wait for the
5 device to be ready
6
7 In pxa3xx_nand_sensing() instead of simply using info->is_ready
8 after issuing a command, the correct way of checking is to wait
9 for the device to be ready through the chip's waitfunc().
10
11 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
12 Tested-by: Daniel Mack <zonque@gmail.com>
13 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
14 ---
15 drivers/mtd/nand/pxa3xx_nand.c | 7 ++++---
16 1 file changed, 4 insertions(+), 3 deletions(-)
17
18 --- a/drivers/mtd/nand/pxa3xx_nand.c
19 +++ b/drivers/mtd/nand/pxa3xx_nand.c
20 @@ -1040,10 +1040,11 @@ static int pxa3xx_nand_sensing(struct px
21 return ret;
22
23 chip->cmdfunc(mtd, NAND_CMD_RESET, 0, 0);
24 - if (!info->need_wait)
25 - return 0;
26 + ret = chip->waitfunc(mtd, chip);
27 + if (ret & NAND_STATUS_FAIL)
28 + return -ENODEV;
29
30 - return -ENODEV;
31 + return 0;
32 }
33
34 static int pxa3xx_nand_scan(struct mtd_info *mtd)