Compare commits

...
Author SHA1 Message Date
BFE EngineeringandClaude Haiku 5.5 a1bb3b4436 U-Boot: retune CPLL to 900 MHz for the 30 MHz panel mode
ci / qemu-tools (push) Successful in 6m11s
ci / patches-apply (push) Successful in 1m39s
ci / kernel-symbols (push) Successful in 5m17s
ci / test (push) Successful in 14s
ci / bench (push) Successful in 12s
ci / mcdc (push) Successful in 27s
ci / prune-artifacts (push) Skipped
ci / kernel-build (push) Skipped
ci / quality (push) Successful in 51s
ci / badges (push) Skipped
The dclk retune in 0001-display-and-boot-timing.patch used rate * 32
(960 MHz for a 30 MHz mode). Align it to 900 MHz so that the /30
divider gives the exact mode clock, as decided for SDK-vop-dclk-43
(pass 3). The retune still runs only when neither CPLL nor GPLL
divides the pixel clock exactly. The image built from this commit
has a new uboot digest and is not yet bench-gated or written.

Refs: flare-edge#3118 (cause 3), SDK-vop-dclk-43.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qGNpGNtFT7nhShpH56
2026-11-15 21:04:25 -06:00
BFE EngineeringandClaude Haiku 5.5 9705273f92 U-Boot flare_ab: drop the unproven p54 attribution from the reset note
ci / badges (push) Skipped
ci / test (push) Successful in 10s
ci / bench (push) Successful in 15s
ci / mcdc (push) Successful in 42s
ci / kernel-build (push) Skipped
ci / patches-apply (push) Successful in 1m25s
ci / prune-artifacts (push) Skipped
ci / kernel-symbols (push) Successful in 2m13s
ci / quality (push) Successful in 1m30s
ci / qemu-tools (push) Successful in 6m33s
The comment above flare_ab_global_reset() said that reset_cpu() ending in
hang() at the boot splash was the stall the p54 record shows
(flare-edge#3118). flare-edge#4569 records that this attribution has no
evidence: the p54 record shows attempt 3 on the recovery branch, where no
reset is issued, and the screen was never captured on serial.

Keep only the source-level finding (the WARM request writes CRU
glb_srst_snd, which does not reset this SoC; flare-edge#4554) and point to
flare-edge#4569 for the open p54 cause.

Comment-only change to 0003-flare-ab-slots.patch. The new-file index id of
common/flare_ab.c moves from 2b41ab8ca to ec685444d; the flare-edge pin and
the wiki pins that cite this commit move with it. check-patch-index.py
passes on the patch.

Refs flare-edge#5555, flare-edge#4554, flare-edge#4569.
Refs flare-edge#4565: the no-committed escalation message (printf in
flare_ab.c) was fixed in the previous commit, which did not cite it.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qGNpGNtFT7nhShpH56
2026-11-14 19:05:37 -06:00
BFE EngineeringandClaude Haiku 5.5 81d609fed3 U-Boot: no-committed ladder, USB download on failed boots [skip ci]
flare_ab keeps the frozen steady-state ladder. The selected committed
slot gets FLARE_AB_SLOT_TRIES (2) boot attempts per power session, then
the other committed slot if it is committed, then the recovery FIT, then
USB download. With no committed alternative the escalation goes from the
two attempts to the recovery FIT. The timed retry from an earlier attempt
(arm the DW watchdog, clear OS_REG4) was rejected by the item decision of
2026-11-06 and is not in this change.

A failed storage boot resets with the CRU glb_srst_fst poke
(flare_ab_global_reset) instead of do_reset(). On this SoC do_reset()
writes glb_srst_snd, which does not reset the chip, and reset_cpu() then
ends in hang() at the boot splash (flare-edge#4554). If the poke does not
take, the unit enters the USB download screens.

flare_ab_usb_download() draws logo_recovery.bmp, logs the return code,
runs download, and on return paints the screen again and re-enters
download after a pause. It never returns, and the unit never calls hang()
on these paths. The draw result was never logged before
(flare-edge#4564, flare-edge#4568).

The no-committed escalation message no longer says that both committed
slots failed when the other slot was never committed.

This does not establish the cause of the p54 splash-only screen
(flare-edge#4569). The bench serial lines (logo_recovery.bmp shown=N,
download returned N) decide it on bench a, which has not run yet.

Refs flare-edge#3118 (cause 3), flare-edge#3302, flare-edge#4554,
flare-edge#4564, flare-edge#4568, flare-edge#4569

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qGNpGNtFT7nhShpH56
2026-11-14 19:04:36 -06:00
2 changed files with 78 additions and 11 deletions
@@ -372,7 +372,7 @@ index a99846f4e..4fc64f33d 100644
+ * by this point, so nothing puts it back underneath us.
+ */
+ if ((priv->cpll_hz % rate) && (priv->gpll_hz % rate)) {
+ ulong want = rate * 32;
+ ulong want = 900 * MHz;
+
+ if (want >= 300 * MHz && want <= 1200 * MHz &&
+ !rockchip_pll_set_rate(&rv1106_pll_clks[CPLL],
@@ -142,10 +142,10 @@ index 52cd612d1..a81071566 100644
obj-$(CONFIG_AUTOBOOT) += autoboot.o
diff --git a/sysdrv/source/uboot/u-boot/common/flare_ab.c b/sysdrv/source/uboot/u-boot/common/flare_ab.c
new file mode 100644
index 000000000..6a5a07e37
index 000000000..ec685444d
--- /dev/null
+++ b/sysdrv/source/uboot/u-boot/common/flare_ab.c
@@ -0,0 +1,642 @@
@@ -0,0 +1,709 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * flare-edge A/B slot boot for U-Boot proper.
@@ -175,6 +175,9 @@ index 000000000..6a5a07e37
+#include <part.h>
+#include <flare_ab.h>
+#include <android_avb/avb_ab_flow.h>
+#if defined(CONFIG_DRM_ROCKCHIP)
+#include <video_rockchip.h>
+#endif
+
+/*
+ * Per-power-session boot-attempt escalation (warehouse deployment).
@@ -215,6 +218,8 @@ index 000000000..6a5a07e37
+ */
+#define FLARE_AB_GLB_RST_ST 0xff3b0c04u /* CRU reset-status: 0 on POR */
+#define FLARE_AB_SESSION_REG 0xff020210u /* PMU GRF OS_REG4: attempt count */
+#define FLARE_AB_GLB_SRST_FST 0xff3b0c08u /* CRU glb_srst_fst: global reset */
+#define FLARE_AB_GLB_SRST_KEY 0xfdb9u /* poke value that starts the reset */
+/*
+ * Attempts on the selected committed slot before failing over to the other
+ * committed slot; the other slot then gets the same budget before recovery.
@@ -551,7 +556,12 @@ index 000000000..6a5a07e37
+ return other;
+ }
+
+ printf("FLARE-AB: both committed slots failed this power session, recovery\n");
+ if (slot_is_bootable(&ab_data.slots[other]) &&
+ ab_data.slots[other].successful_boot)
+ printf("FLARE-AB: both committed slots failed this power session, recovery\n");
+ else
+ printf("FLARE-AB: slot %s failed %d attempts this session, no committed alternative, recovery\n",
+ pref ? "_b" : "_a", FLARE_AB_SLOT_TRIES);
+ flare_ab_force_recovery = 1;
+ return pref;
+}
@@ -707,6 +717,58 @@ index 000000000..6a5a07e37
+ ab_data_write(dev_desc, &ab_data);
+}
+
+/*
+ * Escalating reset after a failed storage boot.
+ *
+ * Do not call do_reset() here. On this SoC the U-Boot WARM request
+ * (sysreset_rockchip, ARM32 path) writes CRU glb_srst_snd (0xeca8), which
+ * does not reset the chip (flare-edge#4554). The p54 splash stall cause is
+ * not established (flare-edge#4569). The reset that works is the CRU
+ * glb_srst_fst poke that the Linux restart path and the bench scenarios use
+ * (docs/boot-flow.md, "Watchdog / reset facts"). It is a warm reset, so
+ * glb_rst_st stays nonzero and OS_REG4 carries the attempt count.
+ */
+static void flare_ab_global_reset(void)
+{
+ flare_ab_reg_write(FLARE_AB_GLB_SRST_FST, FLARE_AB_GLB_SRST_KEY);
+ /*
+ * A taken reset never returns. Reaching the next statement means the
+ * chip did not reset, so give the reset time to land before the caller
+ * falls through to the USB download screens.
+ */
+ udelay(100000);
+}
+
+/*
+ * USB download: the terminal state of every failed boot with no slot or
+ * recovery FIT left (decision 2026-11-06, flare-edge#3118 cause 3).
+ *
+ * The sad-face screen is logo_recovery.bmp. rockchip_show_bmp() can fail
+ * (-ENOMEM when the heap cannot hold the decode scratch after the failed FIT
+ * loads), and do_download() ignores that return, so the splash would stay up
+ * with no serial line saying why. The draw is made here and its result is
+ * logged. do_download() paints the same image again as its first step.
+ *
+ * `download` serves rockusb and is not expected to return. If it does (the
+ * USB session ended), the screen is painted again and download is re-entered
+ * after a pause, so the unit stays USB-flashable and never stops silently at
+ * the splash. This function does not return.
+ */
+static void flare_ab_usb_download(void)
+{
+ int rc;
+
+ for (;;) {
+#if defined(CONFIG_DRM_ROCKCHIP)
+ rc = rockchip_show_bmp("logo_recovery.bmp");
+ printf("FLARE-AB: logo_recovery.bmp shown=%d\n", rc);
+#endif
+ rc = run_command("download", 0);
+ printf("FLARE-AB: download returned %d, re-entering\n", rc);
+ udelay(1000000);
+ }
+}
+
+void flare_ab_boot_failed(void)
+{
+ if (!flare_ab_enabled())
@@ -723,8 +785,7 @@ index 000000000..6a5a07e37
+ * it over the existing USB port.
+ */
+ printf("FLARE-AB: recovery FIT unbootable, entering USB download\n");
+ run_command("download", 0);
+ hang();
+ flare_ab_usb_download();
+ }
+
+ /*
@@ -740,8 +801,14 @@ index 000000000..6a5a07e37
+ * written to flash for a committed slot.
+ */
+ printf("FLARE-AB: slot boot failed, resetting\n");
+ do_reset(NULL, 0, 0, NULL);
+ hang();
+ flare_ab_global_reset();
+ /*
+ * The reset did not take. Do not spin silently at the splash: enter the
+ * same USB download screens as the recovery branch above (sad face and
+ * USB plug, logo_recovery.bmp), where a host can reflash the unit.
+ */
+ printf("FLARE-AB: reset did not take, entering USB download\n");
+ flare_ab_usb_download();
+}
+
+void flare_ab_update_root_partition(void)
@@ -841,7 +908,7 @@ index 182c03771..ad73662eb 100644
return -1;
diff --git a/sysdrv/source/uboot/u-boot/include/flare_ab.h b/sysdrv/source/uboot/u-boot/include/flare_ab.h
new file mode 100644
index 000000000..d009525e0
index 000000000..6e51b405e
--- /dev/null
+++ b/sysdrv/source/uboot/u-boot/include/flare_ab.h
@@ -0,0 +1,73 @@
@@ -857,7 +924,7 @@ index 000000000..d009525e0
+ * per-attempt tries decrement, and fallback to the recovery FIT when
+ * both slots are exhausted.
+ *
+ * Linux-side counterpart: flared's slotctl module — the ONLY writer of
+ * Linux-side counterpart: flared's slotctl module, the ONLY writer of
+ * this metadata from userspace (CI-enforced).
+ */
+
@@ -891,7 +958,7 @@ index 000000000..d009525e0
+/*
+ * One boot attempt against the selected slot: decrement tries_remaining
+ * iff the slot is not yet successful (single-sector write, and no write
+ * at all in the successful steady state — spec fault 14 by construction).
+ * at all in the successful steady state, spec fault 14 by construction).
+ * No-op in recovery fallback mode or on a non-A/B layout.
+ */
+void flare_ab_boot_attempt(void);