diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-05-16 10:35:25 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-05-16 10:35:25 -0400 |
commit | 3c0dec5f58b3c7b3627715126d1bf9b030a076f0 (patch) | |
tree | 4bf8f56fca3bf6be109209b116fc8e32cb2e0f9e /drivers/mtd | |
parent | fcd8d84a585f3578a9ebdd27e757495a27415322 (diff) | |
parent | 7e0fa1b5fa91d9aa456d102c273b2cf0f2e95d39 (diff) |
Merge branch 'clk-next' of git://git.linaro.org/people/mturquette/linux into next/clock
* 'clk-next' of git://git.linaro.org/people/mturquette/linux:
clk: Fix CLK_SET_RATE_GATE flag validation in clk_set_rate().
clk: Provide dummy clk_unregister()
ARM: Kirkwood: Replace clock gating
ARM: Orion: Audio: Add clk/clkdev support
ARM: Orion: PCIE: Add support for clk
ARM: Orion: XOR: Add support for clk
ARM: Orion: CESA: Add support for clk
ARM: Orion: SDIO: Add support for clk.
ARM: Orion: NAND: Add support for clk, if there is one.
ARM: Orion: EHCI: Add support for enabling clocks
ARM: Orion: SATA: Add per channel clk/clkdev support.
ARM: Orion: UART: Get the clock rate via clk_get_rate().
ARM: Orion: WDT: Add clk/clkdev support
ARM: Orion: Eth: Add clk/clkdev support.
ARM: Orion: SPI: Add clk/clkdev support.
ARM: Orion: Add clocks using the generic clk infrastructure.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/orion_nand.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c index 1d3bfb26080c..fdc4786ea3e5 100644 --- a/drivers/mtd/nand/orion_nand.c +++ b/drivers/mtd/nand/orion_nand.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
17 | #include <linux/mtd/nand.h> | 17 | #include <linux/mtd/nand.h> |
18 | #include <linux/mtd/partitions.h> | 18 | #include <linux/mtd/partitions.h> |
19 | #include <linux/clk.h> | ||
20 | #include <linux/err.h> | ||
19 | #include <asm/io.h> | 21 | #include <asm/io.h> |
20 | #include <asm/sizes.h> | 22 | #include <asm/sizes.h> |
21 | #include <mach/hardware.h> | 23 | #include <mach/hardware.h> |
@@ -77,6 +79,7 @@ static int __init orion_nand_probe(struct platform_device *pdev) | |||
77 | struct nand_chip *nc; | 79 | struct nand_chip *nc; |
78 | struct orion_nand_data *board; | 80 | struct orion_nand_data *board; |
79 | struct resource *res; | 81 | struct resource *res; |
82 | struct clk *clk; | ||
80 | void __iomem *io_base; | 83 | void __iomem *io_base; |
81 | int ret = 0; | 84 | int ret = 0; |
82 | 85 | ||
@@ -123,6 +126,14 @@ static int __init orion_nand_probe(struct platform_device *pdev) | |||
123 | 126 | ||
124 | platform_set_drvdata(pdev, mtd); | 127 | platform_set_drvdata(pdev, mtd); |
125 | 128 | ||
129 | /* Not all platforms can gate the clock, so it is not | ||
130 | an error if the clock does not exists. */ | ||
131 | clk = clk_get(&pdev->dev, NULL); | ||
132 | if (!IS_ERR(clk)) { | ||
133 | clk_prepare_enable(clk); | ||
134 | clk_put(clk); | ||
135 | } | ||
136 | |||
126 | if (nand_scan(mtd, 1)) { | 137 | if (nand_scan(mtd, 1)) { |
127 | ret = -ENXIO; | 138 | ret = -ENXIO; |
128 | goto no_dev; | 139 | goto no_dev; |
@@ -151,6 +162,7 @@ static int __devexit orion_nand_remove(struct platform_device *pdev) | |||
151 | { | 162 | { |
152 | struct mtd_info *mtd = platform_get_drvdata(pdev); | 163 | struct mtd_info *mtd = platform_get_drvdata(pdev); |
153 | struct nand_chip *nc = mtd->priv; | 164 | struct nand_chip *nc = mtd->priv; |
165 | struct clk *clk; | ||
154 | 166 | ||
155 | nand_release(mtd); | 167 | nand_release(mtd); |
156 | 168 | ||
@@ -158,6 +170,12 @@ static int __devexit orion_nand_remove(struct platform_device *pdev) | |||
158 | 170 | ||
159 | kfree(nc); | 171 | kfree(nc); |
160 | 172 | ||
173 | clk = clk_get(&pdev->dev, NULL); | ||
174 | if (!IS_ERR(clk)) { | ||
175 | clk_disable_unprepare(clk); | ||
176 | clk_put(clk); | ||
177 | } | ||
178 | |||
161 | return 0; | 179 | return 0; |
162 | } | 180 | } |
163 | 181 | ||