diff options
author | Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> | 2010-05-19 01:49:13 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-20 18:51:07 -0400 |
commit | 1944cc894fd4d2ecce9bab6940e464afbde4fef0 (patch) | |
tree | 5d6c95a2f254ff6690149e18a0fc82a1769fb522 /drivers | |
parent | f72caf7e496465182eeda842ac66a5e75404ddf1 (diff) |
ARM: 6137/1: nomadik hwrng: Add clock support
This adds the clock support to the Nomadik RNG driver
Signed-off-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
Acked-by: Linus walleij <linus.walleij@stericsson.com>
Acked-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/hw_random/nomadik-rng.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/char/hw_random/nomadik-rng.c b/drivers/char/hw_random/nomadik-rng.c index a8b4c4010144..a348c7e9aa0b 100644 --- a/drivers/char/hw_random/nomadik-rng.c +++ b/drivers/char/hw_random/nomadik-rng.c | |||
@@ -15,6 +15,10 @@ | |||
15 | #include <linux/amba/bus.h> | 15 | #include <linux/amba/bus.h> |
16 | #include <linux/hw_random.h> | 16 | #include <linux/hw_random.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/clk.h> | ||
19 | #include <linux/err.h> | ||
20 | |||
21 | static struct clk *rng_clk; | ||
18 | 22 | ||
19 | static int nmk_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) | 23 | static int nmk_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) |
20 | { | 24 | { |
@@ -40,6 +44,15 @@ static int nmk_rng_probe(struct amba_device *dev, struct amba_id *id) | |||
40 | void __iomem *base; | 44 | void __iomem *base; |
41 | int ret; | 45 | int ret; |
42 | 46 | ||
47 | rng_clk = clk_get(&dev->dev, NULL); | ||
48 | if (IS_ERR(rng_clk)) { | ||
49 | dev_err(&dev->dev, "could not get rng clock\n"); | ||
50 | ret = PTR_ERR(rng_clk); | ||
51 | return ret; | ||
52 | } | ||
53 | |||
54 | clk_enable(rng_clk); | ||
55 | |||
43 | ret = amba_request_regions(dev, dev->dev.init_name); | 56 | ret = amba_request_regions(dev, dev->dev.init_name); |
44 | if (ret) | 57 | if (ret) |
45 | return ret; | 58 | return ret; |
@@ -57,6 +70,8 @@ out_unmap: | |||
57 | iounmap(base); | 70 | iounmap(base); |
58 | out_release: | 71 | out_release: |
59 | amba_release_regions(dev); | 72 | amba_release_regions(dev); |
73 | clk_disable(rng_clk); | ||
74 | clk_put(rng_clk); | ||
60 | return ret; | 75 | return ret; |
61 | } | 76 | } |
62 | 77 | ||
@@ -66,6 +81,8 @@ static int nmk_rng_remove(struct amba_device *dev) | |||
66 | hwrng_unregister(&nmk_rng); | 81 | hwrng_unregister(&nmk_rng); |
67 | iounmap(base); | 82 | iounmap(base); |
68 | amba_release_regions(dev); | 83 | amba_release_regions(dev); |
84 | clk_disable(rng_clk); | ||
85 | clk_put(rng_clk); | ||
69 | return 0; | 86 | return 0; |
70 | } | 87 | } |
71 | 88 | ||