summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-bcm283x/mbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-bcm283x/mbox.c')
-rw-r--r--arch/arm/mach-bcm283x/mbox.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c
index 4b14afcfe4..4959a1a652 100644
--- a/arch/arm/mach-bcm283x/mbox.c
+++ b/arch/arm/mach-bcm283x/mbox.c
@@ -14,13 +14,20 @@
#include <init.h>
#include <io.h>
#include <of_address.h>
+#include <pbl.h>
#include <mach/mbox.h>
+#include <mach/core.h>
#define TIMEOUT (MSECOND * 1000)
static void __iomem *mbox_base;
+#ifdef __PBL__
+#define is_timeout_non_interruptible(start, timeout) ((void)start, 0)
+#define get_time_ns() 0
+#endif
+
static int bcm2835_mbox_call_raw(u32 chan, struct bcm2835_mbox_hdr *buffer,
u32 *recv)
{
@@ -109,19 +116,20 @@ static void dump_buf(struct bcm2835_mbox_hdr *buffer)
}
#endif
-static int bcm2835_mbox_probe(void)
+static void __iomem *bcm2835_mbox_probe(void)
{
struct device_node *mbox_node;
+ if (IN_PBL)
+ return bcm2835_get_mmio_base_by_cpuid() + 0xb880;
+
mbox_node = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-mbox");
if (!mbox_node) {
pr_err("Missing mbox node\n");
- return -ENOENT;
+ return NULL;
}
- mbox_base = of_iomap(mbox_node, 0);
-
- return 0;
+ return of_iomap(mbox_node, 0);
}
int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer)
@@ -132,9 +140,9 @@ int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer)
int tag_index;
if (!mbox_base) {
- ret = bcm2835_mbox_probe();
- if (ret)
- return ret;
+ mbox_base = bcm2835_mbox_probe();
+ if (!mbox_base)
+ return -ENOENT;
}
pr_debug("mbox: TX buffer\n");
@@ -143,7 +151,7 @@ int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer)
ret = bcm2835_mbox_call_raw(chan, buffer, &rbuffer);
if (ret)
return ret;
- if (rbuffer != (u32)buffer) {
+ if (rbuffer != (uintptr_t)buffer) {
pr_err("mbox: Response buffer mismatch\n");
return -EIO;
}