]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/mtd/nand/mpc5121_nfc.c
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[karo-tx-linux.git] / drivers / mtd / nand / mpc5121_nfc.c
index 3c9cdcbc4cba7200c99db3db8366e286daf1669a..3c60a000b42614b199605ac1dff95e3d5e21d216 100644 (file)
@@ -617,10 +617,8 @@ static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd)
        struct nand_chip *chip = mtd->priv;
        struct mpc5121_nfc_prv *prv = chip->priv;
 
-       if (prv->clk) {
-               clk_disable(prv->clk);
-               clk_put(prv->clk);
-       }
+       if (prv->clk)
+               clk_disable_unprepare(prv->clk);
 
        if (prv->csreg)
                iounmap(prv->csreg);
@@ -629,6 +627,7 @@ static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd)
 static int mpc5121_nfc_probe(struct platform_device *op)
 {
        struct device_node *rootnode, *dn = op->dev.of_node;
+       struct clk *clk;
        struct device *dev = &op->dev;
        struct mpc5121_nfc_prv *prv;
        struct resource res;
@@ -730,14 +729,18 @@ static int mpc5121_nfc_probe(struct platform_device *op)
        of_node_put(rootnode);
 
        /* Enable NFC clock */
-       prv->clk = clk_get(dev, "nfc_clk");
-       if (IS_ERR(prv->clk)) {
+       clk = devm_clk_get(dev, "nfc_clk");
+       if (IS_ERR(clk)) {
                dev_err(dev, "Unable to acquire NFC clock!\n");
-               retval = PTR_ERR(prv->clk);
+               retval = PTR_ERR(clk);
                goto error;
        }
-
-       clk_enable(prv->clk);
+       retval = clk_prepare_enable(clk);
+       if (retval) {
+               dev_err(dev, "Unable to enable NFC clock!\n");
+               goto error;
+       }
+       prv->clk = clk;
 
        /* Reset NAND Flash controller */
        nfc_set(mtd, NFC_CONFIG1, NFC_RESET);