drivers: entropy: rv32m1_trng: Add DTS support to rv32m1_trng driver
Add a YAML, DTS node and driver support to utilize data from devicetree for register address and driver name. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
19965f8173
commit
0be9d2b18d
7 changed files with 42 additions and 2 deletions
|
@ -7,6 +7,7 @@ config ENTROPY_RV32M1_TRNG
|
|||
bool "RV32M1 TRNG driver"
|
||||
depends on SOC_OPENISA_RV32M1_RISCV32
|
||||
select ENTROPY_HAS_DRIVER
|
||||
select HAS_DTS_ENTROPY
|
||||
help
|
||||
This option enables the true random number generator (TRNG)
|
||||
driver based on the RV32M1 TRNG driver.
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT openisa_rv32m1_trng
|
||||
|
||||
#include <device.h>
|
||||
#include <drivers/entropy.h>
|
||||
#include <random/rand32.h>
|
||||
|
@ -34,12 +36,12 @@ static const struct entropy_driver_api entropy_rv32m1_trng_api_funcs = {
|
|||
};
|
||||
|
||||
static struct rv32m1_entropy_config entropy_rv32m1_config = {
|
||||
.base = TRNG
|
||||
.base = (TRNG_Type *)DT_INST_REG_ADDR(0)
|
||||
};
|
||||
|
||||
static int entropy_rv32m1_trng_init(struct device *);
|
||||
|
||||
DEVICE_AND_API_INIT(entropy_rv32m1_trng, CONFIG_ENTROPY_NAME,
|
||||
DEVICE_AND_API_INIT(entropy_rv32m1_trng, DT_INST_LABEL(0),
|
||||
entropy_rv32m1_trng_init, NULL, &entropy_rv32m1_config,
|
||||
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&entropy_rv32m1_trng_api_funcs);
|
||||
|
|
18
dts/bindings/rng/openisa,rv32m1-trng.yaml
Normal file
18
dts/bindings/rng/openisa,rv32m1-trng.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Copyright (c) 2020, Linaro Limited
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: OpenISA TRNG (True Random Number Generator)
|
||||
|
||||
compatible: "openisa,rv32m1-trng"
|
||||
|
||||
include: base.yaml
|
||||
|
||||
properties:
|
||||
reg:
|
||||
required: true
|
||||
|
||||
interrupts:
|
||||
required: true
|
||||
|
||||
label:
|
||||
required: true
|
|
@ -525,6 +525,14 @@
|
|||
#pwm-cells = <3>;
|
||||
};
|
||||
|
||||
trng: random@41029000{
|
||||
compatible = "openisa,rv32m1-trng";
|
||||
reg = <0x41029000 0x1000>;
|
||||
status = "okay";
|
||||
interrupts = <13 0>;
|
||||
label = "TRNG";
|
||||
};
|
||||
|
||||
pwm3: pwm@4102d000 {
|
||||
compatible = "openisa,rv32m1-tpm";
|
||||
reg = <0x4102d000 0x88>;
|
||||
|
|
|
@ -215,3 +215,8 @@
|
|||
interrupt-parent = <&intmux0_ch1>;
|
||||
interrupts = <23>;
|
||||
};
|
||||
|
||||
&trng {
|
||||
interrupt-parent = <&intmux0_ch1>;
|
||||
interrupts = <20>;
|
||||
};
|
||||
|
|
|
@ -214,3 +214,8 @@
|
|||
interrupt-parent = <&event1>;
|
||||
interrupts = <15>;
|
||||
};
|
||||
|
||||
&trng {
|
||||
interrupt-parent = <&event1>;
|
||||
interrupts = <12>;
|
||||
};
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#define DT_FLASH_DEV_BASE_ADDRESS DT_OPENISA_RV32M1_FTFE_40023000_BASE_ADDRESS
|
||||
#define DT_FLASH_DEV_NAME DT_OPENISA_RV32M1_FTFE_40023000_LABEL
|
||||
#define DT_START_UP_ENTRY_OFFSET 0x80
|
||||
#define CONFIG_ENTROPY_NAME DT_LABEL(DT_INST(0, openisa_rv32m1_trng))
|
||||
|
||||
#endif /* CONFIG_SOC_OPENISA_RV32M1_RISCV32 */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue