drivers: entropy: Add support for SCE7 to entropy driver

add support SCE7 to entropy driver for Renesas RA

Signed-off-by: Danh Doan <danh.doan.ue@bp.renesas.com>
This commit is contained in:
Danh Doan 2024-10-30 13:14:12 +07:00 committed by Benjamin Cabé
commit c432f3dcad
5 changed files with 40 additions and 23 deletions

View file

@ -34,6 +34,6 @@ zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE entropy_ge
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_MAX32_TRNG entropy_max32.c)
zephyr_library_sources_ifdef(CONFIG_ENTROPY_RENESAS_RA_RSIP_E51A_TRNG entropy_renesas_ra.c)
zephyr_library_sources_ifdef(CONFIG_ENTROPY_RENESAS_RA entropy_renesas_ra.c)
zephyr_library_link_libraries_ifdef(CONFIG_BUILD_WITH_TFM tfm_api)

View file

@ -3,11 +3,11 @@
# Renesas RA entropy generator driver configuration
config ENTROPY_RENESAS_RA_RSIP_E51A_TRNG
bool "Renesas RA RSIP-E51A TRNG driver"
config ENTROPY_RENESAS_RA
bool "Renesas RA TRNG driver"
default y
depends on DT_HAS_RENESAS_RA_RSIP_E51A_TRNG_ENABLED
depends on DT_HAS_RENESAS_RA_RSIP_E51A_TRNG_ENABLED || DT_HAS_RENESAS_RA_SCE7_RNG_ENABLED
select ENTROPY_HAS_DRIVER
select USE_RA_FSP_SCE
help
This option enables the Renesas RA RSIP-E51A RNG.
This option enables entropy driver for Renesas RA

View file

@ -4,15 +4,13 @@
* 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)
static int entropy_renesas_ra_get_entropy(const struct device *dev, uint8_t *buf, uint16_t len)
{
ARG_UNUSED(dev);
@ -35,15 +33,19 @@ static int entropy_ra_rsip_trng_get_entropy(const struct device *dev, uint8_t *b
return 0;
}
static DEVICE_API(entropy, entropy_ra_rsip_trng_api) = {
.get_entropy = entropy_ra_rsip_trng_get_entropy,
static DEVICE_API(entropy, entropy_renesas_ra_api) = {
.get_entropy = entropy_renesas_ra_get_entropy,
};
static int entropy_ra_rsip_trng_init(const struct device *dev)
static int entropy_renesas_ra_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);
#define RENESAS_RA_ENTROPY_INIT(nodeid) \
DEVICE_DT_DEFINE(nodeid, entropy_renesas_ra_init, NULL, NULL, NULL, PRE_KERNEL_1, \
CONFIG_ENTROPY_INIT_PRIORITY, &entropy_renesas_ra_api)
DT_FOREACH_STATUS_OKAY(renesas_ra_rsip_e51a_trng, RENESAS_RA_ENTROPY_INIT)
DT_FOREACH_STATUS_OKAY(renesas_ra_sce7_rng, RENESAS_RA_ENTROPY_INIT)

View file

@ -0,0 +1,8 @@
# Copyright (c) 2024 Renesas Electronics Corporation
# SPDX-License-Identifier: Apache-2.0
description: Renesas RA SCE7 TRNG
compatible: "renesas,ra-sce7-rng"
include: base.yaml

View file

@ -50,10 +50,17 @@ if USE_RA_FSP_SCE
config HAS_RENESAS_RA_RSIP_E51A
bool
default y
depends on ENTROPY_RENESAS_RA_RSIP_E51A_TRNG
depends on DT_HAS_RENESAS_RA_RSIP_E51A_TRNG_ENABLED
help
Includes RSIP-E51A implementation for SCE driver
config HAS_RENESAS_RA_SCE7
bool
default y
depends on DT_HAS_RENESAS_RA_SCE7_RNG_ENABLED
help
Includes SCE7 implementation for SCE driver
endif
config USE_RA_FSP_SPI_B