diff mbox

[U-Boot] ARM: bcm2835: use phys_to_bus() for mbox

Message ID 1428202104-16132-1-git-send-email-swarren@wwwdotorg.org
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren April 5, 2015, 2:48 a.m. UTC
When we communicate with the VideoCore to perform property mailbox
transactions, that is a DMA operation as far as the property buffer
is concerned. Use phys_to_bus() on that buffer.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
While this isn't USB-related, it does depend on patches that went into
the USB topic/dwc2 tree. Either this can be merged there, or we'll have
to wait until that branch is merged into u-boot/master and then merge
this.

As best I can tell, this is the last place we need to do this. SDHCI has
potential but CONFIG_MMC_SDMA isn't set so I don't believe the code does
any DMA. LCD has potential, but the VideoCore allocates the display
surface, programs the display engine, and passes the surface's CPU pointer
back to the CPU in a firmware message, of U-Boot isn't involved in setting
up the DMA HW.
---
 arch/arm/cpu/arm1176/bcm2835/mbox.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Marek Vasut April 6, 2015, 3:04 p.m. UTC | #1
On Sunday, April 05, 2015 at 04:48:24 AM, Stephen Warren wrote:
> When we communicate with the VideoCore to perform property mailbox
> transactions, that is a DMA operation as far as the property buffer
> is concerned. Use phys_to_bus() on that buffer.
> 
> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> ---
> While this isn't USB-related, it does depend on patches that went into
> the USB topic/dwc2 tree. Either this can be merged there, or we'll have
> to wait until that branch is merged into u-boot/master and then merge
> this.
> 
> As best I can tell, this is the last place we need to do this. SDHCI has
> potential but CONFIG_MMC_SDMA isn't set so I don't believe the code does
> any DMA. LCD has potential, but the VideoCore allocates the display
> surface, programs the display engine, and passes the surface's CPU pointer
> back to the CPU in a firmware message, of U-Boot isn't involved in setting
> up the DMA HW.
> ---
>  arch/arm/cpu/arm1176/bcm2835/mbox.c | 5 +++--

I don't mind picking this up, but please rebase on top of u-boot/master,
which contains d6c418e4b8036038505ac67bf5d85a19ca2c650d .

Thanks!

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/arch/arm/cpu/arm1176/bcm2835/mbox.c b/arch/arm/cpu/arm1176/bcm2835/mbox.c
index 3b17a31eacfd..1af9be78c68a 100644
--- a/arch/arm/cpu/arm1176/bcm2835/mbox.c
+++ b/arch/arm/cpu/arm1176/bcm2835/mbox.c
@@ -7,6 +7,7 @@ 
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/mbox.h>
+#include <phys2bus.h>
 
 #define TIMEOUT 1000 /* ms */
 
@@ -110,10 +111,10 @@  int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer)
 	dump_buf(buffer);
 #endif
 
-	ret = bcm2835_mbox_call_raw(chan, (u32)buffer, &rbuffer);
+	ret = bcm2835_mbox_call_raw(chan, phys_to_bus((u32)buffer), &rbuffer);
 	if (ret)
 		return ret;
-	if (rbuffer != (u32)buffer) {
+	if (rbuffer != phys_to_bus((u32)buffer)) {
 		printf("mbox: Response buffer mismatch\n");
 		return -1;
 	}