2 * drivers/char/rng/ixp4xx-rng.c
4 * RNG driver for Intel IXP4xx family of NPUs
6 * Author: Deepak Saxena <dsaxena@plexity.net>
8 * Copyright 2005 (c) MontaVista Software, Inc.
10 * Fixes by Michael Buesch
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
17 #include <linux/kernel.h>
18 #include <linux/config.h>
19 #include <linux/types.h>
20 #include <linux/module.h>
21 #include <linux/moduleparam.h>
22 #include <linux/init.h>
23 #include <linux/bitops.h>
24 #include <linux/hw_random.h>
27 #include <asm/hardware.h>
30 static int ixp4xx_rng_data_read(struct hwrng
*rng
, u32
*buffer
)
32 void __iomem
* rng_base
= (void __iomem
*)rng
->priv
;
34 *buffer
= __raw_readl(rng_base
);
39 static struct hwrng ixp4xx_rng_ops
= {
41 .data_read
= ixp4xx_rng_data_read
,
44 static int __init
ixp4xx_rng_init(void)
46 void __iomem
* rng_base
;
49 rng_base
= ioremap(0x70002100, 4);
52 ixp4xx_rng_ops
.priv
= (unsigned long)rng_base
;
53 err
= hwrng_register(&ixp4xx_rng_ops
);
60 static void __exit
ixp4xx_rng_exit(void)
62 void __iomem
* rng_base
= (void __iomem
*)ixp4xx_rng_ops
.priv
;
64 hwrng_unregister(&ixp4xx_rng_ops
);
68 subsys_initcall(ixp4xx_rng_init
);
69 module_exit(ixp4xx_rng_exit
);
71 MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>");
72 MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver for IXP4xx");
73 MODULE_LICENSE("GPL");