Skip to content

Commit a371c10

Browse files
anupbrcmJassiBrar
authored andcommitted
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: dbc049e ("mailbox: Add driver for Broadcom FlexRM ring manager") Signed-off-by: Anup Patel <anup.patel@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Cc: stable@vger.kernel.org Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
1 parent 15f859a commit a371c10

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

drivers/mailbox/bcm-flexrm-mailbox.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,16 +1365,32 @@ static void flexrm_shutdown(struct mbox_chan *chan)
13651365
/* Disable/inactivate ring */
13661366
writel_relaxed(0x0, ring->regs + RING_CONTROL);
13671367

1368-
/* Flush ring with timeout of 1s */
1369-
timeout = 1000;
1368+
/* Set ring flush state */
1369+
timeout = 1000; /* timeout of 1s */
13701370
writel_relaxed(BIT(CONTROL_FLUSH_SHIFT),
13711371
ring->regs + RING_CONTROL);
13721372
do {
13731373
if (readl_relaxed(ring->regs + RING_FLUSH_DONE) &
13741374
FLUSH_DONE_MASK)
13751375
break;
13761376
mdelay(1);
1377-
} while (timeout--);
1377+
} while (--timeout);
1378+
if (!timeout)
1379+
dev_err(ring->mbox->dev,
1380+
"setting ring%d flush state timedout\n", ring->num);
1381+
1382+
/* Clear ring flush state */
1383+
timeout = 1000; /* timeout of 1s */
1384+
writel_relaxed(0x0, ring + RING_CONTROL);
1385+
do {
1386+
if (!(readl_relaxed(ring + RING_FLUSH_DONE) &
1387+
FLUSH_DONE_MASK))
1388+
break;
1389+
mdelay(1);
1390+
} while (--timeout);
1391+
if (!timeout)
1392+
dev_err(ring->mbox->dev,
1393+
"clearing ring%d flush state timedout\n", ring->num);
13781394

13791395
/* Abort all in-flight requests */
13801396
for (reqid = 0; reqid < RING_MAX_REQ_COUNT; reqid++) {

0 commit comments

Comments
 (0)