aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-02-11 16:44:53 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-05-02 04:35:38 -0400
commitceade897f31b8bb66f378cc35859fcfd0d46aaa2 (patch)
tree44f6fffb4f93ec6247b468e4009e414b4124f585 /arch
parent9bf5b2ef673237e0e43161c56f70ac8bf24e43f9 (diff)
ARM: Add Versatile Express support
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig16
-rw-r--r--arch/arm/Makefile1
-rw-r--r--arch/arm/mach-vexpress/Kconfig4
-rw-r--r--arch/arm/mach-vexpress/Makefile5
-rw-r--r--arch/arm/mach-vexpress/Makefile.boot3
-rw-r--r--arch/arm/mach-vexpress/core.h26
-rw-r--r--arch/arm/mach-vexpress/include/mach/clkdev.h15
-rw-r--r--arch/arm/mach-vexpress/include/mach/debug-macro.S23
-rw-r--r--arch/arm/mach-vexpress/include/mach/entry-macro.S67
-rw-r--r--arch/arm/mach-vexpress/include/mach/hardware.h1
-rw-r--r--arch/arm/mach-vexpress/include/mach/io.h28
-rw-r--r--arch/arm/mach-vexpress/include/mach/irqs.h4
-rw-r--r--arch/arm/mach-vexpress/include/mach/memory.h25
-rw-r--r--arch/arm/mach-vexpress/include/mach/motherboard.h121
-rw-r--r--arch/arm/mach-vexpress/include/mach/system.h37
-rw-r--r--arch/arm/mach-vexpress/include/mach/timex.h23
-rw-r--r--arch/arm/mach-vexpress/include/mach/uncompress.h52
-rw-r--r--arch/arm/mach-vexpress/include/mach/vmalloc.h21
-rw-r--r--arch/arm/mach-vexpress/v2m.c361
19 files changed, 833 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 55348705277..58080e17c28 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -276,6 +276,20 @@ config ARCH_VERSATILE
276 help 276 help
277 This enables support for ARM Ltd Versatile board. 277 This enables support for ARM Ltd Versatile board.
278 278
279config ARCH_VEXPRESS
280 bool "ARM Ltd. Versatile Express family"
281 select ARCH_WANT_OPTIONAL_GPIOLIB
282 select ARM_AMBA
283 select ARM_TIMER_SP804
284 select COMMON_CLKDEV
285 select GENERIC_CLOCKEVENTS
286 select GENERIC_TIME
287 select HAVE_CLK
288 select ICST
289 select PLAT_VERSATILE
290 help
291 This enables support for the ARM Ltd Versatile Express boards.
292
279config ARCH_AT91 293config ARCH_AT91
280 bool "Atmel AT91" 294 bool "Atmel AT91"
281 select GENERIC_GPIO 295 select GENERIC_GPIO
@@ -926,6 +940,8 @@ source "arch/arm/mach-ux500/Kconfig"
926 940
927source "arch/arm/mach-versatile/Kconfig" 941source "arch/arm/mach-versatile/Kconfig"
928 942
943source "arch/arm/mach-vexpress/Kconfig"
944
929source "arch/arm/mach-w90x900/Kconfig" 945source "arch/arm/mach-w90x900/Kconfig"
930 946
931# Definitions to make life easier 947# Definitions to make life easier
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 1962deb9073..67c92efa311 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -175,6 +175,7 @@ machine-$(CONFIG_ARCH_STMP37XX) := stmp37xx
175machine-$(CONFIG_ARCH_U300) := u300 175machine-$(CONFIG_ARCH_U300) := u300
176machine-$(CONFIG_ARCH_U8500) := ux500 176machine-$(CONFIG_ARCH_U8500) := ux500
177machine-$(CONFIG_ARCH_VERSATILE) := versatile 177machine-$(CONFIG_ARCH_VERSATILE) := versatile
178machine-$(CONFIG_ARCH_VEXPRESS) := vexpress
178machine-$(CONFIG_ARCH_W90X900) := w90x900 179machine-$(CONFIG_ARCH_W90X900) := w90x900
179machine-$(CONFIG_ARCH_NUC93X) := nuc93x 180machine-$(CONFIG_ARCH_NUC93X) := nuc93x
180machine-$(CONFIG_FOOTBRIDGE) := footbridge 181machine-$(CONFIG_FOOTBRIDGE) := footbridge
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
new file mode 100644
index 00000000000..751858c97e6
--- /dev/null
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -0,0 +1,4 @@
1menu "Versatile Express platform type"
2 depends on ARCH_VEXPRESS
3
4endmenu
diff --git a/arch/arm/mach-vexpress/Makefile b/arch/arm/mach-vexpress/Makefile
new file mode 100644
index 00000000000..b47cf732981
--- /dev/null
+++ b/arch/arm/mach-vexpress/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the linux kernel.
3#
4
5obj-y := v2m.o
diff --git a/arch/arm/mach-vexpress/Makefile.boot b/arch/arm/mach-vexpress/Makefile.boot
new file mode 100644
index 00000000000..07c2d9c457e
--- /dev/null
+++ b/arch/arm/mach-vexpress/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x60008000
2params_phys-y := 0x60000100
3initrd_phys-y := 0x60800000
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
new file mode 100644
index 00000000000..57dd95ce41f
--- /dev/null
+++ b/arch/arm/mach-vexpress/core.h
@@ -0,0 +1,26 @@
1#define __MMIO_P2V(x) (((x) & 0xfffff) | (((x) & 0x0f000000) >> 4) | 0xf8000000)
2#define MMIO_P2V(x) ((void __iomem *)__MMIO_P2V(x))
3
4#define AMBA_DEVICE(name,busid,base,plat) \
5struct amba_device name##_device = { \
6 .dev = { \
7 .coherent_dma_mask = ~0UL, \
8 .init_name = busid, \
9 .platform_data = plat, \
10 }, \
11 .res = { \
12 .start = base, \
13 .end = base + SZ_4K - 1, \
14 .flags = IORESOURCE_MEM, \
15 }, \
16 .dma_mask = ~0UL, \
17 .irq = IRQ_##base, \
18 /* .dma = DMA_##base,*/ \
19}
20
21struct map_desc;
22
23void v2m_map_io(struct map_desc *tile, size_t num);
24extern struct sys_timer v2m_timer;
25
26extern void __iomem *gic_cpu_base_addr;
diff --git a/arch/arm/mach-vexpress/include/mach/clkdev.h b/arch/arm/mach-vexpress/include/mach/clkdev.h
new file mode 100644
index 00000000000..3f8307d73ca
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/clkdev.h
@@ -0,0 +1,15 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#include <plat/clock.h>
5
6struct clk {
7 const struct clk_ops *ops;
8 unsigned long rate;
9 const struct icst_params *params;
10};
11
12#define __clk_get(clk) ({ 1; })
13#define __clk_put(clk) do { } while (0)
14
15#endif
diff --git a/arch/arm/mach-vexpress/include/mach/debug-macro.S b/arch/arm/mach-vexpress/include/mach/debug-macro.S
new file mode 100644
index 00000000000..5167e2aceeb
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/debug-macro.S
@@ -0,0 +1,23 @@
1/* arch/arm/mach-realview/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#define DEBUG_LL_UART_OFFSET 0x00009000
14
15 .macro addruart,rx,tmp
16 mrc p15, 0, \rx, c1, c0
17 tst \rx, #1 @ MMU enabled?
18 moveq \rx, #0x10000000
19 movne \rx, #0xf8000000 @ virtual base
20 orr \rx, \rx, #DEBUG_LL_UART_OFFSET
21 .endm
22
23#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-vexpress/include/mach/entry-macro.S b/arch/arm/mach-vexpress/include/mach/entry-macro.S
new file mode 100644
index 00000000000..20e9fb514f0
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/entry-macro.S
@@ -0,0 +1,67 @@
1#include <asm/hardware/gic.h>
2
3 .macro disable_fiq
4 .endm
5
6 .macro get_irqnr_preamble, base, tmp
7 ldr \base, =gic_cpu_base_addr
8 ldr \base, [\base]
9 .endm
10
11 .macro arch_ret_to_user, tmp1, tmp2
12 .endm
13
14 /*
15 * The interrupt numbering scheme is defined in the
16 * interrupt controller spec. To wit:
17 *
18 * Interrupts 0-15 are IPI
19 * 16-28 are reserved
20 * 29-31 are local. We allow 30 to be used for the watchdog.
21 * 32-1020 are global
22 * 1021-1022 are reserved
23 * 1023 is "spurious" (no interrupt)
24 *
25 * For now, we ignore all local interrupts so only return an interrupt if it's
26 * between 30 and 1020. The test_for_ipi routine below will pick up on IPIs.
27 *
28 * A simple read from the controller will tell us the number of the highest
29 * priority enabled interrupt. We then just need to check whether it is in the
30 * valid range for an IRQ (30-1020 inclusive).
31 */
32
33 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
34 ldr \irqstat, [\base, #GIC_CPU_INTACK] /* bits 12-10 = src CPU, 9-0 = int # */
35 ldr \tmp, =1021
36 bic \irqnr, \irqstat, #0x1c00
37 cmp \irqnr, #29
38 cmpcc \irqnr, \irqnr
39 cmpne \irqnr, \tmp
40 cmpcs \irqnr, \irqnr
41 .endm
42
43 /* We assume that irqstat (the raw value of the IRQ acknowledge
44 * register) is preserved from the macro above.
45 * If there is an IPI, we immediately signal end of interrupt on the
46 * controller, since this requires the original irqstat value which
47 * we won't easily be able to recreate later.
48 */
49
50 .macro test_for_ipi, irqnr, irqstat, base, tmp
51 bic \irqnr, \irqstat, #0x1c00
52 cmp \irqnr, #16
53 strcc \irqstat, [\base, #GIC_CPU_EOI]
54 cmpcs \irqnr, \irqnr
55 .endm
56
57 /* As above, this assumes that irqstat and base are preserved.. */
58
59 .macro test_for_ltirq, irqnr, irqstat, base, tmp
60 bic \irqnr, \irqstat, #0x1c00
61 mov \tmp, #0
62 cmp \irqnr, #29
63 moveq \tmp, #1
64 streq \irqstat, [\base, #GIC_CPU_EOI]
65 cmp \tmp, #0
66 .endm
67
diff --git a/arch/arm/mach-vexpress/include/mach/hardware.h b/arch/arm/mach-vexpress/include/mach/hardware.h
new file mode 100644
index 00000000000..40a8c178f10
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/hardware.h
@@ -0,0 +1 @@
/* empty */
diff --git a/arch/arm/mach-vexpress/include/mach/io.h b/arch/arm/mach-vexpress/include/mach/io.h
new file mode 100644
index 00000000000..748bb524ee7
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/io.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-vexpress/include/mach/io.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define IO_SPACE_LIMIT 0xffffffff
24
25#define __io(a) __typesafe_io(a)
26#define __mem_pci(a) (a)
27
28#endif
diff --git a/arch/arm/mach-vexpress/include/mach/irqs.h b/arch/arm/mach-vexpress/include/mach/irqs.h
new file mode 100644
index 00000000000..7054cbfc9de
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/irqs.h
@@ -0,0 +1,4 @@
1#define IRQ_LOCALTIMER 29
2#define IRQ_LOCALWDOG 30
3
4#define NR_IRQS 128
diff --git a/arch/arm/mach-vexpress/include/mach/memory.h b/arch/arm/mach-vexpress/include/mach/memory.h
new file mode 100644
index 00000000000..be28232ae63
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/memory.h
@@ -0,0 +1,25 @@
1/*
2 * arch/arm/mach-vexpress/include/mach/memory.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H
22
23#define PHYS_OFFSET UL(0x60000000)
24
25#endif
diff --git a/arch/arm/mach-vexpress/include/mach/motherboard.h b/arch/arm/mach-vexpress/include/mach/motherboard.h
new file mode 100644
index 00000000000..98a8ded055b
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/motherboard.h
@@ -0,0 +1,121 @@
1#ifndef __MACH_MOTHERBOARD_H
2#define __MACH_MOTHERBOARD_H
3
4/*
5 * Physical addresses, offset from V2M_PA_CS0-3
6 */
7#define V2M_NOR0 (V2M_PA_CS0)
8#define V2M_NOR1 (V2M_PA_CS1)
9#define V2M_SRAM (V2M_PA_CS2)
10#define V2M_VIDEO_SRAM (V2M_PA_CS3 + 0x00000000)
11#define V2M_LAN9118 (V2M_PA_CS3 + 0x02000000)
12#define V2M_ISP1761 (V2M_PA_CS3 + 0x03000000)
13
14/*
15 * Physical addresses, offset from V2M_PA_CS7
16 */
17#define V2M_SYSREGS (V2M_PA_CS7 + 0x00000000)
18#define V2M_SYSCTL (V2M_PA_CS7 + 0x00001000)
19#define V2M_SERIAL_BUS_PCI (V2M_PA_CS7 + 0x00002000)
20
21#define V2M_AACI (V2M_PA_CS7 + 0x00004000)
22#define V2M_MMCI (V2M_PA_CS7 + 0x00005000)
23#define V2M_KMI0 (V2M_PA_CS7 + 0x00006000)
24#define V2M_KMI1 (V2M_PA_CS7 + 0x00007000)
25
26#define V2M_UART0 (V2M_PA_CS7 + 0x00009000)
27#define V2M_UART1 (V2M_PA_CS7 + 0x0000a000)
28#define V2M_UART2 (V2M_PA_CS7 + 0x0000b000)
29#define V2M_UART3 (V2M_PA_CS7 + 0x0000c000)
30
31#define V2M_WDT (V2M_PA_CS7 + 0x0000f000)
32
33#define V2M_TIMER01 (V2M_PA_CS7 + 0x00011000)
34#define V2M_TIMER23 (V2M_PA_CS7 + 0x00012000)
35
36#define V2M_SERIAL_BUS_DVI (V2M_PA_CS7 + 0x00016000)
37#define V2M_RTC (V2M_PA_CS7 + 0x00017000)
38
39#define V2M_CF (V2M_PA_CS7 + 0x0001a000)
40#define V2M_CLCD (V2M_PA_CS7 + 0x0001f000)
41
42#define V2M_SYS_ID (V2M_SYSREGS + 0x000)
43#define V2M_SYS_SW (V2M_SYSREGS + 0x004)
44#define V2M_SYS_LED (V2M_SYSREGS + 0x008)
45#define V2M_SYS_100HZ (V2M_SYSREGS + 0x024)
46#define V2M_SYS_FLAGS (V2M_SYSREGS + 0x030)
47#define V2M_SYS_FLAGSSET (V2M_SYSREGS + 0x030)
48#define V2M_SYS_FLAGSCLR (V2M_SYSREGS + 0x034)
49#define V2M_SYS_NVFLAGS (V2M_SYSREGS + 0x038)
50#define V2M_SYS_NVFLAGSSET (V2M_SYSREGS + 0x038)
51#define V2M_SYS_NVFLAGSCLR (V2M_SYSREGS + 0x03c)
52#define V2M_SYS_MCI (V2M_SYSREGS + 0x048)
53#define V2M_SYS_FLASH (V2M_SYSREGS + 0x03c)
54#define V2M_SYS_CFGSW (V2M_SYSREGS + 0x058)
55#define V2M_SYS_24MHZ (V2M_SYSREGS + 0x05c)
56#define V2M_SYS_MISC (V2M_SYSREGS + 0x060)
57#define V2M_SYS_DMA (V2M_SYSREGS + 0x064)
58#define V2M_SYS_PROCID0 (V2M_SYSREGS + 0x084)
59#define V2M_SYS_PROCID1 (V2M_SYSREGS + 0x088)
60#define V2M_SYS_CFGDATA (V2M_SYSREGS + 0x0a0)
61#define V2M_SYS_CFGCTRL (V2M_SYSREGS + 0x0a4)
62#define V2M_SYS_CFGSTAT (V2M_SYSREGS + 0x0a8)
63
64#define V2M_TIMER0 (V2M_TIMER01 + 0x000)
65#define V2M_TIMER1 (V2M_TIMER01 + 0x020)
66
67#define V2M_TIMER2 (V2M_TIMER23 + 0x000)
68#define V2M_TIMER3 (V2M_TIMER23 + 0x020)
69
70
71/*
72 * Interrupts. Those in {} are for AMBA devices
73 */
74#define IRQ_V2M_WDT { (32 + 0) }
75#define IRQ_V2M_TIMER0 (32 + 2)
76#define IRQ_V2M_TIMER1 (32 + 2)
77#define IRQ_V2M_TIMER2 (32 + 3)
78#define IRQ_V2M_TIMER3 (32 + 3)
79#define IRQ_V2M_RTC { (32 + 4) }
80#define IRQ_V2M_UART0 { (32 + 5) }
81#define IRQ_V2M_UART1 { (32 + 6) }
82#define IRQ_V2M_UART2 { (32 + 7) }
83#define IRQ_V2M_UART3 { (32 + 8) }
84#define IRQ_V2M_MMCI { (32 + 9), (32 + 10) }
85#define IRQ_V2M_AACI { (32 + 11) }
86#define IRQ_V2M_KMI0 { (32 + 12) }
87#define IRQ_V2M_KMI1 { (32 + 13) }
88#define IRQ_V2M_CLCD { (32 + 14) }
89#define IRQ_V2M_LAN9118 (32 + 15)
90#define IRQ_V2M_ISP1761 (32 + 16)
91#define IRQ_V2M_PCIE (32 + 17)
92
93
94/*
95 * Configuration
96 */
97#define SYS_CFG_START (1 << 31)
98#define SYS_CFG_WRITE (1 << 30)
99#define SYS_CFG_OSC (1 << 20)
100#define SYS_CFG_VOLT (2 << 20)
101#define SYS_CFG_AMP (3 << 20)
102#define SYS_CFG_TEMP (4 << 20)
103#define SYS_CFG_RESET (5 << 20)
104#define SYS_CFG_SCC (6 << 20)
105#define SYS_CFG_MUXFPGA (7 << 20)
106#define SYS_CFG_SHUTDOWN (8 << 20)
107#define SYS_CFG_REBOOT (9 << 20)
108#define SYS_CFG_DVIMODE (11 << 20)
109#define SYS_CFG_POWER (12 << 20)
110#define SYS_CFG_SITE_MB (0 << 16)
111#define SYS_CFG_SITE_DB1 (1 << 16)
112#define SYS_CFG_SITE_DB2 (2 << 16)
113#define SYS_CFG_STACK(n) ((n) << 12)
114
115#define SYS_CFG_ERR (1 << 1)
116#define SYS_CFG_COMPLETE (1 << 0)
117
118int v2m_cfg_write(u32 devfn, u32 data);
119int v2m_cfg_read(u32 devfn, u32 *data);
120
121#endif
diff --git a/arch/arm/mach-vexpress/include/mach/system.h b/arch/arm/mach-vexpress/include/mach/system.h
new file mode 100644
index 00000000000..899a4e628a4
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/system.h
@@ -0,0 +1,37 @@
1/*
2 * arch/arm/mach-vexpress/include/mach/system.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_ARCH_SYSTEM_H
22#define __ASM_ARCH_SYSTEM_H
23
24static inline void arch_idle(void)
25{
26 /*
27 * This should do all the clock switching
28 * and wait for interrupt tricks
29 */
30 cpu_do_idle();
31}
32
33static inline void arch_reset(char mode, const char *cmd)
34{
35}
36
37#endif
diff --git a/arch/arm/mach-vexpress/include/mach/timex.h b/arch/arm/mach-vexpress/include/mach/timex.h
new file mode 100644
index 00000000000..00029bacd43
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/timex.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/mach-vexpress/include/mach/timex.h
3 *
4 * RealView architecture timex specifications
5 *
6 * Copyright (C) 2003 ARM Limited
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#define CLOCK_TICK_RATE (50000000 / 16)
diff --git a/arch/arm/mach-vexpress/include/mach/uncompress.h b/arch/arm/mach-vexpress/include/mach/uncompress.h
new file mode 100644
index 00000000000..7972c5748d0
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/uncompress.h
@@ -0,0 +1,52 @@
1/*
2 * arch/arm/mach-vexpress/include/mach/uncompress.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#define AMBA_UART_DR(base) (*(volatile unsigned char *)((base) + 0x00))
21#define AMBA_UART_LCRH(base) (*(volatile unsigned char *)((base) + 0x2c))
22#define AMBA_UART_CR(base) (*(volatile unsigned char *)((base) + 0x30))
23#define AMBA_UART_FR(base) (*(volatile unsigned char *)((base) + 0x18))
24
25#define get_uart_base() (0x10000000 + 0x00009000)
26
27/*
28 * This does not append a newline
29 */
30static inline void putc(int c)
31{
32 unsigned long base = get_uart_base();
33
34 while (AMBA_UART_FR(base) & (1 << 5))
35 barrier();
36
37 AMBA_UART_DR(base) = c;
38}
39
40static inline void flush(void)
41{
42 unsigned long base = get_uart_base();
43
44 while (AMBA_UART_FR(base) & (1 << 3))
45 barrier();
46}
47
48/*
49 * nothing to do
50 */
51#define arch_decomp_setup()
52#define arch_decomp_wdog()
diff --git a/arch/arm/mach-vexpress/include/mach/vmalloc.h b/arch/arm/mach-vexpress/include/mach/vmalloc.h
new file mode 100644
index 00000000000..f43a36ef678
--- /dev/null
+++ b/arch/arm/mach-vexpress/include/mach/vmalloc.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-vexpress/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 * Copyright (C) 2000 Russell King.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#define VMALLOC_END 0xf8000000UL
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
new file mode 100644
index 00000000000..d250711b8c7
--- /dev/null
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -0,0 +1,361 @@
1/*
2 * Versatile Express V2M Motherboard Support
3 */
4#include <linux/device.h>
5#include <linux/amba/bus.h>
6#include <linux/amba/mmci.h>
7#include <linux/io.h>
8#include <linux/init.h>
9#include <linux/platform_device.h>
10#include <linux/smsc911x.h>
11#include <linux/spinlock.h>
12#include <linux/sysdev.h>
13#include <linux/usb/isp1760.h>
14
15#include <asm/clkdev.h>
16#include <asm/sizes.h>
17#include <asm/mach/flash.h>
18#include <asm/mach/map.h>
19#include <asm/mach/time.h>
20#include <asm/hardware/arm_timer.h>
21
22#include <mach/clkdev.h>
23#include <mach/motherboard.h>
24
25#include <plat/timer-sp.h>
26
27#include "core.h"
28
29#define V2M_PA_CS0 0x40000000
30#define V2M_PA_CS1 0x44000000
31#define V2M_PA_CS2 0x48000000
32#define V2M_PA_CS3 0x4c000000
33#define V2M_PA_CS7 0x10000000
34
35static struct map_desc v2m_io_desc[] __initdata = {
36 {
37 .virtual = __MMIO_P2V(V2M_PA_CS7),
38 .pfn = __phys_to_pfn(V2M_PA_CS7),
39 .length = SZ_128K,
40 .type = MT_DEVICE,
41 },
42};
43
44void __init v2m_map_io(struct map_desc *tile, size_t num)
45{
46 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc));
47 iotable_init(tile, num);
48}
49
50
51static void v2m_timer_init(void)
52{
53 writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL);
54 writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL);
55
56 sp804_clocksource_init(MMIO_P2V(V2M_TIMER1));
57 sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0);
58}
59
60struct sys_timer v2m_timer = {
61 .init = v2m_timer_init,
62};
63
64
65static DEFINE_SPINLOCK(v2m_cfg_lock);
66
67int v2m_cfg_write(u32 devfn, u32 data)
68{
69 /* Configuration interface broken? */
70 u32 val;
71
72 printk("%s: writing %08x to %08x\n", __func__, data, devfn);
73
74 devfn |= SYS_CFG_START | SYS_CFG_WRITE;
75
76 spin_lock(&v2m_cfg_lock);
77 val = readl(MMIO_P2V(V2M_SYS_CFGSTAT));
78 writel(val & ~SYS_CFG_COMPLETE, MMIO_P2V(V2M_SYS_CFGSTAT));
79
80 writel(data, MMIO_P2V(V2M_SYS_CFGDATA));
81 writel(devfn, MMIO_P2V(V2M_SYS_CFGCTRL));
82
83 do {
84 val = readl(MMIO_P2V(V2M_SYS_CFGSTAT));
85 } while (val == 0);
86 spin_unlock(&v2m_cfg_lock);
87
88 return !!(val & SYS_CFG_ERR);
89}
90
91int v2m_cfg_read(u32 devfn, u32 *data)
92{
93 u32 val;
94
95 devfn |= SYS_CFG_START;
96
97 spin_lock(&v2m_cfg_lock);
98 writel(0, MMIO_P2V(V2M_SYS_CFGSTAT));
99 writel(devfn, MMIO_P2V(V2M_SYS_CFGCTRL));
100
101 mb();
102
103 do {
104 cpu_relax();
105 val = readl(MMIO_P2V(V2M_SYS_CFGSTAT));
106 } while (val == 0);
107
108 *data = readl(MMIO_P2V(V2M_SYS_CFGDATA));
109 spin_unlock(&v2m_cfg_lock);
110
111 return !!(val & SYS_CFG_ERR);
112}
113
114
115static struct resource v2m_pcie_i2c_resource = {
116 .start = V2M_SERIAL_BUS_PCI,
117 .end = V2M_SERIAL_BUS_PCI + SZ_4K - 1,
118 .flags = IORESOURCE_MEM,
119};
120
121static struct platform_device v2m_pcie_i2c_device = {
122 .name = "versatile-i2c",
123 .id = 0,
124 .num_resources = 1,
125 .resource = &v2m_pcie_i2c_resource,
126};
127
128static struct resource v2m_ddc_i2c_resource = {
129 .start = V2M_SERIAL_BUS_DVI,
130 .end = V2M_SERIAL_BUS_DVI + SZ_4K - 1,
131 .flags = IORESOURCE_MEM,
132};
133
134static struct platform_device v2m_ddc_i2c_device = {
135 .name = "versatile-i2c",
136 .id = 1,
137 .num_resources = 1,
138 .resource = &v2m_ddc_i2c_resource,
139};
140
141static struct resource v2m_eth_resources[] = {
142 {
143 .start = V2M_LAN9118,
144 .end = V2M_LAN9118 + SZ_64K - 1,
145 .flags = IORESOURCE_MEM,
146 }, {
147 .start = IRQ_V2M_LAN9118,
148 .end = IRQ_V2M_LAN9118,
149 .flags = IORESOURCE_IRQ,
150 },
151};
152
153static struct smsc911x_platform_config v2m_eth_config = {
154 .flags = SMSC911X_USE_32BIT,
155 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
156 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
157 .phy_interface = PHY_INTERFACE_MODE_MII,
158};
159
160static struct platform_device v2m_eth_device = {
161 .name = "smsc911x",
162 .id = -1,
163 .resource = v2m_eth_resources,
164 .num_resources = ARRAY_SIZE(v2m_eth_resources),
165 .dev.platform_data = &v2m_eth_config,
166};
167
168static struct resource v2m_usb_resources[] = {
169 {
170 .start = V2M_ISP1761,
171 .end = V2M_ISP1761 + SZ_128K - 1,
172 .flags = IORESOURCE_MEM,
173 }, {
174 .start = IRQ_V2M_ISP1761,
175 .end = IRQ_V2M_ISP1761,
176 .flags = IORESOURCE_IRQ,
177 },
178};
179
180static struct isp1760_platform_data v2m_usb_config = {
181 .is_isp1761 = true,
182 .bus_width_16 = false,
183 .port1_otg = true,
184 .analog_oc = false,
185 .dack_polarity_high = false,
186 .dreq_polarity_high = false,
187};
188
189static struct platform_device v2m_usb_device = {
190 .name = "isp1760",
191 .id = -1,
192 .resource = v2m_usb_resources,
193 .num_resources = ARRAY_SIZE(v2m_usb_resources),
194 .dev.platform_data = &v2m_usb_config,
195};
196
197static int v2m_flash_init(void)
198{
199 writel(0, MMIO_P2V(V2M_SYS_FLASH));
200 return 0;
201}
202
203static void v2m_flash_exit(void)
204{
205 writel(0, MMIO_P2V(V2M_SYS_FLASH));
206}
207
208static void v2m_flash_set_vpp(int on)
209{
210 writel(on != 0, MMIO_P2V(V2M_SYS_FLASH));
211}
212
213static struct flash_platform_data v2m_flash_data = {
214 .map_name = "cfi_probe",
215 .width = 4,
216 .init = v2m_flash_init,
217 .exit = v2m_flash_exit,
218 .set_vpp = v2m_flash_set_vpp,
219};
220
221static struct resource v2m_flash_resources[] = {
222 {
223 .start = V2M_NOR0,
224 .end = V2M_NOR0 + SZ_64M - 1,
225 .flags = IORESOURCE_MEM,
226 }, {
227 .start = V2M_NOR1,
228 .end = V2M_NOR1 + SZ_64M - 1,
229 .flags = IORESOURCE_MEM,
230 },
231};
232
233static struct platform_device v2m_flash_device = {
234 .name = "armflash",
235 .id = -1,
236 .resource = v2m_flash_resources,
237 .num_resources = ARRAY_SIZE(v2m_flash_resources),
238 .dev.platform_data = &v2m_flash_data,
239};
240
241
242static unsigned int v2m_mmci_status(struct device *dev)
243{
244 return !(readl(MMIO_P2V(V2M_SYS_MCI)) & (1 << 0));
245}
246
247static struct mmci_platform_data v2m_mmci_data = {
248 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
249 .status = v2m_mmci_status,
250};
251
252static AMBA_DEVICE(aaci, "mb:aaci", V2M_AACI, NULL);
253static AMBA_DEVICE(mmci, "mb:mmci", V2M_MMCI, &v2m_mmci_data);
254static AMBA_DEVICE(kmi0, "mb:kmi0", V2M_KMI0, NULL);
255static AMBA_DEVICE(kmi1, "mb:kmi1", V2M_KMI1, NULL);
256static AMBA_DEVICE(uart0, "mb:uart0", V2M_UART0, NULL);
257static AMBA_DEVICE(uart1, "mb:uart1", V2M_UART1, NULL);
258static AMBA_DEVICE(uart2, "mb:uart2", V2M_UART2, NULL);
259static AMBA_DEVICE(uart3, "mb:uart3", V2M_UART3, NULL);
260static AMBA_DEVICE(wdt, "mb:wdt", V2M_WDT, NULL);
261static AMBA_DEVICE(rtc, "mb:rtc", V2M_RTC, NULL);
262
263static struct amba_device *v2m_amba_devs[] __initdata = {
264 &aaci_device,
265 &mmci_device,
266 &kmi0_device,
267 &kmi1_device,
268 &uart0_device,
269 &uart1_device,
270 &uart2_device,
271 &uart3_device,
272 &wdt_device,
273 &rtc_device,
274};
275
276
277static long v2m_osc_round(struct clk *clk, unsigned long rate)
278{
279 return rate;
280}
281
282static int v2m_osc1_set(struct clk *clk, unsigned long rate)
283{
284 return v2m_cfg_write(SYS_CFG_OSC | SYS_CFG_SITE_MB | 1, rate);
285}
286
287static const struct clk_ops osc1_clk_ops = {
288 .round = v2m_osc_round,
289 .set = v2m_osc1_set,
290};
291
292static struct clk osc1_clk = {
293 .ops = &osc1_clk_ops,
294 .rate = 24000000,
295};
296
297static struct clk osc2_clk = {
298 .rate = 24000000,
299};
300
301static struct clk_lookup v2m_lookups[] = {
302 { /* UART0 */
303 .dev_id = "mb:uart0",
304 .clk = &osc2_clk,
305 }, { /* UART1 */
306 .dev_id = "mb:uart1",
307 .clk = &osc2_clk,
308 }, { /* UART2 */
309 .dev_id = "mb:uart2",
310 .clk = &osc2_clk,
311 }, { /* UART3 */
312 .dev_id = "mb:uart3",
313 .clk = &osc2_clk,
314 }, { /* KMI0 */
315 .dev_id = "mb:kmi0",
316 .clk = &osc2_clk,
317 }, { /* KMI1 */
318 .dev_id = "mb:kmi1",
319 .clk = &osc2_clk,
320 }, { /* MMC0 */
321 .dev_id = "mb:mmci",
322 .clk = &osc2_clk,
323 }, { /* CLCD */
324 .dev_id = "mb:clcd",
325 .clk = &osc1_clk,
326 },
327};
328
329static void v2m_power_off(void)
330{
331 if (v2m_cfg_write(SYS_CFG_SHUTDOWN | SYS_CFG_SITE_MB, 0))
332 printk(KERN_EMERG "Unable to shutdown\n");
333}
334
335static void v2m_restart(char str, const char *cmd)
336{
337 if (v2m_cfg_write(SYS_CFG_REBOOT | SYS_CFG_SITE_MB, 0))
338 printk(KERN_EMERG "Unable to reboot\n");
339}
340
341static int __init v2m_init(void)
342{
343 int i;
344
345 clkdev_add_table(v2m_lookups, ARRAY_SIZE(v2m_lookups));
346
347 platform_device_register(&v2m_pcie_i2c_device);
348 platform_device_register(&v2m_ddc_i2c_device);
349 platform_device_register(&v2m_flash_device);
350 platform_device_register(&v2m_eth_device);
351 platform_device_register(&v2m_usb_device);
352
353 for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++)
354 amba_device_register(v2m_amba_devs[i], &iomem_resource);
355
356 pm_power_off = v2m_power_off;
357 arm_pm_restart = v2m_restart;
358
359 return 0;
360}
361arch_initcall(v2m_init);