drivers: hwinfo: Implement hwinfo_get_device_id for ESP32-C3
ESP32-C3 uses different fuse addresses for storing the MAC addr, but the the format is the same. Signed-off-by: Michal Moskal <michal@moskal.me>
This commit is contained in:
parent
f8f3629efd
commit
d46b9bd124
2 changed files with 6 additions and 1 deletions
|
|
@ -118,7 +118,7 @@ config HWINFO_SAM0
|
||||||
config HWINFO_ESP32
|
config HWINFO_ESP32
|
||||||
bool "ESP32 device ID"
|
bool "ESP32 device ID"
|
||||||
default y
|
default y
|
||||||
depends on SOC_ESP32
|
depends on SOC_ESP32 || SOC_ESP32C3
|
||||||
help
|
help
|
||||||
Enable ESP32 hwinfo driver.
|
Enable ESP32 hwinfo driver.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,13 @@
|
||||||
|
|
||||||
ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length)
|
ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SOC_ESP32C3
|
||||||
|
uint32_t rdata1 = sys_read32(EFUSE_RD_MAC_SPI_SYS_0_REG);
|
||||||
|
uint32_t rdata2 = sys_read32(EFUSE_RD_MAC_SPI_SYS_1_REG);
|
||||||
|
#else
|
||||||
uint32_t rdata1 = sys_read32(EFUSE_BLK0_RDATA1_REG);
|
uint32_t rdata1 = sys_read32(EFUSE_BLK0_RDATA1_REG);
|
||||||
uint32_t rdata2 = sys_read32(EFUSE_BLK0_RDATA2_REG);
|
uint32_t rdata2 = sys_read32(EFUSE_BLK0_RDATA2_REG);
|
||||||
|
#endif
|
||||||
uint8_t id[6];
|
uint8_t id[6];
|
||||||
|
|
||||||
/* The first word provides the lower 32 bits of the MAC
|
/* The first word provides the lower 32 bits of the MAC
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue