Skip to contentSkip to conversation

arm64: zynqmp: Use sysreset framework for reset and poweroff

PATCH Applied Michal Simek 2 participants 5 messages Jul 13, 2021 – Jul 26, 2021 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

cover arm64: zynqmp: Use sysreset framework for reset and poweroff

Hi,

it is time to do reset/poweroff via sysreset framework to align it with psci 1.1 spec.

Thanks,
Michal

Michal Simek (3):
psci: Do not define do_poweroff() if CONFIG_SYSRESET_CMD_POWEROFF is
enabled
arm64: zynqmp: Do not define do_reset() if sysreset is enabled
arm64: zynqmp: Enable reset and poweroff via sysreset framework

 board/xilinx/zynqmp/zynqmp.c         | 2 ++
 configs/xilinx_zynqmp_virt_defconfig | 3 +++
 drivers/firmware/psci.c              | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/3 psci: Do not define do_poweroff() if CONFIG_SYSRESET_CMD_POWEROFF is enabled

CONFIG_SYSRESET_CMD_POWEROFF defines do_poweroff() in sysreset-uclass.c that's why don't define it twice when both CONFIG_SYSRESET_CMD_POWEROFF and CONFIG_CMD_POWEROFF are enabled. CONFIG_SYSRESET_CMD_POWEROFF depends on CONFIG_CMD_POWEROFF.

---

 drivers/firmware/psci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/psci.c +1 -1
index 89cb7d88e5b3..657e7eb5aea3 100644
@@ -210,7 +210,7 @@ void psci_sys_poweroff(void)
 	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
 }
 
-#ifdef CONFIG_CMD_POWEROFF
+#if IS_ENABLED(CONFIG_CMD_POWEROFF) && !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
 int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	do_psci_probe();
Signature · 1 line
2.32.0
#2 lore raw

PATCH 2/3 arm64: zynqmp: Do not define do_reset() if sysreset is enabled

In reply to Michal Simek

The SPL can also be compiled with sysreset drivers just fine, so update the condition to cater for that option.
The same change was done by commit efa1a62ad2dd ("ARM: imx8m: Do not define do_reset() if sysreset is enabled").

---

 board/xilinx/zynqmp/zynqmp.c | 2 ++
 1 file changed, 2 insertions(+)
board/xilinx/zynqmp/zynqmp.c +2 -0
index 18d5c515def1..38c910fa5bab 100644
@@ -499,9 +499,11 @@ int dram_init(void)
 }
 #endif
 
+#if !CONFIG_IS_ENABLED(SYSRESET)
 void reset_cpu(void)
 {
 }
+#endif
 
 static u8 __maybe_unused zynqmp_get_bootmode(void)
 {
Signature · 1 line
2.32.0
#3 lore raw

PATCH 3/3 arm64: zynqmp: Enable reset and poweroff via sysreset framework

In reply to Michal Simek

reset and poweroff are called via hooks in psci driver which is going around sysreset framework that's why enable sysreset drivers and do reset and poweroff via this framework. Using this flow will allow us to call SYSTEM_WARM_RESET based on psci 1.1 spec which can be calles with reset -w command.

---

 configs/xilinx_zynqmp_virt_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/xilinx_zynqmp_virt_defconfig +3 -0
index 5f32ca49300f..bac1e181d265 100644
@@ -157,6 +157,9 @@ CONFIG_ZYNQ_SERIAL=y
 CONFIG_SPI=y
 CONFIG_ZYNQ_SPI=y
 CONFIG_ZYNQMP_GQSPI=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_CMD_POWEROFF=y
+CONFIG_SYSRESET_PSCI=y
 CONFIG_TPM2_TIS_SPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
Signature · 1 line
2.32.0
Applied
#4 lore raw
In reply to Michal Simek

út 13. 7. 2021 v 17:04 odesílatel Michal Simek <[email protected]> napsal:

Quoted 16 lines

Hi,

it is time to do reset/poweroff via sysreset framework to align it with psci 1.1 spec.

Thanks,
Michal

Michal Simek (3):
psci: Do not define do_poweroff() if CONFIG_SYSRESET_CMD_POWEROFF is
enabled
arm64: zynqmp: Do not define do_reset() if sysreset is enabled
arm64: zynqmp: Enable reset and poweroff via sysreset framework

Quoted 8 lines
 board/xilinx/zynqmp/zynqmp.c         | 2 ++
 configs/xilinx_zynqmp_virt_defconfig | 3 +++
 drivers/firmware/psci.c              | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

--
2.32.0

Applied.
M

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs