aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/cavium-octeon
diff options
context:
space:
mode:
authorDavid Daney <ddaney@caviumnetworks.com>2009-08-20 17:10:22 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-09-17 14:07:51 -0400
commite26449153c386904d2801d6348d66d00e5ba2211 (patch)
treede1ef89387558c11c4451e2ad9c6c24e9fddeaf8 /arch/mips/cavium-octeon
parent982f6ffeeed5ef6104cfd72e517ff9e7a9270fda (diff)
MIPS: Octeon: Add hardware RNG platform device.
Add a platform device for the Octeon Random Number Generator (RNG). Signed-off-by: David Daney <ddaney@caviumnetworks.com> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/cavium-octeon')
-rw-r--r--arch/mips/cavium-octeon/setup.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index da559249cc2f..468a1209833f 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -33,6 +33,7 @@
33#include <asm/time.h> 33#include <asm/time.h>
34 34
35#include <asm/octeon/octeon.h> 35#include <asm/octeon/octeon.h>
36#include <asm/octeon/cvmx-rnm-defs.h>
36 37
37#ifdef CONFIG_CAVIUM_DECODE_RSL 38#ifdef CONFIG_CAVIUM_DECODE_RSL
38extern void cvmx_interrupt_rsl_decode(void); 39extern void cvmx_interrupt_rsl_decode(void);
@@ -926,3 +927,45 @@ out:
926 return ret; 927 return ret;
927} 928}
928device_initcall(octeon_cf_device_init); 929device_initcall(octeon_cf_device_init);
930
931/* Octeon Random Number Generator. */
932static int __init octeon_rng_device_init(void)
933{
934 struct platform_device *pd;
935 int ret = 0;
936
937 struct resource rng_resources[] = {
938 {
939 .flags = IORESOURCE_MEM,
940 .start = XKPHYS_TO_PHYS(CVMX_RNM_CTL_STATUS),
941 .end = XKPHYS_TO_PHYS(CVMX_RNM_CTL_STATUS) + 0xf
942 }, {
943 .flags = IORESOURCE_MEM,
944 .start = cvmx_build_io_address(8, 0),
945 .end = cvmx_build_io_address(8, 0) + 0x7
946 }
947 };
948
949 pd = platform_device_alloc("octeon_rng", -1);
950 if (!pd) {
951 ret = -ENOMEM;
952 goto out;
953 }
954
955 ret = platform_device_add_resources(pd, rng_resources,
956 ARRAY_SIZE(rng_resources));
957 if (ret)
958 goto fail;
959
960 ret = platform_device_add(pd);
961 if (ret)
962 goto fail;
963
964 return ret;
965fail:
966 platform_device_put(pd);
967
968out:
969 return ret;
970}
971device_initcall(octeon_rng_device_init);