From e13befb9258391056891b332955ca01e1714c834 Mon Sep 17 00:00:00 2001 From: mojyack Date: Wed, 4 Mar 2026 10:24:19 +0900 Subject: [PATCH] pp5020: ata: do not yield in ata_wait_intrq() Confirmed on iFlash-modded ipodvideo, USB mass storage connections frequently fail with bus resets during mount on macOS, and trigger "reset high-speed USB device" errors on Linux during sequential reads. The root cause is: storage_read_sectors() calls yield() via ata_wait_intrq(), which switches to the main thread running handle_usb_events() loop. This calls send_event(GUI_EVENT_ACTIONUPDATE), triggering LCD redraw that takes approximately 110ms. This stalls the ATA DMA completion, causing the USB bulk transfer to time out from the host's perspective. This commit removes the yield to prevent the reading thread from being preempted by the lengthy LCD redraw during DMA completion. This also improves sequential read throughput from ~13MB/s to ~18MB/s. Change-Id: Ia552f97aa0169c93c4f21e250d13dc3a626661d4 --- firmware/target/arm/pp/ata-pp5020.c | 1 - 1 file changed, 1 deletion(-) diff --git a/firmware/target/arm/pp/ata-pp5020.c b/firmware/target/arm/pp/ata-pp5020.c index 7351215693..3850f34fb1 100644 --- a/firmware/target/arm/pp/ata-pp5020.c +++ b/firmware/target/arm/pp/ata-pp5020.c @@ -154,7 +154,6 @@ static ICODE_ATTR int ata_wait_intrq(void) if (IDE0_CFG & IDE_CFG_INTRQ) return 1; ata_keep_active(); - yield(); } while (TIME_BEFORE(current_tick, timeout)); return 0; /* timeout */