[PATCH 0/3] arm: meson: extend sm calls to support Amlogic chip_id v1, v2

Evgeny Bachinin <[email protected]>
Newsgroups io.groups.u-boot-amlogic,org.u-boot-project.lists.u-boot
Message-ID <20250210-meson_chip_id_all_vers-v1-0-b98f8b6880b8@salutedevices.com>
The Amlogic Meson SoC secure monitor (TF-A) handles a call (0x82000044)
to retrieve a chip_id from eFuse OTP data [1].

Previously, this sm call (0x82000044) was used to retrieve just unique
SoC number [2] (a.k.a. SoC "serial" [3]), identifying particular die.
This SoC serial, stored in the eFuse, is always 12 bytes long.

However, this smc provides more info and the patch series generalizes
the API to provide SoC serial and support of chip_id.

Chip_id in eFuse OTP storage exists in two flavors [1]: v1 (12 bytes)
and v2 (16 bytes). The vendor U-Boot handles this difference before
returning the chip_id value to the client and generalizes versions to
look like the following (always 16 bytes in size):

    4 bytes      12 bytes
    +-------+-------------------+
    |       |                   |
    | CPUID | SOC SERIAL NUMBER |
    |       |                   |
    +-------+-------------------+
    0                          15

The original chip_id value is utilized in several algorithms (for
example, in the Amlogic boot protocols), making it crucial to have the
ability to read the original chip_id value as intended by the vendor [3]

Links:
[1] https://github.com/TrustedFirmware-A/trusted-firmware-a/blob/03a7a43e18927c876ef5f554e54fa11d252d4f7e/plat/amlogic/common/aml_sip_svc.c#L21
[2] https://lore.kernel.org/u-boot/[email protected]/
[3] https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#m630fbeea6a6e7d531290b5c0af205af4fb979757

Signed-off-by: Evgeny Bachinin <[email protected]>
---
Patch is based on:
- v5 of Linux patch series
  https://lore.kernel.org/linux-amlogic/[email protected]/

Tested:
* on A1, AXG.
* U-boot CI: https://github.com/u-boot/u-boot/pull/740/checks

---
Evgeny Bachinin (3):
      arm: meson: unify type being used for socinfo
      arm: meson: sm: get rid of SM_CHIP_ID_SIZE
      arch: arm: meson: support Amlogic chip_id v1 and v2

 arch/arm/include/asm/arch-meson/boot.h |  14 ++++
 arch/arm/include/asm/arch-meson/sm.h   |  48 ++++++++++++-
 arch/arm/mach-meson/board-info.c       |  13 ++--
 arch/arm/mach-meson/sm.c               | 120 ++++++++++++++++++++++++++++++---
 4 files changed, 179 insertions(+), 16 deletions(-)
---
base-commit: 6d41f0a39d6423c8e57e92ebbe9f8c0333a63f72
change-id: 20250208-meson_chip_id_all_vers-8ed402afae36

Best regards,
-- 
Evgeny Bachinin <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.