diff options
author | Furquan Shaikh <furquan@google.com> | 2014-09-30 20:34:18 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-03-28 08:45:09 +0100 |
commit | 4d9dc8cf50445e9e3e637edbe89daf6602dec62f (patch) | |
tree | c5415e3accc5d5b1591b05aae94ba37d638f62dd /src/soc/nvidia | |
parent | c2115e3f383a0c5046f49497e1c48791b21d17d1 (diff) | |
download | coreboot-4d9dc8cf50445e9e3e637edbe89daf6602dec62f.tar.xz |
tegra132: Add support for pmc_rst_status get and print
BUG=None
BRANCH=None
TEST=Compiles successfully and pmc rst status POR is seen.
Change-Id: Ic09cb46d9be7670e467543e42b251efb1a4313d0
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 5dbfae6bbc0f4f30e216e37b515f4120f7833a38
Original-Change-Id: Id0c2b208222deaf099b8938ba583551979588d52
Original-Signed-off-by: Furquan Shaikh <furquan@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/220721
Original-Tested-by: Furquan Shaikh <furquan@chromium.org>
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/9106
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/nvidia')
-rw-r--r-- | src/soc/nvidia/tegra132/Makefile.inc | 1 | ||||
-rw-r--r-- | src/soc/nvidia/tegra132/bootblock.c | 2 | ||||
-rw-r--r-- | src/soc/nvidia/tegra132/pmc.h | 10 | ||||
-rw-r--r-- | src/soc/nvidia/tegra132/power.c | 22 | ||||
-rw-r--r-- | src/soc/nvidia/tegra132/power.h | 3 |
5 files changed, 38 insertions, 0 deletions
diff --git a/src/soc/nvidia/tegra132/Makefile.inc b/src/soc/nvidia/tegra132/Makefile.inc index 7603c70b40..38d7bc751c 100644 --- a/src/soc/nvidia/tegra132/Makefile.inc +++ b/src/soc/nvidia/tegra132/Makefile.inc @@ -8,6 +8,7 @@ bootblock-y += i2c.c bootblock-y += dma.c bootblock-y += monotonic_timer.c bootblock-y += padconfig.c +bootblock-y += power.c bootblock-y += funitcfg.c bootblock-y += reset.c bootblock-y += ../tegra/gpio.c diff --git a/src/soc/nvidia/tegra132/bootblock.c b/src/soc/nvidia/tegra132/bootblock.c index 7afe7b556d..6481eb3e4d 100644 --- a/src/soc/nvidia/tegra132/bootblock.c +++ b/src/soc/nvidia/tegra132/bootblock.c @@ -64,6 +64,8 @@ void main(void) printk(BIOS_INFO, "T132 bootblock: Clock init done\n"); + pmc_print_rst_status(); + bootblock_mainboard_init(); printk(BIOS_INFO, "T132 bootblock: Mainboard bootblock init done\n"); diff --git a/src/soc/nvidia/tegra132/pmc.h b/src/soc/nvidia/tegra132/pmc.h index 60d97c3cbe..119b3be54b 100644 --- a/src/soc/nvidia/tegra132/pmc.h +++ b/src/soc/nvidia/tegra132/pmc.h @@ -317,6 +317,16 @@ struct tegra_pmc_regs { check_member(tegra_pmc_regs, scratch119, 0x6fc); enum { + PMC_RST_STATUS_SOURCE_MASK = 0x7, + PMC_RST_STATUS_SOURCE_POR = 0x0, + PMC_RST_STATUS_SOURCE_WATCHDOG = 0x1, + PMC_RST_STATUS_SOURCE_SENSOR = 0x2, + PMC_RST_STATUS_SOURCE_SW_MAIN = 0x3, + PMC_RST_STATUS_SOURCE_LP0 = 0x4, + PMC_RST_STATUS_NUM_SOURCES = 0x5, +}; + +enum { PMC_PWRGATE_TOGGLE_PARTID_MASK = 0x1f, PMC_PWRGATE_TOGGLE_PARTID_SHIFT = 0, PMC_PWRGATE_TOGGLE_START = 0x1 << 8 diff --git a/src/soc/nvidia/tegra132/power.c b/src/soc/nvidia/tegra132/power.c index 5c7cc05ef4..679845c2ce 100644 --- a/src/soc/nvidia/tegra132/power.c +++ b/src/soc/nvidia/tegra132/power.c @@ -19,6 +19,7 @@ */ #include <arch/io.h> +#include <assert.h> #include <console/console.h> #include <soc/addressmap.h> @@ -55,3 +56,24 @@ void power_ungate_partition(uint32_t id) printk(BIOS_INFO, "Ungated power partition %d.\n", id); } + +uint8_t pmc_rst_status(void) +{ + return read32(&pmc->rst_status) & PMC_RST_STATUS_SOURCE_MASK; +} + +static const char *pmc_rst_status_str[PMC_RST_STATUS_NUM_SOURCES] = { + [PMC_RST_STATUS_SOURCE_POR] = "POR", + [PMC_RST_STATUS_SOURCE_WATCHDOG] = "Watchdog", + [PMC_RST_STATUS_SOURCE_SENSOR] = "Sensor", + [PMC_RST_STATUS_SOURCE_SW_MAIN] = "SW Main", + [PMC_RST_STATUS_SOURCE_LP0] = "LP0", +}; + +void pmc_print_rst_status(void) +{ + uint8_t rst_status = pmc_rst_status(); + assert(rst_status < PMC_RST_STATUS_NUM_SOURCES); + printk(BIOS_INFO, "PMC Reset Status: %s\n", + pmc_rst_status_str[rst_status]); +} diff --git a/src/soc/nvidia/tegra132/power.h b/src/soc/nvidia/tegra132/power.h index b36f91f15f..0dbcc5e082 100644 --- a/src/soc/nvidia/tegra132/power.h +++ b/src/soc/nvidia/tegra132/power.h @@ -24,4 +24,7 @@ void power_ungate_partition(uint32_t id); +uint8_t pmc_rst_status(void); +void pmc_print_rst_status(void); + #endif /* __SOC_NVIDIA_TEGRA132_POWER_H__ */ |