openwrt/target/linux/bcm27xx/patches-6.1/950-1217-firmware-psci-Pass-given-partition-number-through.patch
Marty Jones 2e715fb4fc bcm27xx: update 6.1 patches to latest version
Add support for BCM2712 (Raspberry Pi 5).
3bb5880ab3
Patches were generated from the diff between linux kernel branch linux-6.1.y
and rpi-6.1.y from raspberry pi kernel source:
- git format-patch linux-6.1.y...rpi-6.1.y

Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2710/RPi3B, bcm2711/RPi4B

Signed-off-by: Marty Jones <mj8263788@gmail.com>
[Remove applied and reverted patches, squash patches and config commits]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-01-25 17:46:45 +01:00

34 lines
1.2 KiB
Diff

From 6988ae7c909dc342322a82daaa3a95b78d038305 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 11 Dec 2023 16:58:07 +0000
Subject: [PATCH] firmware/psci: Pass given partition number through
Pi 5 uses BL31 as its armstub file, so the reset goes via PSCI. Parse
any "reboot" parameter as a partition number to reboot into.
N.B. This code path is only used if reboot mode has been set to warm
or soft.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/firmware/psci/psci.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -314,7 +314,14 @@ static int psci_sys_reset(struct notifie
* reset_type[30:0] = 0 (SYSTEM_WARM_RESET)
* cookie = 0 (ignored by the implementation)
*/
- invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0);
+ // Allow extra arguments separated by spaces after
+ // the partition number.
+ unsigned long val;
+ u8 partition = 0;
+
+ if (data && sscanf(data, "%lu", &val) == 1 && val < 63)
+ partition = val;
+ invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, partition, 0);
} else {
invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
}