drivers: hwinfo: Add cypress psoc6 hwinfo support
Introduce Cypress PSoC-6 hwinfo driver. Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
This commit is contained in:
parent
ea54b00f4c
commit
03ef8feeb6
3 changed files with 42 additions and 0 deletions
|
@ -12,4 +12,5 @@ zephyr_sources_ifdef(CONFIG_HWINFO_SAM hwinfo_sam.c)
|
||||||
zephyr_sources_ifdef(CONFIG_HWINFO_SAM4L hwinfo_sam4l.c)
|
zephyr_sources_ifdef(CONFIG_HWINFO_SAM4L hwinfo_sam4l.c)
|
||||||
zephyr_sources_ifdef(CONFIG_HWINFO_SAM0 hwinfo_sam0.c)
|
zephyr_sources_ifdef(CONFIG_HWINFO_SAM0 hwinfo_sam0.c)
|
||||||
zephyr_sources_ifdef(CONFIG_HWINFO_LITEX hwinfo_litex.c)
|
zephyr_sources_ifdef(CONFIG_HWINFO_LITEX hwinfo_litex.c)
|
||||||
|
zephyr_sources_ifdef(CONFIG_HWINFO_PSOC6 hwinfo_psoc6.c)
|
||||||
zephyr_sources_ifdef(CONFIG_HWINFO_SHELL hwinfo_shell.c)
|
zephyr_sources_ifdef(CONFIG_HWINFO_SHELL hwinfo_shell.c)
|
||||||
|
|
|
@ -91,4 +91,13 @@ config HWINFO_LITEX
|
||||||
select HWINFO_HAS_DRIVER
|
select HWINFO_HAS_DRIVER
|
||||||
help
|
help
|
||||||
Enable LiteX hwinfo driver
|
Enable LiteX hwinfo driver
|
||||||
|
|
||||||
|
config HWINFO_PSOC6
|
||||||
|
bool "Cypress PSoC-6 unique device ID"
|
||||||
|
default y
|
||||||
|
depends on SOC_FAMILY_PSOC6
|
||||||
|
select HWINFO_HAS_DRIVER
|
||||||
|
help
|
||||||
|
Enable Cypress PSoC-6 hwinfo driver.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
32
drivers/hwinfo/hwinfo_psoc6.c
Normal file
32
drivers/hwinfo/hwinfo_psoc6.c
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 ATL Electronics
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DT_DRV_COMPAT cypress_psoc6_uid
|
||||||
|
|
||||||
|
#include <device.h>
|
||||||
|
#include <drivers/hwinfo.h>
|
||||||
|
#include <init.h>
|
||||||
|
#include <soc.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <cy_syslib.h>
|
||||||
|
|
||||||
|
ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length)
|
||||||
|
{
|
||||||
|
uint8_t *uid_addr = (uint8_t *) DT_INST_REG_ADDR(0);
|
||||||
|
|
||||||
|
if (buffer == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length > DT_INST_REG_SIZE(0)) {
|
||||||
|
length = DT_INST_REG_SIZE(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(buffer, uid_addr, length);
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue