summaryrefslogtreecommitdiffstats
path: root/configs/platform-v7a/patches/barebox-2020.01.0/0015-ARM-rpi-mailbox-Use-non-interruptible-timeout.patch
blob: 88a7c531420bafef4ceb45dbc38d5d1ada32f5c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Wed, 8 Jan 2020 10:29:16 +0100
Subject: [PATCH] ARM: rpi mailbox: Use non interruptible timeout

This makes sure that during a mailbox transfer no other mailbox transfer
is started. This happens on a raspberrypi3 where one GPIO on the
firmware GPIO controller (which is controlled via mailbox) is registered
as a heartbeat LED. With this it can happen that during a mailbox
transfer the poller which drives the heartbeat LED is triggered in
is_timeout() which results in corrupted transfers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-bcm283x/mbox.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c
index 1b1981f7cb67..22abbb0ca586 100644
--- a/arch/arm/mach-bcm283x/mbox.c
+++ b/arch/arm/mach-bcm283x/mbox.c
@@ -37,7 +37,7 @@ static int bcm2835_mbox_call_raw(u32 chan, struct bcm2835_mbox_hdr *buffer,
 		val = readl(mbox_base + MAIL0_STA);
 		if (val & BCM2835_MBOX_STATUS_RD_EMPTY)
 			break;
-		if (is_timeout(starttime, TIMEOUT)) {
+		if (is_timeout_non_interruptible(starttime, TIMEOUT)) {
 			pr_err("mbox: Timeout draining stale responses\n");
 			return -ETIMEDOUT;
 		}
@@ -49,7 +49,7 @@ static int bcm2835_mbox_call_raw(u32 chan, struct bcm2835_mbox_hdr *buffer,
 		val = readl(mbox_base + MAIL0_STA);
 		if (!(val & BCM2835_MBOX_STATUS_WR_FULL))
 			break;
-		if (is_timeout(starttime, TIMEOUT)) {
+		if (is_timeout_non_interruptible(starttime, TIMEOUT)) {
 			pr_err("mbox: Timeout waiting for send space\n");
 			return -ETIMEDOUT;
 		}
@@ -67,7 +67,7 @@ static int bcm2835_mbox_call_raw(u32 chan, struct bcm2835_mbox_hdr *buffer,
 		val = readl(mbox_base + MAIL0_STA);
 		if (!(val & BCM2835_MBOX_STATUS_RD_EMPTY))
 			break;
-		if (is_timeout(starttime, TIMEOUT)) {
+		if (is_timeout_non_interruptible(starttime, TIMEOUT)) {
 			pr_err("mbox: Timeout waiting for response\n");
 			return -ETIMEDOUT;
 		}