aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/atmel_nand.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand/atmel_nand.c')
-rw-r--r--drivers/mtd/nand/atmel_nand.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 9c5f717bda54..d1e502f8dbd0 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -27,6 +27,7 @@
27 * 27 *
28 */ 28 */
29 29
30#include <linux/clk.h>
30#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
31#include <linux/slab.h> 32#include <linux/slab.h>
32#include <linux/module.h> 33#include <linux/module.h>
@@ -96,6 +97,8 @@ struct atmel_nfc {
96 bool use_nfc_sram; 97 bool use_nfc_sram;
97 bool write_by_sram; 98 bool write_by_sram;
98 99
100 struct clk *clk;
101
99 bool is_initialized; 102 bool is_initialized;
100 struct completion comp_ready; 103 struct completion comp_ready;
101 struct completion comp_cmd_done; 104 struct completion comp_cmd_done;
@@ -2248,6 +2251,7 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
2248{ 2251{
2249 struct atmel_nfc *nfc = &nand_nfc; 2252 struct atmel_nfc *nfc = &nand_nfc;
2250 struct resource *nfc_cmd_regs, *nfc_hsmc_regs, *nfc_sram; 2253 struct resource *nfc_cmd_regs, *nfc_hsmc_regs, *nfc_sram;
2254 int ret;
2251 2255
2252 nfc_cmd_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2256 nfc_cmd_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2253 nfc->base_cmd_regs = devm_ioremap_resource(&pdev->dev, nfc_cmd_regs); 2257 nfc->base_cmd_regs = devm_ioremap_resource(&pdev->dev, nfc_cmd_regs);
@@ -2279,8 +2283,28 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
2279 nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff); 2283 nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff);
2280 nfc_readl(nfc->hsmc_regs, SR); /* clear the NFC_SR */ 2284 nfc_readl(nfc->hsmc_regs, SR); /* clear the NFC_SR */
2281 2285
2286 nfc->clk = devm_clk_get(&pdev->dev, NULL);
2287 if (!IS_ERR(nfc->clk)) {
2288 ret = clk_prepare_enable(nfc->clk);
2289 if (ret)
2290 return ret;
2291 } else {
2292 dev_warn(&pdev->dev, "NFC clock missing, update your Device Tree");
2293 }
2294
2282 nfc->is_initialized = true; 2295 nfc->is_initialized = true;
2283 dev_info(&pdev->dev, "NFC is probed.\n"); 2296 dev_info(&pdev->dev, "NFC is probed.\n");
2297
2298 return 0;
2299}
2300
2301static int atmel_nand_nfc_remove(struct platform_device *pdev)
2302{
2303 struct atmel_nfc *nfc = &nand_nfc;
2304
2305 if (!IS_ERR(nfc->clk))
2306 clk_disable_unprepare(nfc->clk);
2307
2284 return 0; 2308 return 0;
2285} 2309}
2286 2310
@@ -2297,6 +2321,7 @@ static struct platform_driver atmel_nand_nfc_driver = {
2297 .of_match_table = of_match_ptr(atmel_nand_nfc_match), 2321 .of_match_table = of_match_ptr(atmel_nand_nfc_match),
2298 }, 2322 },
2299 .probe = atmel_nand_nfc_probe, 2323 .probe = atmel_nand_nfc_probe,
2324 .remove = atmel_nand_nfc_remove,
2300}; 2325};
2301 2326
2302static struct platform_driver atmel_nand_driver = { 2327static struct platform_driver atmel_nand_driver = {