提交 a371c10e 编写于 作者: A Anup Patel 提交者: Jassi Brar

mailbox: bcm-flexrm-mailbox: Fix FlexRM ring flush sequence

As-per suggestion from FlexRM HW folks, we have to first set
FlexRM ring flush state and then clear it for FlexRM ring flush
to work properly.

Currently, the FlexRM driver has incomplete FlexRM ring flush
sequence which causes repeated insmod+rmmod of mailbox client
drivers to fail.

This patch fixes FlexRM ring flush sequence in flexrm_shutdown()
as described above.

Fixes: dbc049ee ("mailbox: Add driver for Broadcom FlexRM
ring manager")
Signed-off-by: NAnup Patel <anup.patel@broadcom.com>
Reviewed-by: NScott Branden <scott.branden@broadcom.com>
Cc: stable@vger.kernel.org
Signed-off-by: NJassi Brar <jaswinder.singh@linaro.org>
上级 15f859ae
...@@ -1365,8 +1365,8 @@ static void flexrm_shutdown(struct mbox_chan *chan) ...@@ -1365,8 +1365,8 @@ static void flexrm_shutdown(struct mbox_chan *chan)
/* Disable/inactivate ring */ /* Disable/inactivate ring */
writel_relaxed(0x0, ring->regs + RING_CONTROL); writel_relaxed(0x0, ring->regs + RING_CONTROL);
/* Flush ring with timeout of 1s */ /* Set ring flush state */
timeout = 1000; timeout = 1000; /* timeout of 1s */
writel_relaxed(BIT(CONTROL_FLUSH_SHIFT), writel_relaxed(BIT(CONTROL_FLUSH_SHIFT),
ring->regs + RING_CONTROL); ring->regs + RING_CONTROL);
do { do {
...@@ -1374,7 +1374,23 @@ static void flexrm_shutdown(struct mbox_chan *chan) ...@@ -1374,7 +1374,23 @@ static void flexrm_shutdown(struct mbox_chan *chan)
FLUSH_DONE_MASK) FLUSH_DONE_MASK)
break; break;
mdelay(1); mdelay(1);
} while (timeout--); } while (--timeout);
if (!timeout)
dev_err(ring->mbox->dev,
"setting ring%d flush state timedout\n", ring->num);
/* Clear ring flush state */
timeout = 1000; /* timeout of 1s */
writel_relaxed(0x0, ring + RING_CONTROL);
do {
if (!(readl_relaxed(ring + RING_FLUSH_DONE) &
FLUSH_DONE_MASK))
break;
mdelay(1);
} while (--timeout);
if (!timeout)
dev_err(ring->mbox->dev,
"clearing ring%d flush state timedout\n", ring->num);
/* Abort all in-flight requests */ /* Abort all in-flight requests */
for (reqid = 0; reqid < RING_MAX_REQ_COUNT; reqid++) { for (reqid = 0; reqid < RING_MAX_REQ_COUNT; reqid++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册