aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Carriere <etienne.carriere@linaro.org>2022-06-17 17:36:53 +0200
committerTom Rini <trini@konsulko.com>2022-07-08 09:06:57 -0400
commit82b7942eccb4fe3645cb7670c4c9c3dfddf0393c (patch)
tree2f67492dad50bfa4b94aa8264c8c6dbdd1516265
parentcd9f208c650bee1a71e73fe0d9e92dcc3e4b7d51 (diff)
downloadu-boot-82b7942eccb4fe3645cb7670c4c9c3dfddf0393c.zip
u-boot-82b7942eccb4fe3645cb7670c4c9c3dfddf0393c.tar.gz
u-boot-82b7942eccb4fe3645cb7670c4c9c3dfddf0393c.tar.bz2
drivers: rng: optee_rng: register to CONFIG_OPTEE_SERVICE_DISCOVERY
Changes optee_rng driver to register itself has a OP-TEE service so that a device is bound for the driver when OP-TEE enumerates the PTA RNG service. Cc: Sughosh Ganu <sughosh.ganu@linaro.org> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
-rw-r--r--drivers/rng/Kconfig1
-rw-r--r--drivers/rng/optee_rng.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/rng/Kconfig b/drivers/rng/Kconfig
index 21a9ff0..0cbb40a 100644
--- a/drivers/rng/Kconfig
+++ b/drivers/rng/Kconfig
@@ -41,6 +41,7 @@ config RNG_NPCM
config RNG_OPTEE
bool "OP-TEE based Random Number Generator support"
depends on DM_RNG && OPTEE
+ default y if OPTEE_SERVICE_DISCOVERY
help
This driver provides support for the OP-TEE based Random Number
Generator on ARM SoCs where hardware entropy sources are not
diff --git a/drivers/rng/optee_rng.c b/drivers/rng/optee_rng.c
index aa8ce86..410dfc0 100644
--- a/drivers/rng/optee_rng.c
+++ b/drivers/rng/optee_rng.c
@@ -11,6 +11,9 @@
#include <dm/device.h>
#include <dm/device_compat.h>
#include <linux/sizes.h>
+#include <tee/optee_service.h>
+
+#define DRIVER_NAME "optee-rng"
#define TEE_ERROR_HEALTH_TEST_FAIL 0x00000001
@@ -35,6 +38,8 @@
#define TA_HWRNG_UUID { 0xab7a617c, 0xb8e7, 0x4d8f, \
{ 0x83, 0x01, 0xd0, 0x9b, 0x61, 0x03, 0x6b, 0x64 } }
+OPTEE_SERVICE_DRIVER(optee_rng, TA_HWRNG_UUID, DRIVER_NAME);
+
/** open_session_ta_hwrng() - Open session with hwrng Trusted App
*
* @dev: device
@@ -177,7 +182,7 @@ static const struct dm_rng_ops optee_rng_ops = {
};
U_BOOT_DRIVER(optee_rng) = {
- .name = "optee-rng",
+ .name = DRIVER_NAME,
.id = UCLASS_RNG,
.ops = &optee_rng_ops,
.probe = optee_rng_probe,