Skip to content

Commit

Permalink
Merge branch 'for-rmk' of git://linux-arm.org/linux-2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Russell King committed Nov 10, 2009
2 parents cc20d42 + c97c5aa commit 65f69e5
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 9 deletions.
4 changes: 4 additions & 0 deletions arch/arm/kernel/smp_scu.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ void __init scu_enable(void __iomem *scu_base)
u32 scu_ctrl;

scu_ctrl = __raw_readl(scu_base + SCU_CTRL);
/* already enabled? */
if (scu_ctrl & 1)
return;

scu_ctrl |= 1;
__raw_writel(scu_ctrl, scu_base + SCU_CTRL);

Expand Down
5 changes: 4 additions & 1 deletion arch/arm/mach-realview/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ config MACH_REALVIEW_PBX
bool "Support RealView/PBX platform"
select ARM_GIC
select HAVE_PATA_PLATFORM
select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !HIGH_PHYS_OFFSET
select ZONE_DMA if SPARSEMEM
help
Include support for the ARM(R) RealView PBX platform.

Expand All @@ -82,6 +84,7 @@ config REALVIEW_HIGH_PHYS_OFFSET
0x70000000, 256MB of which being mirrored at 0x00000000. If
the board supports 512MB of RAM, this option allows the
memory to be accessed contiguously at the high physical
offset.
offset. On the PBX board, disabling this option allows 1GB of
RAM to be used with SPARSEMEM.

endmenu
42 changes: 41 additions & 1 deletion arch/arm/mach-realview/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,25 @@
/* used by entry-macro.S and platsmp.c */
void __iomem *gic_cpu_base_addr;

#ifdef CONFIG_ZONE_DMA
/*
* Adjust the zones if there are restrictions for DMA access.
*/
void __init realview_adjust_zones(int node, unsigned long *size,
unsigned long *hole)
{
unsigned long dma_size = SZ_256M >> PAGE_SHIFT;

if (!machine_is_realview_pbx() || node || (size[0] <= dma_size))
return;

size[ZONE_NORMAL] = size[0] - dma_size;
size[ZONE_DMA] = dma_size;
hole[ZONE_NORMAL] = hole[0];
hole[ZONE_DMA] = 0;
}
#endif

/*
* This is the RealView sched_clock implementation. This has
* a resolution of 41.7ns, and a maximum value of about 179s.
Expand Down Expand Up @@ -543,7 +562,7 @@ static int realview_clcd_setup(struct clcd_fb *fb)
fb->panel = realview_clcd_panel();

fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize,
&dma, GFP_KERNEL);
&dma, GFP_KERNEL | GFP_DMA);
if (!fb->fb.screen_base) {
printk(KERN_ERR "CLCD: unable to map framebuffer\n");
return -ENOMEM;
Expand Down Expand Up @@ -788,3 +807,24 @@ void __init realview_timer_init(unsigned int timer_irq)
realview_clocksource_init();
realview_clockevents_init(timer_irq);
}

/*
* Setup the memory banks.
*/
void realview_fixup(struct machine_desc *mdesc, struct tag *tags, char **from,
struct meminfo *meminfo)
{
/*
* Most RealView platforms have 512MB contiguous RAM at 0x70000000.
* Half of this is mirrored at 0.
*/
#ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
meminfo->bank[0].start = 0x70000000;
meminfo->bank[0].size = SZ_512M;
meminfo->nr_banks = 1;
#else
meminfo->bank[0].start = 0;
meminfo->bank[0].size = SZ_256M;
meminfo->nr_banks = 1;
#endif
}
6 changes: 6 additions & 0 deletions arch/arm/mach-realview/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/amba/bus.h>
#include <linux/io.h>

#include <asm/setup.h>
#include <asm/leds.h>

#define AMBA_DEVICE(name,busid,base,plat) \
Expand All @@ -44,6 +45,8 @@ static struct amba_device name##_device = { \
/* .dma = base##_DMA,*/ \
}

struct machine_desc;

extern struct platform_device realview_flash_device;
extern struct platform_device realview_cf_device;
extern struct platform_device realview_i2c_device;
Expand All @@ -61,5 +64,8 @@ extern void realview_timer_init(unsigned int timer_irq);
extern int realview_flash_register(struct resource *res, u32 num);
extern int realview_eth_register(const char *name, struct resource *res);
extern int realview_usb_register(struct resource *res);
extern void realview_fixup(struct machine_desc *mdesc, struct tag *tags,
char **from, struct meminfo *meminfo);
extern void (*realview_reset)(char);

#endif
49 changes: 49 additions & 0 deletions arch/arm/mach-realview/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,53 @@
#define PHYS_OFFSET UL(0x00000000)
#endif

#if !defined(__ASSEMBLY__) && defined(CONFIG_ZONE_DMA)
extern void realview_adjust_zones(int node, unsigned long *size,
unsigned long *hole);
#define arch_adjust_zones(node, size, hole) \
realview_adjust_zones(node, size, hole)

#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_256M - 1)
#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_256M)
#endif

#ifdef CONFIG_SPARSEMEM

/*
* Sparsemem definitions for RealView PBX.
*
* The RealView PBX board has another block of 512MB of RAM at 0x20000000,
* however only the block at 0x70000000 (or the 256MB mirror at 0x00000000)
* may be used for DMA.
*
* The macros below define a section size of 256MB and a non-linear virtual to
* physical mapping:
*
* 256MB @ 0x00000000 -> PAGE_OFFSET
* 512MB @ 0x20000000 -> PAGE_OFFSET + 0x10000000
* 256MB @ 0x80000000 -> PAGE_OFFSET + 0x30000000
*/
#ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
#error "SPARSEMEM not available with REALVIEW_HIGH_PHYS_OFFSET"
#endif

#define MAX_PHYSMEM_BITS 32
#define SECTION_SIZE_BITS 28

/* bank page offsets */
#define PAGE_OFFSET1 (PAGE_OFFSET + 0x10000000)
#define PAGE_OFFSET2 (PAGE_OFFSET + 0x30000000)

#define __phys_to_virt(phys) \
((phys) >= 0x80000000 ? (phys) - 0x80000000 + PAGE_OFFSET2 : \
(phys) >= 0x20000000 ? (phys) - 0x20000000 + PAGE_OFFSET1 : \
(phys) + PAGE_OFFSET)

#define __virt_to_phys(virt) \
((virt) >= PAGE_OFFSET2 ? (virt) - PAGE_OFFSET2 + 0x80000000 : \
(virt) >= PAGE_OFFSET1 ? (virt) - PAGE_OFFSET1 + 0x20000000 : \
(virt) - PAGE_OFFSET)

#endif /* CONFIG_SPARSEMEM */

#endif
5 changes: 1 addition & 4 deletions arch/arm/mach-realview/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,8 @@ static void __init poke_milo(void)
* register. The BootMonitor waits for this register to become
* non-zero.
*/
#define REALVIEW_SYS_FLAGSS_OFFSET 0x30
#define REALVIEW_SYS_FLAGSC_OFFSET 0x34
__raw_writel(BSYM(virt_to_phys(realview_secondary_startup)),
__io_address(REALVIEW_SYS_BASE) +
REALVIEW_SYS_FLAGSS_OFFSET);
__io_address(REALVIEW_SYS_FLAGSSET));

mb();
}
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-realview/realview_eb.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
.phys_io = REALVIEW_EB_UART0_BASE,
.io_pg_offst = (IO_ADDRESS(REALVIEW_EB_UART0_BASE) >> 18) & 0xfffc,
.boot_params = PHYS_OFFSET + 0x00000100,
.fixup = realview_fixup,
.map_io = realview_eb_map_io,
.init_irq = gic_init_irq,
.timer = &realview_eb_timer,
Expand Down
13 changes: 13 additions & 0 deletions arch/arm/mach-realview/realview_pb1176.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,18 @@ static void realview_pb1176_reset(char mode)
__raw_writel(REALVIEW_PB1176_SYS_LOCKVAL_RSTCTL, hdr_ctrl);
}

static void realview_pb1176_fixup(struct machine_desc *mdesc,
struct tag *tags, char **from,
struct meminfo *meminfo)
{
/*
* RealView PB1176 only has 128MB of RAM mapped at 0.
*/
meminfo->bank[0].start = 0;
meminfo->bank[0].size = SZ_128M;
meminfo->nr_banks = 1;
}

static void __init realview_pb1176_init(void)
{
int i;
Expand Down Expand Up @@ -331,6 +343,7 @@ MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176")
.phys_io = REALVIEW_PB1176_UART0_BASE,
.io_pg_offst = (IO_ADDRESS(REALVIEW_PB1176_UART0_BASE) >> 18) & 0xfffc,
.boot_params = PHYS_OFFSET + 0x00000100,
.fixup = realview_pb1176_fixup,
.map_io = realview_pb1176_map_io,
.init_irq = gic_init_irq,
.timer = &realview_pb1176_timer,
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-realview/realview_pb11mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore")
.phys_io = REALVIEW_PB11MP_UART0_BASE,
.io_pg_offst = (IO_ADDRESS(REALVIEW_PB11MP_UART0_BASE) >> 18) & 0xfffc,
.boot_params = PHYS_OFFSET + 0x00000100,
.fixup = realview_fixup,
.map_io = realview_pb11mp_map_io,
.init_irq = gic_init_irq,
.timer = &realview_pb11mp_timer,
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-realview/realview_pba8.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8")
.phys_io = REALVIEW_PBA8_UART0_BASE,
.io_pg_offst = (IO_ADDRESS(REALVIEW_PBA8_UART0_BASE) >> 18) & 0xfffc,
.boot_params = PHYS_OFFSET + 0x00000100,
.fixup = realview_fixup,
.map_io = realview_pba8_map_io,
.init_irq = gic_init_irq,
.timer = &realview_pba8_timer,
Expand Down
21 changes: 21 additions & 0 deletions arch/arm/mach-realview/realview_pbx.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,26 @@ static struct sys_timer realview_pbx_timer = {
.init = realview_pbx_timer_init,
};

static void realview_pbx_fixup(struct machine_desc *mdesc, struct tag *tags,
char **from, struct meminfo *meminfo)
{
#ifdef CONFIG_SPARSEMEM
/*
* Memory configuration with SPARSEMEM enabled on RealView PBX (see
* asm/mach/memory.h for more information).
*/
meminfo->bank[0].start = 0;
meminfo->bank[0].size = SZ_256M;
meminfo->bank[1].start = 0x20000000;
meminfo->bank[1].size = SZ_512M;
meminfo->bank[2].start = 0x80000000;
meminfo->bank[2].size = SZ_256M;
meminfo->nr_banks = 3;
#else
realview_fixup(mdesc, tags, from, meminfo);
#endif
}

static void __init realview_pbx_init(void)
{
int i;
Expand Down Expand Up @@ -345,6 +365,7 @@ MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX")
.phys_io = REALVIEW_PBX_UART0_BASE,
.io_pg_offst = (IO_ADDRESS(REALVIEW_PBX_UART0_BASE) >> 18) & 0xfffc,
.boot_params = PHYS_OFFSET + 0x00000100,
.fixup = realview_pbx_fixup,
.map_io = realview_pbx_map_io,
.init_irq = gic_init_irq,
.timer = &realview_pbx_timer,
Expand Down
7 changes: 4 additions & 3 deletions arch/arm/mm/proc-v7.S
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ cpu_v7_name:
*/
__v7_setup:
#ifdef CONFIG_SMP
mrc p15, 0, r0, c1, c0, 1 @ Enable SMP/nAMP mode and
orr r0, r0, #(1 << 6) | (1 << 0) @ TLB ops broadcasting
mcr p15, 0, r0, c1, c0, 1
mrc p15, 0, r0, c1, c0, 1
tst r0, #(1 << 6) @ SMP/nAMP mode enabled?
orreq r0, r0, #(1 << 6) | (1 << 0) @ Enable SMP/nAMP mode and
mcreq p15, 0, r0, c1, c0, 1 @ TLB ops broadcasting
#endif
adr r12, __v7_setup_stack @ the local stack
stmia r12, {r0-r5, r7, r9, r11, lr}
Expand Down

0 comments on commit 65f69e5

Please sign in to comment.