mvebu: backport mainline patches from kernel 3.13
[openwrt/staging/chunkeey.git] / target / linux / mvebu / patches-3.10 / 0134-mtd-nand-pxa3xx-read_page-returns-max_bitflips.patch
1 From 97598678602aaea473303523ce37a45d258206ca Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Thu, 7 Nov 2013 12:17:13 -0300
4 Subject: [PATCH 134/203] mtd: nand: pxa3xx: read_page() returns max_bitflips
5
6 As per the ecc.read_page() prototype, we must return the maximum number
7 of bitflips that were corrected on any one region covering an ecc step.
8
9 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
10 Tested-by: Daniel Mack <zonque@gmail.com>
11 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
12 ---
13 drivers/mtd/nand/pxa3xx_nand.c | 4 +++-
14 1 file changed, 3 insertions(+), 1 deletion(-)
15
16 --- a/drivers/mtd/nand/pxa3xx_nand.c
17 +++ b/drivers/mtd/nand/pxa3xx_nand.c
18 @@ -751,6 +751,7 @@ static int pxa3xx_nand_read_page_hwecc(s
19 {
20 struct pxa3xx_nand_host *host = mtd->priv;
21 struct pxa3xx_nand_info *info = host->info_data;
22 + int max_bitflips = 0;
23
24 chip->read_buf(mtd, buf, mtd->writesize);
25 chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
26 @@ -758,6 +759,7 @@ static int pxa3xx_nand_read_page_hwecc(s
27 if (info->retcode == ERR_SBERR) {
28 switch (info->use_ecc) {
29 case 1:
30 + max_bitflips = 1;
31 mtd->ecc_stats.corrected++;
32 break;
33 case 0:
34 @@ -776,7 +778,7 @@ static int pxa3xx_nand_read_page_hwecc(s
35 mtd->ecc_stats.failed++;
36 }
37
38 - return 0;
39 + return max_bitflips;
40 }
41
42 static uint8_t pxa3xx_nand_read_byte(struct mtd_info *mtd)