aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2008-04-16 07:24:42 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2008-04-20 22:19:34 -0400
commitc49a7f182c44c31ea460093eb263110824f6c98e (patch)
tree04314bdbe31c755b414f29233f4ddb513cd06d2c
parent584fffc8b1965cc09ebc4b7608bafcbf12ad5244 (diff)
[HWRNG] omap: Minor updates
Minor cleanups to the OMAP RNG: - Comment update re RNG status: * yes, it works on 16xx; "rngtest" is quite happy * it's fast enough that polling vs IRQ is a non-issue - Get rid of BUG_ON - Help GCC not be stupid about inlining (object code shrink) - Remove "sparse" warning - Cope with new hotplug rule requiring "platform:" modalias And make the file header match kernel conventions. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/char/hw_random/omap-rng.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 7e319951fa41..51738bdd834e 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * drivers/char/hw_random/omap-rng.c 2 * omap-rng.c - RNG driver for TI OMAP CPU family
3 *
4 * RNG driver for TI OMAP CPU family
5 * 3 *
6 * Author: Deepak Saxena <dsaxena@plexity.net> 4 * Author: Deepak Saxena <dsaxena@plexity.net>
7 * 5 *
@@ -15,11 +13,6 @@
15 * This file is licensed under the terms of the GNU General Public 13 * This file is licensed under the terms of the GNU General Public
16 * License version 2. This program is licensed "as is" without any 14 * License version 2. This program is licensed "as is" without any
17 * warranty of any kind, whether express or implied. 15 * warranty of any kind, whether express or implied.
18 *
19 * TODO:
20 *
21 * - Make status updated be interrupt driven so we don't poll
22 *
23 */ 16 */
24 17
25#include <linux/module.h> 18#include <linux/module.h>
@@ -55,17 +48,16 @@ static void __iomem *rng_base;
55static struct clk *rng_ick; 48static struct clk *rng_ick;
56static struct platform_device *rng_dev; 49static struct platform_device *rng_dev;
57 50
58static u32 omap_rng_read_reg(int reg) 51static inline u32 omap_rng_read_reg(int reg)
59{ 52{
60 return __raw_readl(rng_base + reg); 53 return __raw_readl(rng_base + reg);
61} 54}
62 55
63static void omap_rng_write_reg(int reg, u32 val) 56static inline void omap_rng_write_reg(int reg, u32 val)
64{ 57{
65 __raw_writel(val, rng_base + reg); 58 __raw_writel(val, rng_base + reg);
66} 59}
67 60
68/* REVISIT: Does the status bit really work on 16xx? */
69static int omap_rng_data_present(struct hwrng *rng, int wait) 61static int omap_rng_data_present(struct hwrng *rng, int wait)
70{ 62{
71 int data, i; 63 int data, i;
@@ -74,6 +66,11 @@ static int omap_rng_data_present(struct hwrng *rng, int wait)
74 data = omap_rng_read_reg(RNG_STAT_REG) ? 0 : 1; 66 data = omap_rng_read_reg(RNG_STAT_REG) ? 0 : 1;
75 if (data || !wait) 67 if (data || !wait)
76 break; 68 break;
69 /* RNG produces data fast enough (2+ MBit/sec, even
70 * during "rngtest" loads, that these delays don't
71 * seem to trigger. We *could* use the RNG IRQ, but
72 * that'd be higher overhead ... so why bother?
73 */
77 udelay(10); 74 udelay(10);
78 } 75 }
79 return data; 76 return data;
@@ -101,7 +98,8 @@ static int __init omap_rng_probe(struct platform_device *pdev)
101 * A bit ugly, and it will never actually happen but there can 98 * A bit ugly, and it will never actually happen but there can
102 * be only one RNG and this catches any bork 99 * be only one RNG and this catches any bork
103 */ 100 */
104 BUG_ON(rng_dev); 101 if (rng_dev)
102 return -EBUSY;
105 103
106 if (cpu_is_omap24xx()) { 104 if (cpu_is_omap24xx()) {
107 rng_ick = clk_get(NULL, "rng_ick"); 105 rng_ick = clk_get(NULL, "rng_ick");
@@ -124,7 +122,7 @@ static int __init omap_rng_probe(struct platform_device *pdev)
124 return -EBUSY; 122 return -EBUSY;
125 123
126 dev_set_drvdata(&pdev->dev, mem); 124 dev_set_drvdata(&pdev->dev, mem);
127 rng_base = (u32 __iomem *)io_p2v(res->start); 125 rng_base = (u32 __force __iomem *)io_p2v(res->start);
128 126
129 ret = hwrng_register(&omap_rng_ops); 127 ret = hwrng_register(&omap_rng_ops);
130 if (ret) { 128 if (ret) {
@@ -182,6 +180,8 @@ static int omap_rng_resume(struct platform_device *pdev)
182 180
183#endif 181#endif
184 182
183/* work with hotplug and coldplug */
184MODULE_ALIAS("platform:omap_rng");
185 185
186static struct platform_driver omap_rng_driver = { 186static struct platform_driver omap_rng_driver = {
187 .driver = { 187 .driver = {