aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-realview
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2009-11-04 07:19:05 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2009-11-05 05:10:36 -0500
commitc97c5aa83c41a532bc67da356d77da929bc41b9c (patch)
treeb01bec4b8151f5697512b180406c54bc5588811a /arch/arm/mach-realview
parent157aed7473d300587e89cc87e13f194e3fa6fa36 (diff)
RealView: Add sparsemem support for the RealView PBX platform
The RealView PBX board has two 512MB blocks of memory - one at 0x70000000 (with 256MB mirror at 0) and another at 0x20000000. Only the block at 0x70000000 (or the mirror at 0) may be used for DMA (e.g. framebuffer). This patch adds the sparsemem definitions to allow the use of all the memory split as follows: 256MB @ 0x00000000 (ZONE_DMA) 512MB @ 0x20000000 (ZONE_NORMAL) 256MB @ 0x80000000 (ZONE_NORMAL) Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm/mach-realview')
-rw-r--r--arch/arm/mach-realview/Kconfig5
-rw-r--r--arch/arm/mach-realview/core.c21
-rw-r--r--arch/arm/mach-realview/include/mach/memory.h49
-rw-r--r--arch/arm/mach-realview/realview_pbx.c22
4 files changed, 94 insertions, 3 deletions
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig
index dfc9b0bc6eb2..c48e1f2c3349 100644
--- a/arch/arm/mach-realview/Kconfig
+++ b/arch/arm/mach-realview/Kconfig
@@ -70,6 +70,8 @@ config MACH_REALVIEW_PBX
70 bool "Support RealView/PBX platform" 70 bool "Support RealView/PBX platform"
71 select ARM_GIC 71 select ARM_GIC
72 select HAVE_PATA_PLATFORM 72 select HAVE_PATA_PLATFORM
73 select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !HIGH_PHYS_OFFSET
74 select ZONE_DMA if SPARSEMEM
73 help 75 help
74 Include support for the ARM(R) RealView PBX platform. 76 Include support for the ARM(R) RealView PBX platform.
75 77
@@ -82,6 +84,7 @@ config REALVIEW_HIGH_PHYS_OFFSET
82 0x70000000, 256MB of which being mirrored at 0x00000000. If 84 0x70000000, 256MB of which being mirrored at 0x00000000. If
83 the board supports 512MB of RAM, this option allows the 85 the board supports 512MB of RAM, this option allows the
84 memory to be accessed contiguously at the high physical 86 memory to be accessed contiguously at the high physical
85 offset. 87 offset. On the PBX board, disabling this option allows 1GB of
88 RAM to be used with SPARSEMEM.
86 89
87endmenu 90endmenu
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index c21b0fd39652..9f293438e020 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -59,6 +59,25 @@
59/* used by entry-macro.S and platsmp.c */ 59/* used by entry-macro.S and platsmp.c */
60void __iomem *gic_cpu_base_addr; 60void __iomem *gic_cpu_base_addr;
61 61
62#ifdef CONFIG_ZONE_DMA
63/*
64 * Adjust the zones if there are restrictions for DMA access.
65 */
66void __init realview_adjust_zones(int node, unsigned long *size,
67 unsigned long *hole)
68{
69 unsigned long dma_size = SZ_256M >> PAGE_SHIFT;
70
71 if (!machine_is_realview_pbx() || node || (size[0] <= dma_size))
72 return;
73
74 size[ZONE_NORMAL] = size[0] - dma_size;
75 size[ZONE_DMA] = dma_size;
76 hole[ZONE_NORMAL] = hole[0];
77 hole[ZONE_DMA] = 0;
78}
79#endif
80
62/* 81/*
63 * This is the RealView sched_clock implementation. This has 82 * This is the RealView sched_clock implementation. This has
64 * a resolution of 41.7ns, and a maximum value of about 179s. 83 * a resolution of 41.7ns, and a maximum value of about 179s.
@@ -543,7 +562,7 @@ static int realview_clcd_setup(struct clcd_fb *fb)
543 fb->panel = realview_clcd_panel(); 562 fb->panel = realview_clcd_panel();
544 563
545 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize, 564 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize,
546 &dma, GFP_KERNEL); 565 &dma, GFP_KERNEL | GFP_DMA);
547 if (!fb->fb.screen_base) { 566 if (!fb->fb.screen_base) {
548 printk(KERN_ERR "CLCD: unable to map framebuffer\n"); 567 printk(KERN_ERR "CLCD: unable to map framebuffer\n");
549 return -ENOMEM; 568 return -ENOMEM;
diff --git a/arch/arm/mach-realview/include/mach/memory.h b/arch/arm/mach-realview/include/mach/memory.h
index 293c30025e7e..2417bbcf97fd 100644
--- a/arch/arm/mach-realview/include/mach/memory.h
+++ b/arch/arm/mach-realview/include/mach/memory.h
@@ -29,4 +29,53 @@
29#define PHYS_OFFSET UL(0x00000000) 29#define PHYS_OFFSET UL(0x00000000)
30#endif 30#endif
31 31
32#if !defined(__ASSEMBLY__) && defined(CONFIG_ZONE_DMA)
33extern void realview_adjust_zones(int node, unsigned long *size,
34 unsigned long *hole);
35#define arch_adjust_zones(node, size, hole) \
36 realview_adjust_zones(node, size, hole)
37
38#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_256M - 1)
39#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_256M)
40#endif
41
42#ifdef CONFIG_SPARSEMEM
43
44/*
45 * Sparsemem definitions for RealView PBX.
46 *
47 * The RealView PBX board has another block of 512MB of RAM at 0x20000000,
48 * however only the block at 0x70000000 (or the 256MB mirror at 0x00000000)
49 * may be used for DMA.
50 *
51 * The macros below define a section size of 256MB and a non-linear virtual to
52 * physical mapping:
53 *
54 * 256MB @ 0x00000000 -> PAGE_OFFSET
55 * 512MB @ 0x20000000 -> PAGE_OFFSET + 0x10000000
56 * 256MB @ 0x80000000 -> PAGE_OFFSET + 0x30000000
57 */
58#ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
59#error "SPARSEMEM not available with REALVIEW_HIGH_PHYS_OFFSET"
60#endif
61
62#define MAX_PHYSMEM_BITS 32
63#define SECTION_SIZE_BITS 28
64
65/* bank page offsets */
66#define PAGE_OFFSET1 (PAGE_OFFSET + 0x10000000)
67#define PAGE_OFFSET2 (PAGE_OFFSET + 0x30000000)
68
69#define __phys_to_virt(phys) \
70 ((phys) >= 0x80000000 ? (phys) - 0x80000000 + PAGE_OFFSET2 : \
71 (phys) >= 0x20000000 ? (phys) - 0x20000000 + PAGE_OFFSET1 : \
72 (phys) + PAGE_OFFSET)
73
74#define __virt_to_phys(virt) \
75 ((virt) >= PAGE_OFFSET2 ? (virt) - PAGE_OFFSET2 + 0x80000000 : \
76 (virt) >= PAGE_OFFSET1 ? (virt) - PAGE_OFFSET1 + 0x20000000 : \
77 (virt) - PAGE_OFFSET)
78
79#endif /* CONFIG_SPARSEMEM */
80
32#endif 81#endif
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 5d09d8b4a1cb..ec39488e2b42 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -304,6 +304,26 @@ static struct sys_timer realview_pbx_timer = {
304 .init = realview_pbx_timer_init, 304 .init = realview_pbx_timer_init,
305}; 305};
306 306
307static void realview_pbx_fixup(struct machine_desc *mdesc, struct tag *tags,
308 char **from, struct meminfo *meminfo)
309{
310#ifdef CONFIG_SPARSEMEM
311 /*
312 * Memory configuration with SPARSEMEM enabled on RealView PBX (see
313 * asm/mach/memory.h for more information).
314 */
315 meminfo->bank[0].start = 0;
316 meminfo->bank[0].size = SZ_256M;
317 meminfo->bank[1].start = 0x20000000;
318 meminfo->bank[1].size = SZ_512M;
319 meminfo->bank[2].start = 0x80000000;
320 meminfo->bank[2].size = SZ_256M;
321 meminfo->nr_banks = 3;
322#else
323 realview_fixup(mdesc, tags, from, meminfo);
324#endif
325}
326
307static void __init realview_pbx_init(void) 327static void __init realview_pbx_init(void)
308{ 328{
309 int i; 329 int i;
@@ -345,7 +365,7 @@ MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX")
345 .phys_io = REALVIEW_PBX_UART0_BASE, 365 .phys_io = REALVIEW_PBX_UART0_BASE,
346 .io_pg_offst = (IO_ADDRESS(REALVIEW_PBX_UART0_BASE) >> 18) & 0xfffc, 366 .io_pg_offst = (IO_ADDRESS(REALVIEW_PBX_UART0_BASE) >> 18) & 0xfffc,
347 .boot_params = PHYS_OFFSET + 0x00000100, 367 .boot_params = PHYS_OFFSET + 0x00000100,
348 .fixup = realview_fixup, 368 .fixup = realview_pbx_fixup,
349 .map_io = realview_pbx_map_io, 369 .map_io = realview_pbx_map_io,
350 .init_irq = gic_init_irq, 370 .init_irq = gic_init_irq,
351 .timer = &realview_pbx_timer, 371 .timer = &realview_pbx_timer,