On the Genio 520 and 720 EVKs (MT8189), the DRAM size and some memory
reserved for the DRAM controller depend on the DRAM fitted to the board.
The devicetree built into U-Boot can't describe them, but the DDR loader
that starts U-Boot SPL has this information.

The DDR loader describes them with a devicetree overlay in a Firmware
Handoff transfer list: a memory node with the DRAM size and a no-map
reserved-memory node for each region. U-Boot proper already applies
such overlays, but only when the transfer list also contains its
devicetree.

v1 made U-Boot proper apply the overlays to the devicetree it found by
other means. Following the discussion on v1, SPL now adds the devicetree
of U-Boot proper to the transfer list instead (patch 2), and passes the
list on to U-Boot proper in registers, so the existing code applies the
overlays. When the transfer list has no room for the devicetree, SPL
moves it to a bigger buffer, so the DDR loader doesn't need to know how
big the devicetree is.

Patch 1 makes BLOBLIST_PASSAGE_MANDATORY apply to U-Boot proper only,
so that SPL doesn't require a devicetree in the transfer list from the
DDR loader.

Patch 4 stops SPL when the DDR loader doesn't pass the overlay, and
patch 5 makes U-Boot proper require the transfer list. U-Boot proper
started as BL33 by the platform BL2 then needs a BL2 that passes a
transfer list with its devicetree as well.

Patch 6 drops a reservation that the OS must not get, and patch 7
passes the reserved regions on to the devicetree of the OS, which may
come from somewhere else other than U-Boot.

Patches 4 and 7 are common MediaTek code, enabled with
MTK_DRAM_DESC_HANDOFF, since the DRAM initialization on MT8366 (Genio
360) has the same code to reserve memory for the DRAM controller. Genio
360 support for this will come in a later series.

Tested on a Genio 520 EVK booting from eMMC.

Signed-off-by: David Lechner <[email protected]>
---
Changes in v2:
- Drop "fdtdec: apply bloblist DT overlays to the built-in devicetree".
  SPL now adds the devicetree of U-Boot proper to the transfer list.
- New patches 1, 2 and 4 to 8; patches 6 and 7 pass the reserved regions
  on to the OS.
- Reword "configs: mt8189: enable bloblist support" for the DDR loader.
- Put the SPL check and the reserved-memory copy in common MediaTek code,
  enabled with MTK_DRAM_DESC_HANDOFF.
- Depend on "bloblist: fixes for transfer lists from TF-A v2.15",
  "spl: pass the bloblist to the next phase in registers" and
  "mediatek: mt8189: add U-Boot SPL boot for Genio 520 and 720".
- Link to v1: 
https://patch.msgid.link/[email protected]

---
David Lechner (8):
      bloblist: limit BLOBLIST_PASSAGE_MANDATORY to U-Boot proper
      spl: add the devicetree of the next phase to the bloblist
      configs: mt8189: enable bloblist support
      arm: mediatek: require the DRAM description from the earlier boot stage
      configs: mt8189: pass the DRAM description from SPL to U-Boot proper
      arm: dts: mediatek: drop the DSI reserved memory on Genio 520/720
      arm: mediatek: pass reserved memory on to the OS
      doc: board: mediatek: describe the Genio 520 and 720 DRAM handoff

 arch/arm/dts/mt8371-genio-common.dtsi   |  5 --
 arch/arm/mach-mediatek/Kconfig          | 17 +++++++
 arch/arm/mach-mediatek/Makefile         |  3 ++
 arch/arm/mach-mediatek/dram_desc.c      | 52 +++++++++++++++++++++
 arch/arm/mach-mediatek/spl.c            | 31 ++++++++++++
 common/Kconfig                          | 18 +++++++
 common/bloblist.c                       |  4 +-
 common/spl/spl.c                        | 83 +++++++++++++++++++++++++++++++++
 configs/mt8189.config                   |  6 +++
 doc/board/mediatek/mt8189-genio-evk.rst | 79 ++++++++++++++++++++++++++++---
 lib/fdtdec.c                            |  2 +-
 11 files changed, 286 insertions(+), 14 deletions(-)
---
base-commit: d1d45c926a571fb6c1e6d7105c280833646915ea
base-tree: https://git.u-boot-project.org/u-boot/u-boot.git main
change-id: 20261013-mtk-mt8189-tfa-fdt-94283317c6c0
prerequisite-change-id: 20261104-bloblist-tl-fixes-4e2617a399c6:v1
prerequisite-patch-id: 316b1610fc2e3953677ec152eee8cd5035723f82
prerequisite-patch-id: 55680c05d9c25c1a5fbd05e2b9f91a5bb1e4c350
prerequisite-change-id: 20261103-spl-bloblist-pass-regs-3130cf768211:v2
prerequisite-patch-id: 2aa06c6d07b125147e3a6bcdc620e19f9c5885df
prerequisite-patch-id: eb93f71f16b3641ae6a369b1b3113656656f65e3
prerequisite-patch-id: 575d26f405980ef8a1be726c9ca0df679eb77d84
prerequisite-patch-id: 6b9e9c6e1f9cbc0ef3b716cd8615430680354877
prerequisite-change-id: 20261013-mtk-genio-720-spl-1620416c6224:v2
prerequisite-patch-id: f109e3e09ffe96d42ba64923f72a2081764a0837
prerequisite-patch-id: 1b7d8c90462884a830b2c4e43bbc7b7d698d7410
prerequisite-patch-id: 8f4cb6976f7c28cf7c2acf3e81ce240e47dcb113
prerequisite-patch-id: 789a3616e548a97eb48ffd62cd59f114bda6d94b
prerequisite-patch-id: 521533b5bb8d1e145d036ea7f9f9e8a7f0856e78
prerequisite-patch-id: 7debdd01277d15f23a983475c7b7bbf05af82175

Best regards,
--  
David Lechner <[email protected]>

Reply via email to