hwinfo: Support NXP LPC family
add hwinfo driver support for NXP's LPC family. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This commit is contained in:
parent
8b0e79e3b9
commit
6dbffcb2a8
6 changed files with 55 additions and 0 deletions
|
@ -83,6 +83,8 @@ features:
|
||||||
+-----------+------------+-------------------------------------+
|
+-----------+------------+-------------------------------------+
|
||||||
| CLOCK | on-chip | clock_control |
|
| CLOCK | on-chip | clock_control |
|
||||||
+-----------+------------+-------------------------------------+
|
+-----------+------------+-------------------------------------+
|
||||||
|
| HWINFO | on-chip | Unique device serial number |
|
||||||
|
+-----------+------------+-------------------------------------+
|
||||||
|
|
||||||
The default configuration can be found in the defconfig file:
|
The default configuration can be found in the defconfig file:
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ zephyr_sources_ifdef(CONFIG_HWINFO hwinfo_weak_impl.c)
|
||||||
zephyr_sources_ifdef(CONFIG_HWINFO_STM32 hwinfo_stm32.c)
|
zephyr_sources_ifdef(CONFIG_HWINFO_STM32 hwinfo_stm32.c)
|
||||||
zephyr_sources_ifdef(CONFIG_HWINFO_NRF hwinfo_nrf.c)
|
zephyr_sources_ifdef(CONFIG_HWINFO_NRF hwinfo_nrf.c)
|
||||||
zephyr_sources_ifdef(CONFIG_HWINFO_MCUX_SIM hwinfo_mcux_sim.c)
|
zephyr_sources_ifdef(CONFIG_HWINFO_MCUX_SIM hwinfo_mcux_sim.c)
|
||||||
|
zephyr_sources_ifdef(CONFIG_HWINFO_MCUX_SYSCON hwinfo_mcux_syscon.c)
|
||||||
zephyr_sources_ifdef(CONFIG_HWINFO_ESP32 hwinfo_esp32.c)
|
zephyr_sources_ifdef(CONFIG_HWINFO_ESP32 hwinfo_esp32.c)
|
||||||
zephyr_sources_ifdef(CONFIG_HWINFO_IMXRT hwinfo_imxrt.c)
|
zephyr_sources_ifdef(CONFIG_HWINFO_IMXRT hwinfo_imxrt.c)
|
||||||
zephyr_sources_ifdef(CONFIG_HWINFO_SAM hwinfo_sam.c)
|
zephyr_sources_ifdef(CONFIG_HWINFO_SAM hwinfo_sam.c)
|
||||||
|
|
|
@ -38,6 +38,13 @@ config HWINFO_MCUX_SIM
|
||||||
help
|
help
|
||||||
Enable NXP kinetis mcux hwinfo driver.
|
Enable NXP kinetis mcux hwinfo driver.
|
||||||
|
|
||||||
|
config HWINFO_MCUX_SYSCON
|
||||||
|
bool "NXP LPC device ID"
|
||||||
|
default y
|
||||||
|
depends on HAS_MCUX_SYSCON
|
||||||
|
help
|
||||||
|
Enable NXP LPC mcux hwinfo driver.
|
||||||
|
|
||||||
config HWINFO_IMXRT
|
config HWINFO_IMXRT
|
||||||
bool "NXP i.mx RT device ID"
|
bool "NXP i.mx RT device ID"
|
||||||
default y
|
default y
|
||||||
|
|
28
drivers/hwinfo/hwinfo_mcux_syscon.c
Normal file
28
drivers/hwinfo/hwinfo_mcux_syscon.c
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 NXP
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DT_DRV_COMPAT nxp_lpc_uid
|
||||||
|
|
||||||
|
#include <drivers/hwinfo.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/byteorder.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;
|
||||||
|
}
|
|
@ -66,6 +66,11 @@
|
||||||
#clock-cells = <1>;
|
#clock-cells = <1>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uuid: uuid@2f50 {
|
||||||
|
compatible = "nxp,lpc-uid";
|
||||||
|
reg = <0x2f50 0x10>;
|
||||||
|
};
|
||||||
|
|
||||||
gpio0: gpio@0 {
|
gpio0: gpio@0 {
|
||||||
compatible = "nxp,lpc-gpio";
|
compatible = "nxp,lpc-gpio";
|
||||||
reg = <0x100000 0x4000>;
|
reg = <0x100000 0x4000>;
|
||||||
|
|
12
dts/bindings/hwinfo/nxp,lpc-uid.yaml
Normal file
12
dts/bindings/hwinfo/nxp,lpc-uid.yaml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Copyright (c) 2021 NXP
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
description: NXP LPC 128-bit Unique identifier
|
||||||
|
|
||||||
|
compatible: "nxp,lpc-uid"
|
||||||
|
|
||||||
|
include: base.yaml
|
||||||
|
|
||||||
|
properties:
|
||||||
|
reg:
|
||||||
|
required: true
|
Loading…
Add table
Add a link
Reference in a new issue