diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/cavium-octeon/setup.c | 43 | ||||
-rw-r--r-- | arch/mips/include/asm/octeon/cvmx-rnm-defs.h | 88 |
2 files changed, 131 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); | ||
diff --git a/arch/mips/include/asm/octeon/cvmx-rnm-defs.h b/arch/mips/include/asm/octeon/cvmx-rnm-defs.h new file mode 100644 index 000000000000..4586958c97be --- /dev/null +++ b/arch/mips/include/asm/octeon/cvmx-rnm-defs.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /***********************license start*************** | ||
2 | * Author: Cavium Networks | ||
3 | * | ||
4 | * Contact: support@caviumnetworks.com | ||
5 | * This file is part of the OCTEON SDK | ||
6 | * | ||
7 | * Copyright (c) 2003-2008 Cavium Networks | ||
8 | * | ||
9 | * This file is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License, Version 2, as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This file is distributed in the hope that it will be useful, but | ||
14 | * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty | ||
15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or | ||
16 | * NONINFRINGEMENT. See the GNU General Public License for more | ||
17 | * details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this file; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
22 | * or visit http://www.gnu.org/licenses/. | ||
23 | * | ||
24 | * This file may also be available under a different license from Cavium. | ||
25 | * Contact Cavium Networks for more information | ||
26 | ***********************license end**************************************/ | ||
27 | |||
28 | #ifndef __CVMX_RNM_DEFS_H__ | ||
29 | #define __CVMX_RNM_DEFS_H__ | ||
30 | |||
31 | #include <linux/types.h> | ||
32 | |||
33 | #define CVMX_RNM_BIST_STATUS \ | ||
34 | CVMX_ADD_IO_SEG(0x0001180040000008ull) | ||
35 | #define CVMX_RNM_CTL_STATUS \ | ||
36 | CVMX_ADD_IO_SEG(0x0001180040000000ull) | ||
37 | |||
38 | union cvmx_rnm_bist_status { | ||
39 | uint64_t u64; | ||
40 | struct cvmx_rnm_bist_status_s { | ||
41 | uint64_t reserved_2_63:62; | ||
42 | uint64_t rrc:1; | ||
43 | uint64_t mem:1; | ||
44 | } s; | ||
45 | struct cvmx_rnm_bist_status_s cn30xx; | ||
46 | struct cvmx_rnm_bist_status_s cn31xx; | ||
47 | struct cvmx_rnm_bist_status_s cn38xx; | ||
48 | struct cvmx_rnm_bist_status_s cn38xxp2; | ||
49 | struct cvmx_rnm_bist_status_s cn50xx; | ||
50 | struct cvmx_rnm_bist_status_s cn52xx; | ||
51 | struct cvmx_rnm_bist_status_s cn52xxp1; | ||
52 | struct cvmx_rnm_bist_status_s cn56xx; | ||
53 | struct cvmx_rnm_bist_status_s cn56xxp1; | ||
54 | struct cvmx_rnm_bist_status_s cn58xx; | ||
55 | struct cvmx_rnm_bist_status_s cn58xxp1; | ||
56 | }; | ||
57 | |||
58 | union cvmx_rnm_ctl_status { | ||
59 | uint64_t u64; | ||
60 | struct cvmx_rnm_ctl_status_s { | ||
61 | uint64_t reserved_9_63:55; | ||
62 | uint64_t ent_sel:4; | ||
63 | uint64_t exp_ent:1; | ||
64 | uint64_t rng_rst:1; | ||
65 | uint64_t rnm_rst:1; | ||
66 | uint64_t rng_en:1; | ||
67 | uint64_t ent_en:1; | ||
68 | } s; | ||
69 | struct cvmx_rnm_ctl_status_cn30xx { | ||
70 | uint64_t reserved_4_63:60; | ||
71 | uint64_t rng_rst:1; | ||
72 | uint64_t rnm_rst:1; | ||
73 | uint64_t rng_en:1; | ||
74 | uint64_t ent_en:1; | ||
75 | } cn30xx; | ||
76 | struct cvmx_rnm_ctl_status_cn30xx cn31xx; | ||
77 | struct cvmx_rnm_ctl_status_cn30xx cn38xx; | ||
78 | struct cvmx_rnm_ctl_status_cn30xx cn38xxp2; | ||
79 | struct cvmx_rnm_ctl_status_s cn50xx; | ||
80 | struct cvmx_rnm_ctl_status_s cn52xx; | ||
81 | struct cvmx_rnm_ctl_status_s cn52xxp1; | ||
82 | struct cvmx_rnm_ctl_status_s cn56xx; | ||
83 | struct cvmx_rnm_ctl_status_s cn56xxp1; | ||
84 | struct cvmx_rnm_ctl_status_s cn58xx; | ||
85 | struct cvmx_rnm_ctl_status_s cn58xxp1; | ||
86 | }; | ||
87 | |||
88 | #endif | ||