Skip to content

Commit

Permalink
snagrecover: am62x: Issue correct DFU command sequence
Browse files Browse the repository at this point in the history
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 <romain.gantois@bootlin.com>
  • Loading branch information
rgantois committed Feb 20, 2024
1 parent fc7ebd6 commit 76ab499
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/snagrecover/firmware/firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
13 changes: 12 additions & 1 deletion src/snagrecover/recoveries/am62x.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 76ab499

Please sign in to comment.