From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965173AbbEMUKg (ORCPT ); Wed, 13 May 2015 16:10:36 -0400 Received: from gabe.freedesktop.org ([131.252.210.177]:34852 "EHLO gabe.freedesktop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964839AbbEMUKe (ORCPT ); Wed, 13 May 2015 16:10:34 -0400 From: Eric Anholt To: linux-kernel@vger.kernel.org Cc: Jassi Brar , linux-rpi-kernel@lists.infradead.org, Eric Anholt Subject: [PATCH] mailbox/bcm2835: Fix mailbox full detection. Date: Wed, 13 May 2015 13:10:32 -0700 Message-Id: <1431547832-32430-1-git-send-email-eric@anholt.net> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the VC reader blocked and the ARM writing, MAIL0_STA reads empty permanently while MAIL1_STA goes from empty (0x40000000) to non-empty (0x00000001-0x00000007) to full (0x80000008). This bug ended up having no effect on us, because all of our transactions in the client driver were synchronous and under a mutex. Suggested-by: Phil Elwell Signed-off-by: Eric Anholt --- This is a port of a patch by Noralf from the downstream Raspberry Pi tree. Noralf said he didn't want attribution on this patch, even if it looks a lot like his. drivers/mailbox/bcm2835-mailbox.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c index 4b13268..0b47dd4 100644 --- a/drivers/mailbox/bcm2835-mailbox.c +++ b/drivers/mailbox/bcm2835-mailbox.c @@ -49,6 +49,7 @@ #define MAIL0_STA (ARM_0_MAIL0 + 0x18) #define MAIL0_CNF (ARM_0_MAIL0 + 0x1C) #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) +#define MAIL1_STA (ARM_0_MAIL1 + 0x18) /* Status register: FIFO state. */ #define ARM_MS_FULL BIT(31) @@ -117,7 +118,7 @@ static bool bcm2835_last_tx_done(struct mbox_chan *link) bool ret; spin_lock(&mbox->lock); - ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL); + ret = !(readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL); spin_unlock(&mbox->lock); return ret; } -- 2.1.4