aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-05-06 11:04:11 -0400
committerStephen Warren <swarren@nvidia.com>2014-05-07 11:58:03 -0400
commit498bb3da7e04ed82d9b66106c4baeb3000a7100e (patch)
treef4095319c121505340805cda85ebb667e6132955 /arch/arm/mach-tegra
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
ARM: tegra: Support reboot modes
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 <treding@nvidia.com> Tested-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r--arch/arm/mach-tegra/pmc.c24
1 files changed, 24 insertions, 0 deletions
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 @@
41#define PMC_REMOVE_CLAMPING 0x34 41#define PMC_REMOVE_CLAMPING 0x34
42#define PMC_PWRGATE_STATUS 0x38 42#define PMC_PWRGATE_STATUS 0x38
43 43
44#define PMC_SCRATCH0 0x50
45#define PMC_SCRATCH0_MODE_RECOVERY (1 << 31)
46#define PMC_SCRATCH0_MODE_BOOTLOADER (1 << 30)
47#define PMC_SCRATCH0_MODE_RCM (1 << 1)
48#define PMC_SCRATCH0_MODE_MASK (PMC_SCRATCH0_MODE_RECOVERY | \
49 PMC_SCRATCH0_MODE_BOOTLOADER | \
50 PMC_SCRATCH0_MODE_RCM)
51
44#define PMC_CPUPWRGOOD_TIMER 0xc8 52#define PMC_CPUPWRGOOD_TIMER 0xc8
45#define PMC_CPUPWROFF_TIMER 0xcc 53#define PMC_CPUPWROFF_TIMER 0xcc
46 54
@@ -165,6 +173,22 @@ void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
165{ 173{
166 u32 val; 174 u32 val;
167 175
176 val = tegra_pmc_readl(PMC_SCRATCH0);
177 val &= ~PMC_SCRATCH0_MODE_MASK;
178
179 if (cmd) {
180 if (strcmp(cmd, "recovery") == 0)
181 val |= PMC_SCRATCH0_MODE_RECOVERY;
182
183 if (strcmp(cmd, "bootloader") == 0)
184 val |= PMC_SCRATCH0_MODE_BOOTLOADER;
185
186 if (strcmp(cmd, "forced-recovery") == 0)
187 val |= PMC_SCRATCH0_MODE_RCM;
188 }
189
190 tegra_pmc_writel(val, PMC_SCRATCH0);
191
168 val = tegra_pmc_readl(0); 192 val = tegra_pmc_readl(0);
169 val |= 0x10; 193 val |= 0x10;
170 tegra_pmc_writel(val, 0); 194 tegra_pmc_writel(val, 0);