This series adds dynamic device tree selection from FIT images for
Qualcomm Snapdragon platforms, enabling U-Boot to select the
appropriate DTB based on hardware parameters detected at boot.

Qualcomm FIT-based DTB format is documented in [1].

The FIT image contains only DTBs, while the kernel is provided
separately as part of a UKI image.

The implementation consists of:

1. Hardware detection infrastructure: Introduces the qcom,hwinfo
   driver and qcom_hwdetect helper to collect hardware identification
   data from SMEM, IMEM and TCSR into a single qcom_hw_params
   structure for consumers such as FIT multi-DTB selection.

2. FIT multi-DTB selection: Implements DTB selection based on the
   aggregated hardware information. The code parses metadata DTBs,
   matches FIT configurations against detected hardware attributes,
   applies overlays, and loads the selected DTB for EFI boot.

[1] https://github.com/qualcomm-linux/qcom-dtb-metadata/blob/main/
    Documentation.md

---

Changes in v4:
1. Drop the SMEM cache infrastructure.

2. misc: qcom: add qcom,hwinfo driver to provide a common interface
   for reading IMEM boot cookie and TCSR SOC version information.

3. arm: snapdragon: add qcom_hwdetect helper to aggregate hardware
   information from SMEM, IMEM and TCSR into a single
   struct qcom_hw_params.

4. Refactor FIT multi-DTB selection to consume qcom_hw_params instead
   of accessing SMEM, IMEM and TCSR data directly.

5. Separate hardware discovery from FIT parsing and DTB matching
   logic, reducing complexity and improving code organization.

6. Load FIT images directly from a raw GPT partition and remove the
   FAT filesystem image based loading approach.

7. Drop IH_TYPE_FATFS, mkimage FAT image generation support and
   related documentation updates.

8. arm: dts: enable qcom,hwinfo on qcs9100-ride-r3, qcs615-ride and
   qcs6490-rb3gen2 by adding the required qcom,hwinfo DT nodes and
   board-specific offsets.

Link to v3:
https://lore.kernel.org/u-boot/[email protected]/

Changes in v3:
1. Runtime IMEM address lookup via DT: Removed CONFIG_QCOM_IMEM_SIZE Kconfig 
option.
   Added qcom_imem_table[] mapping SoC compatible strings to IMEM addresses.

2. Split SoC version sources: SoC hardware version now read from TCSR register 
via
   qcom_read_tcsr_soc_version(). The soc_info->plat_ver from SMEM is stored 
separately
   as board_version. Added socver and boardrev metadata node matching for 
finer-grained DTB selection.

3. qcom_load_fit_image() returns int: Changed return type from efi_status_t to 
int,
   returning standard Linux error codes for consistency with the rest of the 
driver.

4. Code cleanup: strtok() replaced with strsep(); memcpy + manual 
null-termination replaced with strlcpy();
   DDR thresholds use SZ_* macros; compatible matching and FDT loading 
extracted into dedicated helpers.

5. image: add IH_TYPE_FATFS image type: Added new fatfs image type to represent 
a raw FAT
   filesystem partition image, registered in the image type lookup table.

6. mkimage: add fatfs image type for FAT partition images: Added fatimage.c 
handler that
   uses mkfs.vfat and mcopy to create FAT images from a directory.
   New --fat-extra-space, --fat-type, --fat-volume-id, --fat-mkfs-opts long 
options added
   to mkimage.

7. doc: document mkimage fatfs type and Qualcomm multi-DTB: Updated 
'doc/mkimage.1' for the new
   fatfs type and options. Added 'doc/board/qualcomm/multi_dtb.rst' covering 
FIT ITS configuration,
   QCOM metadata format, socver/boardrev guidelines, and image creation steps.

Link to v2:
https://lore.kernel.org/u-boot/[email protected]/

Changes in v2:
1. In v1, a combined DTB format was used for multi-DTB support. Based on
   feedback, v2 implements FIT-based DTB selection instead.
Link to v1: 
https://lore.kernel.org/all/[email protected]/


Aswin Murugan (5):
  misc: qcom: Add HW-Info aggregator driver
  arm: snapdragon: Add hardware detection helper
  arm: snapdragon: Add FIT multi-DTB selection support
  configs: qcom_defconfig: Enable QCOM_FIT_MULTIDTB
  arm: dts: Enable qcom,hwinfo on qcs9100-ride-r3, qcs615-ride and
    qcs6490-rb3gen2

 arch/arm/dts/qcs615-ride-u-boot.dtsi         |   10 +
 arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi     |   10 +
 arch/arm/dts/qcs9100-ride-r3-u-boot.dtsi     |   10 +
 arch/arm/mach-snapdragon/Kconfig             |   17 +
 arch/arm/mach-snapdragon/Makefile            |    2 +
 arch/arm/mach-snapdragon/board.c             |    7 +
 arch/arm/mach-snapdragon/qcom_fit_multidtb.c | 1033 ++++++++++++++++++
 arch/arm/mach-snapdragon/qcom_fit_multidtb.h |   61 ++
 arch/arm/mach-snapdragon/qcom_hwdetect.c     |  167 +++
 arch/arm/mach-snapdragon/qcom_hwdetect.h     |   52 +
 configs/qcom_defconfig                       |    2 +
 drivers/misc/Kconfig                         |    9 +
 drivers/misc/Makefile                        |    1 +
 drivers/misc/qcom_hwinfo.c                   |  160 +++
 include/qcom_hwinfo.h                        |  109 ++
 15 files changed, 1650 insertions(+)
 create mode 100644 arch/arm/mach-snapdragon/qcom_fit_multidtb.c
 create mode 100644 arch/arm/mach-snapdragon/qcom_fit_multidtb.h
 create mode 100644 arch/arm/mach-snapdragon/qcom_hwdetect.c
 create mode 100644 arch/arm/mach-snapdragon/qcom_hwdetect.h
 create mode 100644 drivers/misc/qcom_hwinfo.c
 create mode 100644 include/qcom_hwinfo.h

-- 
2.34.1

Reply via email to