From ae266f7efd1874c8245cde4838b727e4e20e4a5f Mon Sep 17 00:00:00 2001 From: Hyunki Koo Date: Mon, 28 May 2018 16:51:05 +0900 Subject: [PATCH] [COMMON] soc: samsung: exynos-reboot: Add reboot mode This patch add recovery and fastboot modet Change-Id: If8c490f3ec23c88e16718aed6d1a03da02ce48a4 Signed-off-by: Hyunki Koo --- drivers/soc/samsung/exynos-reboot.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/soc/samsung/exynos-reboot.c b/drivers/soc/samsung/exynos-reboot.c index 43b90efd7059..a1fe00c40663 100644 --- a/drivers/soc/samsung/exynos-reboot.c +++ b/drivers/soc/samsung/exynos-reboot.c @@ -67,6 +67,7 @@ int soc_has_big(void) #define SWRESET (0x0400) #define RESET_SEQUENCER_CONFIGURATION (0x0500) #define PS_HOLD_CONTROL (0x330C) +#define EXYNOS_PMU_SYSIP_DAT0 (0x0810) /* defines for BIG reset */ #define PEND_BIG (1 << 0) @@ -199,6 +200,13 @@ void big_reset_control(int en) #define INFORM_RAMDUMP 0xd #define INFORM_RECOVERY 0xf +#define REBOOT_MODE_NORMAL 0x00 +#define REBOOT_MODE_CHARGE 0x0A +/* Reboot into fastboot mode */ +#define REBOOT_MODE_FASTBOOT 0xFC +/* Reboot into recovery */ +#define REBOOT_MODE_RECOVERY 0xFF + #if !defined(CONFIG_SEC_REBOOT) #ifdef CONFIG_OF static void exynos_power_off(void) @@ -260,20 +268,26 @@ static void exynos_power_off(void) static void exynos_reboot(enum reboot_mode mode, const char *cmd) { - u32 restart_inform, soc_id, revision; + u32 soc_id, revision; + void __iomem *addr; if (!exynos_pmu_base) return; #ifdef CONFIG_EXYNOS_ACPM exynos_acpm_reboot(); #endif - restart_inform = INFORM_NONE; + printk("[%s] reboot cmd: %s\n", __func__, cmd); + addr = exynos_pmu_base + EXYNOS_PMU_SYSIP_DAT0; if (cmd) { - if (!strcmp((char *)cmd, "recovery")) - restart_inform = INFORM_RECOVERY; - else if(!strcmp((char *)cmd, "ramdump")) - restart_inform = INFORM_RAMDUMP; + if (!strcmp((char *)cmd, "charge")) { + __raw_writel(REBOOT_MODE_CHARGE, addr); + } else if (!strcmp(cmd, "bootloader") || !strcmp(cmd, "bl") || + !strcmp((char *)cmd, "fastboot") || !strcmp(cmd, "fb")) { + __raw_writel(REBOOT_MODE_FASTBOOT, addr); + } else if (!strcmp(cmd, "recovery")) { + __raw_writel(REBOOT_MODE_RECOVERY, addr); + } } /* Check by each SoC */ -- 2.20.1