gator: Use device-tree when available for address of pl310 cache
authorJon Medhurst <tixy@linaro.org>
Mon, 22 Apr 2013 14:46:09 +0000 (15:46 +0100)
committerJon Medhurst <tixy@linaro.org>
Fri, 26 Apr 2013 12:29:03 +0000 (13:29 +0100)
This helps us avoid probing hard coded addresses which can cause
data aborts and crash the system, as happens on the A9 RTSM.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
driver/gator_events_l2c-310.c

index 52472c7a9e62b69bc8c569bd645bb396a41edb49..e646215f37f65c36353cf2ad89900747b464ea0b 100644 (file)
@@ -11,6 +11,8 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
 #include <asm/hardware/cache-l2x0.h>
 
 #include "gator.h"
@@ -151,6 +153,12 @@ static void __iomem *gator_events_l2c310_probe(void)
        };
        int i;
 
+#if defined(CONFIG_OF)
+       if (of_have_populated_dt())
+               return of_iomap(of_find_compatible_node(NULL,
+                               NULL, "arm,pl310-cache"), 0);
+#endif
+
        for (i = 0; i < ARRAY_SIZE(variants); i++) {
                void __iomem *base = ioremap(variants[i], SZ_4K);