summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2017-06-27 13:41:47 +0800
committerAnson Huang <Anson.Huang@nxp.com>2017-07-12 23:33:09 +0800
commit865f6d5a5e800cf7eabcf581673e34e20a256861 (patch)
tree91be20aa9c48f4d26d339e2146a90a09e5121b5a
parentd2afe314fea30626de3f11b56efa11290d7a85e0 (diff)
imx8mq: add wdog reset
Add wdog reset support. Signed-off-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r--plat/freescale/imx8mq/imx8m_bl31_setup.c1
-rw-r--r--plat/freescale/imx8mq/imx8m_psci.c21
-rw-r--r--plat/freescale/imx8mq/include/platform_def.h2
3 files changed, 24 insertions, 0 deletions
diff --git a/plat/freescale/imx8mq/imx8m_bl31_setup.c b/plat/freescale/imx8mq/imx8m_bl31_setup.c
index b915e551..f8984a60 100644
--- a/plat/freescale/imx8mq/imx8m_bl31_setup.c
+++ b/plat/freescale/imx8mq/imx8m_bl31_setup.c
@@ -168,6 +168,7 @@ void bl31_plat_arch_setup(void)
mmap_add_region(IMX_SRC_BASE, IMX_SRC_BASE,
0x1000, MT_DEVICE | MT_RW);
mmap_add_region(IMX_GPC_BASE, IMX_GPC_BASE, 0x1000, MT_DEVICE | MT_RW);
+ mmap_add_region(IMX_WDOG_BASE, IMX_WDOG_BASE, 0x1000, MT_DEVICE | MT_RW);
mmap_add_region(IMX_ANAMIX_BASE, IMX_ANAMIX_BASE, 0x1000, MT_DEVICE | MT_RW);
mmap_add_region(PLAT_GICD_BASE, PLAT_GICD_BASE, 0x80000,
MT_DEVICE | MT_RW);
diff --git a/plat/freescale/imx8mq/imx8m_psci.c b/plat/freescale/imx8mq/imx8m_psci.c
index f53c81eb..117188b7 100644
--- a/plat/freescale/imx8mq/imx8m_psci.c
+++ b/plat/freescale/imx8mq/imx8m_psci.c
@@ -191,6 +191,26 @@ void imx_get_sys_suspend_power_state(psci_power_state_t *req_state)
req_state->pwr_domain_state[i] = PLAT_MAX_RET_STATE;
}
+void __attribute__((noreturn)) imx_system_reset(void)
+{
+ uintptr_t wdog_base = IMX_WDOG_BASE;
+ unsigned int val;
+
+ /* WDOG_B reset */
+ val = mmio_read_16(wdog_base);
+#ifdef IMX_WDOG_B_RESET
+ val = (val & 0x00FF) | (7 << 2) | (1 << 0);
+#else
+ val = (val & 0x00FF) | (4 << 2) | (1 << 0);
+#endif
+ mmio_write_16(wdog_base, val);
+
+ mmio_write_16(wdog_base + 0x2, 0x5555);
+ mmio_write_16(wdog_base + 0x2, 0xaaaa);
+ while (1)
+ ;
+}
+
static const plat_psci_ops_t imx_plat_psci_ops = {
.pwr_domain_on = imx_pwr_domain_on,
.pwr_domain_on_finish = imx_pwr_domain_on_finish,
@@ -201,6 +221,7 @@ static const plat_psci_ops_t imx_plat_psci_ops = {
.pwr_domain_suspend = imx_domain_suspend,
.pwr_domain_suspend_finish = imx_domain_suspend_finish,
.get_sys_suspend_power_state = imx_get_sys_suspend_power_state,
+ .system_reset = imx_system_reset,
};
/* export the platform specific psci ops */
diff --git a/plat/freescale/imx8mq/include/platform_def.h b/plat/freescale/imx8mq/include/platform_def.h
index 8d5dffb7..058cd4ef 100644
--- a/plat/freescale/imx8mq/include/platform_def.h
+++ b/plat/freescale/imx8mq/include/platform_def.h
@@ -45,8 +45,10 @@
#define IMX_ANAMIX_BASE 0x30360000
#define IMX_SRC_BASE 0x30390000
#define IMX_GPC_BASE 0x303a0000
+#define IMX_WDOG_BASE 0x30280000
#define COUNTER_FREQUENCY 8000000 /* 8MHz */
#define DEBUG_CONSOLE 0
+#define IMX_WDOG_B_RESET
#define PLAT_IMX8M 1