diff options
Diffstat (limited to 'arch/mips/cavium-octeon/setup.c')
-rw-r--r-- | arch/mips/cavium-octeon/setup.c | 43 |
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 |
38 | extern void cvmx_interrupt_rsl_decode(void); | 39 | extern void cvmx_interrupt_rsl_decode(void); |
@@ -926,3 +927,45 @@ out: | |||
926 | return ret; | 927 | return ret; |
927 | } | 928 | } |
928 | device_initcall(octeon_cf_device_init); | 929 | device_initcall(octeon_cf_device_init); |
930 | |||
931 | /* Octeon Random Number Generator. */ | ||
932 | static 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; | ||
965 | fail: | ||
966 | platform_device_put(pd); | ||
967 | |||
968 | out: | ||
969 | return ret; | ||
970 | } | ||
971 | device_initcall(octeon_rng_device_init); | ||