feat: port MT76 firmware load and download script

Add chip::load_firmware(): validates the xow_dongle.bin header, DMAs
the ILM and DLM images in 0x3800-byte chunks over EP 0x04 OUT with
FCE completion polling, then loads the IVB and waits for the firmware
to start. Probe now issues a USB reset first (port of
usb_reset_device), matching xone_dongle_probe.

The chip keeps its firmware across a USB reset on macOS and does not
set the upstream reset-complete bit, so load_firmware falls back to
the running firmware when the chip is still alive. Verified on
hardware: fresh load and re-plug both return success.

Add scripts/download-firmware.sh (port of install/firmware.sh), which
fetches the driver CAB from Windows Update and extracts
firmware/xow_dongle.bin, hash-verified.

Co-Authored-By: qwen3.8-27b@q2_k_xl: ported firmware load and download script
This commit is contained in:
portersky
2026-08-17 16:35:34 +02:00
parent ccc5bc819d
commit 21dc0e09b3
7 changed files with 318 additions and 4 deletions
+12
View File
@@ -32,10 +32,22 @@ void test_efuse_registers(void)
TEST_ASSERT_EQUAL_UINT32(xone::mt76::mt_vend_type_cfg, 0x40000000u);
}
// Pin the firmware load layout to transport/mt76.c values.
void test_firmware_layout(void)
{
TEST_ASSERT_EQUAL_UINT32(xone::mt76::fw_ilm_offset, 0x080000);
TEST_ASSERT_EQUAL_UINT32(xone::mt76::fw_dlm_offset, 0x110800);
TEST_ASSERT_EQUAL_UINT32(xone::mt76::fw_chunk_size, 0x3800);
TEST_ASSERT_EQUAL_UINT32(sizeof(xone::mt76::fw_header), 32);
TEST_ASSERT_EQUAL_UINT32(xone::mt76::mt_fce_dma_addr, 0x0230);
TEST_ASSERT_EQUAL_UINT32(xone::mt76::mt_fce_dma_len, 0x0234);
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_bitfield_helpers);
RUN_TEST(test_efuse_registers);
RUN_TEST(test_firmware_layout);
return UNITY_END();
}