aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wangtao <kevin.wangtao@hisilicon.com>2018-11-07 17:08:04 +0800
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2018-11-28 15:39:37 +0530
commitdff75e5439b719b0833d950bf8b8a95df1449821 (patch)
treea28456e5cdc8bc151cdb7c2831956496026b6052
parent8ee481b7c2037a892bc0ccf52bcb6e362d0ed5cd (diff)
download96b-common-dff75e5439b719b0833d950bf8b8a95df1449821.tar.gz
mailbox: Hi3660: Fixup mailbox conflict issue
Each time before we send a new message we need to check last tx has done instead of reset the channel directly. Signed-off-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r--drivers/mailbox/hi3660-mailbox.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/drivers/mailbox/hi3660-mailbox.c b/drivers/mailbox/hi3660-mailbox.c
index 3eea6b642484..e85040a70882 100644
--- a/drivers/mailbox/hi3660-mailbox.c
+++ b/drivers/mailbox/hi3660-mailbox.c
@@ -106,6 +106,7 @@ static int hi3660_mbox_check_state(struct mbox_chan *chan)
/* Ensure channel is released */
writel(0xffffffff, base + MBOX_IMASK_REG);
writel(BIT(mchan->ack_irq), base + MBOX_SRC_REG);
+
return 0;
}
@@ -156,15 +157,21 @@ static int hi3660_mbox_acquire_channel(struct mbox_chan *chan)
return retry ? 0 : -ETIMEDOUT;
}
-static int hi3660_mbox_startup(struct mbox_chan *chan)
+static int hi3660_mbox_send_data(struct mbox_chan *chan, void *msg)
{
+ unsigned long ch = (unsigned long)chan->con_priv;
+ struct hi3660_mbox *mbox = to_hi3660_mbox(chan->mbox);
+ struct hi3660_chan_info *mchan = &mbox->mchan[ch];
+ void __iomem *base = MBOX_BASE(mbox, ch);
+ u32 *buf = msg;
+ unsigned int i;
int ret;
- ret = hi3660_mbox_check_state(chan);
+ ret = hi3660_mbox_unlock(chan);
if (ret)
return ret;
- ret = hi3660_mbox_unlock(chan);
+ ret = hi3660_mbox_check_state(chan);
if (ret)
return ret;
@@ -172,22 +179,6 @@ static int hi3660_mbox_startup(struct mbox_chan *chan)
if (ret)
return ret;
- return 0;
-}
-
-static int hi3660_mbox_send_data(struct mbox_chan *chan, void *msg)
-{
- unsigned long ch = (unsigned long)chan->con_priv;
- struct hi3660_mbox *mbox = to_hi3660_mbox(chan->mbox);
- struct hi3660_chan_info *mchan = &mbox->mchan[ch];
- void __iomem *base = MBOX_BASE(mbox, ch);
- u32 *buf = msg;
- unsigned int i;
-
- /* Ensure channel is released */
- writel_relaxed(0xffffffff, base + MBOX_IMASK_REG);
- writel_relaxed(BIT(mchan->ack_irq), base + MBOX_SRC_REG);
-
/* Clear mask for destination interrupt */
writel_relaxed(~BIT(mchan->dst_irq), base + MBOX_IMASK_REG);
@@ -207,7 +198,6 @@ static int hi3660_mbox_send_data(struct mbox_chan *chan, void *msg)
}
static struct mbox_chan_ops hi3660_mbox_ops = {
- .startup = hi3660_mbox_startup,
.send_data = hi3660_mbox_send_data,
};