Skip to content

snagrecover: th1520: Add T-Head TH1520 support - #110

Open
tprrt wants to merge 1 commit into
bootlin:mainfrom
tprrt:dev/tprrt/th1520-recovery
Open

tprrt wants to merge 1 commit into
bootlin:mainfrom
tprrt:dev/tprrt/th1520-recovery

Conversation

@tprrt

@tprrt tprrt commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

The ROM code of the TH1520 exposes a Fastboot interface in USB download mode (2345:7654). Download the image holding SPL, OpenSBI and U-Boot to the "ram" pseudo-partition and start it with "reboot". SPL initializes the DRAM, so no other boot stage is needed.

Tested on a BeagleV-Ahead with the vendor U-Boot SPL.

snagrecover -s th1520 -f th1520-beaglev-ahead.yaml --loglevel debug
2026-10-15 15:51:37,510 [DEBUG] Searching for USB device paths matching 2345:7654...
2026-10-15 15:51:37,534 [DEBUG] recovery_config:{'soc_model': 'th1520', 'soc_family': 'th1520', 'usb_path': (9, (2, 3, 2, 5, 3)), 'firmware': {'u-boot': {'path': '/home/tperrot/Downloads/ahead-yocto-1.1.2-20230610/u-boot-with-spl.bin'}}, 'args': {'soc': 'th1520', 'firmware_file': ['th1520-beaglev-ahead.yaml'], 'firmware': None, 'uart': None, 'baudrate': 115200, 'netns': 'snagbootnet', 'loglevel': 'debug', 'logfile': 'board_recovery.log', 'rom_usb': None, 'usb_path': None, 'list_socs': False, 'version': False, 'template': None, 'udev': False, 'am335x_setup': False}}
2026-10-15 15:51:37,534 [INFO] Starting recovery of th1520 board
2026-10-15 15:51:37,538 [INFO] Installing firmware u-boot
2026-10-15 15:51:37,538 [INFO] Downloading file...
2026-10-15 15:51:37,541 [DEBUG] fastboot DATA length: 963760
2026-10-15 15:51:37,790 [INFO] fastboot OKAY
2026-10-15 15:51:37,791 [DEBUG] fastboot OKAY
2026-10-15 15:51:37,791 [INFO] Done
2026-10-15 15:51:37,792 [INFO] Starting firmware...
2026-10-15 15:51:37,793 [DEBUG] fastboot OKAY
2026-10-15 15:51:37,793 [INFO] Done
2026-10-15 15:51:37,793 [INFO] Done installing firmware u-boot
2026-10-15 15:51:37,794 [INFO] Done recovering th1520 board
2026-10-15 15:51:37,794 [INFO] Logs were appended to board_recovery.log
picocom /dev/ttyUSB0
brom_ver 7
[APP][E] protocol_connect failed, exit.
Starting download of 963760 bytes

downloading of 963760 bytes finished

U-Boot SPL 2020.01 (Jun 10 2023 - 20:19:32 +0000)
FM[1] lpddr4x singlerank freq=3733 64bit dbi_off=n sdram init
ddr initialized, jump to uboot
image has no header


U-Boot 2020.01 (Jun 10 2023 - 20:19:32 +0000)

CPU:   rv64imafdcvsu
Model: T-HEAD c910 light
DRAM:  4 GiB
C910 CPU FREQ: 750MHz
AHB2_CPUSYS_HCLK FREQ: 250MHz
AHB3_CPUSYS_PCLK FREQ: 125MHz
PERISYS_AHB_HCLK FREQ: 250MHz
PERISYS_APB_PCLK FREQ: 62MHz
GMAC PLL POSTDIV FREQ: 1000MHZ
DPU0 PLL POSTDIV FREQ: 1188MHZ
DPU1 PLL POSTDIV FREQ: 1188MHZ
MMC:   sdhci@ffe7080000: 0, sd@ffe7090000: 1
Loading Environment from MMC... OK
Error reading output register
Warning: cannot get lcd-en GPIO
LCD panel cannot be found : -121
splash screen startup cost 15 ms
In:    serial
Out:   serial
Err:   serial
## Resetting to default environment
env ethaddr not exist or invalid
env eth1addr not exist or invalid
Saving Environment to MMC... Writing to MMC(0)... OK
Writing GPT: success!
dwc3_gadget_start maximum_speed:5 revision:0x5533330b
dwc3_gadget_start DWC3_DCFG:0x80804
dwc3_gadget_conndone_interrupt speed:0 dwc3_dsts:0x20000
dwc3_gadget_conndone_interrupt speed:0 dwc3_dsts:0x3ec68
Net:
Warning: ethernet@ffe7070000 (eth0) using random MAC address - 2e:03:45:04:99:06
eth0: ethernet@ffe7070000ethernet@ffe7070000:0 is connected to ethernet@ffe7070000.  Reconnecting to ethernet@ffe7060000

Warning: ethernet@ffe7060000 (eth1) using random MAC address - d6:fe:c4:4d:ff:03
, eth1: ethernet@ffe7060000
Hit any key to stop autoboot:  0
C910 Light#
C910 Light#

The ROM code of the TH1520 exposes a Fastboot interface in USB download
mode (2345:7654). Download the image holding SPL, OpenSBI and U-Boot to
the "ram" pseudo-partition and start it with "reboot". SPL initializes
the DRAM, so no other boot stage is needed.

Tested on a BeagleV-Ahead with the vendor U-Boot SPL.

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
@tprrt
tprrt requested a review from rgantois October 15, 2026 15:01
pseudo-partition, then started with the "reboot" command.

The commands are sent exactly as the stock fastboot client sends
them (no trailing NUL byte), since the ROM code is not known to

@jacmet jacmet Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean "not known to" or "known to not"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants