aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/mxc_nand.c6
-rw-r--r--drivers/mtd/nand/orion_nand.c18
2 files changed, 21 insertions, 3 deletions
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index cc0678a967c1..9e374e9bd296 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -690,7 +690,7 @@ static void mxc_nand_select_chip(struct mtd_info *mtd, int chip)
690 if (chip == -1) { 690 if (chip == -1) {
691 /* Disable the NFC clock */ 691 /* Disable the NFC clock */
692 if (host->clk_act) { 692 if (host->clk_act) {
693 clk_disable(host->clk); 693 clk_disable_unprepare(host->clk);
694 host->clk_act = 0; 694 host->clk_act = 0;
695 } 695 }
696 return; 696 return;
@@ -698,7 +698,7 @@ static void mxc_nand_select_chip(struct mtd_info *mtd, int chip)
698 698
699 if (!host->clk_act) { 699 if (!host->clk_act) {
700 /* Enable the NFC clock */ 700 /* Enable the NFC clock */
701 clk_enable(host->clk); 701 clk_prepare_enable(host->clk);
702 host->clk_act = 1; 702 host->clk_act = 1;
703 } 703 }
704 704
@@ -1078,7 +1078,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
1078 goto eclk; 1078 goto eclk;
1079 } 1079 }
1080 1080
1081 clk_enable(host->clk); 1081 clk_prepare_enable(host->clk);
1082 host->clk_act = 1; 1082 host->clk_act = 1;
1083 1083
1084 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1084 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index 0f50ef38b87b..513dc88a05ca 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -17,6 +17,8 @@
17#include <linux/mtd/mtd.h> 17#include <linux/mtd/mtd.h>
18#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
19#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20#include <linux/clk.h>
21#include <linux/err.h>
20#include <asm/io.h> 22#include <asm/io.h>
21#include <asm/sizes.h> 23#include <asm/sizes.h>
22#include <mach/hardware.h> 24#include <mach/hardware.h>
@@ -79,6 +81,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
79 struct nand_chip *nc; 81 struct nand_chip *nc;
80 struct orion_nand_data *board; 82 struct orion_nand_data *board;
81 struct resource *res; 83 struct resource *res;
84 struct clk *clk;
82 void __iomem *io_base; 85 void __iomem *io_base;
83 int ret = 0; 86 int ret = 0;
84 u32 val = 0; 87 u32 val = 0;
@@ -155,6 +158,14 @@ static int __init orion_nand_probe(struct platform_device *pdev)
155 158
156 platform_set_drvdata(pdev, mtd); 159 platform_set_drvdata(pdev, mtd);
157 160
161 /* Not all platforms can gate the clock, so it is not
162 an error if the clock does not exists. */
163 clk = clk_get(&pdev->dev, NULL);
164 if (!IS_ERR(clk)) {
165 clk_prepare_enable(clk);
166 clk_put(clk);
167 }
168
158 if (nand_scan(mtd, 1)) { 169 if (nand_scan(mtd, 1)) {
159 ret = -ENXIO; 170 ret = -ENXIO;
160 goto no_dev; 171 goto no_dev;
@@ -184,6 +195,7 @@ static int __devexit orion_nand_remove(struct platform_device *pdev)
184{ 195{
185 struct mtd_info *mtd = platform_get_drvdata(pdev); 196 struct mtd_info *mtd = platform_get_drvdata(pdev);
186 struct nand_chip *nc = mtd->priv; 197 struct nand_chip *nc = mtd->priv;
198 struct clk *clk;
187 199
188 nand_release(mtd); 200 nand_release(mtd);
189 201
@@ -191,6 +203,12 @@ static int __devexit orion_nand_remove(struct platform_device *pdev)
191 203
192 kfree(nc); 204 kfree(nc);
193 205
206 clk = clk_get(&pdev->dev, NULL);
207 if (!IS_ERR(clk)) {
208 clk_disable_unprepare(clk);
209 clk_put(clk);
210 }
211
194 return 0; 212 return 0;
195} 213}
196 214