HACK: mailbox: Hi3660: Fixup for mailbox state machine
authorLeo Yan <leo.yan@linaro.org>
Thu, 31 May 2018 01:04:50 +0000 (09:04 +0800)
committerDouglas RAILLARD <douglas.raillard@arm.com>
Tue, 14 Aug 2018 15:32:10 +0000 (16:32 +0100)
Now we only check the mailbox state machine at the beginning of request
the channel, and later we will not run state machine code for sending
message.  This results the state machine malfunction and the message
cannot be really handle from MCU side.

This patch is temporarily move the state machine operations into send
message flow.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
drivers/mailbox/hi3660-mailbox.c

index 3eea6b6424841ad16a726382045a5e19fe8be0d0..8229ade3a93a0d653d95b666c668cb837f37cca8 100644 (file)
@@ -156,8 +156,14 @@ 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);
@@ -172,21 +178,8 @@ 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 +200,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,
 };