From b697469f16ced5fe51dbbf0e64a8efe637425ee4 Mon Sep 17 00:00:00 2001 From: Jone Chou Date: Tue, 20 Dec 2022 20:42:46 +0800 Subject: power: reset: align all thermal shutdown scenario Senario: - warm reset -> debug boot -> memory wipe -> power off Commands: - adb reboot "shutdown,thermal[sub-reason]" - adb reboot "shutdown-thermal[sub-reason]" Bug: 263071957 signed-off-by: Jone Chou Change-Id: Idf2efd3bad865ee9f689509ffd0cdb6c5d7820f3 (cherry picked from commit 1f0b2f8aa0687abe6dd4a509fc46022a6a74e661) --- exynos-gs101-reboot.c | 4 ++-- exynos-gs201-reboot.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exynos-gs101-reboot.c b/exynos-gs101-reboot.c index 140585c..c9bd602 100644 --- a/exynos-gs101-reboot.c +++ b/exynos-gs101-reboot.c @@ -142,8 +142,8 @@ static void exynos_reboot_parse(const char *cmd) value = REBOOT_MODE_DMVERITY_CORRUPTED; } else if (!strcmp(cmd, "rescue")) { value = REBOOT_MODE_RESCUE; - } else if (!strcmp(cmd, "shutdown-thermal") || - !strcmp(cmd, "shutdown,thermal")) { + } else if (!strncmp(cmd, "shutdown-thermal", strlen("shutdown-thermal")) || + !strncmp(cmd, "shutdown,thermal", strlen("shutdown,thermal"))) { if (force_warm_reboot_on_thermal_shutdown) force_warm_reboot = true; value = REBOOT_MODE_SHUTDOWN_THERMAL; diff --git a/exynos-gs201-reboot.c b/exynos-gs201-reboot.c index bb658d0..224aa2d 100644 --- a/exynos-gs201-reboot.c +++ b/exynos-gs201-reboot.c @@ -83,8 +83,8 @@ static void exynos_reboot_parse(const char *cmd) value = REBOOT_MODE_DMVERITY_CORRUPTED; } else if (!strcmp(cmd, "rescue")) { value = REBOOT_MODE_RESCUE; - } else if (!strcmp(cmd, "shutdown-thermal") || - !strcmp(cmd, "shutdown,thermal")) { + } else if (!strncmp(cmd, "shutdown-thermal", strlen("shutdown-thermal")) || + !strncmp(cmd, "shutdown,thermal", strlen("shutdown,thermal"))) { if (force_warm_reboot_on_thermal_shutdown) force_warm_reboot = true; value = REBOOT_MODE_SHUTDOWN_THERMAL; -- cgit v1.2.3 From 9b4bb088cf8f02bcebece637f0a1a6c33f3db29d Mon Sep 17 00:00:00 2001 From: Jone Chou Date: Fri, 14 Apr 2023 15:47:48 +0800 Subject: power: reset: gs101: use PMU_INFORM2 for dump_gpr_mode Set DUMP_GPR_MODE to PMU_INFORM2 for all warm reset cases. Bug: 276356519 Signed-off-by: Jone Chou Change-Id: Ibfc017a71206f2472ef98d5b6d65a4887827eef2 --- exynos-gs101-reboot.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/exynos-gs101-reboot.c b/exynos-gs101-reboot.c index c9bd602..834b4e8 100644 --- a/exynos-gs101-reboot.c +++ b/exynos-gs101-reboot.c @@ -31,11 +31,14 @@ #define BMS_RSBM_VALID BIT(31) +#define DUMP_GPR_MODE (0xDAB) + static struct regmap *pmureg; static u32 warm_reboot_offset, warm_reboot_trigger; static u32 cold_reboot_offset, cold_reboot_trigger; static u32 reboot_cmd_offset; static u32 shutdown_offset, shutdown_trigger; +static u32 dump_gpr_offset; static phys_addr_t pmu_alive_base; static bool rsbm_supported; static bool force_warm_reboot_on_thermal_shutdown; @@ -199,6 +202,11 @@ static int exynos_restart_handler(struct notifier_block *this, unsigned long mod /* Do S/W Reset */ pr_emerg("%s: Exynos SoC reset right now\n", __func__); + if (reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) + set_priv_reg(pmu_alive_base + dump_gpr_offset, DUMP_GPR_MODE); + else + set_priv_reg(pmu_alive_base + dump_gpr_offset, 0x0); + if (s2mpg10_get_rev_id() == S2MPG10_EVT0 || !rsbm_supported || reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) { set_priv_reg(pmu_alive_base + warm_reboot_offset, warm_reboot_trigger); @@ -274,6 +282,11 @@ static int exynos_reboot_probe(struct platform_device *pdev) reboot_cmd_offset = EXYNOS_PMU_SYSIP_DAT0; } + if (of_property_read_u32(np, "dump-gpr-offset", &dump_gpr_offset) < 0) { + dev_err(dev, "failed to find dump-gpr-offset property\n"); + return -EINVAL; + } + force_warm_reboot_on_thermal_shutdown = of_property_read_bool(np, "force-warm-reboot-on-thermal-shutdown"); -- cgit v1.2.3