Commit a7bb3388 authored by Lin Huang's avatar Lin Huang Committed by Caesar Wang
Browse files

rockchip/rk3399: do secure timer init in pmusram



we will use timer in pmusarm, when logic power rail shutdown,
the secure timer will gone, so need to initial it in pmusram.

Change-Id: I472e7eec3fc197f56223e6fff9167556c1c5e3bc
Signed-off-by: default avatarLin Huang <hl@rock-chips.com>
parent 4c3770d9
...@@ -726,6 +726,8 @@ __pmusramfunc void dmc_resume(void) ...@@ -726,6 +726,8 @@ __pmusramfunc void dmc_resume(void)
uint32_t channel_mask = 0; uint32_t channel_mask = 0;
uint32_t channel; uint32_t channel;
sram_secure_timer_init();
/* /*
* we switch ddr clock to abpll when suspend, * we switch ddr clock to abpll when suspend,
* we set back to dpll here * we set back to dpll here
......
...@@ -101,6 +101,19 @@ void secure_watchdog_enable(void) ...@@ -101,6 +101,19 @@ void secure_watchdog_enable(void)
WMSK_BIT(PCLK_WDT_CM0_GATE_SHIFT)); WMSK_BIT(PCLK_WDT_CM0_GATE_SHIFT));
} }
__pmusramfunc void sram_secure_timer_init(void)
{
mmio_write_32(STIMER1_CHN_BASE(5) + TIMER_END_COUNT0, 0xffffffff);
mmio_write_32(STIMER1_CHN_BASE(5) + TIMER_END_COUNT1, 0xffffffff);
mmio_write_32(STIMER1_CHN_BASE(5) + TIMER_INIT_COUNT0, 0x0);
mmio_write_32(STIMER1_CHN_BASE(5) + TIMER_INIT_COUNT0, 0x0);
/* auto reload & enable the timer */
mmio_write_32(STIMER1_CHN_BASE(5) + TIMER_CONTROL_REG,
TIMER_EN | TIMER_FMODE);
}
void secure_timer_init(void) void secure_timer_init(void)
{ {
mmio_write_32(STIMER1_CHN_BASE(5) + TIMER_END_COUNT0, 0xffffffff); mmio_write_32(STIMER1_CHN_BASE(5) + TIMER_END_COUNT0, 0xffffffff);
......
...@@ -100,5 +100,6 @@ void secure_watchdog_enable(void); ...@@ -100,5 +100,6 @@ void secure_watchdog_enable(void);
void secure_timer_init(void); void secure_timer_init(void);
void secure_sgrf_init(void); void secure_sgrf_init(void);
void secure_sgrf_ddr_rgn_init(void); void secure_sgrf_ddr_rgn_init(void);
__pmusramfunc void sram_secure_timer_init(void);
#endif /* __PLAT_ROCKCHIP_RK3399_DRIVER_SECURE_H__ */ #endif /* __PLAT_ROCKCHIP_RK3399_DRIVER_SECURE_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment