drivers: entropy: Initial support for trng driver of RA8
Initial commit for entropy support on RA8 - drivers: entropy: implementation for TRNG driver of RA8x1 - dts: arm: add device node for trng of RA8x1 - boards: arm: enable support zephyr_entropy for ek_ra8m1 and update board documentation Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com> Signed-off-by: Duy Phuong Hoang. Nguyen <duy.nguyen.xa@renesas.com>
This commit is contained in:
parent
b41054340d
commit
b9f31c0e40
9 changed files with 108 additions and 9 deletions
|
@ -100,6 +100,8 @@ The below features are currently supported on Zephyr OS for EK-RA8M1 board:
|
||||||
+-----------+------------+----------------------+
|
+-----------+------------+----------------------+
|
||||||
| I2C | on-chip | i2c |
|
| I2C | on-chip | i2c |
|
||||||
+-----------+------------+----------------------+
|
+-----------+------------+----------------------+
|
||||||
|
| ENTROPY | on-chip | entropy |
|
||||||
|
+-----------+------------+----------------------+
|
||||||
|
|
||||||
Other hardware features are currently not supported by the port.
|
Other hardware features are currently not supported by the port.
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
zephyr,flash = &flash0;
|
zephyr,flash = &flash0;
|
||||||
zephyr,console = &uart9;
|
zephyr,console = &uart9;
|
||||||
zephyr,shell-uart = &uart9;
|
zephyr,shell-uart = &uart9;
|
||||||
|
zephyr,entropy = &trng;
|
||||||
};
|
};
|
||||||
|
|
||||||
leds {
|
leds {
|
||||||
|
@ -158,3 +159,7 @@ mikrobus_serial: &uart3 {};
|
||||||
pinctrl-0 = <&adc0_default>;
|
pinctrl-0 = <&adc0_default>;
|
||||||
pinctrl-names = "default";
|
pinctrl-names = "default";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&trng {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
|
@ -34,5 +34,6 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE entropy_gecko_se.
|
||||||
zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypto.c)
|
zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypto.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_ENTROPY_NPCX_DRBG entropy_npcx_drbg.c)
|
zephyr_library_sources_ifdef(CONFIG_ENTROPY_NPCX_DRBG entropy_npcx_drbg.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_ENTROPY_MAX32_TRNG entropy_max32.c)
|
zephyr_library_sources_ifdef(CONFIG_ENTROPY_MAX32_TRNG entropy_max32.c)
|
||||||
|
zephyr_library_sources_ifdef(CONFIG_ENTROPY_RENESAS_RA_RSIP_E51A_TRNG entropy_renesas_ra.c)
|
||||||
|
|
||||||
zephyr_library_link_libraries_ifdef(CONFIG_BUILD_WITH_TFM tfm_api)
|
zephyr_library_link_libraries_ifdef(CONFIG_BUILD_WITH_TFM tfm_api)
|
||||||
|
|
|
@ -37,6 +37,7 @@ source "drivers/entropy/Kconfig.bt_hci"
|
||||||
source "drivers/entropy/Kconfig.psa_crypto"
|
source "drivers/entropy/Kconfig.psa_crypto"
|
||||||
source "drivers/entropy/Kconfig.npcx"
|
source "drivers/entropy/Kconfig.npcx"
|
||||||
source "drivers/entropy/Kconfig.max32"
|
source "drivers/entropy/Kconfig.max32"
|
||||||
|
source "drivers/entropy/Kconfig.renesas_ra"
|
||||||
|
|
||||||
config ENTROPY_HAS_DRIVER
|
config ENTROPY_HAS_DRIVER
|
||||||
bool
|
bool
|
||||||
|
|
13
drivers/entropy/Kconfig.renesas_ra
Normal file
13
drivers/entropy/Kconfig.renesas_ra
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Copyright (c) 2024 Renesas Electronics Corporation
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# Renesas RA entropy generator driver configuration
|
||||||
|
|
||||||
|
config ENTROPY_RENESAS_RA_RSIP_E51A_TRNG
|
||||||
|
bool "Renesas RA RSIP-E51A TRNG driver"
|
||||||
|
default y
|
||||||
|
depends on DT_HAS_RENESAS_RA_RSIP_E51A_TRNG_ENABLED
|
||||||
|
select ENTROPY_HAS_DRIVER
|
||||||
|
select USE_RA_FSP_SCE
|
||||||
|
help
|
||||||
|
This option enables the Renesas RA RSIP-E51A RNG.
|
49
drivers/entropy/entropy_renesas_ra.c
Normal file
49
drivers/entropy/entropy_renesas_ra.c
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Renesas Electronics Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DT_DRV_COMPAT renesas_ra_rsip_e51a_trng
|
||||||
|
|
||||||
|
#include <soc.h>
|
||||||
|
#include <zephyr/drivers/entropy.h>
|
||||||
|
|
||||||
|
#include "hw_sce_trng_private.h"
|
||||||
|
#include "hw_sce_private.h"
|
||||||
|
|
||||||
|
static int entropy_ra_rsip_trng_get_entropy(const struct device *dev, uint8_t *buf, uint16_t len)
|
||||||
|
{
|
||||||
|
ARG_UNUSED(dev);
|
||||||
|
|
||||||
|
if (buf == NULL) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
uint32_t n[4];
|
||||||
|
const uint32_t to_copy = MIN(sizeof(n), len);
|
||||||
|
|
||||||
|
if (FSP_SUCCESS != HW_SCE_RNG_Read(n)) {
|
||||||
|
return -ENODATA;
|
||||||
|
}
|
||||||
|
memcpy(buf, n, to_copy);
|
||||||
|
buf += to_copy;
|
||||||
|
len -= to_copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct entropy_driver_api entropy_ra_rsip_trng_api = {
|
||||||
|
.get_entropy = entropy_ra_rsip_trng_get_entropy,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int entropy_ra_rsip_trng_init(const struct device *dev)
|
||||||
|
{
|
||||||
|
HW_SCE_McuSpecificInit();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEVICE_DT_INST_DEFINE(0, entropy_ra_rsip_trng_init, NULL, NULL, NULL, PRE_KERNEL_1,
|
||||||
|
CONFIG_ENTROPY_INIT_PRIORITY, &entropy_ra_rsip_trng_api);
|
|
@ -299,6 +299,10 @@
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
trng: trng {
|
||||||
|
compatible = "renesas,ra-rsip-e51a-trng";
|
||||||
|
};
|
||||||
|
|
||||||
option_setting_ofs: option_setting_ofs@300a100 {
|
option_setting_ofs: option_setting_ofs@300a100 {
|
||||||
compatible = "zephyr,memory-region";
|
compatible = "zephyr,memory-region";
|
||||||
reg = <0x0300a100 0x18>;
|
reg = <0x0300a100 0x18>;
|
||||||
|
|
8
dts/bindings/rng/renesas,ra-rsip-e51a-trng.yaml
Normal file
8
dts/bindings/rng/renesas,ra-rsip-e51a-trng.yaml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Copyright (c) 2024 Renesas Electronics Corporation
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
description: Renesas RA RSIP-E51A TRNG
|
||||||
|
|
||||||
|
compatible: "renesas,ra-rsip-e51a-trng"
|
||||||
|
|
||||||
|
include: base.yaml
|
|
@ -32,3 +32,19 @@ config USE_RA_FSP_ADC
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
Enable RA FSP ADC driver
|
Enable RA FSP ADC driver
|
||||||
|
|
||||||
|
config USE_RA_FSP_SCE
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Enable RA FSP SCE driver
|
||||||
|
|
||||||
|
if USE_RA_FSP_SCE
|
||||||
|
|
||||||
|
config HAS_RENESAS_RA_RSIP_E51A
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
depends on ENTROPY_RENESAS_RA_RSIP_E51A_TRNG
|
||||||
|
help
|
||||||
|
Includes RSIP-E51A implementation for SCE driver
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue