]> git.sur5r.net Git - u-boot/blobdiff - drivers/mtd/nand/sunxi_nand.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / drivers / mtd / nand / sunxi_nand.c
index c4e2cd7f552766a42e471937313e1e6ee2ff4681..bb87aca6987ffbf3345e51912dc2d43efff1d393 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2013 Boris BREZILLON <b.brezillon.dev@gmail.com>
  * Copyright (C) 2015 Roy Spliet <r.spliet@ultimaker.com>
@@ -21,8 +22,6 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -32,7 +31,7 @@
 
 #include <linux/kernel.h>
 #include <linux/mtd/mtd.h>
-#include <linux/mtd/nand.h>
+#include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
 #include <linux/io.h>
 
@@ -1407,8 +1406,14 @@ static int sunxi_nand_hw_common_ecc_ctrl_init(struct mtd_info *mtd,
 
        /* Add ECC info retrieval from DT */
        for (i = 0; i < ARRAY_SIZE(strengths); i++) {
-               if (ecc->strength <= strengths[i])
+               if (ecc->strength <= strengths[i]) {
+                       /*
+                        * Update ecc->strength value with the actual strength
+                        * that will be used by the ECC engine.
+                        */
+                       ecc->strength = strengths[i];
                        break;
+               }
        }
 
        if (i >= ARRAY_SIZE(strengths)) {
@@ -1663,7 +1668,7 @@ static int sunxi_nand_chip_init(int node, struct sunxi_nfc *nfc, int devnum)
                        chip->sels[i].rb.type = RB_NATIVE;
                        chip->sels[i].rb.info.nativeid = tmp;
                } else {
-                       ret = gpio_request_by_name_nodev(blob, node,
+                       ret = gpio_request_by_name_nodev(offset_to_ofnode(node),
                                                "rb-gpios", i,
                                                &chip->sels[i].rb.info.gpio,
                                                GPIOD_IS_IN);