drivers: hwinfo: Remove HWINFO_NRF limitation for non-secure config

Remove the limitiation in HWINFO_NRF not working in non-secure
configuration. Use the exposed soc_secure_read_deviceid function
that accesses the device ID through the secure services.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2022-03-18 15:06:00 +01:00 committed by Carles Cufí
commit 52be3030aa
2 changed files with 7 additions and 4 deletions

View file

@ -31,7 +31,7 @@ config HWINFO_STM32
config HWINFO_NRF
bool "NRF device ID"
default y
depends on SOC_FAMILY_NRF && !TRUSTED_EXECUTION_NONSECURE
depends on SOC_FAMILY_NRF
help
Enable Nordic NRF hwinfo driver.

View file

@ -12,7 +12,7 @@
#ifndef CONFIG_BOARD_QEMU_CORTEX_M0
#include <helpers/nrfx_reset_reason.h>
#endif
#include <soc_secure.h>
struct nrf_uid {
uint32_t id[2];
};
@ -20,9 +20,12 @@ struct nrf_uid {
ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length)
{
struct nrf_uid dev_id;
uint32_t deviceid[2];
dev_id.id[0] = sys_cpu_to_be32(nrf_ficr_deviceid_get(NRF_FICR, 1));
dev_id.id[1] = sys_cpu_to_be32(nrf_ficr_deviceid_get(NRF_FICR, 0));
soc_secure_read_deviceid(deviceid);
dev_id.id[0] = sys_cpu_to_be32(deviceid[1]);
dev_id.id[1] = sys_cpu_to_be32(deviceid[0]);
if (length > sizeof(dev_id.id)) {
length = sizeof(dev_id.id);