Skip to content

Commit c432f3d

Browse files
Danh Doankartben
authored andcommitted
drivers: entropy: Add support for SCE7 to entropy driver
add support SCE7 to entropy driver for Renesas RA Signed-off-by: Danh Doan <[email protected]>
1 parent 9d06cd7 commit c432f3d

File tree

5 files changed

+40
-23
lines changed

5 files changed

+40
-23
lines changed

drivers/entropy/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ if(CONFIG_FAKE_ENTROPY_NATIVE_POSIX)
2525
endif()
2626
endif()
2727

28-
zephyr_library_sources_ifdef(CONFIG_USERSPACE entropy_handlers.c)
29-
zephyr_library_sources_ifdef(CONFIG_ENTROPY_RV32M1_TRNG entropy_rv32m1_trng.c)
30-
zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_TRNG entropy_gecko_trng.c)
31-
zephyr_library_sources_ifdef(CONFIG_ENTROPY_NEORV32_TRNG entropy_neorv32_trng.c)
32-
zephyr_library_sources_ifdef(CONFIG_ENTROPY_BT_HCI entropy_bt_hci.c)
33-
zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE entropy_gecko_se.c)
34-
zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypto.c)
35-
zephyr_library_sources_ifdef(CONFIG_ENTROPY_NPCX_DRBG entropy_npcx_drbg.c)
36-
zephyr_library_sources_ifdef(CONFIG_ENTROPY_MAX32_TRNG entropy_max32.c)
37-
zephyr_library_sources_ifdef(CONFIG_ENTROPY_RENESAS_RA_RSIP_E51A_TRNG entropy_renesas_ra.c)
28+
zephyr_library_sources_ifdef(CONFIG_USERSPACE entropy_handlers.c)
29+
zephyr_library_sources_ifdef(CONFIG_ENTROPY_RV32M1_TRNG entropy_rv32m1_trng.c)
30+
zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_TRNG entropy_gecko_trng.c)
31+
zephyr_library_sources_ifdef(CONFIG_ENTROPY_NEORV32_TRNG entropy_neorv32_trng.c)
32+
zephyr_library_sources_ifdef(CONFIG_ENTROPY_BT_HCI entropy_bt_hci.c)
33+
zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE entropy_gecko_se.c)
34+
zephyr_library_sources_ifdef(CONFIG_ENTROPY_PSA_CRYPTO_RNG entropy_psa_crypto.c)
35+
zephyr_library_sources_ifdef(CONFIG_ENTROPY_NPCX_DRBG entropy_npcx_drbg.c)
36+
zephyr_library_sources_ifdef(CONFIG_ENTROPY_MAX32_TRNG entropy_max32.c)
37+
zephyr_library_sources_ifdef(CONFIG_ENTROPY_RENESAS_RA entropy_renesas_ra.c)
3838

3939
zephyr_library_link_libraries_ifdef(CONFIG_BUILD_WITH_TFM tfm_api)

drivers/entropy/Kconfig.renesas_ra

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
# Renesas RA entropy generator driver configuration
55

6-
config ENTROPY_RENESAS_RA_RSIP_E51A_TRNG
7-
bool "Renesas RA RSIP-E51A TRNG driver"
6+
config ENTROPY_RENESAS_RA
7+
bool "Renesas RA TRNG driver"
88
default y
9-
depends on DT_HAS_RENESAS_RA_RSIP_E51A_TRNG_ENABLED
9+
depends on DT_HAS_RENESAS_RA_RSIP_E51A_TRNG_ENABLED || DT_HAS_RENESAS_RA_SCE7_RNG_ENABLED
1010
select ENTROPY_HAS_DRIVER
1111
select USE_RA_FSP_SCE
1212
help
13-
This option enables the Renesas RA RSIP-E51A RNG.
13+
This option enables entropy driver for Renesas RA

drivers/entropy/entropy_renesas_ra.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#define DT_DRV_COMPAT renesas_ra_rsip_e51a_trng
8-
97
#include <soc.h>
108
#include <zephyr/drivers/entropy.h>
119

1210
#include "hw_sce_trng_private.h"
1311
#include "hw_sce_private.h"
1412

15-
static int entropy_ra_rsip_trng_get_entropy(const struct device *dev, uint8_t *buf, uint16_t len)
13+
static int entropy_renesas_ra_get_entropy(const struct device *dev, uint8_t *buf, uint16_t len)
1614
{
1715
ARG_UNUSED(dev);
1816

@@ -35,15 +33,19 @@ static int entropy_ra_rsip_trng_get_entropy(const struct device *dev, uint8_t *b
3533
return 0;
3634
}
3735

38-
static DEVICE_API(entropy, entropy_ra_rsip_trng_api) = {
39-
.get_entropy = entropy_ra_rsip_trng_get_entropy,
36+
static DEVICE_API(entropy, entropy_renesas_ra_api) = {
37+
.get_entropy = entropy_renesas_ra_get_entropy,
4038
};
4139

42-
static int entropy_ra_rsip_trng_init(const struct device *dev)
40+
static int entropy_renesas_ra_init(const struct device *dev)
4341
{
4442
HW_SCE_McuSpecificInit();
4543
return 0;
4644
}
4745

48-
DEVICE_DT_INST_DEFINE(0, entropy_ra_rsip_trng_init, NULL, NULL, NULL, PRE_KERNEL_1,
49-
CONFIG_ENTROPY_INIT_PRIORITY, &entropy_ra_rsip_trng_api);
46+
#define RENESAS_RA_ENTROPY_INIT(nodeid) \
47+
DEVICE_DT_DEFINE(nodeid, entropy_renesas_ra_init, NULL, NULL, NULL, PRE_KERNEL_1, \
48+
CONFIG_ENTROPY_INIT_PRIORITY, &entropy_renesas_ra_api)
49+
50+
DT_FOREACH_STATUS_OKAY(renesas_ra_rsip_e51a_trng, RENESAS_RA_ENTROPY_INIT)
51+
DT_FOREACH_STATUS_OKAY(renesas_ra_sce7_rng, RENESAS_RA_ENTROPY_INIT)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: Renesas RA SCE7 TRNG
5+
6+
compatible: "renesas,ra-sce7-rng"
7+
8+
include: base.yaml

modules/Kconfig.renesas_fsp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,17 @@ if USE_RA_FSP_SCE
5050
config HAS_RENESAS_RA_RSIP_E51A
5151
bool
5252
default y
53-
depends on ENTROPY_RENESAS_RA_RSIP_E51A_TRNG
53+
depends on DT_HAS_RENESAS_RA_RSIP_E51A_TRNG_ENABLED
5454
help
5555
Includes RSIP-E51A implementation for SCE driver
5656

57+
config HAS_RENESAS_RA_SCE7
58+
bool
59+
default y
60+
depends on DT_HAS_RENESAS_RA_SCE7_RNG_ENABLED
61+
help
62+
Includes SCE7 implementation for SCE driver
63+
5764
endif
5865

5966
config USE_RA_FSP_SPI_B

0 commit comments

Comments
 (0)