[U-Boot,11/16] bcm283x mbox: Correctly wait for space to send
diff mbox series

Message ID 20190716133803.1174-12-andrei@gherzan.ro
State Superseded
Delegated to: Matthias Brugger
Headers show
Series
  • Raspberry Pi 32/64 support
Related show

Commit Message

Andrei Gherzan July 16, 2019, 1:37 p.m. UTC
From: Fabian Vogt <fvogt@suse.com>

For sending, the second mailbox is used, but previously the status register of
the first one was read.
---
 arch/arm/mach-bcm283x/include/mach/mbox.h | 7 +++++--
 arch/arm/mach-bcm283x/mbox.c              | 6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index cad035e8cd..cd78966150 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -51,9 +51,12 @@ 
 struct bcm2835_mbox_regs {
 	u32 read;
 	u32 rsvd0[5];
-	u32 status;
-	u32 config;
+	u32 status_r;
+	u32 config_r;
 	u32 write;
+	u32 rsvd1[5];
+	u32 status_w;
+	u32 config_w;
 };
 
 #define BCM2835_MBOX_STATUS_WR_FULL	0x80000000
diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c
index 1642ebd103..f7483bf423 100644
--- a/arch/arm/mach-bcm283x/mbox.c
+++ b/arch/arm/mach-bcm283x/mbox.c
@@ -27,7 +27,7 @@  int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv)
 	/* Drain any stale responses */
 
 	for (;;) {
-		val = readl(&regs->status);
+		val = readl(&regs->status_r);
 		if (val & BCM2835_MBOX_STATUS_RD_EMPTY)
 			break;
 		if (get_timer(0) >= endtime) {
@@ -40,7 +40,7 @@  int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv)
 	/* Wait for space to send */
 
 	for (;;) {
-		val = readl(&regs->status);
+		val = readl(&regs->status_w);
 		if (!(val & BCM2835_MBOX_STATUS_WR_FULL))
 			break;
 		if (get_timer(0) >= endtime) {
@@ -58,7 +58,7 @@  int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv)
 	/* Wait for the response */
 
 	for (;;) {
-		val = readl(&regs->status);
+		val = readl(&regs->status_r);
 		if (!(val & BCM2835_MBOX_STATUS_RD_EMPTY))
 			break;
 		if (get_timer(0) >= endtime) {