kirkwood: add *plugs to uci-defaults
[openwrt.git] / target / linux / mvebu / patches-3.14 / 011-pxa3xx_nand_clean_error_handling.patch
1 From eee0166d8ead9d719d794df3e66acd8f83630e05 Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Wed, 14 May 2014 14:58:07 -0300
4 Subject: mtd: nand: pxa3xx: Clean pxa_ecc_init() error handling
5
6 Let's make pxa_ecc_init() return a negative errno on error or zero
7 if succesful, which is standard kernel practice. Also, report the
8 selected ECC strength and step size, which is important information.
9
10 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
11 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
12
13 --- a/drivers/mtd/nand/pxa3xx_nand.c
14 +++ b/drivers/mtd/nand/pxa3xx_nand.c
15 @@ -1355,7 +1355,6 @@ static int pxa_ecc_init(struct pxa3xx_na
16                 ecc->mode = NAND_ECC_HW;
17                 ecc->size = 512;
18                 ecc->strength = 1;
19 -               return 1;
20  
21         } else if (strength == 1 && ecc_stepsize == 512 && page_size == 512) {
22                 info->chunk_size = 512;
23 @@ -1364,7 +1363,6 @@ static int pxa_ecc_init(struct pxa3xx_na
24                 ecc->mode = NAND_ECC_HW;
25                 ecc->size = 512;
26                 ecc->strength = 1;
27 -               return 1;
28  
29         /*
30          * Required ECC: 4-bit correction per 512 bytes
31 @@ -1379,7 +1377,6 @@ static int pxa_ecc_init(struct pxa3xx_na
32                 ecc->size = info->chunk_size;
33                 ecc->layout = &ecc_layout_2KB_bch4bit;
34                 ecc->strength = 16;
35 -               return 1;
36  
37         } else if (strength == 4 && ecc_stepsize == 512 && page_size == 4096) {
38                 info->ecc_bch = 1;
39 @@ -1390,7 +1387,6 @@ static int pxa_ecc_init(struct pxa3xx_na
40                 ecc->size = info->chunk_size;
41                 ecc->layout = &ecc_layout_4KB_bch4bit;
42                 ecc->strength = 16;
43 -               return 1;
44  
45         /*
46          * Required ECC: 8-bit correction per 512 bytes
47 @@ -1405,8 +1401,15 @@ static int pxa_ecc_init(struct pxa3xx_na
48                 ecc->size = info->chunk_size;
49                 ecc->layout = &ecc_layout_4KB_bch8bit;
50                 ecc->strength = 16;
51 -               return 1;
52 +       } else {
53 +               dev_err(&info->pdev->dev,
54 +                       "ECC strength %d at page size %d is not supported\n",
55 +                       strength, page_size);
56 +               return -ENODEV;
57         }
58 +
59 +       dev_info(&info->pdev->dev, "ECC strength %d, ECC step size %d\n",
60 +                ecc->strength, ecc->size);
61         return 0;
62  }
63  
64 @@ -1528,12 +1531,8 @@ KEEP_CONFIG:
65  
66         ret = pxa_ecc_init(info, &chip->ecc, ecc_strength,
67                            ecc_step, mtd->writesize);
68 -       if (!ret) {
69 -               dev_err(&info->pdev->dev,
70 -                       "ECC strength %d at page size %d is not supported\n",
71 -                       ecc_strength, mtd->writesize);
72 -               return -ENODEV;
73 -       }
74 +       if (ret)
75 +               return ret;
76  
77         /* calculate addressing information */
78         if (mtd->writesize >= 2048)