gc_bba_test: disambiguate the speed sweep result

'highest good = 0' meant both 'only index 0 works' and 'nothing works', which
are opposite diagnoses -- the first says oversampling, the second rules it
out.  Now reports the per-index map and says NONE explicitly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 12:43:11 +02:00
parent 7df0c97c78
commit e682fded4a
+10 -3
View File
@@ -139,6 +139,7 @@ static int t_speed_sweep(char *m, size_t n)
{
u32 saved = bba_speed, s;
u32 best = 0;
int any = 0;
char buf[40];
int off = 0;
buf[0] = 0;
@@ -149,11 +150,17 @@ static int t_speed_sweep(char *m, size_t n)
if (bba_r8(REG_NWAYS) != NWAYS_LINKUP) bad++;
off += snprintf(buf + off, sizeof(buf) - off, "%s%u", s ? "," : "",
(unsigned)(bad ? 0 : 1));
if (!bad) best = s;
if (!bad) { best = s; any = 1; }
}
bba_speed = saved;
snprintf(m, n, "idx0..5 ok=[%s]; highest good = %u", buf, (unsigned)best);
return best >= EXI_SPEED32MHZ ? 0 : 1;
/* `best` of 0 is ambiguous (index 0 works vs nothing works), so report
* the per-index map and say NONE explicitly. */
if (!any)
snprintf(m, n, "ok=[%s] NONE work - not an oversampling issue", buf);
else
snprintf(m, n, "ok=[%s] highest good idx=%u (5=27MHz)", buf,
(unsigned)best);
return (any && best >= EXI_SPEED32MHZ) ? 0 : 1;
}
static int t_gap_sweep(char *m, size_t n)