ARM: tegra: core code changes for 3.16

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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJTdlZ5AAoJEMzrak5tbycxzBYP/3w8M/VNvK79hkPwAzvHUi2U
 xh4eDX1LrUv8KvXXYCEtZ9+m3fpDSsmUurvAZipBNpdt28ELWKWT9iUQzhmQs0dc
 8FqvqRrl1BNeY+35J0wmxrUv7Q2m41AQnOIQmm5VC0WiR5Na4GzUvCqm8GCjrMse
 TnF3/a12p+IlVxcP966/LFR5H00FPtrhTgi4GiU+jIsqjPNPUw2/6GfV1GzqJscH
 okJe5uAwDUrJiXvk1oJvyXS9qTLiiC2FOK2iBVzfr6pVo/JBcm4KQuMUnmXtrJau
 f+juCeM4bLGrNiOZzvgwuhlWCU83GeJ5J5dXKOAsZe/LOvkhiZOOGHMod4hVS3nT
 BYdv9rL66qHkvNkwxYqxnNOphPpqdrX5PbxOcBKQ4Wq8BCfOmbRvwPUt9YslYEK1
 md5/HQCBefyn7B5cjnRc/hUf1pLIH1cqzub2jSYYgiiBV/LBr5mSUZQUqV9cujqI
 J+Io8txiXkAFZ9hFgny+/knJV4MHhg/d3Ml/EicoGwZeL0mmnbtMc3qvTXkrIca6
 DBp8uCe2AP9KrEI3sHxILUyTA45ujPWT5z41v4jvmrTSJ8kQlzlEVqNdASWPxNOH
 g/wfIJqkY6JvkDJdwGvu1UusjrvuySQRJpLBtMl2N0aVb3JFB4v9GayAn5ijcqof
 yn2qq5S+NHCMdtp8AnXs
 =l5yt
 -----END PGP SIGNATURE-----

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: Olof Johansson <olof@lixom.net>
This commit is contained in:
Olof Johansson 2014-05-21 15:04:52 -07:00
Родитель 0b3534be65 498bb3da7e
Коммит 9706c077d8
1 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -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);