diff options
author | Redick Lin <redicklin@google.com> | 2021-12-17 00:13:44 +0800 |
---|---|---|
committer | Will McVicker <willmcvicker@google.com> | 2022-05-20 15:04:39 -0700 |
commit | 46c506decce88672c5b09225cba33bc25ee0a4a6 (patch) | |
tree | 43b6901f7e131526c17db54387a3cdbe4fc22bb4 | |
parent | 0dfd7e36b67774021d61a40c57aef66c25befbbd (diff) | |
download | raviole-device-46c506decce88672c5b09225cba33bc25ee0a4a6.tar.gz |
acpm: wait for ACPM IPC flushing before SICD
Bug: 205073890
Change-Id: I3f00ca96521127107a672de9e223f4838b737059
Signed-off-by: Redick Lin <redicklin@google.com>
(cherry picked from commit 213f3e8d99898f00ac31bcd4a2d13f0ecc8d16b3)
Signed-off-by: Will McVicker <willmcvicker@google.com>
-rw-r--r-- | drivers/soc/google/acpm/acpm_ipc.c | 27 | ||||
-rw-r--r-- | drivers/soc/google/exynos-cpupm.c | 2 | ||||
-rw-r--r-- | include/soc/google/acpm_ipc_ctrl.h | 6 |
3 files changed, 24 insertions, 11 deletions
diff --git a/drivers/soc/google/acpm/acpm_ipc.c b/drivers/soc/google/acpm/acpm_ipc.c index c4451ef38..f4c87549d 100644 --- a/drivers/soc/google/acpm/acpm_ipc.c +++ b/drivers/soc/google/acpm/acpm_ipc.c @@ -90,20 +90,33 @@ u64 get_frc_time(void) } EXPORT_SYMBOL_GPL(get_frc_time); -#define IPC_AP_FVP_CAL 0 -bool is_acpm_ipc_busy(void) +#define IPC_AP_FVP_CAL 0 +#define IPC_BUSY_CHK_CNT 500 + +bool is_acpm_ipc_flushed(void) { struct acpm_ipc_ch *channel; unsigned int channel_id = IPC_AP_FVP_CAL; - unsigned int tx_front, rx_front; + volatile unsigned int tx_front, rx_front; + unsigned int wait_cnt = 0; + bool ret = false; channel = &acpm_ipc->channel[channel_id]; - tx_front = __raw_readl(channel->tx_ch.front); - rx_front = __raw_readl(channel->rx_ch.front); - return (tx_front != rx_front); + while (wait_cnt++ <= IPC_BUSY_CHK_CNT) { + tx_front = __raw_readl(channel->tx_ch.front); + rx_front = __raw_readl(channel->rx_ch.front); + + if (tx_front == rx_front) { + /*mbox req has been flushed*/ + ret = true; + break; + } else + udelay(10); + } + return ret; } -EXPORT_SYMBOL_GPL(is_acpm_ipc_busy); +EXPORT_SYMBOL_GPL(is_acpm_ipc_flushed); static int plugins_init(struct device_node *node) { diff --git a/drivers/soc/google/exynos-cpupm.c b/drivers/soc/google/exynos-cpupm.c index 064374ee8..5baa2a29f 100644 --- a/drivers/soc/google/exynos-cpupm.c +++ b/drivers/soc/google/exynos-cpupm.c @@ -846,7 +846,7 @@ static void enter_power_mode(int cpu, struct power_mode *mode) if (system_disabled) return; - if (is_acpm_ipc_busy()) + if (!is_acpm_ipc_flushed()) return; if (unlikely(exynos_cpupm_notify(SICD_ENTER, 0))) diff --git a/include/soc/google/acpm_ipc_ctrl.h b/include/soc/google/acpm_ipc_ctrl.h index 6f71a9118..f0ff6c6a0 100644 --- a/include/soc/google/acpm_ipc_ctrl.h +++ b/include/soc/google/acpm_ipc_ctrl.h @@ -67,7 +67,7 @@ int acpm_ipc_get_buffer(const char *name, char **addr, u32 *size); void exynos_acpm_reboot(void); void acpm_stop_log_and_dumpram(void); u64 get_frc_time(void); -bool is_acpm_ipc_busy(void); +bool is_acpm_ipc_flushed(void); #else static inline int acpm_ipc_request_channel(struct device_node *np, @@ -124,9 +124,9 @@ static u64 get_frc_time(void) return 0; } -static bool is_acpm_ipc_busy(void) +static bool is_acpm_ipc_flushed(void) { - return false; + return true; } #endif |