brcm2708: update 4.1 patches
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.1 / 0110-mailbox-bcm2835-Fix-mailbox-full-detection.patch
1 From 38a0a5c357245cfe2b359277bc38509fa05c268d Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Wed, 13 May 2015 13:10:32 -0700
4 Subject: [PATCH 110/148] mailbox/bcm2835: Fix mailbox full detection.
5
6 With the VC reader blocked and the ARM writing, MAIL0_STA reads empty
7 permanently while MAIL1_STA goes from empty (0x40000000) to non-empty
8 (0x00000001-0x00000007) to full (0x80000008).
9
10 This bug ended up having no effect on us, because all of our
11 transactions in the client driver were synchronous and under a mutex.
12
13 Suggested-by: Phil Elwell <phil@raspberrypi.org>
14 Signed-off-by: Eric Anholt <eric@anholt.net>
15 Acked-by: Stephen Warren <swarren@wwwdotorg.org>
16 Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
17 ---
18 drivers/mailbox/bcm2835-mailbox.c | 3 ++-
19 1 file changed, 2 insertions(+), 1 deletion(-)
20
21 --- a/drivers/mailbox/bcm2835-mailbox.c
22 +++ b/drivers/mailbox/bcm2835-mailbox.c
23 @@ -49,6 +49,7 @@
24 #define MAIL0_STA (ARM_0_MAIL0 + 0x18)
25 #define MAIL0_CNF (ARM_0_MAIL0 + 0x1C)
26 #define MAIL1_WRT (ARM_0_MAIL1 + 0x00)
27 +#define MAIL1_STA (ARM_0_MAIL1 + 0x18)
28
29 /* Status register: FIFO state. */
30 #define ARM_MS_FULL BIT(31)
31 @@ -117,7 +118,7 @@ static bool bcm2835_last_tx_done(struct
32 bool ret;
33
34 spin_lock(&mbox->lock);
35 - ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL);
36 + ret = !(readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL);
37 spin_unlock(&mbox->lock);
38 return ret;
39 }