Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1bb3b4436 | ||
|
|
9705273f92 | ||
|
|
81d609fed3 |
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user