summaryrefslogtreecommitdiff
path: root/plat/imx/imx8mq
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2017-06-27 13:41:47 +0800
committerAbel Vesa <abel.vesa@nxp.com>2018-06-11 10:08:38 +0300
commitf5327694e3c1b71dd4a396300bf3587d5e6bb645 (patch)
treec076de888ab09b53f3ac47090db296cbbeae8547 /plat/imx/imx8mq
parent8fc449e3c1474e779c2c4f2d3c001cda89a9289a (diff)
imx8mq: add wdog reset
Add wdog reset support. Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'plat/imx/imx8mq')
-rw-r--r--plat/imx/imx8mq/imx8m_bl31_setup.c1
-rw-r--r--plat/imx/imx8mq/imx8m_psci.c21
-rw-r--r--plat/imx/imx8mq/include/platform_def.h2
3 files changed, 24 insertions, 0 deletions
diff --git a/plat/imx/imx8mq/imx8m_bl31_setup.c b/plat/imx/imx8mq/imx8m_bl31_setup.c
index 660fbb86..0fd7e636 100644
--- a/plat/imx/imx8mq/imx8m_bl31_setup.c
+++ b/plat/imx/imx8mq/imx8m_bl31_setup.c
@@ -162,6 +162,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/imx/imx8mq/imx8m_psci.c b/plat/imx/imx8mq/imx8m_psci.c
index 8a156173..82b07a8d 100644
--- a/plat/imx/imx8mq/imx8m_psci.c
+++ b/plat/imx/imx8mq/imx8m_psci.c
@@ -190,6 +190,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,
@@ -200,6 +220,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/imx/imx8mq/include/platform_def.h b/plat/imx/imx8mq/include/platform_def.h
index 8d5dffb7..058cd4ef 100644
--- a/plat/imx/imx8mq/include/platform_def.h
+++ b/plat/imx/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