From f64d494576a3f78a4a76923ce283a208f39251d6 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Thu, 22 May 2014 11:37:50 +0200 Subject: Add arm-tegra-reboot-rcm.patch --- arm-tegra-reboot-rcm.patch | 59 ++++++++++++++++++++++++++++++++++++++++++++++ kernel.spec | 4 ++++ 2 files changed, 63 insertions(+) create mode 100644 arm-tegra-reboot-rcm.patch diff --git a/arm-tegra-reboot-rcm.patch b/arm-tegra-reboot-rcm.patch new file mode 100644 index 00000000..8b9f4153 --- /dev/null +++ b/arm-tegra-reboot-rcm.patch @@ -0,0 +1,59 @@ +The boot ROM on Tegra SoCs supports booting into forced recovery mode +(RCM) by setting a bit in the PMC scratch register 0. Similarily, the +Android bootloader examines some of the bits in this register to disable +autoboot or enter recovery mode. + +Support these modes by setting the corresponding bits depending on the +specified reboot command (forced-recovery, bootloader, recovery). Recent +systemd-based distributions allow this to be specified using an optional +argument to the reboot command. + +Signed-off-by: Thierry Reding +--- + arch/arm/mach-tegra/pmc.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c +index fb7920201ab4..7c7123e7557b 100644 +--- a/arch/arm/mach-tegra/pmc.c ++++ b/arch/arm/mach-tegra/pmc.c +@@ -41,6 +41,14 @@ + #define PMC_REMOVE_CLAMPING 0x34 + #define PMC_PWRGATE_STATUS 0x38 + ++#define PMC_SCRATCH0 0x50 ++#define PMC_SCRATCH0_MODE_RECOVERY (1 << 31) ++#define PMC_SCRATCH0_MODE_BOOTLOADER (1 << 30) ++#define PMC_SCRATCH0_MODE_RCM (1 << 1) ++#define PMC_SCRATCH0_MODE_MASK (PMC_SCRATCH0_MODE_RECOVERY | \ ++ PMC_SCRATCH0_MODE_BOOTLOADER | \ ++ PMC_SCRATCH0_MODE_RCM) ++ + #define PMC_CPUPWRGOOD_TIMER 0xc8 + #define PMC_CPUPWROFF_TIMER 0xcc + +@@ -165,6 +173,22 @@ void tegra_pmc_restart(enum reboot_mode mode, const char *cmd) + { + u32 val; + ++ val = tegra_pmc_readl(PMC_SCRATCH0); ++ val &= ~PMC_SCRATCH0_MODE_MASK; ++ ++ if (cmd) { ++ if (strcmp(cmd, "recovery") == 0) ++ val |= PMC_SCRATCH0_MODE_RECOVERY; ++ ++ if (strcmp(cmd, "bootloader") == 0) ++ val |= PMC_SCRATCH0_MODE_BOOTLOADER; ++ ++ if (strcmp(cmd, "forced-recovery") == 0) ++ val |= PMC_SCRATCH0_MODE_RCM; ++ } ++ ++ tegra_pmc_writel(val, PMC_SCRATCH0); ++ + val = tegra_pmc_readl(0); + val |= 0x10; + tegra_pmc_writel(val, 0); +-- +1.9.2 diff --git a/kernel.spec b/kernel.spec index 7caaf568..d2b19015 100644 --- a/kernel.spec +++ b/kernel.spec @@ -708,6 +708,8 @@ Patch21204: 0004-NOT_FOR_UPSTREAM-staging-nvec-remove-lid-and-power-e.patch Patch21205: 0005-NOT_FOR_UPSTREAM-staging-nvec-update-TODO.patch Patch21206: Update-panel-simple_3.15.patch +#http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/253575.html +Patch21210: arm-tegra-reboot-rcm.patch #rhbz 754518 Patch21235: scsi-sd_revalidate_disk-prevent-NULL-ptr-deref.patch @@ -1352,6 +1354,8 @@ ApplyPatch 0004-NOT_FOR_UPSTREAM-staging-nvec-remove-lid-and-power-e.patch ApplyPatch 0005-NOT_FOR_UPSTREAM-staging-nvec-update-TODO.patch ApplyPatch Update-panel-simple_3.15.patch +ApplyPatch arm-tegra-reboot-rcm.patch + # # bugfixes to drivers and filesystems -- cgit