From 76ab499b9b1cd9ce7771be05725a687272d10fc0 Mon Sep 17 00:00:00 2001 From: Romain Gantois Date: Tue, 20 Feb 2024 17:20:25 +0100 Subject: [PATCH] snagrecover: am62x: Issue correct DFU command sequence Newer versions of U-Boot for AM62x platforms have a different behavior when booting from DFU. With previous versions, U-Boot proper and SPL would both run after a single detach. With recent versions, only spl runs after the first detach and u-boot proper has to be sent again. Change the AM62x recovery procedure to accomodate these newer U-Boot versions. Signed-off-by: Romain Gantois --- src/snagrecover/firmware/firmware.py | 3 +-- src/snagrecover/recoveries/am62x.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/snagrecover/firmware/firmware.py b/src/snagrecover/firmware/firmware.py index 8aa3432..7d24ec0 100644 --- a/src/snagrecover/firmware/firmware.py +++ b/src/snagrecover/firmware/firmware.py @@ -74,8 +74,7 @@ def am62x_run(dev: usb.core.Device, fw_name: str, fw_blob: bytes): print("Downloading file...") dfu_cmd.download_and_run(fw_blob, partid, offset=0, size=len(fw_blob)) print("Done") - if fw_name == "tispl": - # run tispl firmware + if fw_name == "u-boot": print("Sending detach command...") dfu_cmd.detach(partid) diff --git a/src/snagrecover/recoveries/am62x.py b/src/snagrecover/recoveries/am62x.py index 1609e42..f8a2b98 100644 --- a/src/snagrecover/recoveries/am62x.py +++ b/src/snagrecover/recoveries/am62x.py @@ -18,6 +18,17 @@ def main(): usb_addr = parse_usb_addr(recovery_config["firmware"]["tiboot3"]["usb"]) dev = get_usb(usb_addr) - run_firmware(dev, "u-boot") + run_firmware(dev, "tispl") + run_firmware(dev, "u-boot") + + time.sleep(2) + + # For newer versions of U-Boot, only SPL will run from the + # previous commands and the u-boot firmware should be sent + # one more time. + + dev = get_usb(usb_addr, error_on_fail=False) + if dev is not None: + run_firmware(dev, "u-boot")