Skip to content

Commit

Permalink
ARM: Add Versatile Express support
Browse files Browse the repository at this point in the history
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Russell King committed May 2, 2010
1 parent 9bf5b2e commit ceade89
Show file tree
Hide file tree
Showing 20 changed files with 834 additions and 1 deletion.
16 changes: 16 additions & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,20 @@ config ARCH_VERSATILE
help
This enables support for ARM Ltd Versatile board.

config ARCH_VEXPRESS
bool "ARM Ltd. Versatile Express family"
select ARCH_WANT_OPTIONAL_GPIOLIB
select ARM_AMBA
select ARM_TIMER_SP804
select COMMON_CLKDEV
select GENERIC_CLOCKEVENTS
select GENERIC_TIME
select HAVE_CLK
select ICST
select PLAT_VERSATILE
help
This enables support for the ARM Ltd Versatile Express boards.

config ARCH_AT91
bool "Atmel AT91"
select GENERIC_GPIO
Expand Down Expand Up @@ -926,6 +940,8 @@ source "arch/arm/mach-ux500/Kconfig"

source "arch/arm/mach-versatile/Kconfig"

source "arch/arm/mach-vexpress/Kconfig"

source "arch/arm/mach-w90x900/Kconfig"

# Definitions to make life easier
Expand Down
1 change: 1 addition & 0 deletions arch/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ machine-$(CONFIG_ARCH_STMP37XX) := stmp37xx
machine-$(CONFIG_ARCH_U300) := u300
machine-$(CONFIG_ARCH_U8500) := ux500
machine-$(CONFIG_ARCH_VERSATILE) := versatile
machine-$(CONFIG_ARCH_VEXPRESS) := vexpress
machine-$(CONFIG_ARCH_W90X900) := w90x900
machine-$(CONFIG_ARCH_NUC93X) := nuc93x
machine-$(CONFIG_FOOTBRIDGE) := footbridge
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-vexpress/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
menu "Versatile Express platform type"
depends on ARCH_VEXPRESS

endmenu
5 changes: 5 additions & 0 deletions arch/arm/mach-vexpress/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# Makefile for the linux kernel.
#

obj-y := v2m.o
3 changes: 3 additions & 0 deletions arch/arm/mach-vexpress/Makefile.boot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zreladdr-y := 0x60008000
params_phys-y := 0x60000100
initrd_phys-y := 0x60800000
26 changes: 26 additions & 0 deletions arch/arm/mach-vexpress/core.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#define __MMIO_P2V(x) (((x) & 0xfffff) | (((x) & 0x0f000000) >> 4) | 0xf8000000)
#define MMIO_P2V(x) ((void __iomem *)__MMIO_P2V(x))

#define AMBA_DEVICE(name,busid,base,plat) \
struct amba_device name##_device = { \
.dev = { \
.coherent_dma_mask = ~0UL, \
.init_name = busid, \
.platform_data = plat, \
}, \
.res = { \
.start = base, \
.end = base + SZ_4K - 1, \
.flags = IORESOURCE_MEM, \
}, \
.dma_mask = ~0UL, \
.irq = IRQ_##base, \
/* .dma = DMA_##base,*/ \
}

struct map_desc;

void v2m_map_io(struct map_desc *tile, size_t num);
extern struct sys_timer v2m_timer;

extern void __iomem *gic_cpu_base_addr;
15 changes: 15 additions & 0 deletions arch/arm/mach-vexpress/include/mach/clkdev.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef __ASM_MACH_CLKDEV_H
#define __ASM_MACH_CLKDEV_H

#include <plat/clock.h>

struct clk {
const struct clk_ops *ops;
unsigned long rate;
const struct icst_params *params;
};

#define __clk_get(clk) ({ 1; })
#define __clk_put(clk) do { } while (0)

#endif
23 changes: 23 additions & 0 deletions arch/arm/mach-vexpress/include/mach/debug-macro.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* arch/arm/mach-realview/include/mach/debug-macro.S
*
* Debugging macro include header
*
* Copyright (C) 1994-1999 Russell King
* Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#define DEBUG_LL_UART_OFFSET 0x00009000

.macro addruart,rx,tmp
mrc p15, 0, \rx, c1, c0
tst \rx, #1 @ MMU enabled?
moveq \rx, #0x10000000
movne \rx, #0xf8000000 @ virtual base
orr \rx, \rx, #DEBUG_LL_UART_OFFSET
.endm

#include <asm/hardware/debug-pl01x.S>
67 changes: 67 additions & 0 deletions arch/arm/mach-vexpress/include/mach/entry-macro.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include <asm/hardware/gic.h>

.macro disable_fiq
.endm

.macro get_irqnr_preamble, base, tmp
ldr \base, =gic_cpu_base_addr
ldr \base, [\base]
.endm

.macro arch_ret_to_user, tmp1, tmp2
.endm

/*
* The interrupt numbering scheme is defined in the
* interrupt controller spec. To wit:
*
* Interrupts 0-15 are IPI
* 16-28 are reserved
* 29-31 are local. We allow 30 to be used for the watchdog.
* 32-1020 are global
* 1021-1022 are reserved
* 1023 is "spurious" (no interrupt)
*
* For now, we ignore all local interrupts so only return an interrupt if it's
* between 30 and 1020. The test_for_ipi routine below will pick up on IPIs.
*
* A simple read from the controller will tell us the number of the highest
* priority enabled interrupt. We then just need to check whether it is in the
* valid range for an IRQ (30-1020 inclusive).
*/

.macro get_irqnr_and_base, irqnr, irqstat, base, tmp
ldr \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 = src CPU, 9-0 = int # */
ldr \tmp, =1021
bic \irqnr, \irqstat, #0x1c00
cmp \irqnr, #29
cmpcc \irqnr, \irqnr
cmpne \irqnr, \tmp
cmpcs \irqnr, \irqnr
.endm

/* We assume that irqstat (the raw value of the IRQ acknowledge
* register) is preserved from the macro above.
* If there is an IPI, we immediately signal end of interrupt on the
* controller, since this requires the original irqstat value which
* we won't easily be able to recreate later.
*/

.macro test_for_ipi, irqnr, irqstat, base, tmp
bic \irqnr, \irqstat, #0x1c00
cmp \irqnr, #16
strcc \irqstat, [\base, #GIC_CPU_EOI]
cmpcs \irqnr, \irqnr
.endm

/* As above, this assumes that irqstat and base are preserved.. */

.macro test_for_ltirq, irqnr, irqstat, base, tmp
bic \irqnr, \irqstat, #0x1c00
mov \tmp, #0
cmp \irqnr, #29
moveq \tmp, #1
streq \irqstat, [\base, #GIC_CPU_EOI]
cmp \tmp, #0
.endm

1 change: 1 addition & 0 deletions arch/arm/mach-vexpress/include/mach/hardware.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* empty */
28 changes: 28 additions & 0 deletions arch/arm/mach-vexpress/include/mach/io.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* arch/arm/mach-vexpress/include/mach/io.h
*
* Copyright (C) 2003 ARM Limited
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __ASM_ARM_ARCH_IO_H
#define __ASM_ARM_ARCH_IO_H

#define IO_SPACE_LIMIT 0xffffffff

#define __io(a) __typesafe_io(a)
#define __mem_pci(a) (a)

#endif
4 changes: 4 additions & 0 deletions arch/arm/mach-vexpress/include/mach/irqs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define IRQ_LOCALTIMER 29
#define IRQ_LOCALWDOG 30

#define NR_IRQS 128
25 changes: 25 additions & 0 deletions arch/arm/mach-vexpress/include/mach/memory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* arch/arm/mach-vexpress/include/mach/memory.h
*
* Copyright (C) 2003 ARM Limited
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H

#define PHYS_OFFSET UL(0x60000000)

#endif
121 changes: 121 additions & 0 deletions arch/arm/mach-vexpress/include/mach/motherboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#ifndef __MACH_MOTHERBOARD_H
#define __MACH_MOTHERBOARD_H

/*
* Physical addresses, offset from V2M_PA_CS0-3
*/
#define V2M_NOR0 (V2M_PA_CS0)
#define V2M_NOR1 (V2M_PA_CS1)
#define V2M_SRAM (V2M_PA_CS2)
#define V2M_VIDEO_SRAM (V2M_PA_CS3 + 0x00000000)
#define V2M_LAN9118 (V2M_PA_CS3 + 0x02000000)
#define V2M_ISP1761 (V2M_PA_CS3 + 0x03000000)

/*
* Physical addresses, offset from V2M_PA_CS7
*/
#define V2M_SYSREGS (V2M_PA_CS7 + 0x00000000)
#define V2M_SYSCTL (V2M_PA_CS7 + 0x00001000)
#define V2M_SERIAL_BUS_PCI (V2M_PA_CS7 + 0x00002000)

#define V2M_AACI (V2M_PA_CS7 + 0x00004000)
#define V2M_MMCI (V2M_PA_CS7 + 0x00005000)
#define V2M_KMI0 (V2M_PA_CS7 + 0x00006000)
#define V2M_KMI1 (V2M_PA_CS7 + 0x00007000)

#define V2M_UART0 (V2M_PA_CS7 + 0x00009000)
#define V2M_UART1 (V2M_PA_CS7 + 0x0000a000)
#define V2M_UART2 (V2M_PA_CS7 + 0x0000b000)
#define V2M_UART3 (V2M_PA_CS7 + 0x0000c000)

#define V2M_WDT (V2M_PA_CS7 + 0x0000f000)

#define V2M_TIMER01 (V2M_PA_CS7 + 0x00011000)
#define V2M_TIMER23 (V2M_PA_CS7 + 0x00012000)

#define V2M_SERIAL_BUS_DVI (V2M_PA_CS7 + 0x00016000)
#define V2M_RTC (V2M_PA_CS7 + 0x00017000)

#define V2M_CF (V2M_PA_CS7 + 0x0001a000)
#define V2M_CLCD (V2M_PA_CS7 + 0x0001f000)

#define V2M_SYS_ID (V2M_SYSREGS + 0x000)
#define V2M_SYS_SW (V2M_SYSREGS + 0x004)
#define V2M_SYS_LED (V2M_SYSREGS + 0x008)
#define V2M_SYS_100HZ (V2M_SYSREGS + 0x024)
#define V2M_SYS_FLAGS (V2M_SYSREGS + 0x030)
#define V2M_SYS_FLAGSSET (V2M_SYSREGS + 0x030)
#define V2M_SYS_FLAGSCLR (V2M_SYSREGS + 0x034)
#define V2M_SYS_NVFLAGS (V2M_SYSREGS + 0x038)
#define V2M_SYS_NVFLAGSSET (V2M_SYSREGS + 0x038)
#define V2M_SYS_NVFLAGSCLR (V2M_SYSREGS + 0x03c)
#define V2M_SYS_MCI (V2M_SYSREGS + 0x048)
#define V2M_SYS_FLASH (V2M_SYSREGS + 0x03c)
#define V2M_SYS_CFGSW (V2M_SYSREGS + 0x058)
#define V2M_SYS_24MHZ (V2M_SYSREGS + 0x05c)
#define V2M_SYS_MISC (V2M_SYSREGS + 0x060)
#define V2M_SYS_DMA (V2M_SYSREGS + 0x064)
#define V2M_SYS_PROCID0 (V2M_SYSREGS + 0x084)
#define V2M_SYS_PROCID1 (V2M_SYSREGS + 0x088)
#define V2M_SYS_CFGDATA (V2M_SYSREGS + 0x0a0)
#define V2M_SYS_CFGCTRL (V2M_SYSREGS + 0x0a4)
#define V2M_SYS_CFGSTAT (V2M_SYSREGS + 0x0a8)

#define V2M_TIMER0 (V2M_TIMER01 + 0x000)
#define V2M_TIMER1 (V2M_TIMER01 + 0x020)

#define V2M_TIMER2 (V2M_TIMER23 + 0x000)
#define V2M_TIMER3 (V2M_TIMER23 + 0x020)


/*
* Interrupts. Those in {} are for AMBA devices
*/
#define IRQ_V2M_WDT { (32 + 0) }
#define IRQ_V2M_TIMER0 (32 + 2)
#define IRQ_V2M_TIMER1 (32 + 2)
#define IRQ_V2M_TIMER2 (32 + 3)
#define IRQ_V2M_TIMER3 (32 + 3)
#define IRQ_V2M_RTC { (32 + 4) }
#define IRQ_V2M_UART0 { (32 + 5) }
#define IRQ_V2M_UART1 { (32 + 6) }
#define IRQ_V2M_UART2 { (32 + 7) }
#define IRQ_V2M_UART3 { (32 + 8) }
#define IRQ_V2M_MMCI { (32 + 9), (32 + 10) }
#define IRQ_V2M_AACI { (32 + 11) }
#define IRQ_V2M_KMI0 { (32 + 12) }
#define IRQ_V2M_KMI1 { (32 + 13) }
#define IRQ_V2M_CLCD { (32 + 14) }
#define IRQ_V2M_LAN9118 (32 + 15)
#define IRQ_V2M_ISP1761 (32 + 16)
#define IRQ_V2M_PCIE (32 + 17)


/*
* Configuration
*/
#define SYS_CFG_START (1 << 31)
#define SYS_CFG_WRITE (1 << 30)
#define SYS_CFG_OSC (1 << 20)
#define SYS_CFG_VOLT (2 << 20)
#define SYS_CFG_AMP (3 << 20)
#define SYS_CFG_TEMP (4 << 20)
#define SYS_CFG_RESET (5 << 20)
#define SYS_CFG_SCC (6 << 20)
#define SYS_CFG_MUXFPGA (7 << 20)
#define SYS_CFG_SHUTDOWN (8 << 20)
#define SYS_CFG_REBOOT (9 << 20)
#define SYS_CFG_DVIMODE (11 << 20)
#define SYS_CFG_POWER (12 << 20)
#define SYS_CFG_SITE_MB (0 << 16)
#define SYS_CFG_SITE_DB1 (1 << 16)
#define SYS_CFG_SITE_DB2 (2 << 16)
#define SYS_CFG_STACK(n) ((n) << 12)

#define SYS_CFG_ERR (1 << 1)
#define SYS_CFG_COMPLETE (1 << 0)

int v2m_cfg_write(u32 devfn, u32 data);
int v2m_cfg_read(u32 devfn, u32 *data);

#endif
Loading

0 comments on commit ceade89

Please sign in to comment.