Commit 52be3030 authored by Joakim Andersson's avatar Joakim Andersson Committed by Carles Cufi
Browse files

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: default avatarJoakim Andersson <joakim.andersson@nordicsemi.no>
parent 4b80afdd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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.

+6 −3
Original line number Diff line number Diff line
@@ -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];

	soc_secure_read_deviceid(deviceid);

	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));
	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);