summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap
diff options
context:
space:
mode:
authorWadim Egorov <w.egorov@phytec.de>2015-02-12 10:30:55 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-02 07:54:13 +0100
commiteb657a510b68084c749f455f8edfe32f77c931c0 (patch)
treecd86bbb464839b614bc2c63fb3d50cbc2969e880 /arch/arm/mach-omap
parentc918022532fdb0ea47f6ecc87d3af5f85aae8fb5 (diff)
downloadbarebox-eb657a510b68084c749f455f8edfe32f77c931c0.tar.gz
barebox-eb657a510b68084c749f455f8edfe32f77c931c0.tar.xz
ARM: am33xx: Add support for reset reason detection
Also activate in defconfig. Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-omap')
-rw-r--r--arch/arm/mach-omap/am33xx_generic.c36
-rw-r--r--arch/arm/mach-omap/include/mach/am33xx-silicon.h1
2 files changed, 37 insertions, 0 deletions
diff --git a/arch/arm/mach-omap/am33xx_generic.c b/arch/arm/mach-omap/am33xx_generic.c
index 912138d419..ee30351fa4 100644
--- a/arch/arm/mach-omap/am33xx_generic.c
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -26,6 +26,7 @@
#include <mach/sys_info.h>
#include <mach/am33xx-generic.h>
#include <mach/gpmc.h>
+#include <reset_source.h>
void __noreturn am33xx_reset_cpu(unsigned long addr)
{
@@ -152,6 +153,38 @@ static int am33xx_bootsource(void)
return 0;
}
+static void am33xx_detect_reset_reason(void)
+{
+ uint32_t val = 0;
+
+ val = readl(AM33XX_PRM_RSTST);
+ /* clear AM33XX_PRM_RSTST - must be cleared by software
+ * (warm reset insensitive) */
+ writel(val, AM33XX_PRM_RSTST);
+
+ switch (val) {
+ case (1 << 9):
+ reset_source_set(RESET_JTAG);
+ break;
+ case (1 << 5):
+ reset_source_set(RESET_EXT);
+ break;
+ case (1 << 4):
+ case (1 << 3):
+ reset_source_set(RESET_WDG);
+ break;
+ case (1 << 1):
+ reset_source_set(RESET_RST);
+ break;
+ case (1 << 0):
+ reset_source_set(RESET_POR);
+ break;
+ default:
+ reset_source_set(RESET_UKWN);
+ break;
+ }
+}
+
int am33xx_register_ethaddr(int eth_id, int mac_id)
{
void __iomem *mac_id_low = (void *)AM33XX_MAC_ID0_LO + mac_id * 8;
@@ -209,6 +242,9 @@ int am33xx_init(void)
am33xx_enable_per_clocks();
+ if (IS_ENABLED(CONFIG_RESET_SOURCE))
+ am33xx_detect_reset_reason();
+
return am33xx_bootsource();
}
diff --git a/arch/arm/mach-omap/include/mach/am33xx-silicon.h b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
index 4e63b437ea..7c209ec5d8 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-silicon.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
@@ -68,6 +68,7 @@
#define AM33XX_PRM_RSTCTRL (AM33XX_PRM_BASE + 0x0f00)
#define AM33XX_PRM_RSTCTRL_RESET 0x1
+#define AM33XX_PRM_RSTST (AM33XX_PRM_BASE + 0x0f08)
/* CTRL */
#define AM33XX_CTRL_BASE (AM33XX_L4_WKUP_BASE + 0x210000)