File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,19 @@ config HW_RANDOM_BCM2835
9898
9999 If unsure, say Y.
100100
101+ config HW_RANDOM_BCM2835_RUST
102+ tristate "Rust implementation of Broadcom BCM2835 Random Number Generator"
103+ depends on HAS_RUST && ARCH_BCM2835
104+ help
105+ This driver provides alternative Rust-based kernel-side support
106+ for the Random Number Generator hardware found on the Broadcom
107+ BCM2835 SoC.
108+
109+ To compile this driver as a module, choose M here: the
110+ module will be called bcm2835_rng_rust
111+
112+ If unsure, say N.
113+
101114config HW_RANDOM_IPROC_RNG200
102115 tristate "Broadcom iProc/STB RNG200 support"
103116 depends on ARCH_BCM_IPROC || ARCH_BCM2835 || ARCH_BRCMSTB
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o
3131obj-$(CONFIG_HW_RANDOM_POWERNV) += powernv-rng.o
3232obj-$(CONFIG_HW_RANDOM_HISI) += hisi-rng.o
3333obj-$(CONFIG_HW_RANDOM_BCM2835) += bcm2835-rng.o
34+ obj-$(CONFIG_HW_RANDOM_BCM2835_RUST) += bcm2835_rng_rust.o
3435obj-$(CONFIG_HW_RANDOM_IPROC_RNG200) += iproc-rng200.o
3536obj-$(CONFIG_HW_RANDOM_ST) += st-rng.o
3637obj-$(CONFIG_HW_RANDOM_XGENE) += xgene-rng.o
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0
2+
3+ //! Broadcom BCM2835 Random Number Generator support.
4+
5+ #![ no_std]
6+ #![ feature( allocator_api, global_asm) ]
7+
8+ use alloc:: boxed:: Box ;
9+ use core:: pin:: Pin ;
10+ use kernel:: prelude:: * ;
11+ use kernel:: { cstr, platdev} ;
12+
13+ module ! {
14+ type : RngModule ,
15+ name: b"bcm2835_rng_rust" ,
16+ author: b"Rust for Linux Contributors" ,
17+ description: b"BCM2835 Random Number Generator (RNG) driver" ,
18+ license: b"GPL v2" ,
19+ }
20+
21+ struct RngModule {
22+ _pdev : Pin < Box < platdev:: Registration > > ,
23+ }
24+
25+ impl KernelModule for RngModule {
26+ fn init ( ) -> Result < Self > {
27+ let pdev = platdev:: Registration :: new_pinned ( cstr ! ( "bcm2835-rng-rust" ) , & THIS_MODULE ) ?;
28+
29+ Ok ( RngModule { _pdev : pdev } )
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments