summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/soc/nvidia/tegra132/Makefile.inc1
-rw-r--r--src/soc/nvidia/tegra132/bootblock.c2
-rw-r--r--src/soc/nvidia/tegra132/pmc.h10
-rw-r--r--src/soc/nvidia/tegra132/power.c22
-rw-r--r--src/soc/nvidia/tegra132/power.h3
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__ */