From d00684a6d899048938086c11185c89f082b881e0 Mon Sep 17 00:00:00 2001 From: John Linn Date: Tue, 28 Jan 2014 14:06:45 +0100 Subject: [PATCH] Xilinx: ARM: BSP: prevent DMA into lower memory The DMA zone from 2.6.39 is no longer supported such that a new method was needed. The old method was lost in the move to 3.0 and USB was seeing failures. Signed-off-by: Michal Simek Signed-off-by: Guennadi Liakhovetski --- arch/arm/mach-zynq/common.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 9a7bd13..2d51453 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -39,6 +40,22 @@ void __iomem *zynq_scu_base; +/** + * zynq_memory_init() - Initialize special memory + * + * We need to stop things allocating the low memory as DMA can't work in + * the 1st 512K of memory. Using reserve vs remove is not totally clear yet. + */ +static void __init zynq_memory_init(void) +{ + /* + * Reserve the 0-0x4000 addresses (before page tables and kernel) + * which can't be used for DMA + */ + if (!__pa(PAGE_OFFSET)) + memblock_reserve(0, 0x4000); +} + static struct of_device_id zynq_of_bus_ids[] __initdata = { { .compatible = "simple-bus", }, {} @@ -113,5 +130,6 @@ DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform") .init_machine = zynq_init_machine, .init_time = zynq_timer_init, .dt_compat = zynq_dt_match, + .reserve = zynq_memory_init, .restart = zynq_system_reset, MACHINE_END -- 1.7.2.5