diff options
-rw-r--r-- | plat/marvell/a8k/common/mss/mss_pm_ipc.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/plat/marvell/a8k/common/mss/mss_pm_ipc.c b/plat/marvell/a8k/common/mss/mss_pm_ipc.c index 9d8aedac..151e839b 100644 --- a/plat/marvell/a8k/common/mss/mss_pm_ipc.c +++ b/plat/marvell/a8k/common/mss/mss_pm_ipc.c @@ -53,6 +53,8 @@ #define MSS_SISTR (MVEBU_REGS_BASE + 0x5800D8) #define MSS_MSG_INT_MASK (0x80000000) +#define MSS_TIMER_BASE (MVEBU_REGS_BASE_MASK + 0x580110) +#define MSS_TRIGGER_TIMEOUT (1000) /******************************************************************************* * mss_pm_ipc_msg_send @@ -78,12 +80,27 @@ int mss_pm_ipc_msg_send(unsigned int channel_id, unsigned int msg_id, const psci *******************************************************************************/ int mss_pm_ipc_msg_trigger(void) { + unsigned int timeout; + unsigned int t_end; + unsigned int t_start = mmio_read_32(MSS_TIMER_BASE); + mmio_write_32(MSS_SISR, MSS_MSG_INT_MASK); do { /* wait while SCP process incoming interrupt */ + if (mmio_read_32(MSS_SISTR) != MSS_MSG_INT_MASK) + break; + + /* check timeout */ + t_end = mmio_read_32(MSS_TIMER_BASE); + + timeout = ((t_start > t_end) ? (t_start - t_end) : (t_end - t_start)); + if (timeout > MSS_TRIGGER_TIMEOUT) { + ERROR("PM MSG Trigger Timeout\n"); + break; + } - } while (mmio_read_32(MSS_SISTR) == MSS_MSG_INT_MASK); + } while (1); return 0; } |