]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/mtd/nand/sunxi_nand.c
mtd: nand: Pass the CS line to ->setup_data_interface()
[karo-tx-linux.git] / drivers / mtd / nand / sunxi_nand.c
index 0eeeb8b889ea8af83a12126ded319e84f0389618..9c2dbe352c439b710d199c1e3a32194f2820aeaa 100644 (file)
@@ -1592,9 +1592,8 @@ static int _sunxi_nand_lookup_timing(const s32 *lut, int lut_size, u32 duration,
 #define sunxi_nand_lookup_timing(l, p, c) \
                        _sunxi_nand_lookup_timing(l, ARRAY_SIZE(l), p, c)
 
-static int sunxi_nfc_setup_data_interface(struct mtd_info *mtd,
-                                       const struct nand_data_interface *conf,
-                                       bool check_only)
+static int sunxi_nfc_setup_data_interface(struct mtd_info *mtd, int csline,
+                                       const struct nand_data_interface *conf)
 {
        struct nand_chip *nand = mtd_to_nand(mtd);
        struct sunxi_nand_chip *chip = to_sunxi_nand(nand);
@@ -1707,7 +1706,7 @@ static int sunxi_nfc_setup_data_interface(struct mtd_info *mtd,
                return tRHW;
        }
 
-       if (check_only)
+       if (csline == NAND_DATA_IFACE_CHECK_ONLY)
                return 0;
 
        /*
@@ -2212,17 +2211,17 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
                goto out_ahb_clk_unprepare;
 
        nfc->reset = devm_reset_control_get_optional(dev, "ahb");
-       if (!IS_ERR(nfc->reset)) {
-               ret = reset_control_deassert(nfc->reset);
-               if (ret) {
-                       dev_err(dev, "reset err %d\n", ret);
-                       goto out_mod_clk_unprepare;
-               }
-       } else if (PTR_ERR(nfc->reset) != -ENOENT) {
+       if (IS_ERR(nfc->reset)) {
                ret = PTR_ERR(nfc->reset);
                goto out_mod_clk_unprepare;
        }
 
+       ret = reset_control_deassert(nfc->reset);
+       if (ret) {
+               dev_err(dev, "reset err %d\n", ret);
+               goto out_mod_clk_unprepare;
+       }
+
        ret = sunxi_nfc_rst(nfc);
        if (ret)
                goto out_ahb_reset_reassert;
@@ -2262,8 +2261,7 @@ out_release_dmac:
        if (nfc->dmac)
                dma_release_channel(nfc->dmac);
 out_ahb_reset_reassert:
-       if (!IS_ERR(nfc->reset))
-               reset_control_assert(nfc->reset);
+       reset_control_assert(nfc->reset);
 out_mod_clk_unprepare:
        clk_disable_unprepare(nfc->mod_clk);
 out_ahb_clk_unprepare:
@@ -2278,8 +2276,7 @@ static int sunxi_nfc_remove(struct platform_device *pdev)
 
        sunxi_nand_chips_cleanup(nfc);
 
-       if (!IS_ERR(nfc->reset))
-               reset_control_assert(nfc->reset);
+       reset_control_assert(nfc->reset);
 
        if (nfc->dmac)
                dma_release_channel(nfc->dmac);