#include <mach/hardware.h>
+#if !defined(__ASSEMBLY__) && defined(CONFIG_ZONE_DMA)
+extern void xilinx_adjust_zones(unsigned long *, unsigned long *);
+#define arch_adjust_zones(size, holes) \
+ xilinx_adjust_zones(size, holes)
+#endif
+
/*
* Virtual view <-> DMA view memory address translations
* This macro is used to translate the virtual address to an address
#include <linux/types.h>
#include <linux/init.h>
#include <linux/platform_device.h>
+#include <linux/mmzone.h>
#include <mach/hardware.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
{}
};
+#define DMA_ZONE_PAGES (SZ_32M >> PAGE_SHIFT)
+#define DMA_ZONE_HOLE_PAGES (SZ_512K >> PAGE_SHIFT)
+
+/* Setup a special DMA memory zone to deal with the fact the from 0 - 512K cannot
+ * be DMA-ed into. The size of the DMA zone is a bit arbitrary but doesn't hurt to
+ * be larger as the memory allocator will use the DMA zone for normal if needed.
+ */
+void xilinx_adjust_zones(unsigned long *zone_size, unsigned long *zhole_size)
+{
+ /* the normal zone has already been setup when this function is called and is
+ * assumed to be the only zone, this code is a bit confusing
+ */
+
+ printk("Xilinx: Adjusting memory zones to add DMA zone\n");
+
+ /* setup the zone sizes reducing the normal zone by the size
+ * of the DMA zone
+ */
+ zone_size[ZONE_NORMAL] = zone_size[0] - DMA_ZONE_PAGES;
+ zone_size[ZONE_DMA] = DMA_ZONE_PAGES;
+
+ /* setup the holes in each zone, the normal zone has the same hole it had
+ * on entry to this function which should be no hole
+ * the dma zone has a hole where DMA can't be done
+ */
+ zhole_size[ZONE_NORMAL] = zhole_size[0];
+ zhole_size[ZONE_DMA] = DMA_ZONE_HOLE_PAGES;
+}
+
static void __init board_init(void)
{
#ifdef CONFIG_CACHE_L2X0