ARM: EXYNOS: Set 64-bit DMA mask for EXYNOS5250
authorTushar Behera <tushar.behera@linaro.org>
Fri, 9 Aug 2013 08:42:27 +0000 (14:12 +0530)
committerMark Brown <broonie@linaro.org>
Sun, 11 Aug 2013 10:48:41 +0000 (11:48 +0100)
When LPAE is enabled, we need to set 64bit DMA mask bits.

[The actual fix for this issue is a much more involved patch series
reworking how DMA masks are set which is still in review upstream
  -- broonie]

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
arch/arm/mach-exynos/mach-exynos5-dt.c

index 753b94f3fca7e3ba4c3895582f638e6c395e60fd..d88234e14f96de651bf1f3ca16e619583bc04222 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/memblock.h>
 #include <linux/io.h>
 #include <linux/clocksource.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/mach/arch.h>
 #include <mach/regs-pmu.h>
 
 #include "common.h"
 
+static u64 dma_mask64 = DMA_BIT_MASK(64);
+
 static void __init exynos5_dt_map_io(void)
 {
        exynos_init_io(NULL, 0);
 }
 
+static int exynos5250_platform_notifier(struct notifier_block *nb,
+                                 unsigned long event, void *__dev)
+{
+       struct device *dev = __dev;
+
+       if (event != BUS_NOTIFY_ADD_DEVICE)
+               return NOTIFY_DONE;
+
+       dev->dma_mask = &dma_mask64;
+       dev->coherent_dma_mask = DMA_BIT_MASK(64);
+
+       return NOTIFY_OK;
+}
+
+static struct notifier_block exynos5250_platform_nb = {
+       .notifier_call = exynos5250_platform_notifier,
+};
+
 static void __init exynos5_dt_machine_init(void)
 {
        struct device_node *i2c_np;
@@ -52,6 +73,11 @@ static void __init exynos5_dt_machine_init(void)
                }
        }
 
+       if (config_enabled(CONFIG_ARM_LPAE) &&
+                       of_machine_is_compatible("samsung,exynos5250"))
+               bus_register_notifier(&platform_bus_type,
+                               &exynos5250_platform_nb);
+
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }