Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
0778836
wb7, wb8: enable pstore/ramoops support in kernel config
evgeny-boger Jul 5, 2026
9331a0f
soc: sunxi: wb: warm-reset via SoC watchdog on panic when ramoops pre…
evgeny-boger Jul 5, 2026
f41160e
mfd: wbec: know the newer EC poweron reasons
evgeny-boger Jul 5, 2026
cc0b8be
wb7, wb8: ship fixed pstore/ramoops reserved-memory node in DTBs
evgeny-boger Jul 5, 2026
2c7ae13
soc: sunxi: wb: brake panic warm-reset loops via an RTC reset-reason …
evgeny-boger Jul 5, 2026
aa805ee
soc: sunxi: wb: fix stale top-of-DRAM header; only log re-arm when he…
evgeny-boger Jul 5, 2026
f2228f1
wb7, wb8: move fixed ramoops region to 0x43800000 (below decompressio…
evgeny-boger Jul 5, 2026
4b4abb2
wb7: document ramoops 0x43800000 clearance on R40 (no build guard, WB…
evgeny-boger Jul 6, 2026
51f5ee4
mfd: wbec: quiet the expected v1-protocol fallback
evgeny-boger Jul 6, 2026
c946339
soc: sunxi: wb: extend the panic-loop breadcrumb to R40
evgeny-boger Jul 6, 2026
99b3567
soc: sunxi: wb: R40 has no usable loop-brake breadcrumb (panic path w…
evgeny-boger Jul 7, 2026
c05acf3
wb7: correct R40 ramoops-node comments (retention validated, U-Boot g…
evgeny-boger Jul 7, 2026
55ace43
soc: sunxi: wb: give R40 a DRAM breadcrumb so the panic-loop brake works
evgeny-boger Jul 7, 2026
68b52d3
soc: sunxi: wb: resolve the R40 breadcrumb address from DT, not a har…
evgeny-boger Jul 7, 2026
6a8f3ae
soc: sunxi: wb: note the DRAM breadcrumb read is not guaranteed bit-p…
evgeny-boger Jul 7, 2026
d736a37
soc: sunxi: wb: use the RTC breadcrumb for R40 like H616 (revert the …
evgeny-boger Jul 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions arch/arm/boot/dts/allwinner/sun8i-r40-wirenboard72x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,36 @@
stdout-path = "serial0:115200n8";
};

/* Fixed-address pstore/ramoops region; survives a warm reset so the
* same kernel can harvest it even under an old U-Boot with no shuttle.
* The base MUST match U-Boot WB_RAMOOPS_BASE (0x43800000).
*
* The address was chosen for the arm64/H616 boot map but is reused
* here for R40. On R40 it clears the used load addresses (fdt
* 0x43000000, overlay 0x43300000) and sits ~4 MiB above the stock
* RAMDISK_ADDR_R (0x43400000). WB firmware boots without an initrd
* (bootz "... - ..."), so ramdisk_addr_r is unused; if that ever
* changes, an initrd >4 MiB would overlap this region. The WB7 U-Boot
* shuttle carries R40 static_asserts bounding this address against
* RAMDISK_ADDR_R, so such an env change trips a build error there.
* Retention validated on real WB7.4.2 hardware (panic -> sun4i WDT
* warm reset -> kernel harvests dmesg + console from this region).
*/
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;

ramoops@43800000 {
compatible = "ramoops";
reg = <0x43800000 0x100000>;
record-size = <0x20000>;
console-size = <0x40000>;
ecc-size = <32>;
no-map;
};
};

regulators {
compatible = "simple-bus";
#address-cells = <1>;
Expand Down
30 changes: 30 additions & 0 deletions arch/arm/boot/dts/allwinner/sun8i-r40-wirenboard74x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,36 @@
stdout-path = "serial0:115200n8";
};

/* Fixed-address pstore/ramoops region; survives a warm reset so the
* same kernel can harvest it even under an old U-Boot with no shuttle.
* The base MUST match U-Boot WB_RAMOOPS_BASE (0x43800000).
*
* The address was chosen for the arm64/H616 boot map but is reused
* here for R40. On R40 it clears the used load addresses (fdt
* 0x43000000, overlay 0x43300000) and sits ~4 MiB above the stock
* RAMDISK_ADDR_R (0x43400000). WB firmware boots without an initrd
* (bootz "... - ..."), so ramdisk_addr_r is unused; if that ever
* changes, an initrd >4 MiB would overlap this region. The WB7 U-Boot
* shuttle carries R40 static_asserts bounding this address against
* RAMDISK_ADDR_R, so such an env change trips a build error there.
* Retention validated on real WB7.4.2 hardware (panic -> sun4i WDT
* warm reset -> kernel harvests dmesg + console from this region).
*/
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;

ramoops@43800000 {
compatible = "ramoops";
reg = <0x43800000 0x100000>;
record-size = <0x20000>;
console-size = <0x40000>;
ecc-size = <32>;
no-map;
};
};

regulators {
compatible = "simple-bus";
#address-cells = <1>;
Expand Down
9 changes: 9 additions & 0 deletions arch/arm/configs/wirenboard7_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -591,3 +591,12 @@ CONFIG_PREEMPTIRQ_DELAY_TEST=m
CONFIG_STRICT_DEVMEM=y
CONFIG_DEBUG_USER=y
CONFIG_CONFIGFS_FS=y

# Pstore/ramoops: persist kernel panic + console logs in a RAM region
# across warm resets. The reserved-memory "ramoops" node is injected by
# the Wiren Board U-Boot DT fixup (WIRENBOARD_RAMOOPS_FIXUP); without it
# these options are inert. PSTORE_RAM auto-selects REED_SOLOMON*.
CONFIG_PSTORE=y
CONFIG_PSTORE_RAM=y
CONFIG_PSTORE_CONSOLE=y
CONFIG_WB_RAMOOPS_PANIC_RESET=y
19 changes: 19 additions & 0 deletions arch/arm64/boot/dts/allwinner/sun50i-h616-wirenboard84x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,25 @@
rtc_onboard = &rtc_onboard;
};

/* Fixed-address pstore/ramoops region; survives a warm reset so the
* same kernel can harvest it even under an old U-Boot with no shuttle.
* The base MUST match U-Boot WB_RAMOOPS_BASE (0x43800000).
*/
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;

ramoops@43800000 {
compatible = "ramoops";
reg = <0x0 0x43800000 0x0 0x100000>;
record-size = <0x20000>;
console-size = <0x40000>;
ecc-size = <32>;
no-map;
};
};

wirenboard {
adc-type = <3>;
pwm-buzzer = <1>;
Expand Down
15 changes: 15 additions & 0 deletions arch/arm64/boot/dts/allwinner/sun50i-h616-wirenboard85x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,21 @@
alloc-ranges = <0x0 0x00000000 0x0 0x80000000>;
linux,cma-default;
};

/* Fixed-address pstore/ramoops region; survives a warm reset so
* the same kernel can harvest it even under an old U-Boot with no
* shuttle. The base MUST match U-Boot WB_RAMOOPS_BASE (0x43800000).
* #address-cells/#size-cells/ranges (2/2) are inherited from the
* /reserved-memory node in sun50i-h616.dtsi that this merges into.
*/
ramoops@43800000 {
compatible = "ramoops";
reg = <0x0 0x43800000 0x0 0x100000>;
record-size = <0x20000>;
console-size = <0x40000>;
ecc-size = <32>;
no-map;
};
};

soc {
Expand Down
9 changes: 9 additions & 0 deletions arch/arm64/configs/wb8.config
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,12 @@ CONFIG_SUN50I_H6_PRCM_PPU=y

#SOUND
CONFIG_SND_HDA_PREALLOC_SIZE=2048

# Pstore/ramoops: persist kernel panic + console logs in a RAM region
# across warm resets. The reserved-memory "ramoops" node is injected by
# the Wiren Board U-Boot DT fixup (WIRENBOARD_RAMOOPS_FIXUP); without it
# these options are inert. PSTORE_RAM auto-selects REED_SOLOMON*.
CONFIG_PSTORE=y
CONFIG_PSTORE_RAM=y
CONFIG_PSTORE_CONSOLE=y
CONFIG_WB_RAMOOPS_PANIC_RESET=y
29 changes: 21 additions & 8 deletions drivers/mfd/wbec.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,21 @@
/* For power off WBEC activates PWON pin on PMIC for 6s */
#define WBEC_POWER_RESET_DELAY_MS 10000

/*
* Mirrors LINUX_POWERON_REASON in wb-embedded-controller src/wbec.c;
* append-only ABI.
*/
static const char * const wbec_poweron_reason[] = {
"Power supply on",
"Power button",
"RTC alarm",
"Reboot",
"Reboot instead of poweroff",
"Watchdog",
"PMIC is unexpectedly off",
[0] = "Power supply on",
[1] = "Power button",
[2] = "RTC alarm",
[3] = "Reboot",
[4] = "Reboot instead of poweroff",
[5] = "Watchdog",
[6] = "PMIC is unexpectedly off",
[7] = "Unknown",
[8] = "Watchdog (warm reset)",
[9] = "Full power cycle request",
};

static const struct regmap_config wbec_regmap_config_v1 = {
Expand Down Expand Up @@ -354,7 +361,13 @@ static int wbec_probe(struct spi_device *spi)

ret = wbec_check_present(wbec);
if (ret == -ENODEV) {
dev_info(wbec->dev, "WBEC not found with v2 protocol, trying v1\n");
/*
* Expected on every board that speaks the v1 protocol (the v2
* pad-word protocol is a newer-EC feature): probe v2 first, then
* fall back to v1. Keep this at debug level so a normal v1 board
* does not log a scary "not found" line during ordinary probing.
*/
dev_dbg(wbec->dev, "no WBEC on v2 protocol, falling back to v1\n");
/* don't worry about memory leak, previous regmap will be freed by devm */
wbec->regmap = devm_regmap_init_spi(spi, &wbec_regmap_config_v1);

Expand Down
11 changes: 11 additions & 0 deletions drivers/soc/sunxi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ config SUNXI_SRAM
Say y here to enable the SRAM controller support. This
device is responsible on mapping the SRAM in the sunXi SoCs
whether to the CPU/DMA, or to the devices.

config WB_RAMOOPS_PANIC_RESET
bool "Wiren Board: SoC watchdog warm reset on panic when ramoops is present"
depends on ARCH_SUNXI && PSTORE_RAM
help
On panic, arm the (otherwise idle) SoC watchdog so a Wiren
Board 7 (Allwinner R40/A40i) or Wiren Board 8 (Allwinner
T507/H616) takes a DRAM-preserving warm reset and the panic
log survives in the ramoops region for the bootloader to
persist. Arms itself only when a ramoops reserved-memory
node is present.
1 change: 1 addition & 0 deletions drivers/soc/sunxi/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_SUNXI_MBUS) += sunxi_mbus.o
obj-$(CONFIG_SUNXI_SRAM) += sunxi_sram.o
obj-$(CONFIG_WB_RAMOOPS_PANIC_RESET) += wb-ramoops-panic-reset.o
Loading