From 8eb47f474b29444a1f45c88c871e493692b4559f Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Thu, 1 Oct 2026 22:59:14 +0200 Subject: [PATCH] rk27xx: copy a page of every plane at a time copy_sectors() copied one destination raw page at a time, so on a two-plane part every page of a copy took two programs and two tPROG. Its buffer already holds a page of every plane: copy that much at once, and flash_program() programs the planes together. Copies are most of the programs when the FTL closes blocks that random writes left part written. Over USB mass storage on a Samsung YP-CP3 a stress test that ran 66792 one-plane programs ran 692 now, with 43958 two-plane ones, and its program time fell from 85 s to 59 s. Co-Authored-By: Claude Opus 5.5 Change-Id: Icc60d250ecc75c83c2d817efb7678333bffe3137 --- firmware/target/arm/rk27xx/flash-rk27xx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/target/arm/rk27xx/flash-rk27xx.c b/firmware/target/arm/rk27xx/flash-rk27xx.c index c4ba1b6dee..abb203175c 100644 --- a/firmware/target/arm/rk27xx/flash-rk27xx.c +++ b/firmware/target/arm/rk27xx/flash-rk27xx.c @@ -714,9 +714,9 @@ static int copy_sectors(uint32_t src, uint32_t dst, unsigned n, { while (k < n && ret == 0) { - /* one destination raw page at a time */ - uint32_t len = geo.sec_per_page_raw - - (dst + k) % geo.sec_per_page_raw; + /* one destination page of every plane at a time, for + * flash_program() to program the planes together */ + uint32_t len = geo.sec_per_page - (dst + k) % geo.sec_per_page; uint32_t i = 0; if (len > n - k)