diff options
| author | Frieder Schrempf <[email protected]> | 2025-11-04 13:54:28 +0100 |
|---|---|---|
| committer | Fabio Estevam <[email protected]> | 2025-11-04 12:46:11 -0300 |
| commit | 306c3caf81a34d94a13037a6f5772b64b54fe082 (patch) | |
| tree | 6a861046f8da61c02e9bf0f6cc81480f123661e4 /board | |
| parent | 5b4d3c81719d0e2d6ddef022c8ec904caa5a01d8 (diff) | |
imx: kontron-sl-mx8mm: Add support for reading HW UIDs
The factory provides a CPU UID in the OTPs and the SoM module
and the carrier board might provide additional UIDs in the GP
registers of the OTPs. Load these values in the following order
and create a serial number string:
* Board UID (GP2)
* SoM UID (GP1)
* CPU UID (UNIQUE_ID)
The string is stored in the "serial#" env variable and
exported to Linux. Further this prints the used UID to the
console which looks like this
ID: 0042152331 (Board)
or:
ID: 0030124840 (SoM)
or:
ID: 4696668CD9516886 (CPU)
Signed-off-by: Frieder Schrempf <[email protected]>
Diffstat (limited to 'board')
| -rw-r--r-- | board/kontron/sl-mx8mm/Kconfig | 2 | ||||
| -rw-r--r-- | board/kontron/sl-mx8mm/sl-mx8mm.c | 32 |
2 files changed, 34 insertions, 0 deletions
diff --git a/board/kontron/sl-mx8mm/Kconfig b/board/kontron/sl-mx8mm/Kconfig index 1597bcf894d..0a5123d2979 100644 --- a/board/kontron/sl-mx8mm/Kconfig +++ b/board/kontron/sl-mx8mm/Kconfig @@ -9,4 +9,6 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "kontron-sl-mx8mm" +source "board/kontron/common/Kconfig" + endif diff --git a/board/kontron/sl-mx8mm/sl-mx8mm.c b/board/kontron/sl-mx8mm/sl-mx8mm.c index df92765cb2d..d24d5286e45 100644 --- a/board/kontron/sl-mx8mm/sl-mx8mm.c +++ b/board/kontron/sl-mx8mm/sl-mx8mm.c @@ -18,8 +18,37 @@ #include <mmc.h> #include <net.h> +#include "../common/hw-uid.h" + DECLARE_GLOBAL_DATA_PTR; +#if IS_ENABLED(CONFIG_KONTRON_HW_UID) + +struct uid_otp_loc uid_otp_locations[] = { + { + .addr = (u32 *)(OCOTP_BASE_ADDR + 0x7A0), + .len = 2, + .format = UID_OTP_FORMAT_DEC, + .desc = "BOARD" + }, + { + .addr = (u32 *)(OCOTP_BASE_ADDR + 0x780), + .len = 2, + .format = UID_OTP_FORMAT_DEC, + .desc = "SOM" + }, +#if IS_ENABLED(CONFIG_KONTRON_HW_UID_USE_SOC_FALLBACK) + { + .addr = (u32 *)(OCOTP_BASE_ADDR + 0x410), + .len = 2, + .format = UID_OTP_FORMAT_HEX, + .desc = "SOC" + } +#endif +}; + +#endif /* CONFIG_KONTRON_HW_UID */ + #if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) struct efi_fw_image fw_images[] = { { @@ -167,6 +196,9 @@ int board_late_init(void) env_set("touch_rst_gpio", "87"); } + if (IS_ENABLED(CONFIG_KONTRON_HW_UID)) + get_serial_number(uid_otp_locations, ARRAY_SIZE(uid_otp_locations)); + if (is_usb_boot()) { env_set("bootcmd", "fastboot 0"); env_set("bootdelay", "0"); |
