summaryrefslogtreecommitdiff
path: root/plat/rockchip
diff options
context:
space:
mode:
authorDerek Basehore <dbasehore@chromium.org>2017-02-24 14:33:03 +0800
committerXing Zheng <zhengxing@rock-chips.com>2017-02-24 20:07:44 +0800
commitc6e15d1437a50a17b17ff852ec6850e21f73d677 (patch)
tree91962431614528eb408e5a0019d4a9c7a7f9c4e9 /plat/rockchip
parentad84ad49b3cb72346184613db8ef87add65a9e7e (diff)
rockchip: rk3399: fix hang in ddr set rate
This fixes a hang with setting the DRAM rate based on a race condition with the M0 which sets the DRAM rate. The AP can also starve the M0, so this also delays the AP reads to the DONE parameter for the M0. Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Diffstat (limited to 'plat/rockchip')
-rw-r--r--plat/rockchip/rk3399/drivers/pmu/m0_ctl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/plat/rockchip/rk3399/drivers/pmu/m0_ctl.c b/plat/rockchip/rk3399/drivers/pmu/m0_ctl.c
index 4df0195b..6f9a25cd 100644
--- a/plat/rockchip/rk3399/drivers/pmu/m0_ctl.c
+++ b/plat/rockchip/rk3399/drivers/pmu/m0_ctl.c
@@ -31,6 +31,7 @@
#include <arch_helpers.h>
#include <assert.h>
#include <debug.h>
+#include <delay_timer.h>
#include <mmio.h>
#include <m0_ctl.h>
#include <plat_private.h>
@@ -70,6 +71,7 @@ void m0_start(void)
{
/* clean the PARAM_M0_DONE flag, mean that M0 will start working */
mmio_write_32(M0_PARAM_ADDR + PARAM_M0_DONE, 0);
+ dmbst();
/* enable clocks for M0 */
mmio_write_32(PMUCRU_BASE + PMUCRU_CLKGATE_CON2,
@@ -93,6 +95,12 @@ void m0_stop(void)
void m0_wait_done(void)
{
- while (mmio_read_32(M0_PARAM_ADDR + PARAM_M0_DONE) != M0_DONE_FLAG)
+ while (mmio_read_32(M0_PARAM_ADDR + PARAM_M0_DONE) != M0_DONE_FLAG) {
+ /*
+ * Don't starve the M0 for access to SRAM, so delay before
+ * reading the PARAM_M0_DONE value again.
+ */
+ udelay(5);
dsb();
+ }
}