Commit 9706c077 authored by Olof Johansson's avatar Olof Johansson

Merge tag 'tegra-for-3.16-soc' of...

Merge tag 'tegra-for-3.16-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into next/soc

Merge "ARM: tegra: core code changes for 3.16" from Stephen Warren:

This branch contains just a single patch this time around. Thierry
enhanced Tegra's restart code to allow programming PMC scratch registers
to request specific behaviour after reboot. One of the most useful
options for mainline software is the ability to reboot directly into USB
recovery mode, which e.g. allows the bootloader to be reflashed.

* tag 'tegra-for-3.16-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  ARM: tegra: Support reboot modes
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents 0b3534be 498bb3da
...@@ -41,6 +41,14 @@ ...@@ -41,6 +41,14 @@
#define PMC_REMOVE_CLAMPING 0x34 #define PMC_REMOVE_CLAMPING 0x34
#define PMC_PWRGATE_STATUS 0x38 #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_CPUPWRGOOD_TIMER 0xc8
#define PMC_CPUPWROFF_TIMER 0xcc #define PMC_CPUPWROFF_TIMER 0xcc
...@@ -165,6 +173,22 @@ void tegra_pmc_restart(enum reboot_mode mode, const char *cmd) ...@@ -165,6 +173,22 @@ void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
{ {
u32 val; 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 = tegra_pmc_readl(0);
val |= 0x10; val |= 0x10;
tegra_pmc_writel(val, 0); tegra_pmc_writel(val, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment