summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororenbh <orenbh@marvell.com>2017-04-19 09:06:52 +0300
committerKostya Porotchkin <kostap@marvell.com>2017-04-19 17:26:04 +0300
commitf51ede86dd51c014dd2fdc93143508a7c39cb513 (patch)
treed1ed70a55c6a6b4e1c0731805a5817c7a96606a2
parentf394970f1608f1f115fbc41e627715f0edb7aa3c (diff)
pm: a70x0: a80x0: Add message trigger timeout
Add timeout validation check after PM message interrupt trigger Change-Id: I10ae8d36ac04024960085419877b55d67661927c Signed-off-by: orenbh <orenbh@marvell.com> Reviewed-on: http://vgitil04.il.marvell.com:8080/38714 Reviewed-by: Kostya Porotchkin <kostap@marvell.com> Tested-by: Kostya Porotchkin <kostap@marvell.com>
-rw-r--r--plat/marvell/a8k/common/mss/mss_pm_ipc.c19
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;
}