mirror of
https://github.com/torvalds/linux.git
synced 2024-12-16 08:02:17 +00:00
firmware: smccc: Register smccc_trng platform device
At the moment we probe for the Random Number Generator SMCCC service, and use that in the core code (arch_get_random). However the hardware entropy can also be useful to access from userland, and be it to assess its quality. Register a platform device when the SMCCC TRNG service is detected, to allow a hw_random driver to hook onto this. The function registering the device is deliberately made in a way which allows expansion, so other services that could be exposed via a platform device (or some other interface), can be added here easily. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
5441a07a12
commit
b83c2d92be
@ -9,6 +9,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/arm-smccc.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <asm/archrandom.h>
|
||||
|
||||
static u32 smccc_version = ARM_SMCCC_VERSION_1_0;
|
||||
@ -42,3 +43,19 @@ u32 arm_smccc_get_version(void)
|
||||
return smccc_version;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(arm_smccc_get_version);
|
||||
|
||||
static int __init smccc_devices_init(void)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
|
||||
if (smccc_trng_available) {
|
||||
pdev = platform_device_register_simple("smccc_trng", -1,
|
||||
NULL, 0);
|
||||
if (IS_ERR(pdev))
|
||||
pr_err("smccc_trng: could not register device: %ld\n",
|
||||
PTR_ERR(pdev));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
device_initcall(smccc_devices_init);
|
||||
|
Loading…
Reference in New Issue
Block a user