aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig53
-rw-r--r--arch/arm/common/gic.c46
-rw-r--r--arch/arm/common/sa1111.c5
-rw-r--r--arch/arm/include/asm/hwcap.h1
-rw-r--r--arch/arm/include/asm/irq.h2
-rw-r--r--arch/arm/include/asm/kexec.h22
-rw-r--r--arch/arm/include/asm/mach/arch.h2
-rw-r--r--arch/arm/include/asm/mach/irq.h1
-rw-r--r--arch/arm/include/asm/memblock.h16
-rw-r--r--arch/arm/include/asm/memory.h67
-rw-r--r--arch/arm/include/asm/mmzone.h30
-rw-r--r--arch/arm/include/asm/ptrace.h36
-rw-r--r--arch/arm/include/asm/setup.h8
-rw-r--r--arch/arm/include/asm/tls.h46
-rw-r--r--arch/arm/include/asm/vfpmacros.h18
-rw-r--r--arch/arm/kernel/Makefile1
-rw-r--r--arch/arm/kernel/crash_dump.c60
-rw-r--r--arch/arm/kernel/entry-armv.S23
-rw-r--r--arch/arm/kernel/irq.c41
-rw-r--r--arch/arm/kernel/machine_kexec.c4
-rw-r--r--arch/arm/kernel/ptrace.c96
-rw-r--r--arch/arm/kernel/relocate_kernel.S6
-rw-r--r--arch/arm/kernel/setup.c100
-rw-r--r--arch/arm/kernel/traps.c41
-rw-r--r--arch/arm/mach-aaec2000/include/mach/memory.h10
-rw-r--r--arch/arm/mach-at91/Kconfig11
-rw-r--r--arch/arm/mach-at91/Makefile3
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c11
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c45
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c45
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c189
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h22
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9260.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9261.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h130
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_sdramc.h23
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9rl.h2
-rw-r--r--arch/arm/mach-at91/include/mach/board.h2
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h10
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h1
-rw-r--r--arch/arm/mach-at91/pm.h49
-rw-r--r--arch/arm/mach-at91/pm_slowclock.S74
-rw-r--r--arch/arm/mach-bcmring/core.c23
-rw-r--r--arch/arm/mach-clps711x/Kconfig1
-rw-r--r--arch/arm/mach-clps711x/clep7312.c1
-rw-r--r--arch/arm/mach-clps711x/edb7211-arch.c10
-rw-r--r--arch/arm/mach-clps711x/fortunet.c1
-rw-r--r--arch/arm/mach-clps711x/include/mach/memory.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/memory.h9
-rw-r--r--arch/arm/mach-ep93xx/adssphere.c24
-rw-r--r--arch/arm/mach-ep93xx/clock.c2
-rw-r--r--arch/arm/mach-ep93xx/core.c46
-rw-r--r--arch/arm/mach-ep93xx/edb93xx.c31
-rw-r--r--arch/arm/mach-ep93xx/gesbc9312.c24
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h3
-rw-r--r--arch/arm/mach-ep93xx/micro9.c37
-rw-r--r--arch/arm/mach-ep93xx/simone.c24
-rw-r--r--arch/arm/mach-ep93xx/ts72xx.c27
-rw-r--r--arch/arm/mach-integrator/common.h1
-rw-r--r--arch/arm/mach-integrator/core.c19
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c3
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c3
-rw-r--r--arch/arm/mach-iop13xx/include/mach/memory.h2
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c4
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/memory.h6
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/memory.h44
-rw-r--r--arch/arm/mach-msm/board-trout.c1
-rw-r--r--arch/arm/mach-nomadik/clock.c4
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c1
-rw-r--r--arch/arm/mach-omap1/board-fsample.c1
-rw-r--r--arch/arm/mach-omap1/board-generic.c1
-rw-r--r--arch/arm/mach-omap1/board-h2.c1
-rw-r--r--arch/arm/mach-omap1/board-h3.c1
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c1
-rw-r--r--arch/arm/mach-omap1/board-innovator.c1
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c1
-rw-r--r--arch/arm/mach-omap1/board-osk.c1
-rw-r--r--arch/arm/mach-omap1/board-palmte.c1
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c1
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c14
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c1
-rw-r--r--arch/arm/mach-omap1/board-sx1.c3
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c1
-rw-r--r--arch/arm/mach-omap1/io.c2
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c1
-rw-r--r--arch/arm/mach-omap2/board-apollon.c1
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c1
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c1
-rw-r--r--arch/arm/mach-omap2/board-generic.c1
-rw-r--r--arch/arm/mach-omap2/board-h4.c1
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c1
-rw-r--r--arch/arm/mach-omap2/board-ldp.c1
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c3
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c1
-rw-r--r--arch/arm/mach-omap2/board-overo.c1
-rw-r--r--arch/arm/mach-omap2/board-rx51.c1
-rw-r--r--arch/arm/mach-omap2/board-zoom2.c1
-rw-r--r--arch/arm/mach-omap2/board-zoom3.c1
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c5
-rw-r--r--arch/arm/mach-omap2/io.c3
-rw-r--r--arch/arm/mach-pxa/cm-x2xx-pci.c4
-rw-r--r--arch/arm/mach-pxa/corgi.c1
-rw-r--r--arch/arm/mach-pxa/eseries.c1
-rw-r--r--arch/arm/mach-pxa/generic.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/memory.h19
-rw-r--r--arch/arm/mach-pxa/palmt5.c7
-rw-r--r--arch/arm/mach-pxa/palmtreo.c9
-rw-r--r--arch/arm/mach-pxa/poodle.c1
-rw-r--r--arch/arm/mach-pxa/spitz.c1
-rw-r--r--arch/arm/mach-pxa/tosa.c1
-rw-r--r--arch/arm/mach-realview/core.c40
-rw-r--r--arch/arm/mach-realview/include/mach/board-pb1176.h1
-rw-r--r--arch/arm/mach-realview/include/mach/irqs-pb1176.h2
-rw-r--r--arch/arm/mach-realview/include/mach/memory.h7
-rw-r--r--arch/arm/mach-realview/realview_eb.c30
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c46
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c9
-rw-r--r--arch/arm/mach-realview/realview_pba8.c9
-rw-r--r--arch/arm/mach-realview/realview_pbx.c9
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c9
-rw-r--r--arch/arm/mach-s3c2412/mach-smdk2413.c1
-rw-r--r--arch/arm/mach-s3c2412/mach-vstms.c1
-rw-r--r--arch/arm/mach-s3c2440/mach-rx1950.c9
-rw-r--r--arch/arm/mach-s3c2440/mach-rx3715.c9
-rw-r--r--arch/arm/mach-sa1100/generic.h3
-rw-r--r--arch/arm/mach-sa1100/include/mach/memory.h6
-rw-r--r--arch/arm/mach-shark/include/mach/memory.h7
-rw-r--r--arch/arm/mach-spear3xx/clock.c3
-rw-r--r--arch/arm/mach-spear6xx/clock.c3
-rw-r--r--arch/arm/mach-u300/clock.c6
-rw-r--r--arch/arm/mach-u300/u300.c17
-rw-r--r--arch/arm/mach-ux500/board-mop500.c36
-rw-r--r--arch/arm/mach-ux500/clock.c4
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c14
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs-board-mop500.h23
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs-db5500.h85
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs-db8500.h96
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs.h22
-rw-r--r--arch/arm/mach-ux500/pins-db8500.h742
-rw-r--r--arch/arm/mach-versatile/core.c35
-rw-r--r--arch/arm/mach-versatile/pci.c2
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c2
-rw-r--r--arch/arm/mach-vexpress/include/mach/ct-ca9x4.h1
-rw-r--r--arch/arm/mach-vexpress/v2m.c7
-rw-r--r--arch/arm/mach-w90x900/dev.c96
-rw-r--r--arch/arm/mach-w90x900/include/mach/regs-gcr.h39
-rw-r--r--arch/arm/mach-w90x900/mach-nuc950evb.c44
-rw-r--r--arch/arm/mach-w90x900/nuc910.c2
-rw-r--r--arch/arm/mach-w90x900/nuc950.c2
-rw-r--r--arch/arm/mm/Kconfig11
-rw-r--r--arch/arm/mm/Makefile1
-rw-r--r--arch/arm/mm/discontig.c45
-rw-r--r--arch/arm/mm/init.c392
-rw-r--r--arch/arm/mm/ioremap.c6
-rw-r--r--arch/arm/mm/mm.h4
-rw-r--r--arch/arm/mm/mmu.c161
-rw-r--r--arch/arm/mm/nommu.c22
-rw-r--r--arch/arm/mm/proc-v6.S5
-rw-r--r--arch/arm/mm/proc-v7.S2
-rw-r--r--arch/arm/plat-iop/time.c53
-rw-r--r--arch/arm/plat-nomadik/gpio.c316
-rw-r--r--arch/arm/plat-nomadik/include/plat/gpio.h15
-rw-r--r--arch/arm/plat-nomadik/include/plat/mtu.h6
-rw-r--r--arch/arm/plat-nomadik/include/plat/pincfg.h72
-rw-r--r--arch/arm/plat-nomadik/timer.c14
-rw-r--r--arch/arm/plat-omap/common.c8
-rw-r--r--arch/arm/plat-omap/fb.c77
-rw-r--r--arch/arm/plat-omap/include/plat/common.h2
-rw-r--r--arch/arm/plat-omap/include/plat/vram.h4
-rw-r--r--arch/arm/plat-spear/time.c47
-rw-r--r--arch/arm/plat-versatile/Makefile4
-rw-r--r--arch/arm/plat-versatile/leds.c103
-rw-r--r--arch/arm/vfp/vfpmodule.c10
181 files changed, 3456 insertions, 1223 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 34cef2546e42..4047f5724da3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -10,6 +10,7 @@ config ARM
10 default y 10 default y
11 select HAVE_AOUT 11 select HAVE_AOUT
12 select HAVE_IDE 12 select HAVE_IDE
13 select HAVE_MEMBLOCK
13 select RTC_LIB 14 select RTC_LIB
14 select SYS_SUPPORTS_APM_EMULATION 15 select SYS_SUPPORTS_APM_EMULATION
15 select GENERIC_ATOMIC64 if (!CPU_32v6K) 16 select GENERIC_ATOMIC64 if (!CPU_32v6K)
@@ -24,6 +25,7 @@ config ARM
24 select HAVE_KERNEL_LZMA 25 select HAVE_KERNEL_LZMA
25 select HAVE_PERF_EVENTS 26 select HAVE_PERF_EVENTS
26 select PERF_USE_VMALLOC 27 select PERF_USE_VMALLOC
28 select HAVE_REGS_AND_STACK_ACCESS_API
27 help 29 help
28 The ARM series is a line of low-power-consumption RISC chip designs 30 The ARM series is a line of low-power-consumption RISC chip designs
29 licensed by ARM Ltd and targeted at embedded applications and 31 licensed by ARM Ltd and targeted at embedded applications and
@@ -704,7 +706,6 @@ config ARCH_SHARK
704config ARCH_LH7A40X 706config ARCH_LH7A40X
705 bool "Sharp LH7A40X" 707 bool "Sharp LH7A40X"
706 select CPU_ARM922T 708 select CPU_ARM922T
707 select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM
708 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM 709 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM
709 select ARCH_USES_GETTIMEOFFSET 710 select ARCH_USES_GETTIMEOFFSET
710 help 711 help
@@ -1016,11 +1017,6 @@ endmenu
1016 1017
1017source "arch/arm/common/Kconfig" 1018source "arch/arm/common/Kconfig"
1018 1019
1019config FORCE_MAX_ZONEORDER
1020 int
1021 depends on SA1111
1022 default "9"
1023
1024menu "Bus support" 1020menu "Bus support"
1025 1021
1026config ARM_AMBA 1022config ARM_AMBA
@@ -1157,9 +1153,10 @@ config HOTPLUG_CPU
1157config LOCAL_TIMERS 1153config LOCAL_TIMERS
1158 bool "Use local timer interrupts" 1154 bool "Use local timer interrupts"
1159 depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || \ 1155 depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || \
1160 REALVIEW_EB_A9MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || ARCH_U8500) 1156 REALVIEW_EB_A9MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
1157 ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
1161 default y 1158 default y
1162 select HAVE_ARM_TWD if (ARCH_REALVIEW || ARCH_OMAP4 || ARCH_U8500) 1159 select HAVE_ARM_TWD if (ARCH_REALVIEW || ARCH_VEXPRESS || ARCH_OMAP4 || ARCH_U8500)
1163 help 1160 help
1164 Enable support for local timers on SMP platforms, rather then the 1161 Enable support for local timers on SMP platforms, rather then the
1165 legacy IPI broadcast method. Local timers allows the system 1162 legacy IPI broadcast method. Local timers allows the system
@@ -1226,10 +1223,6 @@ config OABI_COMPAT
1226config ARCH_HAS_HOLES_MEMORYMODEL 1223config ARCH_HAS_HOLES_MEMORYMODEL
1227 bool 1224 bool
1228 1225
1229# Discontigmem is deprecated
1230config ARCH_DISCONTIGMEM_ENABLE
1231 bool
1232
1233config ARCH_SPARSEMEM_ENABLE 1226config ARCH_SPARSEMEM_ENABLE
1234 bool 1227 bool
1235 1228
@@ -1237,13 +1230,7 @@ config ARCH_SPARSEMEM_DEFAULT
1237 def_bool ARCH_SPARSEMEM_ENABLE 1230 def_bool ARCH_SPARSEMEM_ENABLE
1238 1231
1239config ARCH_SELECT_MEMORY_MODEL 1232config ARCH_SELECT_MEMORY_MODEL
1240 def_bool ARCH_DISCONTIGMEM_ENABLE && ARCH_SPARSEMEM_ENABLE 1233 def_bool ARCH_SPARSEMEM_ENABLE
1241
1242config NODES_SHIFT
1243 int
1244 default "4" if ARCH_LH7A40X
1245 default "2"
1246 depends on NEED_MULTIPLE_NODES
1247 1234
1248config HIGHMEM 1235config HIGHMEM
1249 bool "High Memory Support (EXPERIMENTAL)" 1236 bool "High Memory Support (EXPERIMENTAL)"
@@ -1275,8 +1262,36 @@ config HW_PERF_EVENTS
1275 Enable hardware performance counter support for perf events. If 1262 Enable hardware performance counter support for perf events. If
1276 disabled, perf events will use software events only. 1263 disabled, perf events will use software events only.
1277 1264
1265config SPARSE_IRQ
1266 bool "Support sparse irq numbering"
1267 depends on EXPERIMENTAL
1268 help
1269 This enables support for sparse irqs. This is useful in general
1270 as most CPUs have a fairly sparse array of IRQ vectors, which
1271 the irq_desc then maps directly on to. Systems with a high
1272 number of off-chip IRQs will want to treat this as
1273 experimental until they have been independently verified.
1274
1275 If you don't know what to do here, say N.
1276
1278source "mm/Kconfig" 1277source "mm/Kconfig"
1279 1278
1279config FORCE_MAX_ZONEORDER
1280 int "Maximum zone order" if ARCH_SHMOBILE
1281 range 11 64 if ARCH_SHMOBILE
1282 default "9" if SA1111
1283 default "11"
1284 help
1285 The kernel memory allocator divides physically contiguous memory
1286 blocks into "zones", where each zone is a power of two number of
1287 pages. This option selects the largest power of two that the kernel
1288 keeps in the memory allocator. If you need to allocate very large
1289 blocks of physically contiguous memory, then you may need to
1290 increase this value.
1291
1292 This config option is actually maximum order plus one. For example,
1293 a value of 11 means that the largest free memory block is 2^10 pages.
1294
1280config LEDS 1295config LEDS
1281 bool "Timer and CPU usage LEDs" 1296 bool "Timer and CPU usage LEDs"
1282 depends on ARCH_CDB89712 || ARCH_EBSA110 || \ 1297 depends on ARCH_CDB89712 || ARCH_EBSA110 || \
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 337741f734ac..7dfa9a85bc0c 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -108,6 +108,51 @@ static void gic_unmask_irq(unsigned int irq)
108 spin_unlock(&irq_controller_lock); 108 spin_unlock(&irq_controller_lock);
109} 109}
110 110
111static int gic_set_type(unsigned int irq, unsigned int type)
112{
113 void __iomem *base = gic_dist_base(irq);
114 unsigned int gicirq = gic_irq(irq);
115 u32 enablemask = 1 << (gicirq % 32);
116 u32 enableoff = (gicirq / 32) * 4;
117 u32 confmask = 0x2 << ((gicirq % 16) * 2);
118 u32 confoff = (gicirq / 16) * 4;
119 bool enabled = false;
120 u32 val;
121
122 /* Interrupt configuration for SGIs can't be changed */
123 if (gicirq < 16)
124 return -EINVAL;
125
126 if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
127 return -EINVAL;
128
129 spin_lock(&irq_controller_lock);
130
131 val = readl(base + GIC_DIST_CONFIG + confoff);
132 if (type == IRQ_TYPE_LEVEL_HIGH)
133 val &= ~confmask;
134 else if (type == IRQ_TYPE_EDGE_RISING)
135 val |= confmask;
136
137 /*
138 * As recommended by the spec, disable the interrupt before changing
139 * the configuration
140 */
141 if (readl(base + GIC_DIST_ENABLE_SET + enableoff) & enablemask) {
142 writel(enablemask, base + GIC_DIST_ENABLE_CLEAR + enableoff);
143 enabled = true;
144 }
145
146 writel(val, base + GIC_DIST_CONFIG + confoff);
147
148 if (enabled)
149 writel(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);
150
151 spin_unlock(&irq_controller_lock);
152
153 return 0;
154}
155
111#ifdef CONFIG_SMP 156#ifdef CONFIG_SMP
112static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val) 157static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val)
113{ 158{
@@ -161,6 +206,7 @@ static struct irq_chip gic_chip = {
161 .ack = gic_ack_irq, 206 .ack = gic_ack_irq,
162 .mask = gic_mask_irq, 207 .mask = gic_mask_irq,
163 .unmask = gic_unmask_irq, 208 .unmask = gic_unmask_irq,
209 .set_type = gic_set_type,
164#ifdef CONFIG_SMP 210#ifdef CONFIG_SMP
165 .set_affinity = gic_set_cpu, 211 .set_affinity = gic_set_cpu,
166#endif 212#endif
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 6f80665f477e..ac2fd440652e 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -185,13 +185,10 @@ static struct sa1111_dev_info sa1111_devices[] = {
185 }, 185 },
186}; 186};
187 187
188void __init sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes) 188void __init sa1111_adjust_zones(unsigned long *size, unsigned long *holes)
189{ 189{
190 unsigned int sz = SZ_1M >> PAGE_SHIFT; 190 unsigned int sz = SZ_1M >> PAGE_SHIFT;
191 191
192 if (node != 0)
193 sz = 0;
194
195 size[1] = size[0] - sz; 192 size[1] = size[0] - sz;
196 size[0] = sz; 193 size[0] = sz;
197} 194}
diff --git a/arch/arm/include/asm/hwcap.h b/arch/arm/include/asm/hwcap.h
index f7bd52b1c365..c1062c317103 100644
--- a/arch/arm/include/asm/hwcap.h
+++ b/arch/arm/include/asm/hwcap.h
@@ -19,6 +19,7 @@
19#define HWCAP_NEON 4096 19#define HWCAP_NEON 4096
20#define HWCAP_VFPv3 8192 20#define HWCAP_VFPv3 8192
21#define HWCAP_VFPv3D16 16384 21#define HWCAP_VFPv3D16 16384
22#define HWCAP_TLS 32768
22 23
23#if defined(__KERNEL__) && !defined(__ASSEMBLY__) 24#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
24/* 25/*
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
index 237282f7c762..2721a5814cb9 100644
--- a/arch/arm/include/asm/irq.h
+++ b/arch/arm/include/asm/irq.h
@@ -7,6 +7,8 @@
7#define irq_canonicalize(i) (i) 7#define irq_canonicalize(i) (i)
8#endif 8#endif
9 9
10#define NR_IRQS_LEGACY 16
11
10/* 12/*
11 * Use this value to indicate lack of interrupt 13 * Use this value to indicate lack of interrupt
12 * capability 14 * capability
diff --git a/arch/arm/include/asm/kexec.h b/arch/arm/include/asm/kexec.h
index df15a0dc228e..8ec9ef5c3c7b 100644
--- a/arch/arm/include/asm/kexec.h
+++ b/arch/arm/include/asm/kexec.h
@@ -19,10 +19,26 @@
19 19
20#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
21 21
22struct kimage; 22/**
23/* Provide a dummy definition to avoid build failures. */ 23 * crash_setup_regs() - save registers for the panic kernel
24 * @newregs: registers are saved here
25 * @oldregs: registers to be saved (may be %NULL)
26 *
27 * Function copies machine registers from @oldregs to @newregs. If @oldregs is
28 * %NULL then current registers are stored there.
29 */
24static inline void crash_setup_regs(struct pt_regs *newregs, 30static inline void crash_setup_regs(struct pt_regs *newregs,
25 struct pt_regs *oldregs) { } 31 struct pt_regs *oldregs)
32{
33 if (oldregs) {
34 memcpy(newregs, oldregs, sizeof(*newregs));
35 } else {
36 __asm__ __volatile__ ("stmia %0, {r0 - r15}"
37 : : "r" (&newregs->ARM_r0));
38 __asm__ __volatile__ ("mrs %0, cpsr"
39 : "=r" (newregs->ARM_cpsr));
40 }
41}
26 42
27#endif /* __ASSEMBLY__ */ 43#endif /* __ASSEMBLY__ */
28 44
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index c59842dc7cb8..8a0dd18ba642 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -20,6 +20,7 @@ struct machine_desc {
20 * by assembler code in head.S, head-common.S 20 * by assembler code in head.S, head-common.S
21 */ 21 */
22 unsigned int nr; /* architecture number */ 22 unsigned int nr; /* architecture number */
23 unsigned int nr_irqs; /* number of IRQs */
23 unsigned int phys_io; /* start of physical io */ 24 unsigned int phys_io; /* start of physical io */
24 unsigned int io_pg_offst; /* byte offset for io 25 unsigned int io_pg_offst; /* byte offset for io
25 * page tabe entry */ 26 * page tabe entry */
@@ -37,6 +38,7 @@ struct machine_desc {
37 void (*fixup)(struct machine_desc *, 38 void (*fixup)(struct machine_desc *,
38 struct tag *, char **, 39 struct tag *, char **,
39 struct meminfo *); 40 struct meminfo *);
41 void (*reserve)(void);/* reserve mem blocks */
40 void (*map_io)(void);/* IO mapping function */ 42 void (*map_io)(void);/* IO mapping function */
41 void (*init_irq)(void); 43 void (*init_irq)(void);
42 struct sys_timer *timer; /* system tick timer */ 44 struct sys_timer *timer; /* system tick timer */
diff --git a/arch/arm/include/asm/mach/irq.h b/arch/arm/include/asm/mach/irq.h
index 8920b2d6e3b8..ce3eee9fe26c 100644
--- a/arch/arm/include/asm/mach/irq.h
+++ b/arch/arm/include/asm/mach/irq.h
@@ -17,6 +17,7 @@ struct seq_file;
17/* 17/*
18 * This is internal. Do not use it. 18 * This is internal. Do not use it.
19 */ 19 */
20extern unsigned int arch_nr_irqs;
20extern void (*init_arch_irq)(void); 21extern void (*init_arch_irq)(void);
21extern void init_FIQ(void); 22extern void init_FIQ(void);
22extern int show_fiq_list(struct seq_file *, void *); 23extern int show_fiq_list(struct seq_file *, void *);
diff --git a/arch/arm/include/asm/memblock.h b/arch/arm/include/asm/memblock.h
new file mode 100644
index 000000000000..fdbc43b2e6c0
--- /dev/null
+++ b/arch/arm/include/asm/memblock.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_ARM_MEMBLOCK_H
2#define _ASM_ARM_MEMBLOCK_H
3
4#ifdef CONFIG_MMU
5extern phys_addr_t lowmem_end_addr;
6#define MEMBLOCK_REAL_LIMIT lowmem_end_addr
7#else
8#define MEMBLOCK_REAL_LIMIT 0
9#endif
10
11struct meminfo;
12struct machine_desc;
13
14extern void arm_memblock_init(struct meminfo *, struct machine_desc *);
15
16#endif
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 4312ee5e3d0b..82df0ae71bb4 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -158,7 +158,7 @@
158#endif 158#endif
159 159
160#ifndef arch_adjust_zones 160#ifndef arch_adjust_zones
161#define arch_adjust_zones(node,size,holes) do { } while (0) 161#define arch_adjust_zones(size,holes) do { } while (0)
162#elif !defined(CONFIG_ZONE_DMA) 162#elif !defined(CONFIG_ZONE_DMA)
163#error "custom arch_adjust_zones() requires CONFIG_ZONE_DMA" 163#error "custom arch_adjust_zones() requires CONFIG_ZONE_DMA"
164#endif 164#endif
@@ -234,76 +234,11 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
234 * virt_to_page(k) convert a _valid_ virtual address to struct page * 234 * virt_to_page(k) convert a _valid_ virtual address to struct page *
235 * virt_addr_valid(k) indicates whether a virtual address is valid 235 * virt_addr_valid(k) indicates whether a virtual address is valid
236 */ 236 */
237#ifndef CONFIG_DISCONTIGMEM
238
239#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET 237#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
240 238
241#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 239#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
242#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) 240#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
243 241
244#define PHYS_TO_NID(addr) (0)
245
246#else /* CONFIG_DISCONTIGMEM */
247
248/*
249 * This is more complex. We have a set of mem_map arrays spread
250 * around in memory.
251 */
252#include <linux/numa.h>
253
254#define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn)
255#define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT)
256
257#define virt_to_page(kaddr) \
258 (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
259
260#define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < MAX_NUMNODES)
261
262/*
263 * Common discontigmem stuff.
264 * PHYS_TO_NID is used by the ARM kernel/setup.c
265 */
266#define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT)
267
268/*
269 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
270 * and returns the mem_map of that node.
271 */
272#define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
273
274/*
275 * Given a page frame number, find the owning node of the memory
276 * and returns the mem_map of that node.
277 */
278#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
279
280#ifdef NODE_MEM_SIZE_BITS
281#define NODE_MEM_SIZE_MASK ((1 << NODE_MEM_SIZE_BITS) - 1)
282
283/*
284 * Given a kernel address, find the home node of the underlying memory.
285 */
286#define KVADDR_TO_NID(addr) \
287 (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MEM_SIZE_BITS)
288
289/*
290 * Given a page frame number, convert it to a node id.
291 */
292#define PFN_TO_NID(pfn) \
293 (((pfn) - PHYS_PFN_OFFSET) >> (NODE_MEM_SIZE_BITS - PAGE_SHIFT))
294
295/*
296 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
297 * and returns the index corresponding to the appropriate page in the
298 * node's mem_map.
299 */
300#define LOCAL_MAP_NR(addr) \
301 (((unsigned long)(addr) & NODE_MEM_SIZE_MASK) >> PAGE_SHIFT)
302
303#endif /* NODE_MEM_SIZE_BITS */
304
305#endif /* !CONFIG_DISCONTIGMEM */
306
307/* 242/*
308 * Optional coherency support. Currently used only by selected 243 * Optional coherency support. Currently used only by selected
309 * Intel XSC3-based systems. 244 * Intel XSC3-based systems.
diff --git a/arch/arm/include/asm/mmzone.h b/arch/arm/include/asm/mmzone.h
deleted file mode 100644
index ae63a4fd28c8..000000000000
--- a/arch/arm/include/asm/mmzone.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * arch/arm/include/asm/mmzone.h
3 *
4 * 1999-12-29 Nicolas Pitre Created
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_MMZONE_H
11#define __ASM_MMZONE_H
12
13/*
14 * Currently defined in arch/arm/mm/discontig.c
15 */
16extern pg_data_t discontig_node_data[];
17
18/*
19 * Return a pointer to the node data for node n.
20 */
21#define NODE_DATA(nid) (&discontig_node_data[nid])
22
23/*
24 * NODE_MEM_MAP gives the kaddr for the mem_map of the node.
25 */
26#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
27
28#include <mach/memory.h>
29
30#endif
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 9dcb11e59026..c974be8913a7 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -184,6 +184,42 @@ extern unsigned long profile_pc(struct pt_regs *regs);
184#define predicate(x) ((x) & 0xf0000000) 184#define predicate(x) ((x) & 0xf0000000)
185#define PREDICATE_ALWAYS 0xe0000000 185#define PREDICATE_ALWAYS 0xe0000000
186 186
187/*
188 * kprobe-based event tracer support
189 */
190#include <linux/stddef.h>
191#include <linux/types.h>
192#define MAX_REG_OFFSET (offsetof(struct pt_regs, ARM_ORIG_r0))
193
194extern int regs_query_register_offset(const char *name);
195extern const char *regs_query_register_name(unsigned int offset);
196extern bool regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr);
197extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
198 unsigned int n);
199
200/**
201 * regs_get_register() - get register value from its offset
202 * @regs: pt_regs from which register value is gotten
203 * @offset: offset number of the register.
204 *
205 * regs_get_register returns the value of a register whose offset from @regs.
206 * The @offset is the offset of the register in struct pt_regs.
207 * If @offset is bigger than MAX_REG_OFFSET, this returns 0.
208 */
209static inline unsigned long regs_get_register(struct pt_regs *regs,
210 unsigned int offset)
211{
212 if (unlikely(offset > MAX_REG_OFFSET))
213 return 0;
214 return *(unsigned long *)((unsigned long)regs + offset);
215}
216
217/* Valid only for Kernel mode traps. */
218static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
219{
220 return regs->ARM_sp;
221}
222
187#endif /* __KERNEL__ */ 223#endif /* __KERNEL__ */
188 224
189#endif /* __ASSEMBLY__ */ 225#endif /* __ASSEMBLY__ */
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index f392fb4437af..f1e5a9bca249 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -201,8 +201,7 @@ static struct tagtable __tagtable_##fn __tag = { tag, fn }
201struct membank { 201struct membank {
202 unsigned long start; 202 unsigned long start;
203 unsigned long size; 203 unsigned long size;
204 unsigned short node; 204 unsigned int highmem;
205 unsigned short highmem;
206}; 205};
207 206
208struct meminfo { 207struct meminfo {
@@ -212,9 +211,8 @@ struct meminfo {
212 211
213extern struct meminfo meminfo; 212extern struct meminfo meminfo;
214 213
215#define for_each_nodebank(iter,mi,no) \ 214#define for_each_bank(iter,mi) \
216 for (iter = 0; iter < (mi)->nr_banks; iter++) \ 215 for (iter = 0; iter < (mi)->nr_banks; iter++)
217 if ((mi)->bank[iter].node == no)
218 216
219#define bank_pfn_start(bank) __phys_to_pfn((bank)->start) 217#define bank_pfn_start(bank) __phys_to_pfn((bank)->start)
220#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size) 218#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size)
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h
new file mode 100644
index 000000000000..e71d6ff8d104
--- /dev/null
+++ b/arch/arm/include/asm/tls.h
@@ -0,0 +1,46 @@
1#ifndef __ASMARM_TLS_H
2#define __ASMARM_TLS_H
3
4#ifdef __ASSEMBLY__
5 .macro set_tls_none, tp, tmp1, tmp2
6 .endm
7
8 .macro set_tls_v6k, tp, tmp1, tmp2
9 mcr p15, 0, \tp, c13, c0, 3 @ set TLS register
10 .endm
11
12 .macro set_tls_v6, tp, tmp1, tmp2
13 ldr \tmp1, =elf_hwcap
14 ldr \tmp1, [\tmp1, #0]
15 mov \tmp2, #0xffff0fff
16 tst \tmp1, #HWCAP_TLS @ hardware TLS available?
17 mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register
18 streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0
19 .endm
20
21 .macro set_tls_software, tp, tmp1, tmp2
22 mov \tmp1, #0xffff0fff
23 str \tp, [\tmp1, #-15] @ set TLS value at 0xffff0ff0
24 .endm
25#endif
26
27#ifdef CONFIG_TLS_REG_EMUL
28#define tls_emu 1
29#define has_tls_reg 1
30#define set_tls set_tls_none
31#elif __LINUX_ARM_ARCH__ >= 7 || \
32 (__LINUX_ARM_ARCH__ == 6 && defined(CONFIG_CPU_32v6K))
33#define tls_emu 0
34#define has_tls_reg 1
35#define set_tls set_tls_v6k
36#elif __LINUX_ARM_ARCH__ == 6
37#define tls_emu 0
38#define has_tls_reg (elf_hwcap & HWCAP_TLS)
39#define set_tls set_tls_v6
40#else
41#define tls_emu 0
42#define has_tls_reg 0
43#define set_tls set_tls_software
44#endif
45
46#endif /* __ASMARM_TLS_H */
diff --git a/arch/arm/include/asm/vfpmacros.h b/arch/arm/include/asm/vfpmacros.h
index 422f3cc204a2..3d5fc41ae8d3 100644
--- a/arch/arm/include/asm/vfpmacros.h
+++ b/arch/arm/include/asm/vfpmacros.h
@@ -3,6 +3,8 @@
3 * 3 *
4 * Assembler-only file containing VFP macros and register definitions. 4 * Assembler-only file containing VFP macros and register definitions.
5 */ 5 */
6#include <asm/hwcap.h>
7
6#include "vfp.h" 8#include "vfp.h"
7 9
8@ Macros to allow building with old toolkits (with no VFP support) 10@ Macros to allow building with old toolkits (with no VFP support)
@@ -22,12 +24,20 @@
22 LDC p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d0-d15} 24 LDC p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d0-d15}
23#endif 25#endif
24#ifdef CONFIG_VFPv3 26#ifdef CONFIG_VFPv3
27#if __LINUX_ARM_ARCH__ <= 6
28 ldr \tmp, =elf_hwcap @ may not have MVFR regs
29 ldr \tmp, [\tmp, #0]
30 tst \tmp, #HWCAP_VFPv3D16
31 ldceq p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
32 addne \base, \base, #32*4 @ step over unused register space
33#else
25 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0 34 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
26 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field 35 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
27 cmp \tmp, #2 @ 32 x 64bit registers? 36 cmp \tmp, #2 @ 32 x 64bit registers?
28 ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31} 37 ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
29 addne \base, \base, #32*4 @ step over unused register space 38 addne \base, \base, #32*4 @ step over unused register space
30#endif 39#endif
40#endif
31 .endm 41 .endm
32 42
33 @ write all the working registers out of the VFP 43 @ write all the working registers out of the VFP
@@ -38,10 +48,18 @@
38 STC p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d0-d15} 48 STC p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d0-d15}
39#endif 49#endif
40#ifdef CONFIG_VFPv3 50#ifdef CONFIG_VFPv3
51#if __LINUX_ARM_ARCH__ <= 6
52 ldr \tmp, =elf_hwcap @ may not have MVFR regs
53 ldr \tmp, [\tmp, #0]
54 tst \tmp, #HWCAP_VFPv3D16
55 stceq p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
56 addne \base, \base, #32*4 @ step over unused register space
57#else
41 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0 58 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
42 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field 59 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
43 cmp \tmp, #2 @ 32 x 64bit registers? 60 cmp \tmp, #2 @ 32 x 64bit registers?
44 stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31} 61 stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
45 addne \base, \base, #32*4 @ step over unused register space 62 addne \base, \base, #32*4 @ step over unused register space
46#endif 63#endif
64#endif
47 .endm 65 .endm
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 26d302c28e13..ea023c6aa31e 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_ARM_THUMBEE) += thumbee.o
39obj-$(CONFIG_KGDB) += kgdb.o 39obj-$(CONFIG_KGDB) += kgdb.o
40obj-$(CONFIG_ARM_UNWIND) += unwind.o 40obj-$(CONFIG_ARM_UNWIND) += unwind.o
41obj-$(CONFIG_HAVE_TCM) += tcm.o 41obj-$(CONFIG_HAVE_TCM) += tcm.o
42obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
42 43
43obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o 44obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o
44AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312 45AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312
diff --git a/arch/arm/kernel/crash_dump.c b/arch/arm/kernel/crash_dump.c
new file mode 100644
index 000000000000..cd3b853a8a6d
--- /dev/null
+++ b/arch/arm/kernel/crash_dump.c
@@ -0,0 +1,60 @@
1/*
2 * arch/arm/kernel/crash_dump.c
3 *
4 * Copyright (C) 2010 Nokia Corporation.
5 * Author: Mika Westerberg
6 *
7 * This code is taken from arch/x86/kernel/crash_dump_64.c
8 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
9 * Copyright (C) IBM Corporation, 2004. All rights reserved
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/errno.h>
17#include <linux/crash_dump.h>
18#include <linux/uaccess.h>
19#include <linux/io.h>
20
21/* stores the physical address of elf header of crash image */
22unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
23
24/**
25 * copy_oldmem_page() - copy one page from old kernel memory
26 * @pfn: page frame number to be copied
27 * @buf: buffer where the copied page is placed
28 * @csize: number of bytes to copy
29 * @offset: offset in bytes into the page
30 * @userbuf: if set, @buf is int he user address space
31 *
32 * This function copies one page from old kernel memory into buffer pointed by
33 * @buf. If @buf is in userspace, set @userbuf to %1. Returns number of bytes
34 * copied or negative error in case of failure.
35 */
36ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
37 size_t csize, unsigned long offset,
38 int userbuf)
39{
40 void *vaddr;
41
42 if (!csize)
43 return 0;
44
45 vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
46 if (!vaddr)
47 return -ENOMEM;
48
49 if (userbuf) {
50 if (copy_to_user(buf, vaddr + offset, csize)) {
51 iounmap(vaddr);
52 return -EFAULT;
53 }
54 } else {
55 memcpy(buf, vaddr + offset, csize);
56 }
57
58 iounmap(vaddr);
59 return csize;
60}
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 3fd7861de4d1..e864e482118a 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -22,6 +22,7 @@
22#include <asm/thread_notify.h> 22#include <asm/thread_notify.h>
23#include <asm/unwind.h> 23#include <asm/unwind.h>
24#include <asm/unistd.h> 24#include <asm/unistd.h>
25#include <asm/tls.h>
25 26
26#include "entry-header.S" 27#include "entry-header.S"
27 28
@@ -735,12 +736,7 @@ ENTRY(__switch_to)
735#ifdef CONFIG_MMU 736#ifdef CONFIG_MMU
736 ldr r6, [r2, #TI_CPU_DOMAIN] 737 ldr r6, [r2, #TI_CPU_DOMAIN]
737#endif 738#endif
738#if defined(CONFIG_HAS_TLS_REG) 739 set_tls r3, r4, r5
739 mcr p15, 0, r3, c13, c0, 3 @ set TLS register
740#elif !defined(CONFIG_TLS_REG_EMUL)
741 mov r4, #0xffff0fff
742 str r3, [r4, #-15] @ TLS val at 0xffff0ff0
743#endif
744#ifdef CONFIG_MMU 740#ifdef CONFIG_MMU
745 mcr p15, 0, r6, c3, c0, 0 @ Set domain register 741 mcr p15, 0, r6, c3, c0, 0 @ Set domain register
746#endif 742#endif
@@ -1005,17 +1001,12 @@ kuser_cmpxchg_fixup:
1005 */ 1001 */
1006 1002
1007__kuser_get_tls: @ 0xffff0fe0 1003__kuser_get_tls: @ 0xffff0fe0
1008 1004 ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init
1009#if !defined(CONFIG_HAS_TLS_REG) && !defined(CONFIG_TLS_REG_EMUL)
1010 ldr r0, [pc, #(16 - 8)] @ TLS stored at 0xffff0ff0
1011#else
1012 mrc p15, 0, r0, c13, c0, 3 @ read TLS register
1013#endif
1014 usr_ret lr 1005 usr_ret lr
1015 1006 mrc p15, 0, r0, c13, c0, 3 @ 0xffff0fe8 hardware TLS code
1016 .rep 5 1007 .rep 4
1017 .word 0 @ pad up to __kuser_helper_version 1008 .word 0 @ 0xffff0ff0 software TLS value, then
1018 .endr 1009 .endr @ pad up to __kuser_helper_version
1019 1010
1020/* 1011/*
1021 * Reference declaration: 1012 * Reference declaration:
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 3b3d2c80509c..c0d5c3b3a760 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -47,12 +47,14 @@
47#define irq_finish(irq) do { } while (0) 47#define irq_finish(irq) do { } while (0)
48#endif 48#endif
49 49
50unsigned int arch_nr_irqs;
50void (*init_arch_irq)(void) __initdata = NULL; 51void (*init_arch_irq)(void) __initdata = NULL;
51unsigned long irq_err_count; 52unsigned long irq_err_count;
52 53
53int show_interrupts(struct seq_file *p, void *v) 54int show_interrupts(struct seq_file *p, void *v)
54{ 55{
55 int i = *(loff_t *) v, cpu; 56 int i = *(loff_t *) v, cpu;
57 struct irq_desc *desc;
56 struct irqaction * action; 58 struct irqaction * action;
57 unsigned long flags; 59 unsigned long flags;
58 60
@@ -67,24 +69,25 @@ int show_interrupts(struct seq_file *p, void *v)
67 seq_putc(p, '\n'); 69 seq_putc(p, '\n');
68 } 70 }
69 71
70 if (i < NR_IRQS) { 72 if (i < nr_irqs) {
71 raw_spin_lock_irqsave(&irq_desc[i].lock, flags); 73 desc = irq_to_desc(i);
72 action = irq_desc[i].action; 74 raw_spin_lock_irqsave(&desc->lock, flags);
75 action = desc->action;
73 if (!action) 76 if (!action)
74 goto unlock; 77 goto unlock;
75 78
76 seq_printf(p, "%3d: ", i); 79 seq_printf(p, "%3d: ", i);
77 for_each_present_cpu(cpu) 80 for_each_present_cpu(cpu)
78 seq_printf(p, "%10u ", kstat_irqs_cpu(i, cpu)); 81 seq_printf(p, "%10u ", kstat_irqs_cpu(i, cpu));
79 seq_printf(p, " %10s", irq_desc[i].chip->name ? : "-"); 82 seq_printf(p, " %10s", desc->chip->name ? : "-");
80 seq_printf(p, " %s", action->name); 83 seq_printf(p, " %s", action->name);
81 for (action = action->next; action; action = action->next) 84 for (action = action->next; action; action = action->next)
82 seq_printf(p, ", %s", action->name); 85 seq_printf(p, ", %s", action->name);
83 86
84 seq_putc(p, '\n'); 87 seq_putc(p, '\n');
85unlock: 88unlock:
86 raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags); 89 raw_spin_unlock_irqrestore(&desc->lock, flags);
87 } else if (i == NR_IRQS) { 90 } else if (i == nr_irqs) {
88#ifdef CONFIG_FIQ 91#ifdef CONFIG_FIQ
89 show_fiq_list(p, v); 92 show_fiq_list(p, v);
90#endif 93#endif
@@ -112,7 +115,7 @@ asmlinkage void __exception asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
112 * Some hardware gives randomly wrong interrupts. Rather 115 * Some hardware gives randomly wrong interrupts. Rather
113 * than crashing, do something sensible. 116 * than crashing, do something sensible.
114 */ 117 */
115 if (unlikely(irq >= NR_IRQS)) { 118 if (unlikely(irq >= nr_irqs)) {
116 if (printk_ratelimit()) 119 if (printk_ratelimit())
117 printk(KERN_WARNING "Bad IRQ%u\n", irq); 120 printk(KERN_WARNING "Bad IRQ%u\n", irq);
118 ack_bad_irq(irq); 121 ack_bad_irq(irq);
@@ -132,12 +135,12 @@ void set_irq_flags(unsigned int irq, unsigned int iflags)
132 struct irq_desc *desc; 135 struct irq_desc *desc;
133 unsigned long flags; 136 unsigned long flags;
134 137
135 if (irq >= NR_IRQS) { 138 if (irq >= nr_irqs) {
136 printk(KERN_ERR "Trying to set irq flags for IRQ%d\n", irq); 139 printk(KERN_ERR "Trying to set irq flags for IRQ%d\n", irq);
137 return; 140 return;
138 } 141 }
139 142
140 desc = irq_desc + irq; 143 desc = irq_to_desc(irq);
141 raw_spin_lock_irqsave(&desc->lock, flags); 144 raw_spin_lock_irqsave(&desc->lock, flags);
142 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; 145 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
143 if (iflags & IRQF_VALID) 146 if (iflags & IRQF_VALID)
@@ -151,14 +154,25 @@ void set_irq_flags(unsigned int irq, unsigned int iflags)
151 154
152void __init init_IRQ(void) 155void __init init_IRQ(void)
153{ 156{
157 struct irq_desc *desc;
154 int irq; 158 int irq;
155 159
156 for (irq = 0; irq < NR_IRQS; irq++) 160 for (irq = 0; irq < nr_irqs; irq++) {
157 irq_desc[irq].status |= IRQ_NOREQUEST | IRQ_NOPROBE; 161 desc = irq_to_desc_alloc_node(irq, 0);
162 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE;
163 }
158 164
159 init_arch_irq(); 165 init_arch_irq();
160} 166}
161 167
168#ifdef CONFIG_SPARSE_IRQ
169int __init arch_probe_nr_irqs(void)
170{
171 nr_irqs = arch_nr_irqs ? arch_nr_irqs : NR_IRQS;
172 return 0;
173}
174#endif
175
162#ifdef CONFIG_HOTPLUG_CPU 176#ifdef CONFIG_HOTPLUG_CPU
163 177
164static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu) 178static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu)
@@ -178,10 +192,9 @@ static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu)
178void migrate_irqs(void) 192void migrate_irqs(void)
179{ 193{
180 unsigned int i, cpu = smp_processor_id(); 194 unsigned int i, cpu = smp_processor_id();
195 struct irq_desc *desc;
181 196
182 for (i = 0; i < NR_IRQS; i++) { 197 for_each_irq_desc(i, desc) {
183 struct irq_desc *desc = irq_desc + i;
184
185 if (desc->node == cpu) { 198 if (desc->node == cpu) {
186 unsigned int newcpu = cpumask_any_and(desc->affinity, 199 unsigned int newcpu = cpumask_any_and(desc->affinity,
187 cpu_online_mask); 200 cpu_online_mask);
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 598ca61e7bca..81e989858d42 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -43,6 +43,10 @@ void machine_shutdown(void)
43 43
44void machine_crash_shutdown(struct pt_regs *regs) 44void machine_crash_shutdown(struct pt_regs *regs)
45{ 45{
46 local_irq_disable();
47 crash_save_cpu(regs, smp_processor_id());
48
49 printk(KERN_INFO "Loading crashdump kernel...\n");
46} 50}
47 51
48void machine_kexec(struct kimage *image) 52void machine_kexec(struct kimage *image)
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 3f562a7c0a99..f99d489822d5 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -52,6 +52,102 @@
52#define BREAKINST_THUMB 0xde01 52#define BREAKINST_THUMB 0xde01
53#endif 53#endif
54 54
55struct pt_regs_offset {
56 const char *name;
57 int offset;
58};
59
60#define REG_OFFSET_NAME(r) \
61 {.name = #r, .offset = offsetof(struct pt_regs, ARM_##r)}
62#define REG_OFFSET_END {.name = NULL, .offset = 0}
63
64static const struct pt_regs_offset regoffset_table[] = {
65 REG_OFFSET_NAME(r0),
66 REG_OFFSET_NAME(r1),
67 REG_OFFSET_NAME(r2),
68 REG_OFFSET_NAME(r3),
69 REG_OFFSET_NAME(r4),
70 REG_OFFSET_NAME(r5),
71 REG_OFFSET_NAME(r6),
72 REG_OFFSET_NAME(r7),
73 REG_OFFSET_NAME(r8),
74 REG_OFFSET_NAME(r9),
75 REG_OFFSET_NAME(r10),
76 REG_OFFSET_NAME(fp),
77 REG_OFFSET_NAME(ip),
78 REG_OFFSET_NAME(sp),
79 REG_OFFSET_NAME(lr),
80 REG_OFFSET_NAME(pc),
81 REG_OFFSET_NAME(cpsr),
82 REG_OFFSET_NAME(ORIG_r0),
83 REG_OFFSET_END,
84};
85
86/**
87 * regs_query_register_offset() - query register offset from its name
88 * @name: the name of a register
89 *
90 * regs_query_register_offset() returns the offset of a register in struct
91 * pt_regs from its name. If the name is invalid, this returns -EINVAL;
92 */
93int regs_query_register_offset(const char *name)
94{
95 const struct pt_regs_offset *roff;
96 for (roff = regoffset_table; roff->name != NULL; roff++)
97 if (!strcmp(roff->name, name))
98 return roff->offset;
99 return -EINVAL;
100}
101
102/**
103 * regs_query_register_name() - query register name from its offset
104 * @offset: the offset of a register in struct pt_regs.
105 *
106 * regs_query_register_name() returns the name of a register from its
107 * offset in struct pt_regs. If the @offset is invalid, this returns NULL;
108 */
109const char *regs_query_register_name(unsigned int offset)
110{
111 const struct pt_regs_offset *roff;
112 for (roff = regoffset_table; roff->name != NULL; roff++)
113 if (roff->offset == offset)
114 return roff->name;
115 return NULL;
116}
117
118/**
119 * regs_within_kernel_stack() - check the address in the stack
120 * @regs: pt_regs which contains kernel stack pointer.
121 * @addr: address which is checked.
122 *
123 * regs_within_kernel_stack() checks @addr is within the kernel stack page(s).
124 * If @addr is within the kernel stack, it returns true. If not, returns false.
125 */
126bool regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr)
127{
128 return ((addr & ~(THREAD_SIZE - 1)) ==
129 (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1)));
130}
131
132/**
133 * regs_get_kernel_stack_nth() - get Nth entry of the stack
134 * @regs: pt_regs which contains kernel stack pointer.
135 * @n: stack entry number.
136 *
137 * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
138 * is specified by @regs. If the @n th entry is NOT in the kernel stack,
139 * this returns 0.
140 */
141unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n)
142{
143 unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs);
144 addr += n;
145 if (regs_within_kernel_stack(regs, (unsigned long)addr))
146 return *addr;
147 else
148 return 0;
149}
150
55/* 151/*
56 * this routine will get a word off of the processes privileged stack. 152 * this routine will get a word off of the processes privileged stack.
57 * the offset is how far from the base addr as stored in the THREAD. 153 * the offset is how far from the base addr as stored in the THREAD.
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S
index 61930eb09029..fd26f8d65151 100644
--- a/arch/arm/kernel/relocate_kernel.S
+++ b/arch/arm/kernel/relocate_kernel.S
@@ -10,6 +10,12 @@ relocate_new_kernel:
10 ldr r0,kexec_indirection_page 10 ldr r0,kexec_indirection_page
11 ldr r1,kexec_start_address 11 ldr r1,kexec_start_address
12 12
13 /*
14 * If there is no indirection page (we are doing crashdumps)
15 * skip any relocation.
16 */
17 cmp r0, #0
18 beq 2f
13 19
140: /* top, read another word for the indirection page */ 200: /* top, read another word for the indirection page */
15 ldr r3, [r0],#4 21 ldr r3, [r0],#4
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 122d999bdc7c..776ea1aa974b 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -19,12 +19,15 @@
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/screen_info.h> 20#include <linux/screen_info.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kexec.h>
23#include <linux/crash_dump.h>
22#include <linux/root_dev.h> 24#include <linux/root_dev.h>
23#include <linux/cpu.h> 25#include <linux/cpu.h>
24#include <linux/interrupt.h> 26#include <linux/interrupt.h>
25#include <linux/smp.h> 27#include <linux/smp.h>
26#include <linux/fs.h> 28#include <linux/fs.h>
27#include <linux/proc_fs.h> 29#include <linux/proc_fs.h>
30#include <linux/memblock.h>
28 31
29#include <asm/unified.h> 32#include <asm/unified.h>
30#include <asm/cpu.h> 33#include <asm/cpu.h>
@@ -269,6 +272,21 @@ static void __init cacheid_init(void)
269extern struct proc_info_list *lookup_processor_type(unsigned int); 272extern struct proc_info_list *lookup_processor_type(unsigned int);
270extern struct machine_desc *lookup_machine_type(unsigned int); 273extern struct machine_desc *lookup_machine_type(unsigned int);
271 274
275static void __init feat_v6_fixup(void)
276{
277 int id = read_cpuid_id();
278
279 if ((id & 0xff0f0000) != 0x41070000)
280 return;
281
282 /*
283 * HWCAP_TLS is available only on 1136 r1p0 and later,
284 * see also kuser_get_tls_init.
285 */
286 if ((((id >> 4) & 0xfff) == 0xb36) && (((id >> 20) & 3) == 0))
287 elf_hwcap &= ~HWCAP_TLS;
288}
289
272static void __init setup_processor(void) 290static void __init setup_processor(void)
273{ 291{
274 struct proc_info_list *list; 292 struct proc_info_list *list;
@@ -311,6 +329,8 @@ static void __init setup_processor(void)
311 elf_hwcap &= ~HWCAP_THUMB; 329 elf_hwcap &= ~HWCAP_THUMB;
312#endif 330#endif
313 331
332 feat_v6_fixup();
333
314 cacheid_init(); 334 cacheid_init();
315 cpu_proc_init(); 335 cpu_proc_init();
316} 336}
@@ -402,13 +422,12 @@ static int __init arm_add_memory(unsigned long start, unsigned long size)
402 size -= start & ~PAGE_MASK; 422 size -= start & ~PAGE_MASK;
403 bank->start = PAGE_ALIGN(start); 423 bank->start = PAGE_ALIGN(start);
404 bank->size = size & PAGE_MASK; 424 bank->size = size & PAGE_MASK;
405 bank->node = PHYS_TO_NID(start);
406 425
407 /* 426 /*
408 * Check whether this memory region has non-zero size or 427 * Check whether this memory region has non-zero size or
409 * invalid node number. 428 * invalid node number.
410 */ 429 */
411 if (bank->size == 0 || bank->node >= MAX_NUMNODES) 430 if (bank->size == 0)
412 return -EINVAL; 431 return -EINVAL;
413 432
414 meminfo.nr_banks++; 433 meminfo.nr_banks++;
@@ -663,6 +682,79 @@ static int __init customize_machine(void)
663} 682}
664arch_initcall(customize_machine); 683arch_initcall(customize_machine);
665 684
685#ifdef CONFIG_KEXEC
686static inline unsigned long long get_total_mem(void)
687{
688 unsigned long total;
689
690 total = max_low_pfn - min_low_pfn;
691 return total << PAGE_SHIFT;
692}
693
694/**
695 * reserve_crashkernel() - reserves memory are for crash kernel
696 *
697 * This function reserves memory area given in "crashkernel=" kernel command
698 * line parameter. The memory reserved is used by a dump capture kernel when
699 * primary kernel is crashing.
700 */
701static void __init reserve_crashkernel(void)
702{
703 unsigned long long crash_size, crash_base;
704 unsigned long long total_mem;
705 int ret;
706
707 total_mem = get_total_mem();
708 ret = parse_crashkernel(boot_command_line, total_mem,
709 &crash_size, &crash_base);
710 if (ret)
711 return;
712
713 ret = reserve_bootmem(crash_base, crash_size, BOOTMEM_EXCLUSIVE);
714 if (ret < 0) {
715 printk(KERN_WARNING "crashkernel reservation failed - "
716 "memory is in use (0x%lx)\n", (unsigned long)crash_base);
717 return;
718 }
719
720 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
721 "for crashkernel (System RAM: %ldMB)\n",
722 (unsigned long)(crash_size >> 20),
723 (unsigned long)(crash_base >> 20),
724 (unsigned long)(total_mem >> 20));
725
726 crashk_res.start = crash_base;
727 crashk_res.end = crash_base + crash_size - 1;
728 insert_resource(&iomem_resource, &crashk_res);
729}
730#else
731static inline void reserve_crashkernel(void) {}
732#endif /* CONFIG_KEXEC */
733
734/*
735 * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
736 * is_kdump_kernel() to determine if we are booting after a panic. Hence
737 * ifdef it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
738 */
739
740#ifdef CONFIG_CRASH_DUMP
741/*
742 * elfcorehdr= specifies the location of elf core header stored by the crashed
743 * kernel. This option will be passed by kexec loader to the capture kernel.
744 */
745static int __init setup_elfcorehdr(char *arg)
746{
747 char *end;
748
749 if (!arg)
750 return -EINVAL;
751
752 elfcorehdr_addr = memparse(arg, &end);
753 return end > arg ? 0 : -EINVAL;
754}
755early_param("elfcorehdr", setup_elfcorehdr);
756#endif /* CONFIG_CRASH_DUMP */
757
666void __init setup_arch(char **cmdline_p) 758void __init setup_arch(char **cmdline_p)
667{ 759{
668 struct tag *tags = (struct tag *)&init_tags; 760 struct tag *tags = (struct tag *)&init_tags;
@@ -716,12 +808,15 @@ void __init setup_arch(char **cmdline_p)
716 808
717 parse_early_param(); 809 parse_early_param();
718 810
811 arm_memblock_init(&meminfo, mdesc);
812
719 paging_init(mdesc); 813 paging_init(mdesc);
720 request_standard_resources(&meminfo, mdesc); 814 request_standard_resources(&meminfo, mdesc);
721 815
722#ifdef CONFIG_SMP 816#ifdef CONFIG_SMP
723 smp_init_cpus(); 817 smp_init_cpus();
724#endif 818#endif
819 reserve_crashkernel();
725 820
726 cpu_init(); 821 cpu_init();
727 tcm_init(); 822 tcm_init();
@@ -729,6 +824,7 @@ void __init setup_arch(char **cmdline_p)
729 /* 824 /*
730 * Set up various architecture-specific pointers 825 * Set up various architecture-specific pointers
731 */ 826 */
827 arch_nr_irqs = mdesc->nr_irqs;
732 init_arch_irq = mdesc->init_irq; 828 init_arch_irq = mdesc->init_irq;
733 system_timer = mdesc->timer; 829 system_timer = mdesc->timer;
734 init_machine = mdesc->init_machine; 830 init_machine = mdesc->init_machine;
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 1621e5327b2a..cda78d59aa31 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -30,6 +30,7 @@
30#include <asm/unistd.h> 30#include <asm/unistd.h>
31#include <asm/traps.h> 31#include <asm/traps.h>
32#include <asm/unwind.h> 32#include <asm/unwind.h>
33#include <asm/tls.h>
33 34
34#include "ptrace.h" 35#include "ptrace.h"
35#include "signal.h" 36#include "signal.h"
@@ -518,17 +519,20 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
518 519
519 case NR(set_tls): 520 case NR(set_tls):
520 thread->tp_value = regs->ARM_r0; 521 thread->tp_value = regs->ARM_r0;
521#if defined(CONFIG_HAS_TLS_REG) 522 if (tls_emu)
522 asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" (regs->ARM_r0) ); 523 return 0;
523#elif !defined(CONFIG_TLS_REG_EMUL) 524 if (has_tls_reg) {
524 /* 525 asm ("mcr p15, 0, %0, c13, c0, 3"
525 * User space must never try to access this directly. 526 : : "r" (regs->ARM_r0));
526 * Expect your app to break eventually if you do so. 527 } else {
527 * The user helper at 0xffff0fe0 must be used instead. 528 /*
528 * (see entry-armv.S for details) 529 * User space must never try to access this directly.
529 */ 530 * Expect your app to break eventually if you do so.
530 *((unsigned int *)0xffff0ff0) = regs->ARM_r0; 531 * The user helper at 0xffff0fe0 must be used instead.
531#endif 532 * (see entry-armv.S for details)
533 */
534 *((unsigned int *)0xffff0ff0) = regs->ARM_r0;
535 }
532 return 0; 536 return 0;
533 537
534#ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG 538#ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG
@@ -743,6 +747,16 @@ void __init trap_init(void)
743 return; 747 return;
744} 748}
745 749
750static void __init kuser_get_tls_init(unsigned long vectors)
751{
752 /*
753 * vectors + 0xfe0 = __kuser_get_tls
754 * vectors + 0xfe8 = hardware TLS instruction at 0xffff0fe8
755 */
756 if (tls_emu || has_tls_reg)
757 memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4);
758}
759
746void __init early_trap_init(void) 760void __init early_trap_init(void)
747{ 761{
748 unsigned long vectors = CONFIG_VECTORS_BASE; 762 unsigned long vectors = CONFIG_VECTORS_BASE;
@@ -761,6 +775,11 @@ void __init early_trap_init(void)
761 memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); 775 memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);
762 776
763 /* 777 /*
778 * Do processor specific fixups for the kuser helpers
779 */
780 kuser_get_tls_init(vectors);
781
782 /*
764 * Copy signal return handlers into the vector page, and 783 * Copy signal return handlers into the vector page, and
765 * set sigreturn to be a pointer to these. 784 * set sigreturn to be a pointer to these.
766 */ 785 */
diff --git a/arch/arm/mach-aaec2000/include/mach/memory.h b/arch/arm/mach-aaec2000/include/mach/memory.h
index c00822543d9f..4f93c567a35a 100644
--- a/arch/arm/mach-aaec2000/include/mach/memory.h
+++ b/arch/arm/mach-aaec2000/include/mach/memory.h
@@ -14,14 +14,4 @@
14 14
15#define PHYS_OFFSET UL(0xf0000000) 15#define PHYS_OFFSET UL(0xf0000000)
16 16
17/*
18 * The nodes are the followings:
19 *
20 * node 0: 0xf000.0000 - 0xf3ff.ffff
21 * node 1: 0xf400.0000 - 0xf7ff.ffff
22 * node 2: 0xf800.0000 - 0xfbff.ffff
23 * node 3: 0xfc00.0000 - 0xffff.ffff
24 */
25#define NODE_MEM_SIZE_BITS 26
26
27#endif /* __ASM_ARCH_MEMORY_H */ 17#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 841eaf8f27e2..939bccd70569 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -366,6 +366,17 @@ config MACH_STAMP9G20
366 366
367endif 367endif
368 368
369if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20)
370comment "AT91SAM9260/AT91SAM9G20 boards"
371
372config MACH_SNAPPER_9260
373 bool "Bluewater Systems Snapper 9260/9G20 module"
374 help
375 Select this if you are using the Bluewater Systems Snapper 9260 or
376 Snapper 9G20 modules.
377 <http://www.bluewatersys.com/>
378endif
379
369# ---------------------------------------------------------- 380# ----------------------------------------------------------
370 381
371if ARCH_AT91SAM9G45 382if ARCH_AT91SAM9G45
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index c1f821e58222..ca2ac003f41f 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -66,6 +66,9 @@ obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o
66obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o 66obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o
67obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o 67obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
68 68
69# AT91SAM9260/AT91SAM9G20 board-specific support
70obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
71
69# AT91SAM9G45 board-specific support 72# AT91SAM9G45 board-specific support
70obj-$(CONFIG_MACH_AT91SAM9G45EKES) += board-sam9m10g45ek.o 73obj-$(CONFIG_MACH_AT91SAM9G45EKES) += board-sam9m10g45ek.o
71 74
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 85166b7e69a1..753c0d31a3d3 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -20,6 +20,7 @@
20#include <mach/at91_pmc.h> 20#include <mach/at91_pmc.h>
21#include <mach/at91_rstc.h> 21#include <mach/at91_rstc.h>
22#include <mach/at91_shdwc.h> 22#include <mach/at91_shdwc.h>
23#include <mach/cpu.h>
23 24
24#include "generic.h" 25#include "generic.h"
25#include "clock.h" 26#include "clock.h"
@@ -176,6 +177,13 @@ static struct clk mmc1_clk = {
176 .type = CLK_TYPE_PERIPHERAL, 177 .type = CLK_TYPE_PERIPHERAL,
177}; 178};
178 179
180/* Video decoder clock - Only for sam9m10/sam9m11 */
181static struct clk vdec_clk = {
182 .name = "vdec_clk",
183 .pmc_mask = 1 << AT91SAM9G45_ID_VDEC,
184 .type = CLK_TYPE_PERIPHERAL,
185};
186
179/* One additional fake clock for ohci */ 187/* One additional fake clock for ohci */
180static struct clk ohci_clk = { 188static struct clk ohci_clk = {
181 .name = "ohci_clk", 189 .name = "ohci_clk",
@@ -239,6 +247,9 @@ static void __init at91sam9g45_register_clocks(void)
239 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++) 247 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
240 clk_register(periph_clocks[i]); 248 clk_register(periph_clocks[i]);
241 249
250 if (cpu_is_at91sam9m10() || cpu_is_at91sam9m11())
251 clk_register(&vdec_clk);
252
242 clk_register(&pck0); 253 clk_register(&pck0);
243 clk_register(&pck1); 254 clk_register(&pck1);
244} 255}
diff --git a/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c b/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
index a4102d72cc9b..c49f5c003ee1 100644
--- a/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
+++ b/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
@@ -26,6 +26,9 @@
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/spi/at73c213.h> 27#include <linux/spi/at73c213.h>
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/regulator/machine.h>
30#include <linux/regulator/fixed.h>
31#include <linux/regulator/consumer.h>
29 32
30#include <mach/hardware.h> 33#include <mach/hardware.h>
31#include <asm/setup.h> 34#include <asm/setup.h>
@@ -235,6 +238,46 @@ static struct gpio_led ek_leds[] = {
235 } 238 }
236}; 239};
237 240
241#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
242static struct regulator_consumer_supply ek_audio_consumer_supplies[] = {
243 REGULATOR_SUPPLY("AVDD", "0-001b"),
244 REGULATOR_SUPPLY("HPVDD", "0-001b"),
245 REGULATOR_SUPPLY("DBVDD", "0-001b"),
246 REGULATOR_SUPPLY("DCVDD", "0-001b"),
247};
248
249static struct regulator_init_data ek_avdd_reg_init_data = {
250 .constraints = {
251 .name = "3V3",
252 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
253 },
254 .consumer_supplies = ek_audio_consumer_supplies,
255 .num_consumer_supplies = ARRAY_SIZE(ek_audio_consumer_supplies),
256};
257
258static struct fixed_voltage_config ek_vdd_pdata = {
259 .supply_name = "board-3V3",
260 .microvolts = 3300000,
261 .gpio = -EINVAL,
262 .enabled_at_boot = 0,
263 .init_data = &ek_avdd_reg_init_data,
264};
265static struct platform_device ek_voltage_regulator = {
266 .name = "reg-fixed-voltage",
267 .id = -1,
268 .num_resources = 0,
269 .dev = {
270 .platform_data = &ek_vdd_pdata,
271 },
272};
273static void __init ek_add_regulators(void)
274{
275 platform_device_register(&ek_voltage_regulator);
276}
277#else
278static void __init ek_add_regulators(void) {}
279#endif
280
238static struct i2c_board_info __initdata ek_i2c_devices[] = { 281static struct i2c_board_info __initdata ek_i2c_devices[] = {
239 { 282 {
240 I2C_BOARD_INFO("24c512", 0x50), 283 I2C_BOARD_INFO("24c512", 0x50),
@@ -256,6 +299,8 @@ static void __init ek_board_init(void)
256 ek_add_device_nand(); 299 ek_add_device_nand();
257 /* Ethernet */ 300 /* Ethernet */
258 at91_add_device_eth(&ek_macb_data); 301 at91_add_device_eth(&ek_macb_data);
302 /* Regulators */
303 ek_add_regulators();
259 /* MMC */ 304 /* MMC */
260#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) 305#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
261 at91_add_device_mci(0, &ek_mmc_data); 306 at91_add_device_mci(0, &ek_mmc_data);
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index c11fd47aec5d..6ea9808b8868 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -27,6 +27,9 @@
27#include <linux/gpio_keys.h> 27#include <linux/gpio_keys.h>
28#include <linux/input.h> 28#include <linux/input.h>
29#include <linux/clk.h> 29#include <linux/clk.h>
30#include <linux/regulator/machine.h>
31#include <linux/regulator/fixed.h>
32#include <linux/regulator/consumer.h>
30 33
31#include <mach/hardware.h> 34#include <mach/hardware.h>
32#include <asm/setup.h> 35#include <asm/setup.h>
@@ -269,6 +272,46 @@ static void __init ek_add_device_buttons(void)
269static void __init ek_add_device_buttons(void) {} 272static void __init ek_add_device_buttons(void) {}
270#endif 273#endif
271 274
275#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
276static struct regulator_consumer_supply ek_audio_consumer_supplies[] = {
277 REGULATOR_SUPPLY("AVDD", "0-001b"),
278 REGULATOR_SUPPLY("HPVDD", "0-001b"),
279 REGULATOR_SUPPLY("DBVDD", "0-001b"),
280 REGULATOR_SUPPLY("DCVDD", "0-001b"),
281};
282
283static struct regulator_init_data ek_avdd_reg_init_data = {
284 .constraints = {
285 .name = "3V3",
286 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
287 },
288 .consumer_supplies = ek_audio_consumer_supplies,
289 .num_consumer_supplies = ARRAY_SIZE(ek_audio_consumer_supplies),
290};
291
292static struct fixed_voltage_config ek_vdd_pdata = {
293 .supply_name = "board-3V3",
294 .microvolts = 3300000,
295 .gpio = -EINVAL,
296 .enabled_at_boot = 0,
297 .init_data = &ek_avdd_reg_init_data,
298};
299static struct platform_device ek_voltage_regulator = {
300 .name = "reg-fixed-voltage",
301 .id = -1,
302 .num_resources = 0,
303 .dev = {
304 .platform_data = &ek_vdd_pdata,
305 },
306};
307static void __init ek_add_regulators(void)
308{
309 platform_device_register(&ek_voltage_regulator);
310}
311#else
312static void __init ek_add_regulators(void) {}
313#endif
314
272 315
273static struct i2c_board_info __initdata ek_i2c_devices[] = { 316static struct i2c_board_info __initdata ek_i2c_devices[] = {
274 { 317 {
@@ -294,6 +337,8 @@ static void __init ek_board_init(void)
294 ek_add_device_nand(); 337 ek_add_device_nand();
295 /* Ethernet */ 338 /* Ethernet */
296 at91_add_device_eth(&ek_macb_data); 339 at91_add_device_eth(&ek_macb_data);
340 /* Regulators */
341 ek_add_regulators();
297 /* MMC */ 342 /* MMC */
298 at91_add_device_mmc(0, &ek_mmc_data); 343 at91_add_device_mmc(0, &ek_mmc_data);
299 /* I2C */ 344 /* I2C */
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
new file mode 100644
index 000000000000..2c08ae4ad3a1
--- /dev/null
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -0,0 +1,189 @@
1/*
2 * linux/arch/arm/mach-at91/board-snapper9260.c
3 *
4 * Copyright (C) 2010 Bluewater System Ltd
5 *
6 * Author: Andre Renaud <andre@bluewatersys.com>
7 * Author: Ryan Mallon <ryan@bluewatersys.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include <linux/init.h>
26#include <linux/gpio.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/i2c/pca953x.h>
30
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33
34#include <mach/hardware.h>
35#include <mach/board.h>
36#include <mach/at91sam9_smc.h>
37
38#include "sam9_smc.h"
39#include "generic.h"
40
41#define SNAPPER9260_IO_EXP_GPIO(x) (NR_BUILTIN_GPIO + (x))
42
43static void __init snapper9260_map_io(void)
44{
45 at91sam9260_initialize(18432000);
46
47 /* Debug on ttyS0 */
48 at91_register_uart(0, 0, 0);
49 at91_set_serial_console(0);
50
51 at91_register_uart(AT91SAM9260_ID_US0, 1,
52 ATMEL_UART_CTS | ATMEL_UART_RTS);
53 at91_register_uart(AT91SAM9260_ID_US1, 2,
54 ATMEL_UART_CTS | ATMEL_UART_RTS);
55 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
56}
57
58static void __init snapper9260_init_irq(void)
59{
60 at91sam9260_init_interrupts(NULL);
61}
62
63static struct at91_usbh_data __initdata snapper9260_usbh_data = {
64 .ports = 2,
65};
66
67static struct at91_udc_data __initdata snapper9260_udc_data = {
68 .vbus_pin = SNAPPER9260_IO_EXP_GPIO(5),
69 .vbus_active_low = 1,
70 .vbus_polled = 1,
71};
72
73static struct at91_eth_data snapper9260_macb_data = {
74 .is_rmii = 1,
75};
76
77static struct mtd_partition __initdata snapper9260_nand_partitions[] = {
78 {
79 .name = "Preboot",
80 .offset = 0,
81 .size = SZ_128K,
82 },
83 {
84 .name = "Bootloader",
85 .offset = MTDPART_OFS_APPEND,
86 .size = SZ_256K,
87 },
88 {
89 .name = "Environment",
90 .offset = MTDPART_OFS_APPEND,
91 .size = SZ_128K,
92 },
93 {
94 .name = "Kernel",
95 .offset = MTDPART_OFS_APPEND,
96 .size = SZ_4M,
97 },
98 {
99 .name = "Filesystem",
100 .offset = MTDPART_OFS_APPEND,
101 .size = MTDPART_SIZ_FULL,
102 },
103};
104
105static struct mtd_partition * __init
106snapper9260_nand_partition_info(int size, int *num_partitions)
107{
108 *num_partitions = ARRAY_SIZE(snapper9260_nand_partitions);
109 return snapper9260_nand_partitions;
110}
111
112static struct atmel_nand_data __initdata snapper9260_nand_data = {
113 .ale = 21,
114 .cle = 22,
115 .rdy_pin = AT91_PIN_PC13,
116 .partition_info = snapper9260_nand_partition_info,
117 .bus_width_16 = 0,
118};
119
120static struct sam9_smc_config __initdata snapper9260_nand_smc_config = {
121 .ncs_read_setup = 0,
122 .nrd_setup = 0,
123 .ncs_write_setup = 0,
124 .nwe_setup = 0,
125
126 .ncs_read_pulse = 5,
127 .nrd_pulse = 2,
128 .ncs_write_pulse = 5,
129 .nwe_pulse = 2,
130
131 .read_cycle = 7,
132 .write_cycle = 7,
133
134 .mode = (AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
135 AT91_SMC_EXNWMODE_DISABLE),
136 .tdf_cycles = 1,
137};
138
139static struct pca953x_platform_data snapper9260_io_expander_data = {
140 .gpio_base = SNAPPER9260_IO_EXP_GPIO(0),
141};
142
143static struct i2c_board_info __initdata snapper9260_i2c_devices[] = {
144 {
145 /* IO expander */
146 I2C_BOARD_INFO("max7312", 0x28),
147 .platform_data = &snapper9260_io_expander_data,
148 },
149 {
150 /* Audio codec */
151 I2C_BOARD_INFO("tlv320aic23", 0x1a),
152 },
153 {
154 /* RTC */
155 I2C_BOARD_INFO("isl1208", 0x6f),
156 },
157};
158
159static void __init snapper9260_add_device_nand(void)
160{
161 at91_set_A_periph(AT91_PIN_PC14, 0);
162 sam9_smc_configure(3, &snapper9260_nand_smc_config);
163 at91_add_device_nand(&snapper9260_nand_data);
164}
165
166static void __init snapper9260_board_init(void)
167{
168 at91_add_device_i2c(snapper9260_i2c_devices,
169 ARRAY_SIZE(snapper9260_i2c_devices));
170 at91_add_device_serial();
171 at91_add_device_usbh(&snapper9260_usbh_data);
172 at91_add_device_udc(&snapper9260_udc_data);
173 at91_add_device_eth(&snapper9260_macb_data);
174 at91_add_device_ssc(AT91SAM9260_ID_SSC, (ATMEL_SSC_TF | ATMEL_SSC_TK |
175 ATMEL_SSC_TD | ATMEL_SSC_RD));
176 snapper9260_add_device_nand();
177}
178
179MACHINE_START(SNAPPER_9260, "Bluewater Systems Snapper 9260/9G20 module")
180 .phys_io = AT91_BASE_SYS,
181 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
182 .boot_params = AT91_SDRAM_BASE + 0x100,
183 .timer = &at91sam926x_timer,
184 .map_io = snapper9260_map_io,
185 .init_irq = snapper9260_init_irq,
186 .init_machine = snapper9260_board_init,
187MACHINE_END
188
189
diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h
index d8c1ededaa75..9c6af9737485 100644
--- a/arch/arm/mach-at91/include/mach/at91cap9.h
+++ b/arch/arm/mach-at91/include/mach/at91cap9.h
@@ -84,7 +84,7 @@
84 */ 84 */
85#define AT91_ECC (0xffffe200 - AT91_BASE_SYS) 85#define AT91_ECC (0xffffe200 - AT91_BASE_SYS)
86#define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS) 86#define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS)
87#define AT91_DDRSDRC (0xffffe600 - AT91_BASE_SYS) 87#define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS)
88#define AT91_SMC (0xffffe800 - AT91_BASE_SYS) 88#define AT91_SMC (0xffffe800 - AT91_BASE_SYS)
89#define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) 89#define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS)
90#define AT91_CCFG (0xffffeb10 - AT91_BASE_SYS) 90#define AT91_CCFG (0xffffeb10 - AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
index 1499b1cbffdd..976f4a6c3353 100644
--- a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
+++ b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
@@ -15,7 +15,7 @@
15#ifndef AT91CAP9_DDRSDR_H 15#ifndef AT91CAP9_DDRSDR_H
16#define AT91CAP9_DDRSDR_H 16#define AT91CAP9_DDRSDR_H
17 17
18#define AT91_DDRSDRC_MR (AT91_DDRSDRC + 0x00) /* Mode Register */ 18#define AT91_DDRSDRC_MR 0x00 /* Mode Register */
19#define AT91_DDRSDRC_MODE (0xf << 0) /* Command Mode */ 19#define AT91_DDRSDRC_MODE (0xf << 0) /* Command Mode */
20#define AT91_DDRSDRC_MODE_NORMAL 0 20#define AT91_DDRSDRC_MODE_NORMAL 0
21#define AT91_DDRSDRC_MODE_NOP 1 21#define AT91_DDRSDRC_MODE_NOP 1
@@ -25,10 +25,10 @@
25#define AT91_DDRSDRC_MODE_EXT_LMR 5 25#define AT91_DDRSDRC_MODE_EXT_LMR 5
26#define AT91_DDRSDRC_MODE_DEEP 6 26#define AT91_DDRSDRC_MODE_DEEP 6
27 27
28#define AT91_DDRSDRC_RTR (AT91_DDRSDRC + 0x04) /* Refresh Timer Register */ 28#define AT91_DDRSDRC_RTR 0x04 /* Refresh Timer Register */
29#define AT91_DDRSDRC_COUNT (0xfff << 0) /* Refresh Timer Counter */ 29#define AT91_DDRSDRC_COUNT (0xfff << 0) /* Refresh Timer Counter */
30 30
31#define AT91_DDRSDRC_CR (AT91_DDRSDRC + 0x08) /* Configuration Register */ 31#define AT91_DDRSDRC_CR 0x08 /* Configuration Register */
32#define AT91_DDRSDRC_NC (3 << 0) /* Number of Column Bits */ 32#define AT91_DDRSDRC_NC (3 << 0) /* Number of Column Bits */
33#define AT91_DDRSDRC_NC_SDR8 (0 << 0) 33#define AT91_DDRSDRC_NC_SDR8 (0 << 0)
34#define AT91_DDRSDRC_NC_SDR9 (1 << 0) 34#define AT91_DDRSDRC_NC_SDR9 (1 << 0)
@@ -49,7 +49,7 @@
49#define AT91_DDRSDRC_DLL (1 << 7) /* Reset DLL */ 49#define AT91_DDRSDRC_DLL (1 << 7) /* Reset DLL */
50#define AT91_DDRSDRC_DICDS (1 << 8) /* Output impedance control */ 50#define AT91_DDRSDRC_DICDS (1 << 8) /* Output impedance control */
51 51
52#define AT91_DDRSDRC_T0PR (AT91_DDRSDRC + 0x0C) /* Timing 0 Register */ 52#define AT91_DDRSDRC_T0PR 0x0C /* Timing 0 Register */
53#define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */ 53#define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */
54#define AT91_DDRSDRC_TRCD (0xf << 4) /* Row to Column delay */ 54#define AT91_DDRSDRC_TRCD (0xf << 4) /* Row to Column delay */
55#define AT91_DDRSDRC_TWR (0xf << 8) /* Write recovery delay */ 55#define AT91_DDRSDRC_TWR (0xf << 8) /* Write recovery delay */
@@ -59,13 +59,13 @@
59#define AT91_DDRSDRC_TWTR (1 << 24) /* Internal Write to Read delay */ 59#define AT91_DDRSDRC_TWTR (1 << 24) /* Internal Write to Read delay */
60#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */ 60#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */
61 61
62#define AT91_DDRSDRC_T1PR (AT91_DDRSDRC + 0x10) /* Timing 1 Register */ 62#define AT91_DDRSDRC_T1PR 0x10 /* Timing 1 Register */
63#define AT91_DDRSDRC_TRFC (0x1f << 0) /* Row Cycle Delay */ 63#define AT91_DDRSDRC_TRFC (0x1f << 0) /* Row Cycle Delay */
64#define AT91_DDRSDRC_TXSNR (0xff << 8) /* Exit self-refresh to non-read */ 64#define AT91_DDRSDRC_TXSNR (0xff << 8) /* Exit self-refresh to non-read */
65#define AT91_DDRSDRC_TXSRD (0xff << 16) /* Exit self-refresh to read */ 65#define AT91_DDRSDRC_TXSRD (0xff << 16) /* Exit self-refresh to read */
66#define AT91_DDRSDRC_TXP (0xf << 24) /* Exit power-down delay */ 66#define AT91_DDRSDRC_TXP (0xf << 24) /* Exit power-down delay */
67 67
68#define AT91_DDRSDRC_LPR (AT91_DDRSDRC + 0x18) /* Low Power Register */ 68#define AT91_DDRSDRC_LPR 0x18 /* Low Power Register */
69#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */ 69#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */
70#define AT91_DDRSDRC_LPCB_DISABLE 0 70#define AT91_DDRSDRC_LPCB_DISABLE 0
71#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1 71#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1
@@ -80,14 +80,14 @@
80#define AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES (1 << 12) 80#define AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES (1 << 12)
81#define AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES (2 << 12) 81#define AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES (2 << 12)
82 82
83#define AT91_DDRSDRC_MDR (AT91_DDRSDRC + 0x1C) /* Memory Device Register */ 83#define AT91_DDRSDRC_MDR 0x1C /* Memory Device Register */
84#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */ 84#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */
85#define AT91_DDRSDRC_MD_SDR 0 85#define AT91_DDRSDRC_MD_SDR 0
86#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1 86#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1
87#define AT91_DDRSDRC_MD_DDR 2 87#define AT91_DDRSDRC_MD_DDR 2
88#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3 88#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3
89 89
90#define AT91_DDRSDRC_DLLR (AT91_DDRSDRC + 0x20) /* DLL Information Register */ 90#define AT91_DDRSDRC_DLLR 0x20 /* DLL Information Register */
91#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */ 91#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */
92#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */ 92#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */
93#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */ 93#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */
@@ -98,5 +98,11 @@
98#define AT91_DDRSDRC_SDVAL (0xff << 16) /* Slave Delay value */ 98#define AT91_DDRSDRC_SDVAL (0xff << 16) /* Slave Delay value */
99#define AT91_DDRSDRC_SDCVAL (0xff << 24) /* Slave Delay Correction value */ 99#define AT91_DDRSDRC_SDCVAL (0xff << 24) /* Slave Delay Correction value */
100 100
101/* Register access macros */
102#define at91_ramc_read(num, reg) \
103 at91_sys_read(AT91_DDRSDRC##num + reg)
104#define at91_ramc_write(num, reg, value) \
105 at91_sys_write(AT91_DDRSDRC##num + reg, value)
106
101 107
102#endif 108#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h
index 43c396b9b4cb..4e79036d3b80 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260.h
@@ -84,7 +84,7 @@
84 * System Peripherals (offset from AT91_BASE_SYS) 84 * System Peripherals (offset from AT91_BASE_SYS)
85 */ 85 */
86#define AT91_ECC (0xffffe800 - AT91_BASE_SYS) 86#define AT91_ECC (0xffffe800 - AT91_BASE_SYS)
87#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS) 87#define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS)
88#define AT91_SMC (0xffffec00 - AT91_BASE_SYS) 88#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
89#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) 89#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
90#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS) 90#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h
index 87de8be17484..2b5618518129 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261.h
@@ -68,7 +68,7 @@
68/* 68/*
69 * System Peripherals (offset from AT91_BASE_SYS) 69 * System Peripherals (offset from AT91_BASE_SYS)
70 */ 70 */
71#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS) 71#define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS)
72#define AT91_SMC (0xffffec00 - AT91_BASE_SYS) 72#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
73#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) 73#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
74#define AT91_AIC (0xfffff000 - AT91_BASE_SYS) 74#define AT91_AIC (0xfffff000 - AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
new file mode 100644
index 000000000000..d27b15ba8ebf
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
@@ -0,0 +1,130 @@
1/*
2 * Header file for the Atmel DDR/SDR SDRAM Controller
3 *
4 * Copyright (C) 2010 Atmel Corporation
5 * Nicolas Ferre <nicolas.ferre@atmel.com>
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#ifndef AT91SAM9_DDRSDR_H
13#define AT91SAM9_DDRSDR_H
14
15#define AT91_DDRSDRC_MR 0x00 /* Mode Register */
16#define AT91_DDRSDRC_MODE (0x7 << 0) /* Command Mode */
17#define AT91_DDRSDRC_MODE_NORMAL 0
18#define AT91_DDRSDRC_MODE_NOP 1
19#define AT91_DDRSDRC_MODE_PRECHARGE 2
20#define AT91_DDRSDRC_MODE_LMR 3
21#define AT91_DDRSDRC_MODE_REFRESH 4
22#define AT91_DDRSDRC_MODE_EXT_LMR 5
23#define AT91_DDRSDRC_MODE_DEEP 6
24
25#define AT91_DDRSDRC_RTR 0x04 /* Refresh Timer Register */
26#define AT91_DDRSDRC_COUNT (0xfff << 0) /* Refresh Timer Counter */
27
28#define AT91_DDRSDRC_CR 0x08 /* Configuration Register */
29#define AT91_DDRSDRC_NC (3 << 0) /* Number of Column Bits */
30#define AT91_DDRSDRC_NC_SDR8 (0 << 0)
31#define AT91_DDRSDRC_NC_SDR9 (1 << 0)
32#define AT91_DDRSDRC_NC_SDR10 (2 << 0)
33#define AT91_DDRSDRC_NC_SDR11 (3 << 0)
34#define AT91_DDRSDRC_NC_DDR9 (0 << 0)
35#define AT91_DDRSDRC_NC_DDR10 (1 << 0)
36#define AT91_DDRSDRC_NC_DDR11 (2 << 0)
37#define AT91_DDRSDRC_NC_DDR12 (3 << 0)
38#define AT91_DDRSDRC_NR (3 << 2) /* Number of Row Bits */
39#define AT91_DDRSDRC_NR_11 (0 << 2)
40#define AT91_DDRSDRC_NR_12 (1 << 2)
41#define AT91_DDRSDRC_NR_13 (2 << 2)
42#define AT91_DDRSDRC_NR_14 (3 << 2)
43#define AT91_DDRSDRC_CAS (7 << 4) /* CAS Latency */
44#define AT91_DDRSDRC_CAS_2 (2 << 4)
45#define AT91_DDRSDRC_CAS_3 (3 << 4)
46#define AT91_DDRSDRC_CAS_25 (6 << 4)
47#define AT91_DDRSDRC_RST_DLL (1 << 7) /* Reset DLL */
48#define AT91_DDRSDRC_DICDS (1 << 8) /* Output impedance control */
49#define AT91_DDRSDRC_DIS_DLL (1 << 9) /* Disable DLL */
50#define AT91_DDRSDRC_OCD (1 << 12) /* Off-Chip Driver */
51#define AT91_DDRSDRC_DQMS (1 << 16) /* Mask Data is Shared */
52#define AT91_DDRSDRC_ACTBST (1 << 18) /* Active Bank X to Burst Stop Read Access Bank Y */
53
54#define AT91_DDRSDRC_T0PR 0x0C /* Timing 0 Register */
55#define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */
56#define AT91_DDRSDRC_TRCD (0xf << 4) /* Row to Column delay */
57#define AT91_DDRSDRC_TWR (0xf << 8) /* Write recovery delay */
58#define AT91_DDRSDRC_TRC (0xf << 12) /* Row cycle delay */
59#define AT91_DDRSDRC_TRP (0xf << 16) /* Row precharge delay */
60#define AT91_DDRSDRC_TRRD (0xf << 20) /* Active BankA to BankB */
61#define AT91_DDRSDRC_TWTR (0x7 << 24) /* Internal Write to Read delay */
62#define AT91_DDRSDRC_RED_WRRD (0x1 << 27) /* Reduce Write to Read Delay */
63#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */
64
65#define AT91_DDRSDRC_T1PR 0x10 /* Timing 1 Register */
66#define AT91_DDRSDRC_TRFC (0x1f << 0) /* Row Cycle Delay */
67#define AT91_DDRSDRC_TXSNR (0xff << 8) /* Exit self-refresh to non-read */
68#define AT91_DDRSDRC_TXSRD (0xff << 16) /* Exit self-refresh to read */
69#define AT91_DDRSDRC_TXP (0xf << 24) /* Exit power-down delay */
70
71#define AT91_DDRSDRC_T2PR 0x14 /* Timing 2 Register */
72#define AT91_DDRSDRC_TXARD (0xf << 0) /* Exit active power down delay to read command in mode "Fast Exit" */
73#define AT91_DDRSDRC_TXARDS (0xf << 4) /* Exit active power down delay to read command in mode "Slow Exit" */
74#define AT91_DDRSDRC_TRPA (0xf << 8) /* Row Precharge All delay */
75#define AT91_DDRSDRC_TRTP (0x7 << 12) /* Read to Precharge delay */
76
77#define AT91_DDRSDRC_LPR 0x1C /* Low Power Register */
78#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */
79#define AT91_DDRSDRC_LPCB_DISABLE 0
80#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1
81#define AT91_DDRSDRC_LPCB_POWER_DOWN 2
82#define AT91_DDRSDRC_LPCB_DEEP_POWER_DOWN 3
83#define AT91_DDRSDRC_CLKFR (1 << 2) /* Clock Frozen */
84#define AT91_DDRSDRC_PASR (7 << 4) /* Partial Array Self Refresh */
85#define AT91_DDRSDRC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
86#define AT91_DDRSDRC_DS (3 << 10) /* Drive Strength */
87#define AT91_DDRSDRC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
88#define AT91_DDRSDRC_TIMEOUT_0_CLK_CYCLES (0 << 12)
89#define AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES (1 << 12)
90#define AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES (2 << 12)
91#define AT91_DDRSDRC_APDE (1 << 16) /* Active power down exit time */
92#define AT91_DDRSDRC_UPD_MR (3 << 20) /* Update load mode register and extended mode register */
93
94#define AT91_DDRSDRC_MDR 0x20 /* Memory Device Register */
95#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */
96#define AT91_DDRSDRC_MD_SDR 0
97#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1
98#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3
99#define AT91_DDRSDRC_MD_DDR2 6
100#define AT91_DDRSDRC_DBW (1 << 4) /* Data Bus Width */
101#define AT91_DDRSDRC_DBW_32BITS (0 << 4)
102#define AT91_DDRSDRC_DBW_16BITS (1 << 4)
103
104#define AT91_DDRSDRC_DLL 0x24 /* DLL Information Register */
105#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */
106#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */
107#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */
108#define AT91_DDRSDRC_MDVAL (0xff << 8) /* Master Delay value */
109
110#define AT91_DDRSDRC_HS 0x2C /* High Speed Register */
111#define AT91_DDRSDRC_DIS_ATCP_RD (1 << 2) /* Anticip read access is disabled */
112
113#define AT91_DDRSDRC_DELAY(n) (0x30 + (0x4 * (n))) /* Delay I/O Register n */
114
115#define AT91_DDRSDRC_WPMR 0xE4 /* Write Protect Mode Register */
116#define AT91_DDRSDRC_WP (1 << 0) /* Write protect enable */
117#define AT91_DDRSDRC_WPKEY (0xffffff << 8) /* Write protect key */
118#define AT91_DDRSDRC_KEY (0x444452 << 8) /* Write protect key = "DDR" */
119
120#define AT91_DDRSDRC_WPSR 0xE8 /* Write Protect Status Register */
121#define AT91_DDRSDRC_WPVS (1 << 0) /* Write protect violation status */
122#define AT91_DDRSDRC_WPVSRC (0xffff << 8) /* Write protect violation source */
123
124/* Register access macros */
125#define at91_ramc_read(num, reg) \
126 at91_sys_read(AT91_DDRSDRC##num + reg)
127#define at91_ramc_write(num, reg, value) \
128 at91_sys_write(AT91_DDRSDRC##num + reg, value)
129
130#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
index b7260389f7ca..100f5a592926 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
@@ -17,7 +17,7 @@
17#define AT91SAM9_SDRAMC_H 17#define AT91SAM9_SDRAMC_H
18 18
19/* SDRAM Controller (SDRAMC) registers */ 19/* SDRAM Controller (SDRAMC) registers */
20#define AT91_SDRAMC_MR (AT91_SDRAMC + 0x00) /* SDRAM Controller Mode Register */ 20#define AT91_SDRAMC_MR 0x00 /* SDRAM Controller Mode Register */
21#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */ 21#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
22#define AT91_SDRAMC_MODE_NORMAL 0 22#define AT91_SDRAMC_MODE_NORMAL 0
23#define AT91_SDRAMC_MODE_NOP 1 23#define AT91_SDRAMC_MODE_NOP 1
@@ -27,10 +27,10 @@
27#define AT91_SDRAMC_MODE_EXT_LMR 5 27#define AT91_SDRAMC_MODE_EXT_LMR 5
28#define AT91_SDRAMC_MODE_DEEP 6 28#define AT91_SDRAMC_MODE_DEEP 6
29 29
30#define AT91_SDRAMC_TR (AT91_SDRAMC + 0x04) /* SDRAM Controller Refresh Timer Register */ 30#define AT91_SDRAMC_TR 0x04 /* SDRAM Controller Refresh Timer Register */
31#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Counter */ 31#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Counter */
32 32
33#define AT91_SDRAMC_CR (AT91_SDRAMC + 0x08) /* SDRAM Controller Configuration Register */ 33#define AT91_SDRAMC_CR 0x08 /* SDRAM Controller Configuration Register */
34#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */ 34#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
35#define AT91_SDRAMC_NC_8 (0 << 0) 35#define AT91_SDRAMC_NC_8 (0 << 0)
36#define AT91_SDRAMC_NC_9 (1 << 0) 36#define AT91_SDRAMC_NC_9 (1 << 0)
@@ -57,7 +57,7 @@
57#define AT91_SDRAMC_TRAS (0xf << 24) /* Active to Precharge Delay */ 57#define AT91_SDRAMC_TRAS (0xf << 24) /* Active to Precharge Delay */
58#define AT91_SDRAMC_TXSR (0xf << 28) /* Exit Self Refresh to Active Delay */ 58#define AT91_SDRAMC_TXSR (0xf << 28) /* Exit Self Refresh to Active Delay */
59 59
60#define AT91_SDRAMC_LPR (AT91_SDRAMC + 0x10) /* SDRAM Controller Low Power Register */ 60#define AT91_SDRAMC_LPR 0x10 /* SDRAM Controller Low Power Register */
61#define AT91_SDRAMC_LPCB (3 << 0) /* Low-power Configurations */ 61#define AT91_SDRAMC_LPCB (3 << 0) /* Low-power Configurations */
62#define AT91_SDRAMC_LPCB_DISABLE 0 62#define AT91_SDRAMC_LPCB_DISABLE 0
63#define AT91_SDRAMC_LPCB_SELF_REFRESH 1 63#define AT91_SDRAMC_LPCB_SELF_REFRESH 1
@@ -71,16 +71,21 @@
71#define AT91_SDRAMC_TIMEOUT_64_CLK_CYCLES (1 << 12) 71#define AT91_SDRAMC_TIMEOUT_64_CLK_CYCLES (1 << 12)
72#define AT91_SDRAMC_TIMEOUT_128_CLK_CYCLES (2 << 12) 72#define AT91_SDRAMC_TIMEOUT_128_CLK_CYCLES (2 << 12)
73 73
74#define AT91_SDRAMC_IER (AT91_SDRAMC + 0x14) /* SDRAM Controller Interrupt Enable Register */ 74#define AT91_SDRAMC_IER 0x14 /* SDRAM Controller Interrupt Enable Register */
75#define AT91_SDRAMC_IDR (AT91_SDRAMC + 0x18) /* SDRAM Controller Interrupt Disable Register */ 75#define AT91_SDRAMC_IDR 0x18 /* SDRAM Controller Interrupt Disable Register */
76#define AT91_SDRAMC_IMR (AT91_SDRAMC + 0x1C) /* SDRAM Controller Interrupt Mask Register */ 76#define AT91_SDRAMC_IMR 0x1C /* SDRAM Controller Interrupt Mask Register */
77#define AT91_SDRAMC_ISR (AT91_SDRAMC + 0x20) /* SDRAM Controller Interrupt Status Register */ 77#define AT91_SDRAMC_ISR 0x20 /* SDRAM Controller Interrupt Status Register */
78#define AT91_SDRAMC_RES (1 << 0) /* Refresh Error Status */ 78#define AT91_SDRAMC_RES (1 << 0) /* Refresh Error Status */
79 79
80#define AT91_SDRAMC_MDR (AT91_SDRAMC + 0x24) /* SDRAM Memory Device Register */ 80#define AT91_SDRAMC_MDR 0x24 /* SDRAM Memory Device Register */
81#define AT91_SDRAMC_MD (3 << 0) /* Memory Device Type */ 81#define AT91_SDRAMC_MD (3 << 0) /* Memory Device Type */
82#define AT91_SDRAMC_MD_SDRAM 0 82#define AT91_SDRAMC_MD_SDRAM 0
83#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1 83#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1
84 84
85/* Register access macros */
86#define at91_ramc_read(num, reg) \
87 at91_sys_read(AT91_SDRAMC##num + reg)
88#define at91_ramc_write(num, reg, value) \
89 at91_sys_write(AT91_SDRAMC##num + reg, value)
85 90
86#endif 91#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h
index fc2de6c09c86..87ba8517ad98 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9rl.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h
@@ -74,7 +74,7 @@
74 */ 74 */
75#define AT91_DMA (0xffffe600 - AT91_BASE_SYS) 75#define AT91_DMA (0xffffe600 - AT91_BASE_SYS)
76#define AT91_ECC (0xffffe800 - AT91_BASE_SYS) 76#define AT91_ECC (0xffffe800 - AT91_BASE_SYS)
77#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS) 77#define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS)
78#define AT91_SMC (0xffffec00 - AT91_BASE_SYS) 78#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
79#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) 79#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
80#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS) 80#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index df2ed848c9f8..58528aa9c8a8 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -44,6 +44,8 @@
44 /* USB Device */ 44 /* USB Device */
45struct at91_udc_data { 45struct at91_udc_data {
46 u8 vbus_pin; /* high == host powering us */ 46 u8 vbus_pin; /* high == host powering us */
47 u8 vbus_active_low; /* vbus polarity */
48 u8 vbus_polled; /* Use polling, not interrupt */
47 u8 pullup_pin; /* active == D+ pulled up */ 49 u8 pullup_pin; /* active == D+ pulled up */
48 u8 pullup_active_low; /* true == pullup_pin is active low */ 50 u8 pullup_active_low; /* true == pullup_pin is active low */
49}; 51};
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index 833659d1200a..3bef931d0b1c 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -52,6 +52,7 @@ static inline unsigned long at91_cpu_fully_identify(void)
52 52
53#define ARCH_EXID_AT91SAM9M11 0x00000001 53#define ARCH_EXID_AT91SAM9M11 0x00000001
54#define ARCH_EXID_AT91SAM9M10 0x00000002 54#define ARCH_EXID_AT91SAM9M10 0x00000002
55#define ARCH_EXID_AT91SAM9G46 0x00000003
55#define ARCH_EXID_AT91SAM9G45 0x00000004 56#define ARCH_EXID_AT91SAM9G45 0x00000004
56 57
57static inline unsigned long at91_exid_identify(void) 58static inline unsigned long at91_exid_identify(void)
@@ -128,9 +129,18 @@ static inline unsigned long at91cap9_rev_identify(void)
128#ifdef CONFIG_ARCH_AT91SAM9G45 129#ifdef CONFIG_ARCH_AT91SAM9G45
129#define cpu_is_at91sam9g45() (at91_cpu_identify() == ARCH_ID_AT91SAM9G45) 130#define cpu_is_at91sam9g45() (at91_cpu_identify() == ARCH_ID_AT91SAM9G45)
130#define cpu_is_at91sam9g45es() (at91_cpu_fully_identify() == ARCH_ID_AT91SAM9G45ES) 131#define cpu_is_at91sam9g45es() (at91_cpu_fully_identify() == ARCH_ID_AT91SAM9G45ES)
132#define cpu_is_at91sam9m10() (cpu_is_at91sam9g45() && \
133 (at91_exid_identify() == ARCH_EXID_AT91SAM9M10))
134#define cpu_is_at91sam9m46() (cpu_is_at91sam9g45() && \
135 (at91_exid_identify() == ARCH_EXID_AT91SAM9G46))
136#define cpu_is_at91sam9m11() (cpu_is_at91sam9g45() && \
137 (at91_exid_identify() == ARCH_EXID_AT91SAM9M11))
131#else 138#else
132#define cpu_is_at91sam9g45() (0) 139#define cpu_is_at91sam9g45() (0)
133#define cpu_is_at91sam9g45es() (0) 140#define cpu_is_at91sam9g45es() (0)
141#define cpu_is_at91sam9m10() (0)
142#define cpu_is_at91sam9g46() (0)
143#define cpu_is_at91sam9m11() (0)
134#endif 144#endif
135 145
136#ifdef CONFIG_ARCH_AT91CAP9 146#ifdef CONFIG_ARCH_AT91CAP9
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index 04c91e31c9c5..bfdd8ab26dc8 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -19,6 +19,7 @@
19#define PIN_BASE NR_AIC_IRQS 19#define PIN_BASE NR_AIC_IRQS
20 20
21#define MAX_GPIO_BANKS 5 21#define MAX_GPIO_BANKS 5
22#define NR_BUILTIN_GPIO (PIN_BASE + (MAX_GPIO_BANKS * 32))
22 23
23/* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */ 24/* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */
24 25
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index 08322c44df1a..8c87d0c1b8f8 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -30,14 +30,50 @@ static inline u32 sdram_selfrefresh_enable(void)
30{ 30{
31 u32 saved_lpr, lpr; 31 u32 saved_lpr, lpr;
32 32
33 saved_lpr = at91_sys_read(AT91_DDRSDRC_LPR); 33 saved_lpr = at91_ramc_read(0, AT91_DDRSDRC_LPR);
34 34
35 lpr = saved_lpr & ~AT91_DDRSDRC_LPCB; 35 lpr = saved_lpr & ~AT91_DDRSDRC_LPCB;
36 at91_sys_write(AT91_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH); 36 at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH);
37 return saved_lpr; 37 return saved_lpr;
38} 38}
39 39
40#define sdram_selfrefresh_disable(saved_lpr) at91_sys_write(AT91_DDRSDRC_LPR, saved_lpr) 40#define sdram_selfrefresh_disable(saved_lpr) at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr)
41
42#elif defined(CONFIG_ARCH_AT91SAM9G45)
43#include <mach/at91sam9_ddrsdr.h>
44
45/* We manage both DDRAM/SDRAM controllers, we need more than one value to
46 * remember.
47 */
48static u32 saved_lpr1;
49
50static inline u32 sdram_selfrefresh_enable(void)
51{
52 /* Those tow values allow us to delay self-refresh activation
53 * to the maximum. */
54 u32 lpr0, lpr1;
55 u32 saved_lpr0;
56
57 saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR);
58 lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB;
59 lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH;
60
61 saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR);
62 lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB;
63 lpr0 |= AT91_DDRSDRC_LPCB_SELF_REFRESH;
64
65 /* self-refresh mode now */
66 at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0);
67 at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1);
68
69 return saved_lpr0;
70}
71
72#define sdram_selfrefresh_disable(saved_lpr0) \
73 do { \
74 at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0); \
75 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); \
76 } while (0)
41 77
42#else 78#else
43#include <mach/at91sam9_sdramc.h> 79#include <mach/at91sam9_sdramc.h>
@@ -47,7 +83,6 @@ static inline u32 sdram_selfrefresh_enable(void)
47 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; 83 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
48 * handle those cases both here and in the Suspend-To-RAM support. 84 * handle those cases both here and in the Suspend-To-RAM support.
49 */ 85 */
50#define AT91_SDRAMC AT91_SDRAMC0
51#warning Assuming EB1 SDRAM controller is *NOT* used 86#warning Assuming EB1 SDRAM controller is *NOT* used
52#endif 87#endif
53 88
@@ -55,13 +90,13 @@ static inline u32 sdram_selfrefresh_enable(void)
55{ 90{
56 u32 saved_lpr, lpr; 91 u32 saved_lpr, lpr;
57 92
58 saved_lpr = at91_sys_read(AT91_SDRAMC_LPR); 93 saved_lpr = at91_ramc_read(0, AT91_SDRAMC_LPR);
59 94
60 lpr = saved_lpr & ~AT91_SDRAMC_LPCB; 95 lpr = saved_lpr & ~AT91_SDRAMC_LPCB;
61 at91_sys_write(AT91_SDRAMC_LPR, lpr | AT91_SDRAMC_LPCB_SELF_REFRESH); 96 at91_ramc_write(0, AT91_SDRAMC_LPR, lpr | AT91_SDRAMC_LPCB_SELF_REFRESH);
62 return saved_lpr; 97 return saved_lpr;
63} 98}
64 99
65#define sdram_selfrefresh_disable(saved_lpr) at91_sys_write(AT91_SDRAMC_LPR, saved_lpr) 100#define sdram_selfrefresh_disable(saved_lpr) at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr)
66 101
67#endif 102#endif
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S
index 9c5b48e68a71..b6b00a1f6125 100644
--- a/arch/arm/mach-at91/pm_slowclock.S
+++ b/arch/arm/mach-at91/pm_slowclock.S
@@ -16,10 +16,12 @@
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <mach/at91_pmc.h> 17#include <mach/at91_pmc.h>
18 18
19#ifdef CONFIG_ARCH_AT91RM9200 19#if defined(CONFIG_ARCH_AT91RM9200)
20#include <mach/at91rm9200_mc.h> 20#include <mach/at91rm9200_mc.h>
21#elif defined(CONFIG_ARCH_AT91CAP9) 21#elif defined(CONFIG_ARCH_AT91CAP9)
22#include <mach/at91cap9_ddrsdr.h> 22#include <mach/at91cap9_ddrsdr.h>
23#elif defined(CONFIG_ARCH_AT91SAM9G45)
24#include <mach/at91sam9_ddrsdr.h>
23#else 25#else
24#include <mach/at91sam9_sdramc.h> 26#include <mach/at91sam9_sdramc.h>
25#endif 27#endif
@@ -30,7 +32,6 @@
30 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; 32 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
31 * handle those cases both here and in the Suspend-To-RAM support. 33 * handle those cases both here and in the Suspend-To-RAM support.
32 */ 34 */
33#define AT91_SDRAMC AT91_SDRAMC0
34#warning Assuming EB1 SDRAM controller is *NOT* used 35#warning Assuming EB1 SDRAM controller is *NOT* used
35#endif 36#endif
36 37
@@ -113,12 +114,14 @@ ENTRY(at91_slow_clock)
113 /* 114 /*
114 * Register usage: 115 * Register usage:
115 * R1 = Base address of AT91_PMC 116 * R1 = Base address of AT91_PMC
116 * R2 = Base address of AT91_SDRAMC (or AT91_SYS on AT91RM9200) 117 * R2 = Base address of RAM Controller (SDRAM, DDRSDR, or AT91_SYS)
117 * R3 = temporary register 118 * R3 = temporary register
118 * R4 = temporary register 119 * R4 = temporary register
120 * R5 = Base address of second RAM Controller or 0 if not present
119 */ 121 */
120 ldr r1, .at91_va_base_pmc 122 ldr r1, .at91_va_base_pmc
121 ldr r2, .at91_va_base_sdramc 123 ldr r2, .at91_va_base_sdramc
124 ldr r5, .at91_va_base_ramc1
122 125
123 /* Drain write buffer */ 126 /* Drain write buffer */
124 mcr p15, 0, r0, c7, c10, 4 127 mcr p15, 0, r0, c7, c10, 4
@@ -127,20 +130,33 @@ ENTRY(at91_slow_clock)
127 /* Put SDRAM in self-refresh mode */ 130 /* Put SDRAM in self-refresh mode */
128 mov r3, #1 131 mov r3, #1
129 str r3, [r2, #AT91_SDRAMC_SRR] 132 str r3, [r2, #AT91_SDRAMC_SRR]
130#elif defined(CONFIG_ARCH_AT91CAP9) 133#elif defined(CONFIG_ARCH_AT91CAP9) \
131 /* Enable SDRAM self-refresh mode */ 134 || defined(CONFIG_ARCH_AT91SAM9G45)
132 ldr r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC]
133 str r3, .saved_sam9_lpr
134 135
135 mov r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH 136 /* prepare for DDRAM self-refresh mode */
136 str r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC] 137 ldr r3, [r2, #AT91_DDRSDRC_LPR]
138 str r3, .saved_sam9_lpr
139 bic r3, #AT91_DDRSDRC_LPCB
140 orr r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH
141
142 /* figure out if we use the second ram controller */
143 cmp r5, #0
144 ldrne r4, [r5, #AT91_DDRSDRC_LPR]
145 strne r4, .saved_sam9_lpr1
146 bicne r4, #AT91_DDRSDRC_LPCB
147 orrne r4, #AT91_DDRSDRC_LPCB_SELF_REFRESH
148
149 /* Enable DDRAM self-refresh mode */
150 str r3, [r2, #AT91_DDRSDRC_LPR]
151 strne r4, [r5, #AT91_DDRSDRC_LPR]
137#else 152#else
138 /* Enable SDRAM self-refresh mode */ 153 /* Enable SDRAM self-refresh mode */
139 ldr r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC] 154 ldr r3, [r2, #AT91_SDRAMC_LPR]
140 str r3, .saved_sam9_lpr 155 str r3, .saved_sam9_lpr
141 156
142 mov r3, #AT91_SDRAMC_LPCB_SELF_REFRESH 157 bic r3, #AT91_SDRAMC_LPCB
143 str r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC] 158 orr r3, #AT91_SDRAMC_LPCB_SELF_REFRESH
159 str r3, [r2, #AT91_SDRAMC_LPR]
144#endif 160#endif
145 161
146 /* Save Master clock setting */ 162 /* Save Master clock setting */
@@ -247,14 +263,21 @@ ENTRY(at91_slow_clock)
247 263
248#ifdef CONFIG_ARCH_AT91RM9200 264#ifdef CONFIG_ARCH_AT91RM9200
249 /* Do nothing - self-refresh is automatically disabled. */ 265 /* Do nothing - self-refresh is automatically disabled. */
250#elif defined(CONFIG_ARCH_AT91CAP9) 266#elif defined(CONFIG_ARCH_AT91CAP9) \
251 /* Restore LPR on AT91CAP9 */ 267 || defined(CONFIG_ARCH_AT91SAM9G45)
268 /* Restore LPR on AT91 with DDRAM */
252 ldr r3, .saved_sam9_lpr 269 ldr r3, .saved_sam9_lpr
253 str r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC] 270 str r3, [r2, #AT91_DDRSDRC_LPR]
271
272 /* if we use the second ram controller */
273 cmp r5, #0
274 ldrne r4, .saved_sam9_lpr1
275 strne r4, [r5, #AT91_DDRSDRC_LPR]
276
254#else 277#else
255 /* Restore LPR on AT91SAM9 */ 278 /* Restore LPR on AT91 with SDRAM */
256 ldr r3, .saved_sam9_lpr 279 ldr r3, .saved_sam9_lpr
257 str r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC] 280 str r3, [r2, #AT91_SDRAMC_LPR]
258#endif 281#endif
259 282
260 /* Restore registers, and return */ 283 /* Restore registers, and return */
@@ -273,18 +296,29 @@ ENTRY(at91_slow_clock)
273.saved_sam9_lpr: 296.saved_sam9_lpr:
274 .word 0 297 .word 0
275 298
299.saved_sam9_lpr1:
300 .word 0
301
276.at91_va_base_pmc: 302.at91_va_base_pmc:
277 .word AT91_VA_BASE_SYS + AT91_PMC 303 .word AT91_VA_BASE_SYS + AT91_PMC
278 304
279#ifdef CONFIG_ARCH_AT91RM9200 305#ifdef CONFIG_ARCH_AT91RM9200
280.at91_va_base_sdramc: 306.at91_va_base_sdramc:
281 .word AT91_VA_BASE_SYS 307 .word AT91_VA_BASE_SYS
282#elif defined(CONFIG_ARCH_AT91CAP9) 308#elif defined(CONFIG_ARCH_AT91CAP9) \
309 || defined(CONFIG_ARCH_AT91SAM9G45)
283.at91_va_base_sdramc: 310.at91_va_base_sdramc:
284 .word AT91_VA_BASE_SYS + AT91_DDRSDRC 311 .word AT91_VA_BASE_SYS + AT91_DDRSDRC0
285#else 312#else
286.at91_va_base_sdramc: 313.at91_va_base_sdramc:
287 .word AT91_VA_BASE_SYS + AT91_SDRAMC 314 .word AT91_VA_BASE_SYS + AT91_SDRAMC0
315#endif
316
317.at91_va_base_ramc1:
318#if defined(CONFIG_ARCH_AT91SAM9G45)
319 .word AT91_VA_BASE_SYS + AT91_DDRSDRC1
320#else
321 .word 0
288#endif 322#endif
289 323
290ENTRY(at91_slow_clock_sz) 324ENTRY(at91_slow_clock_sz)
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 72e405df0fb0..d3f959e92b2d 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -91,14 +91,23 @@ static struct clk uart_clk = {
91 .parent = &pll1_clk, 91 .parent = &pll1_clk,
92}; 92};
93 93
94static struct clk dummy_apb_pclk = {
95 .name = "BUSCLK",
96 .type = CLK_TYPE_PRIMARY,
97 .mode = CLK_MODE_XTAL,
98};
99
94static struct clk_lookup lookups[] = { 100static struct clk_lookup lookups[] = {
95 { /* UART0 */ 101 { /* Bus clock */
96 .dev_id = "uarta", 102 .con_id = "apb_pclk",
97 .clk = &uart_clk, 103 .clk = &dummy_apb_pclk,
98 }, { /* UART1 */ 104 }, { /* UART0 */
99 .dev_id = "uartb", 105 .dev_id = "uarta",
100 .clk = &uart_clk, 106 .clk = &uart_clk,
101 } 107 }, { /* UART1 */
108 .dev_id = "uartb",
109 .clk = &uart_clk,
110 }
102}; 111};
103 112
104static struct amba_device *amba_devs[] __initdata = { 113static struct amba_device *amba_devs[] __initdata = {
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index dbaae5f746a1..eb34bd1251d4 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -30,7 +30,6 @@ config ARCH_CLEP7312
30config ARCH_EDB7211 30config ARCH_EDB7211
31 bool "EDB7211" 31 bool "EDB7211"
32 select ISA 32 select ISA
33 select ARCH_DISCONTIGMEM_ENABLE
34 select ARCH_SPARSEMEM_ENABLE 33 select ARCH_SPARSEMEM_ENABLE
35 select ARCH_SELECT_MEMORY_MODEL 34 select ARCH_SELECT_MEMORY_MODEL
36 help 35 help
diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c
index 09fb57e45213..3c3bf45039ff 100644
--- a/arch/arm/mach-clps711x/clep7312.c
+++ b/arch/arm/mach-clps711x/clep7312.c
@@ -32,7 +32,6 @@ fixup_clep7312(struct machine_desc *desc, struct tag *tags,
32 mi->nr_banks=1; 32 mi->nr_banks=1;
33 mi->bank[0].start = 0xc0000000; 33 mi->bank[0].start = 0xc0000000;
34 mi->bank[0].size = 0x01000000; 34 mi->bank[0].size = 0x01000000;
35 mi->bank[0].node = 0;
36} 35}
37 36
38 37
diff --git a/arch/arm/mach-clps711x/edb7211-arch.c b/arch/arm/mach-clps711x/edb7211-arch.c
index dc81cc68595d..4a7a2322979a 100644
--- a/arch/arm/mach-clps711x/edb7211-arch.c
+++ b/arch/arm/mach-clps711x/edb7211-arch.c
@@ -18,6 +18,7 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/memblock.h>
21#include <linux/types.h> 22#include <linux/types.h>
22#include <linux/string.h> 23#include <linux/string.h>
23 24
@@ -29,6 +30,12 @@
29 30
30extern void edb7211_map_io(void); 31extern void edb7211_map_io(void);
31 32
33/* Reserve screen memory region at the start of main system memory. */
34static void __init edb7211_reserve(void)
35{
36 memblock_reserve(PHYS_OFFSET, 0x00020000);
37}
38
32static void __init 39static void __init
33fixup_edb7211(struct machine_desc *desc, struct tag *tags, 40fixup_edb7211(struct machine_desc *desc, struct tag *tags,
34 char **cmdline, struct meminfo *mi) 41 char **cmdline, struct meminfo *mi)
@@ -43,10 +50,8 @@ fixup_edb7211(struct machine_desc *desc, struct tag *tags,
43 */ 50 */
44 mi->bank[0].start = 0xc0000000; 51 mi->bank[0].start = 0xc0000000;
45 mi->bank[0].size = 8*1024*1024; 52 mi->bank[0].size = 8*1024*1024;
46 mi->bank[0].node = 0;
47 mi->bank[1].start = 0xc1000000; 53 mi->bank[1].start = 0xc1000000;
48 mi->bank[1].size = 8*1024*1024; 54 mi->bank[1].size = 8*1024*1024;
49 mi->bank[1].node = 1;
50 mi->nr_banks = 2; 55 mi->nr_banks = 2;
51} 56}
52 57
@@ -57,6 +62,7 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
57 .boot_params = 0xc0020100, /* 0xc0000000 - 0xc001ffff can be video RAM */ 62 .boot_params = 0xc0020100, /* 0xc0000000 - 0xc001ffff can be video RAM */
58 .fixup = fixup_edb7211, 63 .fixup = fixup_edb7211,
59 .map_io = edb7211_map_io, 64 .map_io = edb7211_map_io,
65 .reserve = edb7211_reserve,
60 .init_irq = clps711x_init_irq, 66 .init_irq = clps711x_init_irq,
61 .timer = &clps711x_timer, 67 .timer = &clps711x_timer,
62MACHINE_END 68MACHINE_END
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
index 7430e4049d87..a696099aa4f8 100644
--- a/arch/arm/mach-clps711x/fortunet.c
+++ b/arch/arm/mach-clps711x/fortunet.c
@@ -39,7 +39,6 @@ struct meminfo memmap = {
39 { 39 {
40 .start = 0xC0000000, 40 .start = 0xC0000000,
41 .size = 0x01000000, 41 .size = 0x01000000,
42 .node = 0
43 }, 42 },
44 }, 43 },
45}; 44};
diff --git a/arch/arm/mach-clps711x/include/mach/memory.h b/arch/arm/mach-clps711x/include/mach/memory.h
index f70d52be48a2..f45c8e892cb5 100644
--- a/arch/arm/mach-clps711x/include/mach/memory.h
+++ b/arch/arm/mach-clps711x/include/mach/memory.h
@@ -20,7 +20,6 @@
20#ifndef __ASM_ARCH_MEMORY_H 20#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H 21#define __ASM_ARCH_MEMORY_H
22 22
23
24/* 23/*
25 * Physical DRAM offset. 24 * Physical DRAM offset.
26 */ 25 */
@@ -72,7 +71,6 @@
72 * node 2: 0xd0000000 - 0xd7ffffff 71 * node 2: 0xd0000000 - 0xd7ffffff
73 * node 3: 0xd8000000 - 0xdfffffff 72 * node 3: 0xd8000000 - 0xdfffffff
74 */ 73 */
75#define NODE_MEM_SIZE_BITS 24
76#define SECTION_SIZE_BITS 24 74#define SECTION_SIZE_BITS 24
77#define MAX_PHYSMEM_BITS 32 75#define MAX_PHYSMEM_BITS 32
78 76
diff --git a/arch/arm/mach-davinci/include/mach/memory.h b/arch/arm/mach-davinci/include/mach/memory.h
index a91edfb8beea..22eb97c1c30b 100644
--- a/arch/arm/mach-davinci/include/mach/memory.h
+++ b/arch/arm/mach-davinci/include/mach/memory.h
@@ -48,19 +48,16 @@
48 * below 128M 48 * below 128M
49 */ 49 */
50static inline void 50static inline void
51__arch_adjust_zones(int node, unsigned long *size, unsigned long *holes) 51__arch_adjust_zones(unsigned long *size, unsigned long *holes)
52{ 52{
53 unsigned int sz = (128<<20) >> PAGE_SHIFT; 53 unsigned int sz = (128<<20) >> PAGE_SHIFT;
54 54
55 if (node != 0)
56 sz = 0;
57
58 size[1] = size[0] - sz; 55 size[1] = size[0] - sz;
59 size[0] = sz; 56 size[0] = sz;
60} 57}
61 58
62#define arch_adjust_zones(node, zone_size, holes) \ 59#define arch_adjust_zones(zone_size, holes) \
63 if ((meminfo.bank[0].size >> 20) > 128) __arch_adjust_zones(node, zone_size, holes) 60 if ((meminfo.bank[0].size >> 20) > 128) __arch_adjust_zones(zone_size, holes)
64 61
65#define ISA_DMA_THRESHOLD (PHYS_OFFSET + (128<<20) - 1) 62#define ISA_DMA_THRESHOLD (PHYS_OFFSET + (128<<20) - 1)
66#define MAX_DMA_ADDRESS (PAGE_OFFSET + (128<<20)) 63#define MAX_DMA_ADDRESS (PAGE_OFFSET + (128<<20))
diff --git a/arch/arm/mach-ep93xx/adssphere.c b/arch/arm/mach-ep93xx/adssphere.c
index 3a1a855bfdca..f744f676783f 100644
--- a/arch/arm/mach-ep93xx/adssphere.c
+++ b/arch/arm/mach-ep93xx/adssphere.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/mtd/physmap.h>
17 16
18#include <mach/hardware.h> 17#include <mach/hardware.h>
19 18
@@ -21,26 +20,6 @@
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22 21
23 22
24static struct physmap_flash_data adssphere_flash_data = {
25 .width = 4,
26};
27
28static struct resource adssphere_flash_resource = {
29 .start = EP93XX_CS6_PHYS_BASE,
30 .end = EP93XX_CS6_PHYS_BASE + SZ_32M - 1,
31 .flags = IORESOURCE_MEM,
32};
33
34static struct platform_device adssphere_flash = {
35 .name = "physmap-flash",
36 .id = 0,
37 .dev = {
38 .platform_data = &adssphere_flash_data,
39 },
40 .num_resources = 1,
41 .resource = &adssphere_flash_resource,
42};
43
44static struct ep93xx_eth_data __initdata adssphere_eth_data = { 23static struct ep93xx_eth_data __initdata adssphere_eth_data = {
45 .phy_id = 1, 24 .phy_id = 1,
46}; 25};
@@ -48,8 +27,7 @@ static struct ep93xx_eth_data __initdata adssphere_eth_data = {
48static void __init adssphere_init_machine(void) 27static void __init adssphere_init_machine(void)
49{ 28{
50 ep93xx_init_devices(); 29 ep93xx_init_devices();
51 platform_device_register(&adssphere_flash); 30 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
52
53 ep93xx_register_eth(&adssphere_eth_data, 1); 31 ep93xx_register_eth(&adssphere_eth_data, 1);
54} 32}
55 33
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index e29bdef9b2e2..7f3039761d91 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -185,7 +185,7 @@ static struct clk_lookup clocks[] = {
185 INIT_CK(NULL, "pll1", &clk_pll1), 185 INIT_CK(NULL, "pll1", &clk_pll1),
186 INIT_CK(NULL, "fclk", &clk_f), 186 INIT_CK(NULL, "fclk", &clk_f),
187 INIT_CK(NULL, "hclk", &clk_h), 187 INIT_CK(NULL, "hclk", &clk_h),
188 INIT_CK(NULL, "pclk", &clk_p), 188 INIT_CK(NULL, "apb_pclk", &clk_p),
189 INIT_CK(NULL, "pll2", &clk_pll2), 189 INIT_CK(NULL, "pll2", &clk_pll2),
190 INIT_CK("ep93xx-ohci", NULL, &clk_usb_host), 190 INIT_CK("ep93xx-ohci", NULL, &clk_usb_host),
191 INIT_CK("ep93xx-keypad", NULL, &clk_keypad), 191 INIT_CK("ep93xx-keypad", NULL, &clk_keypad),
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 9092677f63eb..8e37a045188c 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -29,6 +29,7 @@
29#include <linux/termios.h> 29#include <linux/termios.h>
30#include <linux/amba/bus.h> 30#include <linux/amba/bus.h>
31#include <linux/amba/serial.h> 31#include <linux/amba/serial.h>
32#include <linux/mtd/physmap.h>
32#include <linux/i2c.h> 33#include <linux/i2c.h>
33#include <linux/i2c-gpio.h> 34#include <linux/i2c-gpio.h>
34#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
@@ -215,8 +216,8 @@ void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits)
215 spin_lock_irqsave(&syscon_swlock, flags); 216 spin_lock_irqsave(&syscon_swlock, flags);
216 217
217 val = __raw_readl(EP93XX_SYSCON_DEVCFG); 218 val = __raw_readl(EP93XX_SYSCON_DEVCFG);
218 val |= set_bits;
219 val &= ~clear_bits; 219 val &= ~clear_bits;
220 val |= set_bits;
220 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); 221 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK);
221 __raw_writel(val, EP93XX_SYSCON_DEVCFG); 222 __raw_writel(val, EP93XX_SYSCON_DEVCFG);
222 223
@@ -348,6 +349,43 @@ static struct platform_device ep93xx_ohci_device = {
348 349
349 350
350/************************************************************************* 351/*************************************************************************
352 * EP93xx physmap'ed flash
353 *************************************************************************/
354static struct physmap_flash_data ep93xx_flash_data;
355
356static struct resource ep93xx_flash_resource = {
357 .flags = IORESOURCE_MEM,
358};
359
360static struct platform_device ep93xx_flash = {
361 .name = "physmap-flash",
362 .id = 0,
363 .dev = {
364 .platform_data = &ep93xx_flash_data,
365 },
366 .num_resources = 1,
367 .resource = &ep93xx_flash_resource,
368};
369
370/**
371 * ep93xx_register_flash() - Register the external flash device.
372 * @width: bank width in octets
373 * @start: resource start address
374 * @size: resource size
375 */
376void __init ep93xx_register_flash(unsigned int width,
377 resource_size_t start, resource_size_t size)
378{
379 ep93xx_flash_data.width = width;
380
381 ep93xx_flash_resource.start = start;
382 ep93xx_flash_resource.end = start + size - 1;
383
384 platform_device_register(&ep93xx_flash);
385}
386
387
388/*************************************************************************
351 * EP93xx ethernet peripheral handling 389 * EP93xx ethernet peripheral handling
352 *************************************************************************/ 390 *************************************************************************/
353static struct ep93xx_eth_data ep93xx_eth_data; 391static struct ep93xx_eth_data ep93xx_eth_data;
@@ -620,6 +658,11 @@ static struct platform_device ep93xx_fb_device = {
620 .resource = ep93xx_fb_resource, 658 .resource = ep93xx_fb_resource,
621}; 659};
622 660
661static struct platform_device ep93xx_bl_device = {
662 .name = "ep93xx-bl",
663 .id = -1,
664};
665
623/** 666/**
624 * ep93xx_register_fb - Register the framebuffer platform device. 667 * ep93xx_register_fb - Register the framebuffer platform device.
625 * @data: platform specific framebuffer configuration (__initdata) 668 * @data: platform specific framebuffer configuration (__initdata)
@@ -628,6 +671,7 @@ void __init ep93xx_register_fb(struct ep93xxfb_mach_info *data)
628{ 671{
629 ep93xxfb_data = *data; 672 ep93xxfb_data = *data;
630 platform_device_register(&ep93xx_fb_device); 673 platform_device_register(&ep93xx_fb_device);
674 platform_device_register(&ep93xx_bl_device);
631} 675}
632 676
633 677
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index 3884182cd362..c2ce9034ba87 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -27,7 +27,6 @@
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/mtd/physmap.h>
31#include <linux/gpio.h> 30#include <linux/gpio.h>
32#include <linux/i2c.h> 31#include <linux/i2c.h>
33#include <linux/i2c-gpio.h> 32#include <linux/i2c-gpio.h>
@@ -38,39 +37,13 @@
38#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
39 38
40 39
41static struct physmap_flash_data edb93xx_flash_data;
42
43static struct resource edb93xx_flash_resource = {
44 .flags = IORESOURCE_MEM,
45};
46
47static struct platform_device edb93xx_flash = {
48 .name = "physmap-flash",
49 .id = 0,
50 .dev = {
51 .platform_data = &edb93xx_flash_data,
52 },
53 .num_resources = 1,
54 .resource = &edb93xx_flash_resource,
55};
56
57static void __init __edb93xx_register_flash(unsigned int width,
58 resource_size_t start, resource_size_t size)
59{
60 edb93xx_flash_data.width = width;
61 edb93xx_flash_resource.start = start;
62 edb93xx_flash_resource.end = start + size - 1;
63
64 platform_device_register(&edb93xx_flash);
65}
66
67static void __init edb93xx_register_flash(void) 40static void __init edb93xx_register_flash(void)
68{ 41{
69 if (machine_is_edb9307() || machine_is_edb9312() || 42 if (machine_is_edb9307() || machine_is_edb9312() ||
70 machine_is_edb9315()) { 43 machine_is_edb9315()) {
71 __edb93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M); 44 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
72 } else { 45 } else {
73 __edb93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M); 46 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
74 } 47 }
75} 48}
76 49
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c
index a809618e9f05..d97168c0ba33 100644
--- a/arch/arm/mach-ep93xx/gesbc9312.c
+++ b/arch/arm/mach-ep93xx/gesbc9312.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/mtd/physmap.h>
17 16
18#include <mach/hardware.h> 17#include <mach/hardware.h>
19 18
@@ -21,26 +20,6 @@
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22 21
23 22
24static struct physmap_flash_data gesbc9312_flash_data = {
25 .width = 4,
26};
27
28static struct resource gesbc9312_flash_resource = {
29 .start = EP93XX_CS6_PHYS_BASE,
30 .end = EP93XX_CS6_PHYS_BASE + SZ_8M - 1,
31 .flags = IORESOURCE_MEM,
32};
33
34static struct platform_device gesbc9312_flash = {
35 .name = "physmap-flash",
36 .id = 0,
37 .dev = {
38 .platform_data = &gesbc9312_flash_data,
39 },
40 .num_resources = 1,
41 .resource = &gesbc9312_flash_resource,
42};
43
44static struct ep93xx_eth_data __initdata gesbc9312_eth_data = { 23static struct ep93xx_eth_data __initdata gesbc9312_eth_data = {
45 .phy_id = 1, 24 .phy_id = 1,
46}; 25};
@@ -48,8 +27,7 @@ static struct ep93xx_eth_data __initdata gesbc9312_eth_data = {
48static void __init gesbc9312_init_machine(void) 27static void __init gesbc9312_init_machine(void)
49{ 28{
50 ep93xx_init_devices(); 29 ep93xx_init_devices();
51 platform_device_register(&gesbc9312_flash); 30 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_8M);
52
53 ep93xx_register_eth(&gesbc9312_eth_data, 0); 31 ep93xx_register_eth(&gesbc9312_eth_data, 0);
54} 32}
55 33
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index 9a4413dd44bb..a6c09176334c 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -43,6 +43,9 @@ static inline void ep93xx_devcfg_clear_bits(unsigned int bits)
43 43
44unsigned int ep93xx_chip_revision(void); 44unsigned int ep93xx_chip_revision(void);
45 45
46void ep93xx_register_flash(unsigned int width,
47 resource_size_t start, resource_size_t size);
48
46void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); 49void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr);
47void ep93xx_register_i2c(struct i2c_gpio_platform_data *data, 50void ep93xx_register_i2c(struct i2c_gpio_platform_data *data,
48 struct i2c_board_info *devices, int num); 51 struct i2c_board_info *devices, int num);
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c
index 1cc911b4efa6..2ba776320a82 100644
--- a/arch/arm/mach-ep93xx/micro9.c
+++ b/arch/arm/mach-ep93xx/micro9.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mtd/physmap.h>
18#include <linux/io.h> 17#include <linux/io.h>
19 18
20#include <mach/hardware.h> 19#include <mach/hardware.h>
@@ -31,31 +30,6 @@
31 * Micro9-Lite uses a separate MTD map driver for flash support 30 * Micro9-Lite uses a separate MTD map driver for flash support
32 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1 31 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
33 *************************************************************************/ 32 *************************************************************************/
34static struct physmap_flash_data micro9_flash_data;
35
36static struct resource micro9_flash_resource = {
37 .start = EP93XX_CS1_PHYS_BASE,
38 .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1,
39 .flags = IORESOURCE_MEM,
40};
41
42static struct platform_device micro9_flash = {
43 .name = "physmap-flash",
44 .id = 0,
45 .dev = {
46 .platform_data = &micro9_flash_data,
47 },
48 .num_resources = 1,
49 .resource = &micro9_flash_resource,
50};
51
52static void __init __micro9_register_flash(unsigned int width)
53{
54 micro9_flash_data.width = width;
55
56 platform_device_register(&micro9_flash);
57}
58
59static unsigned int __init micro9_detect_bootwidth(void) 33static unsigned int __init micro9_detect_bootwidth(void)
60{ 34{
61 u32 v; 35 u32 v;
@@ -70,10 +44,17 @@ static unsigned int __init micro9_detect_bootwidth(void)
70 44
71static void __init micro9_register_flash(void) 45static void __init micro9_register_flash(void)
72{ 46{
47 unsigned int width;
48
73 if (machine_is_micro9()) 49 if (machine_is_micro9())
74 __micro9_register_flash(4); 50 width = 4;
75 else if (machine_is_micro9m() || machine_is_micro9s()) 51 else if (machine_is_micro9m() || machine_is_micro9s())
76 __micro9_register_flash(micro9_detect_bootwidth()); 52 width = micro9_detect_bootwidth();
53 else
54 width = 0;
55
56 if (width)
57 ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
77} 58}
78 59
79 60
diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c
index 388aec95f60e..5dded5884133 100644
--- a/arch/arm/mach-ep93xx/simone.c
+++ b/arch/arm/mach-ep93xx/simone.c
@@ -18,7 +18,6 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/mtd/physmap.h>
22#include <linux/gpio.h> 21#include <linux/gpio.h>
23#include <linux/i2c.h> 22#include <linux/i2c.h>
24#include <linux/i2c-gpio.h> 23#include <linux/i2c-gpio.h>
@@ -29,26 +28,6 @@
29#include <asm/mach-types.h> 28#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
31 30
32static struct physmap_flash_data simone_flash_data = {
33 .width = 2,
34};
35
36static struct resource simone_flash_resource = {
37 .start = EP93XX_CS6_PHYS_BASE,
38 .end = EP93XX_CS6_PHYS_BASE + SZ_8M - 1,
39 .flags = IORESOURCE_MEM,
40};
41
42static struct platform_device simone_flash = {
43 .name = "physmap-flash",
44 .id = 0,
45 .num_resources = 1,
46 .resource = &simone_flash_resource,
47 .dev = {
48 .platform_data = &simone_flash_data,
49 },
50};
51
52static struct ep93xx_eth_data __initdata simone_eth_data = { 31static struct ep93xx_eth_data __initdata simone_eth_data = {
53 .phy_id = 1, 32 .phy_id = 1,
54}; 33};
@@ -77,8 +56,7 @@ static struct i2c_board_info __initdata simone_i2c_board_info[] = {
77static void __init simone_init_machine(void) 56static void __init simone_init_machine(void)
78{ 57{
79 ep93xx_init_devices(); 58 ep93xx_init_devices();
80 59 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_8M);
81 platform_device_register(&simone_flash);
82 ep93xx_register_eth(&simone_eth_data, 1); 60 ep93xx_register_eth(&simone_eth_data, 1);
83 ep93xx_register_fb(&simone_fb_info); 61 ep93xx_register_fb(&simone_fb_info);
84 ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info, 62 ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info,
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index ae7319e588c7..93aeab8af705 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -17,7 +17,6 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/m48t86.h> 19#include <linux/m48t86.h>
20#include <linux/mtd/physmap.h>
21#include <linux/mtd/nand.h> 20#include <linux/mtd/nand.h>
22#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
23 22
@@ -173,31 +172,13 @@ static struct platform_device ts72xx_nand_flash = {
173}; 172};
174 173
175 174
176/*************************************************************************
177 * NOR flash (TS-7200 only)
178 *************************************************************************/
179static struct physmap_flash_data ts72xx_nor_data = {
180 .width = 2,
181};
182
183static struct resource ts72xx_nor_resource = {
184 .start = EP93XX_CS6_PHYS_BASE,
185 .end = EP93XX_CS6_PHYS_BASE + SZ_16M - 1,
186 .flags = IORESOURCE_MEM,
187};
188
189static struct platform_device ts72xx_nor_flash = {
190 .name = "physmap-flash",
191 .id = 0,
192 .dev.platform_data = &ts72xx_nor_data,
193 .resource = &ts72xx_nor_resource,
194 .num_resources = 1,
195};
196
197static void __init ts72xx_register_flash(void) 175static void __init ts72xx_register_flash(void)
198{ 176{
177 /*
178 * TS7200 has NOR flash all other TS72xx board have NAND flash.
179 */
199 if (board_is_ts7200()) { 180 if (board_is_ts7200()) {
200 platform_device_register(&ts72xx_nor_flash); 181 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
201 } else { 182 } else {
202 resource_size_t start; 183 resource_size_t start;
203 184
diff --git a/arch/arm/mach-integrator/common.h b/arch/arm/mach-integrator/common.h
new file mode 100644
index 000000000000..5f96e1518aa9
--- /dev/null
+++ b/arch/arm/mach-integrator/common.h
@@ -0,0 +1 @@
void integrator_reserve(void);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index b02cfc06e0ae..8f4fb6d638f7 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -14,6 +14,7 @@
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/memblock.h>
17#include <linux/sched.h> 18#include <linux/sched.h>
18#include <linux/smp.h> 19#include <linux/smp.h>
19#include <linux/termios.h> 20#include <linux/termios.h>
@@ -30,6 +31,7 @@
30#include <asm/system.h> 31#include <asm/system.h>
31#include <asm/leds.h> 32#include <asm/leds.h>
32#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34#include <asm/pgtable.h>
33 35
34static struct amba_pl010_data integrator_uart_data; 36static struct amba_pl010_data integrator_uart_data;
35 37
@@ -119,8 +121,13 @@ static struct clk uartclk = {
119 .rate = 14745600, 121 .rate = 14745600,
120}; 122};
121 123
124static struct clk dummy_apb_pclk;
125
122static struct clk_lookup lookups[] = { 126static struct clk_lookup lookups[] = {
123 { /* UART0 */ 127 { /* Bus clock */
128 .con_id = "apb_pclk",
129 .clk = &dummy_apb_pclk,
130 }, { /* UART0 */
124 .dev_id = "mb:16", 131 .dev_id = "mb:16",
125 .clk = &uartclk, 132 .clk = &uartclk,
126 }, { /* UART1 */ 133 }, { /* UART1 */
@@ -215,3 +222,13 @@ void cm_control(u32 mask, u32 set)
215} 222}
216 223
217EXPORT_SYMBOL(cm_control); 224EXPORT_SYMBOL(cm_control);
225
226/*
227 * We need to stop things allocating the low memory; ideally we need a
228 * better implementation of GFP_DMA which does not assume that DMA-able
229 * memory starts at zero.
230 */
231void __init integrator_reserve(void)
232{
233 memblock_reserve(PHYS_OFFSET, __pa(swapper_pg_dir) - PHYS_OFFSET);
234}
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 227cf4d05088..6ab5a03ab9d8 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -48,6 +48,8 @@
48#include <asm/mach/map.h> 48#include <asm/mach/map.h>
49#include <asm/mach/time.h> 49#include <asm/mach/time.h>
50 50
51#include "common.h"
52
51/* 53/*
52 * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx 54 * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
53 * is the (PA >> 12). 55 * is the (PA >> 12).
@@ -502,6 +504,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
502 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, 504 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc,
503 .boot_params = 0x00000100, 505 .boot_params = 0x00000100,
504 .map_io = ap_map_io, 506 .map_io = ap_map_io,
507 .reserve = integrator_reserve,
505 .init_irq = ap_init_irq, 508 .init_irq = ap_init_irq,
506 .timer = &ap_timer, 509 .timer = &ap_timer,
507 .init_machine = ap_init, 510 .init_machine = ap_init,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index cde57b2b83b5..05db40e3c4f7 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -43,6 +43,8 @@
43 43
44#include <plat/timer-sp.h> 44#include <plat/timer-sp.h>
45 45
46#include "common.h"
47
46#define INTCP_PA_FLASH_BASE 0x24000000 48#define INTCP_PA_FLASH_BASE 0x24000000
47#define INTCP_FLASH_SIZE SZ_32M 49#define INTCP_FLASH_SIZE SZ_32M
48 50
@@ -601,6 +603,7 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
601 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, 603 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc,
602 .boot_params = 0x00000100, 604 .boot_params = 0x00000100,
603 .map_io = intcp_map_io, 605 .map_io = intcp_map_io,
606 .reserve = integrator_reserve,
604 .init_irq = intcp_init_irq, 607 .init_irq = intcp_init_irq,
605 .timer = &cp_timer, 608 .timer = &cp_timer,
606 .init_machine = intcp_init, 609 .init_machine = intcp_init,
diff --git a/arch/arm/mach-iop13xx/include/mach/memory.h b/arch/arm/mach-iop13xx/include/mach/memory.h
index 25b1da9a5035..7415e4338651 100644
--- a/arch/arm/mach-iop13xx/include/mach/memory.h
+++ b/arch/arm/mach-iop13xx/include/mach/memory.h
@@ -69,6 +69,4 @@ static inline unsigned long __lbus_to_virt(dma_addr_t x)
69#endif /* CONFIG_ARCH_IOP13XX */ 69#endif /* CONFIG_ARCH_IOP13XX */
70#endif /* !ASSEMBLY */ 70#endif /* !ASSEMBLY */
71 71
72#define PFN_TO_NID(addr) (0)
73
74#endif 72#endif
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index e3181534c7f9..333d04c53650 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -348,7 +348,7 @@ int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
348 * This is really ugly and we need a better way of specifying 348 * This is really ugly and we need a better way of specifying
349 * DMA-capable regions of memory. 349 * DMA-capable regions of memory.
350 */ 350 */
351void __init ixp4xx_adjust_zones(int node, unsigned long *zone_size, 351void __init ixp4xx_adjust_zones(unsigned long *zone_size,
352 unsigned long *zhole_size) 352 unsigned long *zhole_size)
353{ 353{
354 unsigned int sz = SZ_64M >> PAGE_SHIFT; 354 unsigned int sz = SZ_64M >> PAGE_SHIFT;
@@ -356,7 +356,7 @@ void __init ixp4xx_adjust_zones(int node, unsigned long *zone_size,
356 /* 356 /*
357 * Only adjust if > 64M on current system 357 * Only adjust if > 64M on current system
358 */ 358 */
359 if (node || (zone_size[0] <= sz)) 359 if (zone_size[0] <= sz)
360 return; 360 return;
361 361
362 zone_size[1] = zone_size[0] - sz; 362 zone_size[1] = zone_size[0] - sz;
diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h
index 98f5e5e20980..0136eaa29224 100644
--- a/arch/arm/mach-ixp4xx/include/mach/memory.h
+++ b/arch/arm/mach-ixp4xx/include/mach/memory.h
@@ -16,10 +16,10 @@
16 16
17#if !defined(__ASSEMBLY__) && defined(CONFIG_PCI) 17#if !defined(__ASSEMBLY__) && defined(CONFIG_PCI)
18 18
19void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes); 19void ixp4xx_adjust_zones(unsigned long *size, unsigned long *holes);
20 20
21#define arch_adjust_zones(node, size, holes) \ 21#define arch_adjust_zones(size, holes) \
22 ixp4xx_adjust_zones(node, size, holes) 22 ixp4xx_adjust_zones(size, holes)
23 23
24#define ISA_DMA_THRESHOLD (SZ_64M - 1) 24#define ISA_DMA_THRESHOLD (SZ_64M - 1)
25#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M) 25#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M)
diff --git a/arch/arm/mach-lh7a40x/include/mach/memory.h b/arch/arm/mach-lh7a40x/include/mach/memory.h
index 189d20e543e7..edb8f5faf5d5 100644
--- a/arch/arm/mach-lh7a40x/include/mach/memory.h
+++ b/arch/arm/mach-lh7a40x/include/mach/memory.h
@@ -19,50 +19,6 @@
19 */ 19 */
20#define PHYS_OFFSET UL(0xc0000000) 20#define PHYS_OFFSET UL(0xc0000000)
21 21
22#ifdef CONFIG_DISCONTIGMEM
23
24/*
25 * Given a kernel address, find the home node of the underlying memory.
26 */
27
28# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
29# define KVADDR_TO_NID(addr) \
30 ( ((((unsigned long) (addr) - PAGE_OFFSET) >> 24) & 1)\
31 | ((((unsigned long) (addr) - PAGE_OFFSET) >> 25) & ~1))
32# else /* 2 banks per node */
33# define KVADDR_TO_NID(addr) \
34 (((unsigned long) (addr) - PAGE_OFFSET) >> 26)
35# endif
36
37/*
38 * Given a page frame number, convert it to a node id.
39 */
40
41# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
42# define PFN_TO_NID(pfn) \
43 (((((pfn) - PHYS_PFN_OFFSET) >> (24 - PAGE_SHIFT)) & 1)\
44 | ((((pfn) - PHYS_PFN_OFFSET) >> (25 - PAGE_SHIFT)) & ~1))
45# else /* 2 banks per node */
46# define PFN_TO_NID(pfn) \
47 (((pfn) - PHYS_PFN_OFFSET) >> (26 - PAGE_SHIFT))
48#endif
49
50/*
51 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
52 * and returns the index corresponding to the appropriate page in the
53 * node's mem_map.
54 */
55
56# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
57# define LOCAL_MAP_NR(addr) \
58 (((unsigned long)(addr) & 0x003fffff) >> PAGE_SHIFT)
59# else /* 2 banks per node */
60# define LOCAL_MAP_NR(addr) \
61 (((unsigned long)(addr) & 0x01ffffff) >> PAGE_SHIFT)
62# endif
63
64#endif
65
66/* 22/*
67 * Sparsemem version of the above 23 * Sparsemem version of the above
68 */ 24 */
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index dca5a5f062dc..e69a1502e4e8 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -50,7 +50,6 @@ static void __init trout_fixup(struct machine_desc *desc, struct tag *tags,
50{ 50{
51 mi->nr_banks = 1; 51 mi->nr_banks = 1;
52 mi->bank[0].start = PHYS_OFFSET; 52 mi->bank[0].start = PHYS_OFFSET;
53 mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
54 mi->bank[0].size = (101*1024*1024); 53 mi->bank[0].size = (101*1024*1024);
55} 54}
56 55
diff --git a/arch/arm/mach-nomadik/clock.c b/arch/arm/mach-nomadik/clock.c
index f035f4185274..89f793adf776 100644
--- a/arch/arm/mach-nomadik/clock.c
+++ b/arch/arm/mach-nomadik/clock.c
@@ -53,6 +53,10 @@ static struct clk clk_default;
53 } 53 }
54 54
55static struct clk_lookup lookups[] = { 55static struct clk_lookup lookups[] = {
56 {
57 .con_id = "apb_pclk",
58 .clk = &clk_default,
59 },
56 CLK(&clk_24, "mtu0"), 60 CLK(&clk_24, "mtu0"),
57 CLK(&clk_24, "mtu1"), 61 CLK(&clk_24, "mtu1"),
58 CLK(&clk_48, "uart0"), 62 CLK(&clk_48, "uart0"),
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index fdd1dd53fa9c..0a9d61d2d229 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -301,6 +301,7 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
301 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 301 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
302 .boot_params = 0x10000100, 302 .boot_params = 0x10000100,
303 .map_io = ams_delta_map_io, 303 .map_io = ams_delta_map_io,
304 .reserve = omap_reserve,
304 .init_irq = ams_delta_init_irq, 305 .init_irq = ams_delta_init_irq,
305 .init_machine = ams_delta_init, 306 .init_machine = ams_delta_init,
306 .timer = &omap_timer, 307 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 096f2ed102cb..059bac60b35a 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -378,6 +378,7 @@ MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
378 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 378 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
379 .boot_params = 0x10000100, 379 .boot_params = 0x10000100,
380 .map_io = omap_fsample_map_io, 380 .map_io = omap_fsample_map_io,
381 .reserve = omap_reserve,
381 .init_irq = omap_fsample_init_irq, 382 .init_irq = omap_fsample_init_irq,
382 .init_machine = omap_fsample_init, 383 .init_machine = omap_fsample_init,
383 .timer = &omap_timer, 384 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index e1195a3467b8..7a65684d2a15 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -98,6 +98,7 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
98 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 98 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
99 .boot_params = 0x10000100, 99 .boot_params = 0x10000100,
100 .map_io = omap_generic_map_io, 100 .map_io = omap_generic_map_io,
101 .reserve = omap_reserve,
101 .init_irq = omap_generic_init_irq, 102 .init_irq = omap_generic_init_irq,
102 .init_machine = omap_generic_init, 103 .init_machine = omap_generic_init,
103 .timer = &omap_timer, 104 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index d1100e4f65ac..68b2beda8b99 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -467,6 +467,7 @@ MACHINE_START(OMAP_H2, "TI-H2")
467 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 467 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
468 .boot_params = 0x10000100, 468 .boot_params = 0x10000100,
469 .map_io = h2_map_io, 469 .map_io = h2_map_io,
470 .reserve = omap_reserve,
470 .init_irq = h2_init_irq, 471 .init_irq = h2_init_irq,
471 .init_machine = h2_init, 472 .init_machine = h2_init,
472 .timer = &omap_timer, 473 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index a53ab8297d25..0b0825fe6751 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -437,6 +437,7 @@ MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
437 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 437 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
438 .boot_params = 0x10000100, 438 .boot_params = 0x10000100,
439 .map_io = h3_map_io, 439 .map_io = h3_map_io,
440 .reserve = omap_reserve,
440 .init_irq = h3_init_irq, 441 .init_irq = h3_init_irq,
441 .init_machine = h3_init, 442 .init_machine = h3_init,
442 .timer = &omap_timer, 443 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 8e313b4b99a9..d70a4f0923f5 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -304,6 +304,7 @@ MACHINE_START(HERALD, "HTC Herald")
304 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 304 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
305 .boot_params = 0x10000100, 305 .boot_params = 0x10000100,
306 .map_io = htcherald_map_io, 306 .map_io = htcherald_map_io,
307 .reserve = omap_reserve,
307 .init_irq = htcherald_init_irq, 308 .init_irq = htcherald_init_irq,
308 .init_machine = htcherald_init, 309 .init_machine = htcherald_init,
309 .timer = &omap_timer, 310 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 5d12fd35681b..91064b37859a 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -463,6 +463,7 @@ MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
463 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 463 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
464 .boot_params = 0x10000100, 464 .boot_params = 0x10000100,
465 .map_io = innovator_map_io, 465 .map_io = innovator_map_io,
466 .reserve = omap_reserve,
466 .init_irq = innovator_init_irq, 467 .init_irq = innovator_init_irq,
467 .init_machine = innovator_init, 468 .init_machine = innovator_init,
468 .timer = &omap_timer, 469 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 71e1a3fad0ea..8c28b10f3dae 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -400,6 +400,7 @@ MACHINE_START(NOKIA770, "Nokia 770")
400 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 400 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
401 .boot_params = 0x10000100, 401 .boot_params = 0x10000100,
402 .map_io = omap_nokia770_map_io, 402 .map_io = omap_nokia770_map_io,
403 .reserve = omap_reserve,
403 .init_irq = omap_nokia770_init_irq, 404 .init_irq = omap_nokia770_init_irq,
404 .init_machine = omap_nokia770_init, 405 .init_machine = omap_nokia770_init,
405 .timer = &omap_timer, 406 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 80d862001def..e2a72af30890 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -584,6 +584,7 @@ MACHINE_START(OMAP_OSK, "TI-OSK")
584 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 584 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
585 .boot_params = 0x10000100, 585 .boot_params = 0x10000100,
586 .map_io = osk_map_io, 586 .map_io = osk_map_io,
587 .reserve = omap_reserve,
587 .init_irq = osk_init_irq, 588 .init_irq = osk_init_irq,
588 .init_machine = osk_init, 589 .init_machine = osk_init,
589 .timer = &omap_timer, 590 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 569b4c9085cd..61a2321b9732 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -373,6 +373,7 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
373 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 373 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
374 .boot_params = 0x10000100, 374 .boot_params = 0x10000100,
375 .map_io = omap_palmte_map_io, 375 .map_io = omap_palmte_map_io,
376 .reserve = omap_reserve,
376 .init_irq = omap_palmte_init_irq, 377 .init_irq = omap_palmte_init_irq,
377 .init_machine = omap_palmte_init, 378 .init_machine = omap_palmte_init,
378 .timer = &omap_timer, 379 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 6ad49a2cc1a0..21c01c6afcc1 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -321,6 +321,7 @@ MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
321 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 321 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
322 .boot_params = 0x10000100, 322 .boot_params = 0x10000100,
323 .map_io = omap_palmtt_map_io, 323 .map_io = omap_palmtt_map_io,
324 .reserve = omap_reserve,
324 .init_irq = omap_palmtt_init_irq, 325 .init_irq = omap_palmtt_init_irq,
325 .init_machine = omap_palmtt_init, 326 .init_machine = omap_palmtt_init,
326 .timer = &omap_timer, 327 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 6641de9257ef..f32492451533 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -338,10 +338,12 @@ omap_palmz71_map_io(void)
338} 338}
339 339
340MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71") 340MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
341 .phys_io = 0xfff00000, 341 .phys_io = 0xfff00000,
342 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 342 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
343 .boot_params = 0x10000100,.map_io = omap_palmz71_map_io, 343 .boot_params = 0x10000100,
344 .init_irq = omap_palmz71_init_irq, 344 .map_io = omap_palmz71_map_io,
345 .init_machine = omap_palmz71_init, 345 .reserve = omap_reserve,
346 .timer = &omap_timer, 346 .init_irq = omap_palmz71_init_irq,
347 .init_machine = omap_palmz71_init,
348 .timer = &omap_timer,
347MACHINE_END 349MACHINE_END
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index e854d5741c88..8b5ab1fcc405 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -339,6 +339,7 @@ MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
339 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 339 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
340 .boot_params = 0x10000100, 340 .boot_params = 0x10000100,
341 .map_io = omap_perseus2_map_io, 341 .map_io = omap_perseus2_map_io,
342 .reserve = omap_reserve,
342 .init_irq = omap_perseus2_init_irq, 343 .init_irq = omap_perseus2_init_irq,
343 .init_machine = omap_perseus2_init, 344 .init_machine = omap_perseus2_init,
344 .timer = &omap_timer, 345 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 2fb1e5f8e2ec..995566b862bb 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -423,7 +423,8 @@ MACHINE_START(SX1, "OMAP310 based Siemens SX1")
423 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 423 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
424 .boot_params = 0x10000100, 424 .boot_params = 0x10000100,
425 .map_io = omap_sx1_map_io, 425 .map_io = omap_sx1_map_io,
426 .init_irq = omap_sx1_init_irq, 426 .reserve = omap_reserve,
427 .init_irq = omap_sx1_init_irq,
427 .init_machine = omap_sx1_init, 428 .init_machine = omap_sx1_init,
428 .timer = &omap_timer, 429 .timer = &omap_timer,
429MACHINE_END 430MACHINE_END
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 87b9436fe7c0..4c483dc1de5c 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -287,6 +287,7 @@ MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
287 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 287 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
288 .boot_params = 0x10000100, 288 .boot_params = 0x10000100,
289 .map_io = voiceblue_map_io, 289 .map_io = voiceblue_map_io,
290 .reserve = omap_reserve,
290 .init_irq = voiceblue_init_irq, 291 .init_irq = voiceblue_init_irq,
291 .init_machine = voiceblue_init, 292 .init_machine = voiceblue_init,
292 .timer = &omap_timer, 293 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index d9b8d82530ae..0ce3fec2d257 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -22,7 +22,6 @@
22 22
23extern void omap_check_revision(void); 23extern void omap_check_revision(void);
24extern void omap_sram_init(void); 24extern void omap_sram_init(void);
25extern void omapfb_reserve_sdram(void);
26 25
27/* 26/*
28 * The machine specific code may provide the extra mapping besides the 27 * The machine specific code may provide the extra mapping besides the
@@ -122,7 +121,6 @@ void __init omap1_map_common_io(void)
122#endif 121#endif
123 122
124 omap_sram_init(); 123 omap_sram_init();
125 omapfb_reserve_sdram();
126} 124}
127 125
128/* 126/*
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index a11a575745e4..42f49f785c93 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -248,6 +248,7 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
248 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 248 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
249 .boot_params = 0x80000100, 249 .boot_params = 0x80000100,
250 .map_io = omap_2430sdp_map_io, 250 .map_io = omap_2430sdp_map_io,
251 .reserve = omap_reserve,
251 .init_irq = omap_2430sdp_init_irq, 252 .init_irq = omap_2430sdp_init_irq,
252 .init_machine = omap_2430sdp_init, 253 .init_machine = omap_2430sdp_init,
253 .timer = &omap_timer, 254 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index f474a80b8867..dd9c03171a19 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -815,6 +815,7 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
815 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 815 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
816 .boot_params = 0x80000100, 816 .boot_params = 0x80000100,
817 .map_io = omap_3430sdp_map_io, 817 .map_io = omap_3430sdp_map_io,
818 .reserve = omap_reserve,
818 .init_irq = omap_3430sdp_init_irq, 819 .init_irq = omap_3430sdp_init_irq,
819 .init_machine = omap_3430sdp_init, 820 .init_machine = omap_3430sdp_init,
820 .timer = &omap_timer, 821 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index 504d2bd222fe..57290fb3fcd7 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -108,6 +108,7 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
108 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 108 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
109 .boot_params = 0x80000100, 109 .boot_params = 0x80000100,
110 .map_io = omap_sdp_map_io, 110 .map_io = omap_sdp_map_io,
111 .reserve = omap_reserve,
111 .init_irq = omap_sdp_init_irq, 112 .init_irq = omap_sdp_init_irq,
112 .init_machine = omap_sdp_init, 113 .init_machine = omap_sdp_init,
113 .timer = &omap_timer, 114 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index e4a5d66b83b8..4bb2c5d151ec 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -402,6 +402,7 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
402 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 402 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
403 .boot_params = 0x80000100, 403 .boot_params = 0x80000100,
404 .map_io = omap_4430sdp_map_io, 404 .map_io = omap_4430sdp_map_io,
405 .reserve = omap_reserve,
405 .init_irq = omap_4430sdp_init_irq, 406 .init_irq = omap_4430sdp_init_irq,
406 .init_machine = omap_4430sdp_init, 407 .init_machine = omap_4430sdp_init,
407 .timer = &omap_timer, 408 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index af383a876943..7da92defcde0 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -472,6 +472,7 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
472 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 472 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
473 .boot_params = 0x80000100, 473 .boot_params = 0x80000100,
474 .map_io = am3517_evm_map_io, 474 .map_io = am3517_evm_map_io,
475 .reserve = omap_reserve,
475 .init_irq = am3517_evm_init_irq, 476 .init_irq = am3517_evm_init_irq,
476 .init_machine = am3517_evm_init, 477 .init_machine = am3517_evm_init,
477 .timer = &omap_timer, 478 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index aa69fb999748..bd75642aee65 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -346,6 +346,7 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
346 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 346 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
347 .boot_params = 0x80000100, 347 .boot_params = 0x80000100,
348 .map_io = omap_apollon_map_io, 348 .map_io = omap_apollon_map_io,
349 .reserve = omap_reserve,
349 .init_irq = omap_apollon_init_irq, 350 .init_irq = omap_apollon_init_irq,
350 .init_machine = omap_apollon_init, 351 .init_machine = omap_apollon_init,
351 .timer = &omap_timer, 352 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index e679a2cc86c3..bc4c3f807068 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -837,6 +837,7 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
837 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 837 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
838 .boot_params = 0x80000100, 838 .boot_params = 0x80000100,
839 .map_io = cm_t35_map_io, 839 .map_io = cm_t35_map_io,
840 .reserve = omap_reserve,
840 .init_irq = cm_t35_init_irq, 841 .init_irq = cm_t35_init_irq,
841 .init_machine = cm_t35_init, 842 .init_machine = cm_t35_init,
842 .timer = &omap_timer, 843 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 77022b588816..922b7464807f 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -825,6 +825,7 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
825 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 825 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
826 .boot_params = 0x80000100, 826 .boot_params = 0x80000100,
827 .map_io = devkit8000_map_io, 827 .map_io = devkit8000_map_io,
828 .reserve = omap_reserve,
828 .init_irq = devkit8000_init_irq, 829 .init_irq = devkit8000_init_irq,
829 .init_machine = devkit8000_init, 830 .init_machine = devkit8000_init,
830 .timer = &omap_timer, 831 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 16cc06860670..9242902d3a43 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -59,6 +59,7 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
59 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 59 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
60 .boot_params = 0x80000100, 60 .boot_params = 0x80000100,
61 .map_io = omap_generic_map_io, 61 .map_io = omap_generic_map_io,
62 .reserve = omap_reserve,
62 .init_irq = omap_generic_init_irq, 63 .init_irq = omap_generic_init_irq,
63 .init_machine = omap_generic_init, 64 .init_machine = omap_generic_init,
64 .timer = &omap_timer, 65 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 0665f2c8dc8e..16703fdb3515 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -378,6 +378,7 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
378 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 378 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
379 .boot_params = 0x80000100, 379 .boot_params = 0x80000100,
380 .map_io = omap_h4_map_io, 380 .map_io = omap_h4_map_io,
381 .reserve = omap_reserve,
381 .init_irq = omap_h4_init_irq, 382 .init_irq = omap_h4_init_irq,
382 .init_machine = omap_h4_init, 383 .init_machine = omap_h4_init,
383 .timer = &omap_timer, 384 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index d55c57b761a9..759e39d1a702 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -543,6 +543,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
543 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 543 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
544 .boot_params = 0x80000100, 544 .boot_params = 0x80000100,
545 .map_io = igep2_map_io, 545 .map_io = igep2_map_io,
546 .reserve = omap_reserve,
546 .init_irq = igep2_init_irq, 547 .init_irq = igep2_init_irq,
547 .init_machine = igep2_init, 548 .init_machine = igep2_init,
548 .timer = &omap_timer, 549 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index fefd7e6e9779..9cd2669113e4 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -417,6 +417,7 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
417 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 417 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
418 .boot_params = 0x80000100, 418 .boot_params = 0x80000100,
419 .map_io = omap_ldp_map_io, 419 .map_io = omap_ldp_map_io,
420 .reserve = omap_reserve,
420 .init_irq = omap_ldp_init_irq, 421 .init_irq = omap_ldp_init_irq,
421 .init_machine = omap_ldp_init, 422 .init_machine = omap_ldp_init,
422 .timer = &omap_timer, 423 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 3ccc34ebdcc7..2565ff08a221 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -667,6 +667,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
667 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 667 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
668 .boot_params = 0x80000100, 668 .boot_params = 0x80000100,
669 .map_io = n8x0_map_io, 669 .map_io = n8x0_map_io,
670 .reserve = omap_reserve,
670 .init_irq = n8x0_init_irq, 671 .init_irq = n8x0_init_irq,
671 .init_machine = n8x0_init_machine, 672 .init_machine = n8x0_init_machine,
672 .timer = &omap_timer, 673 .timer = &omap_timer,
@@ -677,6 +678,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
677 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 678 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
678 .boot_params = 0x80000100, 679 .boot_params = 0x80000100,
679 .map_io = n8x0_map_io, 680 .map_io = n8x0_map_io,
681 .reserve = omap_reserve,
680 .init_irq = n8x0_init_irq, 682 .init_irq = n8x0_init_irq,
681 .init_machine = n8x0_init_machine, 683 .init_machine = n8x0_init_machine,
682 .timer = &omap_timer, 684 .timer = &omap_timer,
@@ -687,6 +689,7 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
687 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 689 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
688 .boot_params = 0x80000100, 690 .boot_params = 0x80000100,
689 .map_io = n8x0_map_io, 691 .map_io = n8x0_map_io,
692 .reserve = omap_reserve,
690 .init_irq = n8x0_init_irq, 693 .init_irq = n8x0_init_irq,
691 .init_machine = n8x0_init_machine, 694 .init_machine = n8x0_init_machine,
692 .timer = &omap_timer, 695 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 69b154cdc75d..0ab0c26db4dd 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -519,6 +519,7 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
519 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 519 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
520 .boot_params = 0x80000100, 520 .boot_params = 0x80000100,
521 .map_io = omap3_beagle_map_io, 521 .map_io = omap3_beagle_map_io,
522 .reserve = omap_reserve,
522 .init_irq = omap3_beagle_init_irq, 523 .init_irq = omap3_beagle_init_irq,
523 .init_machine = omap3_beagle_init, 524 .init_machine = omap3_beagle_init,
524 .timer = &omap_timer, 525 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index b95261013812..a3d2e285e116 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -727,6 +727,7 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
727 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 727 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
728 .boot_params = 0x80000100, 728 .boot_params = 0x80000100,
729 .map_io = omap3_evm_map_io, 729 .map_io = omap3_evm_map_io,
730 .reserve = omap_reserve,
730 .init_irq = omap3_evm_init_irq, 731 .init_irq = omap3_evm_init_irq,
731 .init_machine = omap3_evm_init, 732 .init_machine = omap3_evm_init,
732 .timer = &omap_timer, 733 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index db06dc910ba7..c0f4f12eba54 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -601,6 +601,7 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
601 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 601 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
602 .boot_params = 0x80000100, 602 .boot_params = 0x80000100,
603 .map_io = omap3pandora_map_io, 603 .map_io = omap3pandora_map_io,
604 .reserve = omap_reserve,
604 .init_irq = omap3pandora_init_irq, 605 .init_irq = omap3pandora_init_irq,
605 .init_machine = omap3pandora_init, 606 .init_machine = omap3pandora_init,
606 .timer = &omap_timer, 607 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 2f5f8233dd5b..f05b867c5851 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -571,6 +571,7 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
571 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 571 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
572 .boot_params = 0x80000100, 572 .boot_params = 0x80000100,
573 .map_io = omap3_touchbook_map_io, 573 .map_io = omap3_touchbook_map_io,
574 .reserve = omap_reserve,
574 .init_irq = omap3_touchbook_init_irq, 575 .init_irq = omap3_touchbook_init_irq,
575 .init_machine = omap3_touchbook_init, 576 .init_machine = omap3_touchbook_init,
576 .timer = &omap_timer, 577 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 79ac41400c21..87acb2f198ec 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -495,6 +495,7 @@ MACHINE_START(OVERO, "Gumstix Overo")
495 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 495 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
496 .boot_params = 0x80000100, 496 .boot_params = 0x80000100,
497 .map_io = overo_map_io, 497 .map_io = overo_map_io,
498 .reserve = omap_reserve,
498 .init_irq = overo_init_irq, 499 .init_irq = overo_init_irq,
499 .init_machine = overo_init, 500 .init_machine = overo_init,
500 .timer = &omap_timer, 501 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 1b86b5bb87a2..3bd956f9e19f 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -154,6 +154,7 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
154 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 154 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
155 .boot_params = 0x80000100, 155 .boot_params = 0x80000100,
156 .map_io = rx51_map_io, 156 .map_io = rx51_map_io,
157 .reserve = omap_reserve,
157 .init_irq = rx51_init_irq, 158 .init_irq = rx51_init_irq,
158 .init_machine = rx51_init, 159 .init_machine = rx51_init,
159 .timer = &omap_timer, 160 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
index 803ef14cbf2d..ffe188cb18e9 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -95,6 +95,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
95 .io_pg_offst = (ZOOM_UART_VIRT >> 18) & 0xfffc, 95 .io_pg_offst = (ZOOM_UART_VIRT >> 18) & 0xfffc,
96 .boot_params = 0x80000100, 96 .boot_params = 0x80000100,
97 .map_io = omap_zoom2_map_io, 97 .map_io = omap_zoom2_map_io,
98 .reserve = omap_reserve,
98 .init_irq = omap_zoom2_init_irq, 99 .init_irq = omap_zoom2_init_irq,
99 .init_machine = omap_zoom2_init, 100 .init_machine = omap_zoom2_init,
100 .timer = &omap_timer, 101 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-zoom3.c b/arch/arm/mach-omap2/board-zoom3.c
index 33147042485f..5b605eba3e7b 100644
--- a/arch/arm/mach-omap2/board-zoom3.c
+++ b/arch/arm/mach-omap2/board-zoom3.c
@@ -77,6 +77,7 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
77 .io_pg_offst = (ZOOM_UART_VIRT >> 18) & 0xfffc, 77 .io_pg_offst = (ZOOM_UART_VIRT >> 18) & 0xfffc,
78 .boot_params = 0x80000100, 78 .boot_params = 0x80000100,
79 .map_io = omap_zoom_map_io, 79 .map_io = omap_zoom_map_io,
80 .reserve = omap_reserve,
80 .init_irq = omap_zoom_init_irq, 81 .init_irq = omap_zoom_init_irq,
81 .init_machine = omap_zoom_init, 82 .init_machine = omap_zoom_init,
82 .timer = &omap_timer, 83 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 41b155acfca7..d33744117ce2 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3166,6 +3166,10 @@ static struct clk uart4_ick_am35xx = {
3166 .recalc = &followparent_recalc, 3166 .recalc = &followparent_recalc,
3167}; 3167};
3168 3168
3169static struct clk dummy_apb_pclk = {
3170 .name = "apb_pclk",
3171 .ops = &clkops_null,
3172};
3169 3173
3170/* 3174/*
3171 * clkdev 3175 * clkdev
@@ -3173,6 +3177,7 @@ static struct clk uart4_ick_am35xx = {
3173 3177
3174/* XXX At some point we should rename this file to clock3xxx_data.c */ 3178/* XXX At some point we should rename this file to clock3xxx_data.c */
3175static struct omap_clk omap3xxx_clks[] = { 3179static struct omap_clk omap3xxx_clks[] = {
3180 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX),
3176 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX), 3181 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX),
3177 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX), 3182 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX),
3178 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX), 3183 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX),
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 3cfb425ea67e..4e1f53d0b880 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -33,7 +33,6 @@
33#include <plat/sdrc.h> 33#include <plat/sdrc.h>
34#include <plat/gpmc.h> 34#include <plat/gpmc.h>
35#include <plat/serial.h> 35#include <plat/serial.h>
36#include <plat/vram.h>
37 36
38#include "clock2xxx.h" 37#include "clock2xxx.h"
39#include "clock3xxx.h" 38#include "clock3xxx.h"
@@ -241,8 +240,6 @@ static void __init _omap2_map_common_io(void)
241 240
242 omap2_check_revision(); 241 omap2_check_revision();
243 omap_sram_init(); 242 omap_sram_init();
244 omapfb_reserve_sdram();
245 omap_vram_reserve_sdram();
246} 243}
247 244
248#ifdef CONFIG_ARCH_OMAP2420 245#ifdef CONFIG_ARCH_OMAP2420
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c
index 161fc2d61207..0f3130599770 100644
--- a/arch/arm/mach-pxa/cm-x2xx-pci.c
+++ b/arch/arm/mach-pxa/cm-x2xx-pci.c
@@ -35,7 +35,7 @@ static int cmx2xx_it8152_irq_gpio;
35 * This is really ugly and we need a better way of specifying 35 * This is really ugly and we need a better way of specifying
36 * DMA-capable regions of memory. 36 * DMA-capable regions of memory.
37 */ 37 */
38void __init cmx2xx_pci_adjust_zones(int node, unsigned long *zone_size, 38void __init cmx2xx_pci_adjust_zones(unsigned long *zone_size,
39 unsigned long *zhole_size) 39 unsigned long *zhole_size)
40{ 40{
41 unsigned int sz = SZ_64M >> PAGE_SHIFT; 41 unsigned int sz = SZ_64M >> PAGE_SHIFT;
@@ -46,7 +46,7 @@ void __init cmx2xx_pci_adjust_zones(int node, unsigned long *zone_size,
46 /* 46 /*
47 * Only adjust if > 64M on current system 47 * Only adjust if > 64M on current system
48 */ 48 */
49 if (node || (zone_size[0] <= sz)) 49 if (zone_size[0] <= sz)
50 return; 50 return;
51 51
52 zone_size[1] = zone_size[0] - sz; 52 zone_size[1] = zone_size[0] - sz;
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 51ffa6afb675..461ba4080155 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -715,7 +715,6 @@ static void __init fixup_corgi(struct machine_desc *desc,
715 sharpsl_save_param(); 715 sharpsl_save_param();
716 mi->nr_banks=1; 716 mi->nr_banks=1;
717 mi->bank[0].start = 0xa0000000; 717 mi->bank[0].start = 0xa0000000;
718 mi->bank[0].node = 0;
719 if (machine_is_corgi()) 718 if (machine_is_corgi())
720 mi->bank[0].size = (32*1024*1024); 719 mi->bank[0].size = (32*1024*1024);
721 else 720 else
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index 96ed13081639..a0ab3082a000 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -34,7 +34,6 @@ void __init eseries_fixup(struct machine_desc *desc,
34{ 34{
35 mi->nr_banks=1; 35 mi->nr_banks=1;
36 mi->bank[0].start = 0xa0000000; 36 mi->bank[0].start = 0xa0000000;
37 mi->bank[0].node = 0;
38 if (machine_is_e800()) 37 if (machine_is_e800())
39 mi->bank[0].size = (128*1024*1024); 38 mi->bank[0].size = (128*1024*1024);
40 else 39 else
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index 890fb90a672f..c6305c5b8a72 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -26,8 +26,7 @@ extern unsigned int get_clk_frequency_khz(int info);
26 26
27#define SET_BANK(__nr,__start,__size) \ 27#define SET_BANK(__nr,__start,__size) \
28 mi->bank[__nr].start = (__start), \ 28 mi->bank[__nr].start = (__start), \
29 mi->bank[__nr].size = (__size), \ 29 mi->bank[__nr].size = (__size)
30 mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27)
31 30
32#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) 31#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
33 32
diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h
index f626730ee42e..92361a66b223 100644
--- a/arch/arm/mach-pxa/include/mach/memory.h
+++ b/arch/arm/mach-pxa/include/mach/memory.h
@@ -17,24 +17,11 @@
17 */ 17 */
18#define PHYS_OFFSET UL(0xa0000000) 18#define PHYS_OFFSET UL(0xa0000000)
19 19
20/*
21 * The nodes are matched with the physical SDRAM banks as follows:
22 *
23 * node 0: 0xa0000000-0xa3ffffff --> 0xc0000000-0xc3ffffff
24 * node 1: 0xa4000000-0xa7ffffff --> 0xc4000000-0xc7ffffff
25 * node 2: 0xa8000000-0xabffffff --> 0xc8000000-0xcbffffff
26 * node 3: 0xac000000-0xafffffff --> 0xcc000000-0xcfffffff
27 *
28 * This needs a node mem size of 26 bits.
29 */
30#define NODE_MEM_SIZE_BITS 26
31
32#if !defined(__ASSEMBLY__) && defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI) 20#if !defined(__ASSEMBLY__) && defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
33void cmx2xx_pci_adjust_zones(int node, unsigned long *size, 21void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes);
34 unsigned long *holes);
35 22
36#define arch_adjust_zones(node, size, holes) \ 23#define arch_adjust_zones(size, holes) \
37 cmx2xx_pci_adjust_zones(node, size, holes) 24 cmx2xx_pci_adjust_zones(size, holes)
38 25
39#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_64M - 1) 26#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_64M - 1)
40#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M) 27#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M)
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 5305a3993e69..5e92d84fe50d 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -21,6 +21,7 @@
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/gpio_keys.h> 22#include <linux/gpio_keys.h>
23#include <linux/input.h> 23#include <linux/input.h>
24#include <linux/memblock.h>
24#include <linux/pda_power.h> 25#include <linux/pda_power.h>
25#include <linux/pwm_backlight.h> 26#include <linux/pwm_backlight.h>
26#include <linux/gpio.h> 27#include <linux/gpio.h>
@@ -396,6 +397,11 @@ static void __init palmt5_udc_init(void)
396 } 397 }
397} 398}
398 399
400static void __init palmt5_reserve(void)
401{
402 memblock_reserve(0xa0200000, 0x1000);
403}
404
399static void __init palmt5_init(void) 405static void __init palmt5_init(void)
400{ 406{
401 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); 407 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
@@ -421,6 +427,7 @@ MACHINE_START(PALMT5, "Palm Tungsten|T5")
421 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 427 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
422 .boot_params = 0xa0000100, 428 .boot_params = 0xa0000100,
423 .map_io = pxa_map_io, 429 .map_io = pxa_map_io,
430 .reserve = palmt5_reserve,
424 .init_irq = pxa27x_init_irq, 431 .init_irq = pxa27x_init_irq,
425 .timer = &pxa_timer, 432 .timer = &pxa_timer,
426 .init_machine = palmt5_init 433 .init_machine = palmt5_init
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index d8b4469607a1..3d0c9cc2a406 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -20,6 +20,7 @@
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/memblock.h>
23#include <linux/pda_power.h> 24#include <linux/pda_power.h>
24#include <linux/pwm_backlight.h> 25#include <linux/pwm_backlight.h>
25#include <linux/gpio.h> 26#include <linux/gpio.h>
@@ -633,6 +634,12 @@ static void __init treo_lcd_power_init(void)
633 treo_lcd_screen.pxafb_lcd_power = treo_lcd_power; 634 treo_lcd_screen.pxafb_lcd_power = treo_lcd_power;
634} 635}
635 636
637static void __init treo_reserve(void)
638{
639 memblock_reserve(0xa0000000, 0x1000);
640 memblock_reserve(0xa2000000, 0x1000);
641}
642
636static void __init treo_init(void) 643static void __init treo_init(void)
637{ 644{
638 pxa_set_ffuart_info(NULL); 645 pxa_set_ffuart_info(NULL);
@@ -668,6 +675,7 @@ MACHINE_START(TREO680, "Palm Treo 680")
668 .io_pg_offst = io_p2v(0x40000000), 675 .io_pg_offst = io_p2v(0x40000000),
669 .boot_params = 0xa0000100, 676 .boot_params = 0xa0000100,
670 .map_io = pxa_map_io, 677 .map_io = pxa_map_io,
678 .reserve = treo_reserve,
671 .init_irq = pxa27x_init_irq, 679 .init_irq = pxa27x_init_irq,
672 .timer = &pxa_timer, 680 .timer = &pxa_timer,
673 .init_machine = treo680_init, 681 .init_machine = treo680_init,
@@ -691,6 +699,7 @@ MACHINE_START(CENTRO, "Palm Centro 685")
691 .io_pg_offst = io_p2v(0x40000000), 699 .io_pg_offst = io_p2v(0x40000000),
692 .boot_params = 0xa0000100, 700 .boot_params = 0xa0000100,
693 .map_io = pxa_map_io, 701 .map_io = pxa_map_io,
702 .reserve = treo_reserve,
694 .init_irq = pxa27x_init_irq, 703 .init_irq = pxa27x_init_irq,
695 .timer = &pxa_timer, 704 .timer = &pxa_timer,
696 .init_machine = centro_init, 705 .init_machine = centro_init,
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index f4abdaafdac4..bc2758b54446 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -463,7 +463,6 @@ static void __init fixup_poodle(struct machine_desc *desc,
463 sharpsl_save_param(); 463 sharpsl_save_param();
464 mi->nr_banks=1; 464 mi->nr_banks=1;
465 mi->bank[0].start = 0xa0000000; 465 mi->bank[0].start = 0xa0000000;
466 mi->bank[0].node = 0;
467 mi->bank[0].size = (32*1024*1024); 466 mi->bank[0].size = (32*1024*1024);
468} 467}
469 468
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index c1048a35f187..51756c723557 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -847,7 +847,6 @@ static void __init fixup_spitz(struct machine_desc *desc,
847 sharpsl_save_param(); 847 sharpsl_save_param();
848 mi->nr_banks = 1; 848 mi->nr_banks = 1;
849 mi->bank[0].start = 0xa0000000; 849 mi->bank[0].start = 0xa0000000;
850 mi->bank[0].node = 0;
851 mi->bank[0].size = (64*1024*1024); 850 mi->bank[0].size = (64*1024*1024);
852} 851}
853 852
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 7512b822c6ca..83cc3a18c2e9 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -948,7 +948,6 @@ static void __init fixup_tosa(struct machine_desc *desc,
948 sharpsl_save_param(); 948 sharpsl_save_param();
949 mi->nr_banks=1; 949 mi->nr_banks=1;
950 mi->bank[0].start = 0xa0000000; 950 mi->bank[0].start = 0xa0000000;
951 mi->bank[0].node = 0;
952 mi->bank[0].size = (64*1024*1024); 951 mi->bank[0].size = (64*1024*1024);
953} 952}
954 953
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 595be19f8ad5..a54fbda77e45 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -61,12 +61,11 @@ void __iomem *gic_cpu_base_addr;
61/* 61/*
62 * Adjust the zones if there are restrictions for DMA access. 62 * Adjust the zones if there are restrictions for DMA access.
63 */ 63 */
64void __init realview_adjust_zones(int node, unsigned long *size, 64void __init realview_adjust_zones(unsigned long *size, unsigned long *hole)
65 unsigned long *hole)
66{ 65{
67 unsigned long dma_size = SZ_256M >> PAGE_SHIFT; 66 unsigned long dma_size = SZ_256M >> PAGE_SHIFT;
68 67
69 if (!machine_is_realview_pbx() || node || (size[0] <= dma_size)) 68 if (!machine_is_realview_pbx() || size[0] <= dma_size)
70 return; 69 return;
71 70
72 size[ZONE_NORMAL] = size[0] - dma_size; 71 size[ZONE_NORMAL] = size[0] - dma_size;
@@ -232,6 +231,21 @@ static unsigned int realview_mmc_status(struct device *dev)
232 struct amba_device *adev = container_of(dev, struct amba_device, dev); 231 struct amba_device *adev = container_of(dev, struct amba_device, dev);
233 u32 mask; 232 u32 mask;
234 233
234 if (machine_is_realview_pb1176()) {
235 static bool inserted = false;
236
237 /*
238 * The PB1176 does not have the status register,
239 * assume it is inserted at startup, then invert
240 * for each call so card insertion/removal will
241 * be detected anyway. This will not be called if
242 * GPIO on PL061 is active, which is the proper
243 * way to do this on the PB1176.
244 */
245 inserted = !inserted;
246 return inserted ? 0 : 1;
247 }
248
235 if (adev->res.start == REALVIEW_MMCI0_BASE) 249 if (adev->res.start == REALVIEW_MMCI0_BASE)
236 mask = 1; 250 mask = 1;
237 else 251 else
@@ -300,8 +314,13 @@ static struct clk ref24_clk = {
300 .rate = 24000000, 314 .rate = 24000000,
301}; 315};
302 316
317static struct clk dummy_apb_pclk;
318
303static struct clk_lookup lookups[] = { 319static struct clk_lookup lookups[] = {
304 { /* UART0 */ 320 { /* Bus clock */
321 .con_id = "apb_pclk",
322 .clk = &dummy_apb_pclk,
323 }, { /* UART0 */
305 .dev_id = "dev:uart0", 324 .dev_id = "dev:uart0",
306 .clk = &ref24_clk, 325 .clk = &ref24_clk,
307 }, { /* UART1 */ 326 }, { /* UART1 */
@@ -313,6 +332,12 @@ static struct clk_lookup lookups[] = {
313 }, { /* UART3 */ 332 }, { /* UART3 */
314 .dev_id = "fpga:uart3", 333 .dev_id = "fpga:uart3",
315 .clk = &ref24_clk, 334 .clk = &ref24_clk,
335 }, { /* UART3 is on the dev chip in PB1176 */
336 .dev_id = "dev:uart3",
337 .clk = &ref24_clk,
338 }, { /* UART4 only exists in PB1176 */
339 .dev_id = "fpga:uart4",
340 .clk = &ref24_clk,
316 }, { /* KMI0 */ 341 }, { /* KMI0 */
317 .dev_id = "fpga:kmi0", 342 .dev_id = "fpga:kmi0",
318 .clk = &ref24_clk, 343 .clk = &ref24_clk,
@@ -322,12 +347,15 @@ static struct clk_lookup lookups[] = {
322 }, { /* MMC0 */ 347 }, { /* MMC0 */
323 .dev_id = "fpga:mmc0", 348 .dev_id = "fpga:mmc0",
324 .clk = &ref24_clk, 349 .clk = &ref24_clk,
325 }, { /* EB:CLCD */ 350 }, { /* CLCD is in the PB1176 and EB DevChip */
326 .dev_id = "dev:clcd", 351 .dev_id = "dev:clcd",
327 .clk = &oscvco_clk, 352 .clk = &oscvco_clk,
328 }, { /* PB:CLCD */ 353 }, { /* PB:CLCD */
329 .dev_id = "issp:clcd", 354 .dev_id = "issp:clcd",
330 .clk = &oscvco_clk, 355 .clk = &oscvco_clk,
356 }, { /* SSP */
357 .dev_id = "dev:ssp0",
358 .clk = &ref24_clk,
331 } 359 }
332}; 360};
333 361
@@ -342,7 +370,7 @@ static int __init clk_init(void)
342 370
343 return 0; 371 return 0;
344} 372}
345arch_initcall(clk_init); 373core_initcall(clk_init);
346 374
347/* 375/*
348 * CLCD support. 376 * CLCD support.
diff --git a/arch/arm/mach-realview/include/mach/board-pb1176.h b/arch/arm/mach-realview/include/mach/board-pb1176.h
index 2f5ccb298858..002ab5d8c11c 100644
--- a/arch/arm/mach-realview/include/mach/board-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/board-pb1176.h
@@ -26,6 +26,7 @@
26/* 26/*
27 * Peripheral addresses 27 * Peripheral addresses
28 */ 28 */
29#define REALVIEW_PB1176_UART4_BASE 0x10009000 /* UART 4 */
29#define REALVIEW_PB1176_SCTL_BASE 0x10100000 /* System controller */ 30#define REALVIEW_PB1176_SCTL_BASE 0x10100000 /* System controller */
30#define REALVIEW_PB1176_SMC_BASE 0x10111000 /* SMC */ 31#define REALVIEW_PB1176_SMC_BASE 0x10111000 /* SMC */
31#define REALVIEW_PB1176_DMC_BASE 0x10109000 /* DMC configuration */ 32#define REALVIEW_PB1176_DMC_BASE 0x10109000 /* DMC configuration */
diff --git a/arch/arm/mach-realview/include/mach/irqs-pb1176.h b/arch/arm/mach-realview/include/mach/irqs-pb1176.h
index 830055bb8628..5c3c625e3e04 100644
--- a/arch/arm/mach-realview/include/mach/irqs-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/irqs-pb1176.h
@@ -40,6 +40,7 @@
40#define IRQ_DC1176_L2CC (IRQ_DC1176_GIC_START + 13) 40#define IRQ_DC1176_L2CC (IRQ_DC1176_GIC_START + 13)
41#define IRQ_DC1176_RTC (IRQ_DC1176_GIC_START + 14) 41#define IRQ_DC1176_RTC (IRQ_DC1176_GIC_START + 14)
42#define IRQ_DC1176_CLCD (IRQ_DC1176_GIC_START + 15) /* CLCD controller */ 42#define IRQ_DC1176_CLCD (IRQ_DC1176_GIC_START + 15) /* CLCD controller */
43#define IRQ_DC1176_SSP (IRQ_DC1176_GIC_START + 17) /* SSP port */
43#define IRQ_DC1176_UART0 (IRQ_DC1176_GIC_START + 18) /* UART 0 on development chip */ 44#define IRQ_DC1176_UART0 (IRQ_DC1176_GIC_START + 18) /* UART 0 on development chip */
44#define IRQ_DC1176_UART1 (IRQ_DC1176_GIC_START + 19) /* UART 1 on development chip */ 45#define IRQ_DC1176_UART1 (IRQ_DC1176_GIC_START + 19) /* UART 1 on development chip */
45#define IRQ_DC1176_UART2 (IRQ_DC1176_GIC_START + 20) /* UART 2 on development chip */ 46#define IRQ_DC1176_UART2 (IRQ_DC1176_GIC_START + 20) /* UART 2 on development chip */
@@ -73,7 +74,6 @@
73#define IRQ_PB1176_RTC (IRQ_PB1176_GIC_START + 25) /* Real Time Clock */ 74#define IRQ_PB1176_RTC (IRQ_PB1176_GIC_START + 25) /* Real Time Clock */
74 75
75#define IRQ_PB1176_GPIO0 -1 76#define IRQ_PB1176_GPIO0 -1
76#define IRQ_PB1176_SSP -1
77#define IRQ_PB1176_SCTL -1 77#define IRQ_PB1176_SCTL -1
78 78
79#define NR_GIC_PB1176 2 79#define NR_GIC_PB1176 2
diff --git a/arch/arm/mach-realview/include/mach/memory.h b/arch/arm/mach-realview/include/mach/memory.h
index 2417bbcf97fd..5dafc157b276 100644
--- a/arch/arm/mach-realview/include/mach/memory.h
+++ b/arch/arm/mach-realview/include/mach/memory.h
@@ -30,10 +30,9 @@
30#endif 30#endif
31 31
32#if !defined(__ASSEMBLY__) && defined(CONFIG_ZONE_DMA) 32#if !defined(__ASSEMBLY__) && defined(CONFIG_ZONE_DMA)
33extern void realview_adjust_zones(int node, unsigned long *size, 33extern void realview_adjust_zones(unsigned long *size, unsigned long *hole);
34 unsigned long *hole); 34#define arch_adjust_zones(size, hole) \
35#define arch_adjust_zones(node, size, hole) \ 35 realview_adjust_zones(size, hole)
36 realview_adjust_zones(node, size, hole)
37 36
38#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_256M - 1) 37#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_256M - 1)
39#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_256M) 38#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_256M)
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 4425018fab82..991c1f8390e2 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -25,6 +25,7 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
28#include <linux/amba/pl022.h>
28#include <linux/io.h> 29#include <linux/io.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
@@ -129,6 +130,12 @@ static struct pl061_platform_data gpio2_plat_data = {
129 .irq_base = -1, 130 .irq_base = -1,
130}; 131};
131 132
133static struct pl022_ssp_controller ssp0_plat_data = {
134 .bus_id = 0,
135 .enable_dma = 0,
136 .num_chipselect = 1,
137};
138
132/* 139/*
133 * RealView EB AMBA devices 140 * RealView EB AMBA devices
134 */ 141 */
@@ -213,7 +220,7 @@ AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
213AMBA_DEVICE(uart0, "dev:uart0", EB_UART0, NULL); 220AMBA_DEVICE(uart0, "dev:uart0", EB_UART0, NULL);
214AMBA_DEVICE(uart1, "dev:uart1", EB_UART1, NULL); 221AMBA_DEVICE(uart1, "dev:uart1", EB_UART1, NULL);
215AMBA_DEVICE(uart2, "dev:uart2", EB_UART2, NULL); 222AMBA_DEVICE(uart2, "dev:uart2", EB_UART2, NULL);
216AMBA_DEVICE(ssp0, "dev:ssp0", EB_SSP, NULL); 223AMBA_DEVICE(ssp0, "dev:ssp0", EB_SSP, &ssp0_plat_data);
217 224
218static struct amba_device *amba_devs[] __initdata = { 225static struct amba_device *amba_devs[] __initdata = {
219 &dmac_device, 226 &dmac_device,
@@ -324,6 +331,26 @@ static struct platform_device pmu_device = {
324 .resource = pmu_resources, 331 .resource = pmu_resources,
325}; 332};
326 333
334static struct resource char_lcd_resources[] = {
335 {
336 .start = REALVIEW_CHAR_LCD_BASE,
337 .end = (REALVIEW_CHAR_LCD_BASE + SZ_4K - 1),
338 .flags = IORESOURCE_MEM,
339 },
340 {
341 .start = IRQ_EB_CHARLCD,
342 .end = IRQ_EB_CHARLCD,
343 .flags = IORESOURCE_IRQ,
344 },
345};
346
347static struct platform_device char_lcd_device = {
348 .name = "arm-charlcd",
349 .id = -1,
350 .num_resources = ARRAY_SIZE(char_lcd_resources),
351 .resource = char_lcd_resources,
352};
353
327static void __init gic_init_irq(void) 354static void __init gic_init_irq(void)
328{ 355{
329 if (core_tile_eb11mp() || core_tile_a9mp()) { 356 if (core_tile_eb11mp() || core_tile_a9mp()) {
@@ -442,6 +469,7 @@ static void __init realview_eb_init(void)
442 469
443 realview_flash_register(&realview_eb_flash_resource, 1); 470 realview_flash_register(&realview_eb_flash_resource, 1);
444 platform_device_register(&realview_i2c_device); 471 platform_device_register(&realview_i2c_device);
472 platform_device_register(&char_lcd_device);
445 eth_device_register(); 473 eth_device_register();
446 realview_usb_register(realview_eb_isp1761_resources); 474 realview_usb_register(realview_eb_isp1761_resources);
447 475
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index 099a1f125cf8..d2be12eb829e 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -25,6 +25,7 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
28#include <linux/amba/pl022.h>
28#include <linux/io.h> 29#include <linux/io.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
@@ -123,6 +124,12 @@ static struct pl061_platform_data gpio2_plat_data = {
123 .irq_base = -1, 124 .irq_base = -1,
124}; 125};
125 126
127static struct pl022_ssp_controller ssp0_plat_data = {
128 .bus_id = 0,
129 .enable_dma = 0,
130 .num_chipselect = 1,
131};
132
126/* 133/*
127 * RealView PB1176 AMBA devices 134 * RealView PB1176 AMBA devices
128 */ 135 */
@@ -144,8 +151,6 @@ static struct pl061_platform_data gpio2_plat_data = {
144#define MPMC_DMA { 0, 0 } 151#define MPMC_DMA { 0, 0 }
145#define PB1176_CLCD_IRQ { IRQ_DC1176_CLCD, NO_IRQ } 152#define PB1176_CLCD_IRQ { IRQ_DC1176_CLCD, NO_IRQ }
146#define PB1176_CLCD_DMA { 0, 0 } 153#define PB1176_CLCD_DMA { 0, 0 }
147#define DMAC_IRQ { IRQ_PB1176_DMAC, NO_IRQ }
148#define DMAC_DMA { 0, 0 }
149#define SCTL_IRQ { NO_IRQ, NO_IRQ } 154#define SCTL_IRQ { NO_IRQ, NO_IRQ }
150#define SCTL_DMA { 0, 0 } 155#define SCTL_DMA { 0, 0 }
151#define PB1176_WATCHDOG_IRQ { IRQ_DC1176_WATCHDOG, NO_IRQ } 156#define PB1176_WATCHDOG_IRQ { IRQ_DC1176_WATCHDOG, NO_IRQ }
@@ -166,7 +171,9 @@ static struct pl061_platform_data gpio2_plat_data = {
166#define PB1176_UART2_DMA { 11, 10 } 171#define PB1176_UART2_DMA { 11, 10 }
167#define PB1176_UART3_IRQ { IRQ_DC1176_UART3, NO_IRQ } 172#define PB1176_UART3_IRQ { IRQ_DC1176_UART3, NO_IRQ }
168#define PB1176_UART3_DMA { 0x86, 0x87 } 173#define PB1176_UART3_DMA { 0x86, 0x87 }
169#define PB1176_SSP_IRQ { IRQ_PB1176_SSP, NO_IRQ } 174#define PB1176_UART4_IRQ { IRQ_PB1176_UART4, NO_IRQ }
175#define PB1176_UART4_DMA { 0, 0 }
176#define PB1176_SSP_IRQ { IRQ_DC1176_SSP, NO_IRQ }
170#define PB1176_SSP_DMA { 9, 8 } 177#define PB1176_SSP_DMA { 9, 8 }
171 178
172/* FPGA Primecells */ 179/* FPGA Primecells */
@@ -174,7 +181,7 @@ AMBA_DEVICE(aaci, "fpga:aaci", AACI, NULL);
174AMBA_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data); 181AMBA_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data);
175AMBA_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL); 182AMBA_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL);
176AMBA_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL); 183AMBA_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL);
177AMBA_DEVICE(uart3, "fpga:uart3", PB1176_UART3, NULL); 184AMBA_DEVICE(uart4, "fpga:uart4", PB1176_UART4, NULL);
178 185
179/* DevChip Primecells */ 186/* DevChip Primecells */
180AMBA_DEVICE(smc, "dev:smc", PB1176_SMC, NULL); 187AMBA_DEVICE(smc, "dev:smc", PB1176_SMC, NULL);
@@ -188,18 +195,16 @@ AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
188AMBA_DEVICE(uart0, "dev:uart0", PB1176_UART0, NULL); 195AMBA_DEVICE(uart0, "dev:uart0", PB1176_UART0, NULL);
189AMBA_DEVICE(uart1, "dev:uart1", PB1176_UART1, NULL); 196AMBA_DEVICE(uart1, "dev:uart1", PB1176_UART1, NULL);
190AMBA_DEVICE(uart2, "dev:uart2", PB1176_UART2, NULL); 197AMBA_DEVICE(uart2, "dev:uart2", PB1176_UART2, NULL);
191AMBA_DEVICE(ssp0, "dev:ssp0", PB1176_SSP, NULL); 198AMBA_DEVICE(uart3, "dev:uart3", PB1176_UART3, NULL);
192 199AMBA_DEVICE(ssp0, "dev:ssp0", PB1176_SSP, &ssp0_plat_data);
193/* Primecells on the NEC ISSP chip */ 200AMBA_DEVICE(clcd, "dev:clcd", PB1176_CLCD, &clcd_plat_data);
194AMBA_DEVICE(clcd, "issp:clcd", PB1176_CLCD, &clcd_plat_data);
195//AMBA_DEVICE(dmac, "issp:dmac", PB1176_DMAC, NULL);
196 201
197static struct amba_device *amba_devs[] __initdata = { 202static struct amba_device *amba_devs[] __initdata = {
198// &dmac_device,
199 &uart0_device, 203 &uart0_device,
200 &uart1_device, 204 &uart1_device,
201 &uart2_device, 205 &uart2_device,
202 &uart3_device, 206 &uart3_device,
207 &uart4_device,
203 &smc_device, 208 &smc_device,
204 &clcd_device, 209 &clcd_device,
205 &sctl_device, 210 &sctl_device,
@@ -276,6 +281,26 @@ static struct platform_device pmu_device = {
276 .resource = &pmu_resource, 281 .resource = &pmu_resource,
277}; 282};
278 283
284static struct resource char_lcd_resources[] = {
285 {
286 .start = REALVIEW_CHAR_LCD_BASE,
287 .end = (REALVIEW_CHAR_LCD_BASE + SZ_4K - 1),
288 .flags = IORESOURCE_MEM,
289 },
290 {
291 .start = IRQ_PB1176_CHARLCD,
292 .end = IRQ_PB1176_CHARLCD,
293 .flags = IORESOURCE_IRQ,
294 },
295};
296
297static struct platform_device char_lcd_device = {
298 .name = "arm-charlcd",
299 .id = -1,
300 .num_resources = ARRAY_SIZE(char_lcd_resources),
301 .resource = char_lcd_resources,
302};
303
279static void __init gic_init_irq(void) 304static void __init gic_init_irq(void)
280{ 305{
281 /* ARM1176 DevChip GIC, primary */ 306 /* ARM1176 DevChip GIC, primary */
@@ -338,6 +363,7 @@ static void __init realview_pb1176_init(void)
338 platform_device_register(&realview_i2c_device); 363 platform_device_register(&realview_i2c_device);
339 realview_usb_register(realview_pb1176_isp1761_resources); 364 realview_usb_register(realview_pb1176_isp1761_resources);
340 platform_device_register(&pmu_device); 365 platform_device_register(&pmu_device);
366 platform_device_register(&char_lcd_device);
341 367
342 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 368 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
343 struct amba_device *d = amba_devs[i]; 369 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 0e07a5ccb75f..d591bc00b86e 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -25,6 +25,7 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
28#include <linux/amba/pl022.h>
28#include <linux/io.h> 29#include <linux/io.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
@@ -124,6 +125,12 @@ static struct pl061_platform_data gpio2_plat_data = {
124 .irq_base = -1, 125 .irq_base = -1,
125}; 126};
126 127
128static struct pl022_ssp_controller ssp0_plat_data = {
129 .bus_id = 0,
130 .enable_dma = 0,
131 .num_chipselect = 1,
132};
133
127/* 134/*
128 * RealView PB11MPCore AMBA devices 135 * RealView PB11MPCore AMBA devices
129 */ 136 */
@@ -190,7 +197,7 @@ AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
190AMBA_DEVICE(uart0, "dev:uart0", PB11MP_UART0, NULL); 197AMBA_DEVICE(uart0, "dev:uart0", PB11MP_UART0, NULL);
191AMBA_DEVICE(uart1, "dev:uart1", PB11MP_UART1, NULL); 198AMBA_DEVICE(uart1, "dev:uart1", PB11MP_UART1, NULL);
192AMBA_DEVICE(uart2, "dev:uart2", PB11MP_UART2, NULL); 199AMBA_DEVICE(uart2, "dev:uart2", PB11MP_UART2, NULL);
193AMBA_DEVICE(ssp0, "dev:ssp0", PB11MP_SSP, NULL); 200AMBA_DEVICE(ssp0, "dev:ssp0", PB11MP_SSP, &ssp0_plat_data);
194 201
195/* Primecells on the NEC ISSP chip */ 202/* Primecells on the NEC ISSP chip */
196AMBA_DEVICE(clcd, "issp:clcd", PB11MP_CLCD, &clcd_plat_data); 203AMBA_DEVICE(clcd, "issp:clcd", PB11MP_CLCD, &clcd_plat_data);
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index ac2f06f1ca50..6c37621217bc 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -25,6 +25,7 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
28#include <linux/amba/pl022.h>
28#include <linux/io.h> 29#include <linux/io.h>
29 30
30#include <asm/irq.h> 31#include <asm/irq.h>
@@ -114,6 +115,12 @@ static struct pl061_platform_data gpio2_plat_data = {
114 .irq_base = -1, 115 .irq_base = -1,
115}; 116};
116 117
118static struct pl022_ssp_controller ssp0_plat_data = {
119 .bus_id = 0,
120 .enable_dma = 0,
121 .num_chipselect = 1,
122};
123
117/* 124/*
118 * RealView PBA8Core AMBA devices 125 * RealView PBA8Core AMBA devices
119 */ 126 */
@@ -180,7 +187,7 @@ AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
180AMBA_DEVICE(uart0, "dev:uart0", PBA8_UART0, NULL); 187AMBA_DEVICE(uart0, "dev:uart0", PBA8_UART0, NULL);
181AMBA_DEVICE(uart1, "dev:uart1", PBA8_UART1, NULL); 188AMBA_DEVICE(uart1, "dev:uart1", PBA8_UART1, NULL);
182AMBA_DEVICE(uart2, "dev:uart2", PBA8_UART2, NULL); 189AMBA_DEVICE(uart2, "dev:uart2", PBA8_UART2, NULL);
183AMBA_DEVICE(ssp0, "dev:ssp0", PBA8_SSP, NULL); 190AMBA_DEVICE(ssp0, "dev:ssp0", PBA8_SSP, &ssp0_plat_data);
184 191
185/* Primecells on the NEC ISSP chip */ 192/* Primecells on the NEC ISSP chip */
186AMBA_DEVICE(clcd, "issp:clcd", PBA8_CLCD, &clcd_plat_data); 193AMBA_DEVICE(clcd, "issp:clcd", PBA8_CLCD, &clcd_plat_data);
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 08fd683adc4c..9428eff0b116 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -24,6 +24,7 @@
24#include <linux/amba/bus.h> 24#include <linux/amba/bus.h>
25#include <linux/amba/pl061.h> 25#include <linux/amba/pl061.h>
26#include <linux/amba/mmci.h> 26#include <linux/amba/mmci.h>
27#include <linux/amba/pl022.h>
27#include <linux/io.h> 28#include <linux/io.h>
28 29
29#include <asm/irq.h> 30#include <asm/irq.h>
@@ -136,6 +137,12 @@ static struct pl061_platform_data gpio2_plat_data = {
136 .irq_base = -1, 137 .irq_base = -1,
137}; 138};
138 139
140static struct pl022_ssp_controller ssp0_plat_data = {
141 .bus_id = 0,
142 .enable_dma = 0,
143 .num_chipselect = 1,
144};
145
139/* 146/*
140 * RealView PBXCore AMBA devices 147 * RealView PBXCore AMBA devices
141 */ 148 */
@@ -202,7 +209,7 @@ AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
202AMBA_DEVICE(uart0, "dev:uart0", PBX_UART0, NULL); 209AMBA_DEVICE(uart0, "dev:uart0", PBX_UART0, NULL);
203AMBA_DEVICE(uart1, "dev:uart1", PBX_UART1, NULL); 210AMBA_DEVICE(uart1, "dev:uart1", PBX_UART1, NULL);
204AMBA_DEVICE(uart2, "dev:uart2", PBX_UART2, NULL); 211AMBA_DEVICE(uart2, "dev:uart2", PBX_UART2, NULL);
205AMBA_DEVICE(ssp0, "dev:ssp0", PBX_SSP, NULL); 212AMBA_DEVICE(ssp0, "dev:ssp0", PBX_SSP, &ssp0_plat_data);
206 213
207/* Primecells on the NEC ISSP chip */ 214/* Primecells on the NEC ISSP chip */
208AMBA_DEVICE(clcd, "issp:clcd", PBX_CLCD, &clcd_plat_data); 215AMBA_DEVICE(clcd, "issp:clcd", PBX_CLCD, &clcd_plat_data);
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 779b45b3f80f..3ba3bab139d0 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/memblock.h>
18#include <linux/timer.h> 19#include <linux/timer.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/sysdev.h> 21#include <linux/sysdev.h>
@@ -304,6 +305,13 @@ static void __init h1940_map_io(void)
304 s3c_pm_init(); 305 s3c_pm_init();
305} 306}
306 307
308/* H1940 and RX3715 need to reserve this for suspend */
309static void __init h1940_reserve(void)
310{
311 memblock_reserve(0x30003000, 0x1000);
312 memblock_reserve(0x30081000, 0x1000);
313}
314
307static void __init h1940_init_irq(void) 315static void __init h1940_init_irq(void)
308{ 316{
309 s3c24xx_init_irq(); 317 s3c24xx_init_irq();
@@ -346,6 +354,7 @@ MACHINE_START(H1940, "IPAQ-H1940")
346 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 354 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
347 .boot_params = S3C2410_SDRAM_PA + 0x100, 355 .boot_params = S3C2410_SDRAM_PA + 0x100,
348 .map_io = h1940_map_io, 356 .map_io = h1940_map_io,
357 .reserve = h1940_reserve,
349 .init_irq = h1940_init_irq, 358 .init_irq = h1940_init_irq,
350 .init_machine = h1940_init, 359 .init_machine = h1940_init,
351 .timer = &s3c24xx_timer, 360 .timer = &s3c24xx_timer,
diff --git a/arch/arm/mach-s3c2412/mach-smdk2413.c b/arch/arm/mach-s3c2412/mach-smdk2413.c
index ba93a356a839..054c9f92232a 100644
--- a/arch/arm/mach-s3c2412/mach-smdk2413.c
+++ b/arch/arm/mach-s3c2412/mach-smdk2413.c
@@ -119,7 +119,6 @@ static void __init smdk2413_fixup(struct machine_desc *desc,
119 mi->nr_banks=1; 119 mi->nr_banks=1;
120 mi->bank[0].start = 0x30000000; 120 mi->bank[0].start = 0x30000000;
121 mi->bank[0].size = SZ_64M; 121 mi->bank[0].size = SZ_64M;
122 mi->bank[0].node = 0;
123 } 122 }
124} 123}
125 124
diff --git a/arch/arm/mach-s3c2412/mach-vstms.c b/arch/arm/mach-s3c2412/mach-vstms.c
index 3ca9265b6997..f291ac25d312 100644
--- a/arch/arm/mach-s3c2412/mach-vstms.c
+++ b/arch/arm/mach-s3c2412/mach-vstms.c
@@ -137,7 +137,6 @@ static void __init vstms_fixup(struct machine_desc *desc,
137 mi->nr_banks=1; 137 mi->nr_banks=1;
138 mi->bank[0].start = 0x30000000; 138 mi->bank[0].start = 0x30000000;
139 mi->bank[0].size = SZ_64M; 139 mi->bank[0].size = SZ_64M;
140 mi->bank[0].node = 0;
141 } 140 }
142} 141}
143 142
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
index 8603b577a24b..142d1f921176 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/memblock.h>
18#include <linux/delay.h> 19#include <linux/delay.h>
19#include <linux/timer.h> 20#include <linux/timer.h>
20#include <linux/init.h> 21#include <linux/init.h>
@@ -570,12 +571,20 @@ static void __init rx1950_init_machine(void)
570 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices)); 571 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
571} 572}
572 573
574/* H1940 and RX3715 need to reserve this for suspend */
575static void __init rx1950_reserve(void)
576{
577 memblock_reserve(0x30003000, 0x1000);
578 memblock_reserve(0x30081000, 0x1000);
579}
580
573MACHINE_START(RX1950, "HP iPAQ RX1950") 581MACHINE_START(RX1950, "HP iPAQ RX1950")
574 /* Maintainers: Vasily Khoruzhick */ 582 /* Maintainers: Vasily Khoruzhick */
575 .phys_io = S3C2410_PA_UART, 583 .phys_io = S3C2410_PA_UART,
576 .io_pg_offst = (((u32) S3C24XX_VA_UART) >> 18) & 0xfffc, 584 .io_pg_offst = (((u32) S3C24XX_VA_UART) >> 18) & 0xfffc,
577 .boot_params = S3C2410_SDRAM_PA + 0x100, 585 .boot_params = S3C2410_SDRAM_PA + 0x100,
578 .map_io = rx1950_map_io, 586 .map_io = rx1950_map_io,
587 .reserve = rx1950_reserve,
579 .init_irq = s3c24xx_init_irq, 588 .init_irq = s3c24xx_init_irq,
580 .init_machine = rx1950_init_machine, 589 .init_machine = rx1950_init_machine,
581 .timer = &s3c24xx_timer, 590 .timer = &s3c24xx_timer,
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c
index d2946de3f365..6bb44f75a9ce 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c2440/mach-rx3715.c
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/memblock.h>
18#include <linux/timer.h> 19#include <linux/timer.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/tty.h> 21#include <linux/tty.h>
@@ -191,6 +192,13 @@ static void __init rx3715_map_io(void)
191 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); 192 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
192} 193}
193 194
195/* H1940 and RX3715 need to reserve this for suspend */
196static void __init rx3715_reserve(void)
197{
198 memblock_reserve(0x30003000, 0x1000);
199 memblock_reserve(0x30081000, 0x1000);
200}
201
194static void __init rx3715_init_irq(void) 202static void __init rx3715_init_irq(void)
195{ 203{
196 s3c24xx_init_irq(); 204 s3c24xx_init_irq();
@@ -214,6 +222,7 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
214 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 222 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
215 .boot_params = S3C2410_SDRAM_PA + 0x100, 223 .boot_params = S3C2410_SDRAM_PA + 0x100,
216 .map_io = rx3715_map_io, 224 .map_io = rx3715_map_io,
225 .reserve = rx3715_reserve,
217 .init_irq = rx3715_init_irq, 226 .init_irq = rx3715_init_irq,
218 .init_machine = rx3715_init_machine, 227 .init_machine = rx3715_init_machine,
219 .timer = &s3c24xx_timer, 228 .timer = &s3c24xx_timer,
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index ec03f187c52b..b7a9a601c2d1 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -13,8 +13,7 @@ extern void __init sa1100_init_gpio(void);
13 13
14#define SET_BANK(__nr,__start,__size) \ 14#define SET_BANK(__nr,__start,__size) \
15 mi->bank[__nr].start = (__start), \ 15 mi->bank[__nr].start = (__start), \
16 mi->bank[__nr].size = (__size), \ 16 mi->bank[__nr].size = (__size)
17 mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27)
18 17
19extern void (*sa1100fb_backlight_power)(int on); 18extern void (*sa1100fb_backlight_power)(int on);
20extern void (*sa1100fb_lcd_power)(int on); 19extern void (*sa1100fb_lcd_power)(int on);
diff --git a/arch/arm/mach-sa1100/include/mach/memory.h b/arch/arm/mach-sa1100/include/mach/memory.h
index d5277f9bee77..128a1dfa96b9 100644
--- a/arch/arm/mach-sa1100/include/mach/memory.h
+++ b/arch/arm/mach-sa1100/include/mach/memory.h
@@ -17,10 +17,10 @@
17#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
18 18
19#ifdef CONFIG_SA1111 19#ifdef CONFIG_SA1111
20void sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes); 20void sa1111_adjust_zones(unsigned long *size, unsigned long *holes);
21 21
22#define arch_adjust_zones(node, size, holes) \ 22#define arch_adjust_zones(size, holes) \
23 sa1111_adjust_zones(node, size, holes) 23 sa1111_adjust_zones(size, holes)
24 24
25#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1) 25#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1)
26#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_1M) 26#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_1M)
diff --git a/arch/arm/mach-shark/include/mach/memory.h b/arch/arm/mach-shark/include/mach/memory.h
index 3053e5b7f168..d9c4812f1c31 100644
--- a/arch/arm/mach-shark/include/mach/memory.h
+++ b/arch/arm/mach-shark/include/mach/memory.h
@@ -19,9 +19,8 @@
19 19
20#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
21 21
22static inline void __arch_adjust_zones(int node, unsigned long *zone_size, unsigned long *zhole_size) 22static inline void __arch_adjust_zones(unsigned long *zone_size, unsigned long *zhole_size)
23{ 23{
24 if (node != 0) return;
25 /* Only the first 4 MB (=1024 Pages) are usable for DMA */ 24 /* Only the first 4 MB (=1024 Pages) are usable for DMA */
26 /* See dev / -> .properties in OpenFirmware. */ 25 /* See dev / -> .properties in OpenFirmware. */
27 zone_size[1] = zone_size[0] - 1024; 26 zone_size[1] = zone_size[0] - 1024;
@@ -30,8 +29,8 @@ static inline void __arch_adjust_zones(int node, unsigned long *zone_size, unsig
30 zhole_size[0] = 0; 29 zhole_size[0] = 0;
31} 30}
32 31
33#define arch_adjust_zones(node, size, holes) \ 32#define arch_adjust_zones(size, holes) \
34 __arch_adjust_zones(node, size, holes) 33 __arch_adjust_zones(size, holes)
35 34
36#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_4M - 1) 35#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_4M - 1)
37#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_4M) 36#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_4M)
diff --git a/arch/arm/mach-spear3xx/clock.c b/arch/arm/mach-spear3xx/clock.c
index 39f6ccf22294..18febf92f20a 100644
--- a/arch/arm/mach-spear3xx/clock.c
+++ b/arch/arm/mach-spear3xx/clock.c
@@ -341,8 +341,11 @@ static struct clk gpio_clk = {
341 .recalc = &follow_parent, 341 .recalc = &follow_parent,
342}; 342};
343 343
344static struct clk dummy_apb_pclk;
345
344/* array of all spear 3xx clock lookups */ 346/* array of all spear 3xx clock lookups */
345static struct clk_lookup spear_clk_lookups[] = { 347static struct clk_lookup spear_clk_lookups[] = {
348 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk},
346 /* root clks */ 349 /* root clks */
347 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 350 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk},
348 { .con_id = "osc_24m_clk", .clk = &osc_24m_clk}, 351 { .con_id = "osc_24m_clk", .clk = &osc_24m_clk},
diff --git a/arch/arm/mach-spear6xx/clock.c b/arch/arm/mach-spear6xx/clock.c
index 13e27c769685..36ff056b7321 100644
--- a/arch/arm/mach-spear6xx/clock.c
+++ b/arch/arm/mach-spear6xx/clock.c
@@ -428,8 +428,11 @@ static struct clk gpio2_clk = {
428 .recalc = &follow_parent, 428 .recalc = &follow_parent,
429}; 429};
430 430
431static struct clk dummy_apb_pclk;
432
431/* array of all spear 6xx clock lookups */ 433/* array of all spear 6xx clock lookups */
432static struct clk_lookup spear_clk_lookups[] = { 434static struct clk_lookup spear_clk_lookups[] = {
435 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk},
433 /* root clks */ 436 /* root clks */
434 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 437 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk},
435 { .con_id = "osc_30m_clk", .clk = &osc_30m_clk}, 438 { .con_id = "osc_30m_clk", .clk = &osc_30m_clk},
diff --git a/arch/arm/mach-u300/clock.c b/arch/arm/mach-u300/clock.c
index 5af71d5ba665..5d12d547789e 100644
--- a/arch/arm/mach-u300/clock.c
+++ b/arch/arm/mach-u300/clock.c
@@ -1212,6 +1212,8 @@ static struct clk ppm_clk = {
1212}; 1212};
1213#endif 1213#endif
1214 1214
1215static struct clk dummy_apb_pclk;
1216
1215#define DEF_LOOKUP(devid, clkref) \ 1217#define DEF_LOOKUP(devid, clkref) \
1216 { \ 1218 { \
1217 .dev_id = devid, \ 1219 .dev_id = devid, \
@@ -1223,6 +1225,10 @@ static struct clk ppm_clk = {
1223 * look up through clockdevice. 1225 * look up through clockdevice.
1224 */ 1226 */
1225static struct clk_lookup lookups[] = { 1227static struct clk_lookup lookups[] = {
1228 {
1229 .con_id = "apb_pclk",
1230 .clk = &dummy_apb_pclk,
1231 },
1226 /* Connected directly to the AMBA bus */ 1232 /* Connected directly to the AMBA bus */
1227 DEF_LOOKUP("amba", &amba_clk), 1233 DEF_LOOKUP("amba", &amba_clk),
1228 DEF_LOOKUP("cpu", &cpu_clk), 1234 DEF_LOOKUP("cpu", &cpu_clk),
diff --git a/arch/arm/mach-u300/u300.c b/arch/arm/mach-u300/u300.c
index d2a0b8847a18..bfcda9820888 100644
--- a/arch/arm/mach-u300/u300.c
+++ b/arch/arm/mach-u300/u300.c
@@ -14,6 +14,7 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/memblock.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <mach/hardware.h> 20#include <mach/hardware.h>
@@ -22,6 +23,21 @@
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24 25
26static void __init u300_reserve(void)
27{
28 /*
29 * U300 - This platform family can share physical memory
30 * between two ARM cpus, one running Linux and the other
31 * running another OS.
32 */
33#ifdef CONFIG_MACH_U300_SINGLE_RAM
34#if ((CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1) == 1) && \
35 CONFIG_MACH_U300_2MB_ALIGNMENT_FIX
36 memblock_reserve(PHYS_OFFSET, 0x00100000);
37#endif
38#endif
39}
40
25static void __init u300_init_machine(void) 41static void __init u300_init_machine(void)
26{ 42{
27 u300_init_devices(); 43 u300_init_devices();
@@ -49,6 +65,7 @@ MACHINE_START(U300, MACH_U300_STRING)
49 .io_pg_offst = ((U300_AHB_PER_VIRT_BASE) >> 18) & 0xfffc, 65 .io_pg_offst = ((U300_AHB_PER_VIRT_BASE) >> 18) & 0xfffc,
50 .boot_params = BOOT_PARAMS_OFFSET, 66 .boot_params = BOOT_PARAMS_OFFSET,
51 .map_io = u300_map_io, 67 .map_io = u300_map_io,
68 .reserve = u300_reserve,
52 .init_irq = u300_init_irq, 69 .init_irq = u300_init_irq,
53 .timer = &u300_timer, 70 .timer = &u300_timer,
54 .init_machine = u300_init_machine, 71 .init_machine = u300_init_machine,
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index bb8d7b771817..0e8fd135a57d 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -13,19 +13,42 @@
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/gpio.h>
16#include <linux/amba/bus.h> 17#include <linux/amba/bus.h>
17#include <linux/amba/pl022.h> 18#include <linux/amba/pl022.h>
18#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
20#include <linux/mfd/ab8500.h>
19 21
20#include <asm/mach-types.h> 22#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
22 24
25#include <plat/pincfg.h>
23#include <plat/i2c.h> 26#include <plat/i2c.h>
24 27
25#include <mach/hardware.h> 28#include <mach/hardware.h>
26#include <mach/setup.h> 29#include <mach/setup.h>
27#include <mach/devices.h> 30#include <mach/devices.h>
28 31
32#include "pins-db8500.h"
33
34static pin_cfg_t mop500_pins[] = {
35 /* SSP0 */
36 GPIO143_SSP0_CLK,
37 GPIO144_SSP0_FRM,
38 GPIO145_SSP0_RXD,
39 GPIO146_SSP0_TXD,
40
41 /* I2C */
42 GPIO147_I2C0_SCL,
43 GPIO148_I2C0_SDA,
44 GPIO16_I2C1_SCL,
45 GPIO17_I2C1_SDA,
46 GPIO10_I2C2_SDA,
47 GPIO11_I2C2_SCL,
48 GPIO229_I2C3_SDA,
49 GPIO230_I2C3_SCL,
50};
51
29static void ab4500_spi_cs_control(u32 command) 52static void ab4500_spi_cs_control(u32 command)
30{ 53{
31 /* set the FRM signal, which is CS - TODO */ 54 /* set the FRM signal, which is CS - TODO */
@@ -48,15 +71,20 @@ struct pl022_config_chip ab4500_chip_info = {
48 .cs_control = ab4500_spi_cs_control, 71 .cs_control = ab4500_spi_cs_control,
49}; 72};
50 73
74static struct ab8500_platform_data ab8500_platdata = {
75 .irq_base = MOP500_AB8500_IRQ_BASE,
76};
77
51static struct spi_board_info u8500_spi_devices[] = { 78static struct spi_board_info u8500_spi_devices[] = {
52 { 79 {
53 .modalias = "ab8500", 80 .modalias = "ab8500",
54 .controller_data = &ab4500_chip_info, 81 .controller_data = &ab4500_chip_info,
82 .platform_data = &ab8500_platdata,
55 .max_speed_hz = 12000000, 83 .max_speed_hz = 12000000,
56 .bus_num = 0, 84 .bus_num = 0,
57 .chip_select = 0, 85 .chip_select = 0,
58 .mode = SPI_MODE_0, 86 .mode = SPI_MODE_0,
59 .irq = IRQ_AB4500, 87 .irq = IRQ_DB8500_AB8500,
60 }, 88 },
61}; 89};
62 90
@@ -118,6 +146,10 @@ static void __init u8500_init_machine(void)
118{ 146{
119 int i; 147 int i;
120 148
149 u8500_init_devices();
150
151 nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins));
152
121 u8500_i2c0_device.dev.platform_data = &u8500_i2c0_data; 153 u8500_i2c0_device.dev.platform_data = &u8500_i2c0_data;
122 ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data; 154 ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data;
123 ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data; 155 ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data;
@@ -133,8 +165,6 @@ static void __init u8500_init_machine(void)
133 165
134 spi_register_board_info(u8500_spi_devices, 166 spi_register_board_info(u8500_spi_devices,
135 ARRAY_SIZE(u8500_spi_devices)); 167 ARRAY_SIZE(u8500_spi_devices));
136
137 u8500_init_devices();
138} 168}
139 169
140MACHINE_START(U8500, "ST-Ericsson MOP500 platform") 170MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c
index 0a1318fc8e2b..d8ab7f184fe4 100644
--- a/arch/arm/mach-ux500/clock.c
+++ b/arch/arm/mach-ux500/clock.c
@@ -453,7 +453,11 @@ static DEFINE_PRCC_CLK_CUSTOM(7, mtu0_ed, 2, -1, NULL, clk_mtu_get_rate, 0);
453static DEFINE_PRCC_CLK(7, wdg_ed, 1, -1, NULL); 453static DEFINE_PRCC_CLK(7, wdg_ed, 1, -1, NULL);
454static DEFINE_PRCC_CLK(7, cfgreg_ed, 0, -1, NULL); 454static DEFINE_PRCC_CLK(7, cfgreg_ed, 0, -1, NULL);
455 455
456static struct clk clk_dummy_apb_pclk;
457
456static struct clk_lookup u8500_common_clks[] = { 458static struct clk_lookup u8500_common_clks[] = {
459 CLK(dummy_apb_pclk, NULL, "apb_pclk"),
460
457 /* Peripheral Cluster #1 */ 461 /* Peripheral Cluster #1 */
458 CLK(gpio0, "gpio.0", NULL), 462 CLK(gpio0, "gpio.0", NULL),
459 CLK(gpio0, "gpio.1", NULL), 463 CLK(gpio0, "gpio.1", NULL),
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index 822903421943..654fca944e65 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -65,7 +65,7 @@ struct amba_device u8500_ssp0_device = {
65 .end = U8500_SSP0_BASE + SZ_4K - 1, 65 .end = U8500_SSP0_BASE + SZ_4K - 1,
66 .flags = IORESOURCE_MEM, 66 .flags = IORESOURCE_MEM,
67 }, 67 },
68 .irq = {IRQ_SSP0, NO_IRQ }, 68 .irq = {IRQ_DB8500_SSP0, NO_IRQ },
69 /* ST-Ericsson modified id */ 69 /* ST-Ericsson modified id */
70 .periphid = SSP_PER_ID, 70 .periphid = SSP_PER_ID,
71}; 71};
@@ -77,8 +77,8 @@ static struct resource u8500_i2c0_resources[] = {
77 .flags = IORESOURCE_MEM, 77 .flags = IORESOURCE_MEM,
78 }, 78 },
79 [1] = { 79 [1] = {
80 .start = IRQ_I2C0, 80 .start = IRQ_DB8500_I2C0,
81 .end = IRQ_I2C0, 81 .end = IRQ_DB8500_I2C0,
82 .flags = IORESOURCE_IRQ, 82 .flags = IORESOURCE_IRQ,
83 } 83 }
84}; 84};
@@ -97,8 +97,8 @@ static struct resource u8500_i2c4_resources[] = {
97 .flags = IORESOURCE_MEM, 97 .flags = IORESOURCE_MEM,
98 }, 98 },
99 [1] = { 99 [1] = {
100 .start = IRQ_I2C4, 100 .start = IRQ_DB8500_I2C4,
101 .end = IRQ_I2C4, 101 .end = IRQ_DB8500_I2C4,
102 .flags = IORESOURCE_IRQ, 102 .flags = IORESOURCE_IRQ,
103 } 103 }
104}; 104};
@@ -130,8 +130,8 @@ static struct resource dma40_resources[] = {
130 .name = "lcla", 130 .name = "lcla",
131 }, 131 },
132 [3] = { 132 [3] = {
133 .start = IRQ_DMA, 133 .start = IRQ_DB8500_DMA,
134 .end = IRQ_DMA, 134 .end = IRQ_DB8500_DMA,
135 .flags = IORESOURCE_IRQ} 135 .flags = IORESOURCE_IRQ}
136}; 136};
137 137
diff --git a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
new file mode 100644
index 000000000000..cca4f705601e
--- /dev/null
+++ b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef __MACH_IRQS_BOARD_MOP500_H
9#define __MACH_IRQS_BOARD_MOP500_H
10
11#define AB8500_NR_IRQS 104
12
13#define MOP500_AB8500_IRQ_BASE IRQ_BOARD_START
14#define MOP500_AB8500_IRQ_END (MOP500_AB8500_IRQ_BASE \
15 + AB8500_NR_IRQS)
16#define MOP500_IRQ_END MOP500_AB8500_IRQ_END
17
18#if MOP500_IRQ_END > IRQ_BOARD_END
19#undef IRQ_BOARD_END
20#define IRQ_BOARD_END MOP500_IRQ_END
21#endif
22
23#endif
diff --git a/arch/arm/mach-ux500/include/mach/irqs-db5500.h b/arch/arm/mach-ux500/include/mach/irqs-db5500.h
new file mode 100644
index 000000000000..6fbfe5e2065a
--- /dev/null
+++ b/arch/arm/mach-ux500/include/mach/irqs-db5500.h
@@ -0,0 +1,85 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef __MACH_IRQS_DB5500_H
9#define __MACH_IRQS_DB5500_H
10
11#define IRQ_DB5500_MTU0 (IRQ_SHPI_START + 4)
12#define IRQ_DB5500_SPI2 (IRQ_SHPI_START + 6)
13#define IRQ_DB5500_PMU0 (IRQ_SHPI_START + 7)
14#define IRQ_DB5500_SPI0 (IRQ_SHPI_START + 8)
15#define IRQ_DB5500_RTT (IRQ_SHPI_START + 9)
16#define IRQ_DB5500_PKA (IRQ_SHPI_START + 10)
17#define IRQ_DB5500_UART0 (IRQ_SHPI_START + 11)
18#define IRQ_DB5500_I2C3 (IRQ_SHPI_START + 12)
19#define IRQ_DB5500_L2CC (IRQ_SHPI_START + 13)
20#define IRQ_DB5500_MSP0 (IRQ_SHPI_START + 14)
21#define IRQ_DB5500_CRYP1 (IRQ_SHPI_START + 15)
22#define IRQ_DB5500_PMU1 (IRQ_SHPI_START + 16)
23#define IRQ_DB5500_MTU1 (IRQ_SHPI_START + 17)
24#define IRQ_DB5500_RTC (IRQ_SHPI_START + 18)
25#define IRQ_DB5500_UART1 (IRQ_SHPI_START + 19)
26#define IRQ_DB5500_USB_WAKEUP (IRQ_SHPI_START + 20)
27#define IRQ_DB5500_I2C0 (IRQ_SHPI_START + 21)
28#define IRQ_DB5500_I2C1 (IRQ_SHPI_START + 22)
29#define IRQ_DB5500_USBOTG (IRQ_SHPI_START + 23)
30#define IRQ_DB5500_DMA_SECURE (IRQ_SHPI_START + 24)
31#define IRQ_DB5500_DMA (IRQ_SHPI_START + 25)
32#define IRQ_DB5500_UART2 (IRQ_SHPI_START + 26)
33#define IRQ_DB5500_ICN_PMU1 (IRQ_SHPI_START + 27)
34#define IRQ_DB5500_ICN_PMU2 (IRQ_SHPI_START + 28)
35#define IRQ_DB5500_UART3 (IRQ_SHPI_START + 29)
36#define IRQ_DB5500_SPI3 (IRQ_SHPI_START + 30)
37#define IRQ_DB5500_SDMMC4 (IRQ_SHPI_START + 31)
38#define IRQ_DB5500_IRRC (IRQ_SHPI_START + 33)
39#define IRQ_DB5500_IRDA_FT (IRQ_SHPI_START + 34)
40#define IRQ_DB5500_IRDA_SD (IRQ_SHPI_START + 35)
41#define IRQ_DB5500_IRDA_FI (IRQ_SHPI_START + 36)
42#define IRQ_DB5500_IRDA_FD (IRQ_SHPI_START + 37)
43#define IRQ_DB5500_FSMC_CODEREADY (IRQ_SHPI_START + 38)
44#define IRQ_DB5500_FSMC_NANDWAIT (IRQ_SHPI_START + 39)
45#define IRQ_DB5500_AB5500 (IRQ_SHPI_START + 40)
46#define IRQ_DB5500_SDMMC2 (IRQ_SHPI_START + 41)
47#define IRQ_DB5500_SIA (IRQ_SHPI_START + 42)
48#define IRQ_DB5500_SIA2 (IRQ_SHPI_START + 43)
49#define IRQ_DB5500_HVA (IRQ_SHPI_START + 44)
50#define IRQ_DB5500_HVA2 (IRQ_SHPI_START + 45)
51#define IRQ_DB5500_PRCMU0 (IRQ_SHPI_START + 46)
52#define IRQ_DB5500_PRCMU1 (IRQ_SHPI_START + 47)
53#define IRQ_DB5500_DISP (IRQ_SHPI_START + 48)
54#define IRQ_DB5500_SDMMC1 (IRQ_SHPI_START + 50)
55#define IRQ_DB5500_MSP1 (IRQ_SHPI_START + 52)
56#define IRQ_DB5500_KBD (IRQ_SHPI_START + 53)
57#define IRQ_DB5500_I2C2 (IRQ_SHPI_START + 55)
58#define IRQ_DB5500_B2R2 (IRQ_SHPI_START + 56)
59#define IRQ_DB5500_CRYP0 (IRQ_SHPI_START + 57)
60#define IRQ_DB5500_SDMMC3 (IRQ_SHPI_START + 59)
61#define IRQ_DB5500_SDMMC0 (IRQ_SHPI_START + 60)
62#define IRQ_DB5500_HSEM (IRQ_SHPI_START + 61)
63#define IRQ_DB5500_SBAG (IRQ_SHPI_START + 63)
64#define IRQ_DB5500_SPI1 (IRQ_SHPI_START + 96)
65#define IRQ_DB5500_MSP2 (IRQ_SHPI_START + 98)
66#define IRQ_DB5500_SRPTIMER (IRQ_SHPI_START + 101)
67#define IRQ_DB5500_CTI0 (IRQ_SHPI_START + 108)
68#define IRQ_DB5500_CTI1 (IRQ_SHPI_START + 109)
69#define IRQ_DB5500_ICN_ERR (IRQ_SHPI_START + 110)
70#define IRQ_DB5500_MALI_PPMMU (IRQ_SHPI_START + 112)
71#define IRQ_DB5500_MALI_PP (IRQ_SHPI_START + 113)
72#define IRQ_DB5500_MALI_GPMMU (IRQ_SHPI_START + 114)
73#define IRQ_DB5500_MALI_GP (IRQ_SHPI_START + 115)
74#define IRQ_DB5500_MALI (IRQ_SHPI_START + 116)
75#define IRQ_DB5500_PRCMU_SEM (IRQ_SHPI_START + 118)
76#define IRQ_DB5500_GPIO0 (IRQ_SHPI_START + 119)
77#define IRQ_DB5500_GPIO1 (IRQ_SHPI_START + 120)
78#define IRQ_DB5500_GPIO2 (IRQ_SHPI_START + 121)
79#define IRQ_DB5500_GPIO3 (IRQ_SHPI_START + 122)
80#define IRQ_DB5500_GPIO4 (IRQ_SHPI_START + 123)
81#define IRQ_DB5500_GPIO5 (IRQ_SHPI_START + 124)
82#define IRQ_DB5500_GPIO6 (IRQ_SHPI_START + 125)
83#define IRQ_DB5500_GPIO7 (IRQ_SHPI_START + 126)
84
85#endif
diff --git a/arch/arm/mach-ux500/include/mach/irqs-db8500.h b/arch/arm/mach-ux500/include/mach/irqs-db8500.h
new file mode 100644
index 000000000000..8b5d9f0a1633
--- /dev/null
+++ b/arch/arm/mach-ux500/include/mach/irqs-db8500.h
@@ -0,0 +1,96 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef __MACH_IRQS_DB8500_H
9#define __MACH_IRQS_DB8500_H
10
11#define IRQ_DB8500_MTU0 (IRQ_SHPI_START + 4)
12#define IRQ_DB8500_SPI2 (IRQ_SHPI_START + 6)
13#define IRQ_DB8500_PMU (IRQ_SHPI_START + 7)
14#define IRQ_DB8500_SPI0 (IRQ_SHPI_START + 8)
15#define IRQ_DB8500_RTT (IRQ_SHPI_START + 9)
16#define IRQ_DB8500_PKA (IRQ_SHPI_START + 10)
17#define IRQ_DB8500_UART0 (IRQ_SHPI_START + 11)
18#define IRQ_DB8500_I2C3 (IRQ_SHPI_START + 12)
19#define IRQ_DB8500_L2CC (IRQ_SHPI_START + 13)
20#define IRQ_DB8500_SSP0 (IRQ_SHPI_START + 14)
21#define IRQ_DB8500_CRYP1 (IRQ_SHPI_START + 15)
22#define IRQ_DB8500_MSP1_RX (IRQ_SHPI_START + 16)
23#define IRQ_DB8500_MTU1 (IRQ_SHPI_START + 17)
24#define IRQ_DB8500_RTC (IRQ_SHPI_START + 18)
25#define IRQ_DB8500_UART1 (IRQ_SHPI_START + 19)
26#define IRQ_DB8500_USB_WAKEUP (IRQ_SHPI_START + 20)
27#define IRQ_DB8500_I2C0 (IRQ_SHPI_START + 21)
28#define IRQ_DB8500_I2C1 (IRQ_SHPI_START + 22)
29#define IRQ_DB8500_USBOTG (IRQ_SHPI_START + 23)
30#define IRQ_DB8500_DMA_SECURE (IRQ_SHPI_START + 24)
31#define IRQ_DB8500_DMA (IRQ_SHPI_START + 25)
32#define IRQ_DB8500_UART2 (IRQ_SHPI_START + 26)
33#define IRQ_DB8500_ICN_PMU1 (IRQ_SHPI_START + 27)
34#define IRQ_DB8500_ICN_PMU2 (IRQ_SHPI_START + 28)
35#define IRQ_DB8500_HSIR_EXCEP (IRQ_SHPI_START + 29)
36#define IRQ_DB8500_MSP0 (IRQ_SHPI_START + 31)
37#define IRQ_DB8500_HSIR_CH0_OVRRUN (IRQ_SHPI_START + 32)
38#define IRQ_DB8500_HSIR_CH1_OVRRUN (IRQ_SHPI_START + 33)
39#define IRQ_DB8500_HSIR_CH2_OVRRUN (IRQ_SHPI_START + 34)
40#define IRQ_DB8500_HSIR_CH3_OVRRUN (IRQ_SHPI_START + 35)
41#define IRQ_DB8500_HSIR_CH4_OVRRUN (IRQ_SHPI_START + 36)
42#define IRQ_DB8500_HSIR_CH5_OVRRUN (IRQ_SHPI_START + 37)
43#define IRQ_DB8500_HSIR_CH6_OVRRUN (IRQ_SHPI_START + 38)
44#define IRQ_DB8500_HSIR_CH7_OVRRUN (IRQ_SHPI_START + 39)
45#define IRQ_DB8500_AB8500 (IRQ_SHPI_START + 40)
46#define IRQ_DB8500_SDMMC2 (IRQ_SHPI_START + 41)
47#define IRQ_DB8500_SIA (IRQ_SHPI_START + 42)
48#define IRQ_DB8500_SIA2 (IRQ_SHPI_START + 43)
49#define IRQ_DB8500_SVA (IRQ_SHPI_START + 44)
50#define IRQ_DB8500_SVA2 (IRQ_SHPI_START + 45)
51#define IRQ_DB8500_PRCMU0 (IRQ_SHPI_START + 46)
52#define IRQ_DB8500_PRCMU1 (IRQ_SHPI_START + 47)
53#define IRQ_DB8500_DISP (IRQ_SHPI_START + 48)
54#define IRQ_DB8500_SPI3 (IRQ_SHPI_START + 49)
55#define IRQ_DB8500_SDMMC1 (IRQ_SHPI_START + 50)
56#define IRQ_DB8500_I2C4 (IRQ_SHPI_START + 51)
57#define IRQ_DB8500_SSP1 (IRQ_SHPI_START + 52)
58#define IRQ_DB8500_SKE (IRQ_SHPI_START + 53)
59#define IRQ_DB8500_KB (IRQ_SHPI_START + 54)
60#define IRQ_DB8500_I2C2 (IRQ_SHPI_START + 55)
61#define IRQ_DB8500_B2R2 (IRQ_SHPI_START + 56)
62#define IRQ_DB8500_CRYP0 (IRQ_SHPI_START + 57)
63#define IRQ_DB8500_SDMMC3 (IRQ_SHPI_START + 59)
64#define IRQ_DB8500_SDMMC0 (IRQ_SHPI_START + 60)
65#define IRQ_DB8500_HSEM (IRQ_SHPI_START + 61)
66#define IRQ_DB8500_MSP1 (IRQ_SHPI_START + 62)
67#define IRQ_DB8500_SBAG (IRQ_SHPI_START + 63)
68#define IRQ_DB8500_SPI1 (IRQ_SHPI_START + 96)
69#define IRQ_DB8500_SRPTIMER (IRQ_SHPI_START + 97)
70#define IRQ_DB8500_MSP2 (IRQ_SHPI_START + 98)
71#define IRQ_DB8500_SDMMC4 (IRQ_SHPI_START + 99)
72#define IRQ_DB8500_SDMMC5 (IRQ_SHPI_START + 100)
73#define IRQ_DB8500_HSIRD0 (IRQ_SHPI_START + 104)
74#define IRQ_DB8500_HSIRD1 (IRQ_SHPI_START + 105)
75#define IRQ_DB8500_HSITD0 (IRQ_SHPI_START + 106)
76#define IRQ_DB8500_HSITD1 (IRQ_SHPI_START + 107)
77#define IRQ_DB8500_CTI0 (IRQ_SHPI_START + 108)
78#define IRQ_DB8500_CTI1 (IRQ_SHPI_START + 109)
79#define IRQ_DB8500_ICN_ERR (IRQ_SHPI_START + 110)
80#define IRQ_DB8500_MALI_PPMMU (IRQ_SHPI_START + 112)
81#define IRQ_DB8500_MALI_PP (IRQ_SHPI_START + 113)
82#define IRQ_DB8500_MALI_GPMMU (IRQ_SHPI_START + 114)
83#define IRQ_DB8500_MALI_GP (IRQ_SHPI_START + 115)
84#define IRQ_DB8500_MALI (IRQ_SHPI_START + 116)
85#define IRQ_DB8500_PRCMU_SEM (IRQ_SHPI_START + 118)
86#define IRQ_DB8500_GPIO0 (IRQ_SHPI_START + 119)
87#define IRQ_DB8500_GPIO1 (IRQ_SHPI_START + 120)
88#define IRQ_DB8500_GPIO2 (IRQ_SHPI_START + 121)
89#define IRQ_DB8500_GPIO3 (IRQ_SHPI_START + 122)
90#define IRQ_DB8500_GPIO4 (IRQ_SHPI_START + 123)
91#define IRQ_DB8500_GPIO5 (IRQ_SHPI_START + 124)
92#define IRQ_DB8500_GPIO6 (IRQ_SHPI_START + 125)
93#define IRQ_DB8500_GPIO7 (IRQ_SHPI_START + 126)
94#define IRQ_DB8500_GPIO8 (IRQ_SHPI_START + 127)
95
96#endif
diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/include/mach/irqs.h
index 7970684b1d09..10385bdc2b77 100644
--- a/arch/arm/mach-ux500/include/mach/irqs.h
+++ b/arch/arm/mach-ux500/include/mach/irqs.h
@@ -10,7 +10,8 @@
10#ifndef ASM_ARCH_IRQS_H 10#ifndef ASM_ARCH_IRQS_H
11#define ASM_ARCH_IRQS_H 11#define ASM_ARCH_IRQS_H
12 12
13#include <mach/hardware.h> 13#include <mach/irqs-db5500.h>
14#include <mach/irqs-db8500.h>
14 15
15#define IRQ_LOCALTIMER 29 16#define IRQ_LOCALTIMER 29
16#define IRQ_LOCALWDOG 30 17#define IRQ_LOCALWDOG 30
@@ -67,12 +68,21 @@
67/* There are 128 shared peripheral interrupts assigned to 68/* There are 128 shared peripheral interrupts assigned to
68 * INTID[160:32]. The first 32 interrupts are reserved. 69 * INTID[160:32]. The first 32 interrupts are reserved.
69 */ 70 */
70#define U8500_SOC_NR_IRQS 161 71#define DBX500_NR_INTERNAL_IRQS 161
71 72
72/* After chip-specific IRQ numbers we have the GPIO ones */ 73/* After chip-specific IRQ numbers we have the GPIO ones */
73#define NOMADIK_NR_GPIO 288 74#define NOMADIK_NR_GPIO 288
74#define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + U8500_SOC_NR_IRQS) 75#define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + DBX500_NR_INTERNAL_IRQS)
75#define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - U8500_SOC_NR_IRQS) 76#define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - DBX500_NR_INTERNAL_IRQS)
76#define NR_IRQS NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO) 77#define IRQ_BOARD_START NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO)
77 78
78#endif /*ASM_ARCH_IRQS_H*/ 79/* This will be overridden by board-specific irq headers */
80#define IRQ_BOARD_END IRQ_BOARD_START
81
82#ifdef CONFIG_MACH_U8500_MOP
83#include <mach/irqs-board-mop500.h>
84#endif
85
86#define NR_IRQS IRQ_BOARD_END
87
88#endif /* ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-ux500/pins-db8500.h b/arch/arm/mach-ux500/pins-db8500.h
new file mode 100644
index 000000000000..9055d5d3233c
--- /dev/null
+++ b/arch/arm/mach-ux500/pins-db8500.h
@@ -0,0 +1,742 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License, version 2
5 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
6 */
7
8#ifndef __MACH_PINS_DB8500_H
9#define __MACH_PINS_DB8500_H
10
11/*
12 * TODO: Eventually encode all non-board specific pull up/down configuration
13 * here.
14 */
15
16#define GPIO0_GPIO PIN_CFG(0, GPIO)
17#define GPIO0_U0_CTSn PIN_CFG(0, ALT_A)
18#define GPIO0_TRIG_OUT PIN_CFG(0, ALT_B)
19#define GPIO0_IP_TDO PIN_CFG(0, ALT_C)
20
21#define GPIO1_GPIO PIN_CFG(1, GPIO)
22#define GPIO1_U0_RTSn PIN_CFG(1, ALT_A)
23#define GPIO1_TRIG_IN PIN_CFG(1, ALT_B)
24#define GPIO1_IP_TDI PIN_CFG(1, ALT_C)
25
26#define GPIO2_GPIO PIN_CFG(2, GPIO)
27#define GPIO2_U0_RXD PIN_CFG(2, ALT_A)
28#define GPIO2_NONE PIN_CFG(2, ALT_B)
29#define GPIO2_IP_TMS PIN_CFG(2, ALT_C)
30
31#define GPIO3_GPIO PIN_CFG(3, GPIO)
32#define GPIO3_U0_TXD PIN_CFG(3, ALT_A)
33#define GPIO3_NONE PIN_CFG(3, ALT_B)
34#define GPIO3_IP_TCK PIN_CFG(3, ALT_C)
35
36#define GPIO4_GPIO PIN_CFG(4, GPIO)
37#define GPIO4_U1_RXD PIN_CFG(4, ALT_A)
38#define GPIO4_I2C4_SCL PIN_CFG_PULL(4, ALT_B, UP)
39#define GPIO4_IP_TRSTn PIN_CFG(4, ALT_C)
40
41#define GPIO5_GPIO PIN_CFG(5, GPIO)
42#define GPIO5_U1_TXD PIN_CFG(5, ALT_A)
43#define GPIO5_I2C4_SDA PIN_CFG_PULL(5, ALT_B, UP)
44#define GPIO5_IP_GPIO6 PIN_CFG(5, ALT_C)
45
46#define GPIO6_GPIO PIN_CFG(6, GPIO)
47#define GPIO6_U1_CTSn PIN_CFG(6, ALT_A)
48#define GPIO6_I2C1_SCL PIN_CFG_PULL(6, ALT_B, UP)
49#define GPIO6_IP_GPIO0 PIN_CFG(6, ALT_C)
50
51#define GPIO7_GPIO PIN_CFG(7, GPIO)
52#define GPIO7_U1_RTSn PIN_CFG(7, ALT_A)
53#define GPIO7_I2C1_SDA PIN_CFG_PULL(7, ALT_B, UP)
54#define GPIO7_IP_GPIO1 PIN_CFG(7, ALT_C)
55
56#define GPIO8_GPIO PIN_CFG(8, GPIO)
57#define GPIO8_IPI2C_SDA PIN_CFG_PULL(8, ALT_A, UP)
58#define GPIO8_I2C2_SDA PIN_CFG_PULL(8, ALT_B, UP)
59
60#define GPIO9_GPIO PIN_CFG(9, GPIO)
61#define GPIO9_IPI2C_SCL PIN_CFG_PULL(9, ALT_A, UP)
62#define GPIO9_I2C2_SCL PIN_CFG_PULL(9, ALT_B, UP)
63
64#define GPIO10_GPIO PIN_CFG(10, GPIO)
65#define GPIO10_IPI2C_SDA PIN_CFG_PULL(10, ALT_A, UP)
66#define GPIO10_I2C2_SDA PIN_CFG_PULL(10, ALT_B, UP)
67#define GPIO10_IP_GPIO3 PIN_CFG(10, ALT_C)
68
69#define GPIO11_GPIO PIN_CFG(11, GPIO)
70#define GPIO11_IPI2C_SCL PIN_CFG_PULL(11, ALT_A, UP)
71#define GPIO11_I2C2_SCL PIN_CFG_PULL(11, ALT_B, UP)
72#define GPIO11_IP_GPIO2 PIN_CFG(11, ALT_C)
73
74#define GPIO12_GPIO PIN_CFG(12, GPIO)
75#define GPIO12_MSP0_TXD PIN_CFG(12, ALT_A)
76#define GPIO12_MSP0_RXD PIN_CFG(12, ALT_B)
77
78#define GPIO13_GPIO PIN_CFG(13, GPIO)
79#define GPIO13_MSP0_TFS PIN_CFG(13, ALT_A)
80
81#define GPIO14_GPIO PIN_CFG(14, GPIO)
82#define GPIO14_MSP0_TCK PIN_CFG(14, ALT_A)
83
84#define GPIO15_GPIO PIN_CFG(15, GPIO)
85#define GPIO15_MSP0_RXD PIN_CFG(15, ALT_A)
86#define GPIO15_MSP0_TXD PIN_CFG(15, ALT_B)
87
88#define GPIO16_GPIO PIN_CFG(16, GPIO)
89#define GPIO16_MSP0_RFS PIN_CFG(16, ALT_A)
90#define GPIO16_I2C1_SCL PIN_CFG_PULL(16, ALT_B, UP)
91#define GPIO16_SLIM0_DAT PIN_CFG(16, ALT_C)
92
93#define GPIO17_GPIO PIN_CFG(17, GPIO)
94#define GPIO17_MSP0_RCK PIN_CFG(17, ALT_A)
95#define GPIO17_I2C1_SDA PIN_CFG_PULL(17, ALT_B, UP)
96#define GPIO17_SLIM0_CLK PIN_CFG(17, ALT_C)
97
98#define GPIO18_GPIO PIN_CFG(18, GPIO)
99#define GPIO18_MC0_CMDDIR PIN_CFG(18, ALT_A)
100#define GPIO18_U2_RXD PIN_CFG(18, ALT_B)
101#define GPIO18_MS_IEP PIN_CFG(18, ALT_C)
102
103#define GPIO19_GPIO PIN_CFG(19, GPIO)
104#define GPIO19_MC0_DAT0DIR PIN_CFG(19, ALT_A)
105#define GPIO19_U2_TXD PIN_CFG(19, ALT_B)
106#define GPIO19_MS_DAT0DIR PIN_CFG(19, ALT_C)
107
108#define GPIO20_GPIO PIN_CFG(20, GPIO)
109#define GPIO20_MC0_DAT2DIR PIN_CFG(20, ALT_A)
110#define GPIO20_UARTMOD_TXD PIN_CFG(20, ALT_B)
111#define GPIO20_IP_TRIGOUT PIN_CFG(20, ALT_C)
112
113#define GPIO21_GPIO PIN_CFG(21, GPIO)
114#define GPIO21_MC0_DAT31DIR PIN_CFG(21, ALT_A)
115#define GPIO21_MSP0_SCK PIN_CFG(21, ALT_B)
116#define GPIO21_MS_DAT31DIR PIN_CFG(21, ALT_C)
117
118#define GPIO22_GPIO PIN_CFG(22, GPIO)
119#define GPIO22_MC0_FBCLK PIN_CFG(22, ALT_A)
120#define GPIO22_UARTMOD_RXD PIN_CFG(22, ALT_B)
121#define GPIO22_MS_FBCLK PIN_CFG(22, ALT_C)
122
123#define GPIO23_GPIO PIN_CFG(23, GPIO)
124#define GPIO23_MC0_CLK PIN_CFG(23, ALT_A)
125#define GPIO23_STMMOD_CLK PIN_CFG(23, ALT_B)
126#define GPIO23_MS_CLK PIN_CFG(23, ALT_C)
127
128#define GPIO24_GPIO PIN_CFG(24, GPIO)
129#define GPIO24_MC0_CMD PIN_CFG(24, ALT_A)
130#define GPIO24_UARTMOD_RXD PIN_CFG(24, ALT_B)
131#define GPIO24_MS_BS PIN_CFG(24, ALT_C)
132
133#define GPIO25_GPIO PIN_CFG(25, GPIO)
134#define GPIO25_MC0_DAT0 PIN_CFG(25, ALT_A)
135#define GPIO25_STMMOD_DAT0 PIN_CFG(25, ALT_B)
136#define GPIO25_MS_DAT0 PIN_CFG(25, ALT_C)
137
138#define GPIO26_GPIO PIN_CFG(26, GPIO)
139#define GPIO26_MC0_DAT1 PIN_CFG(26, ALT_A)
140#define GPIO26_STMMOD_DAT1 PIN_CFG(26, ALT_B)
141#define GPIO26_MS_DAT1 PIN_CFG(26, ALT_C)
142
143#define GPIO27_GPIO PIN_CFG(27, GPIO)
144#define GPIO27_MC0_DAT2 PIN_CFG(27, ALT_A)
145#define GPIO27_STMMOD_DAT2 PIN_CFG(27, ALT_B)
146#define GPIO27_MS_DAT2 PIN_CFG(27, ALT_C)
147
148#define GPIO28_GPIO PIN_CFG(28, GPIO)
149#define GPIO28_MC0_DAT3 PIN_CFG(28, ALT_A)
150#define GPIO28_STMMOD_DAT3 PIN_CFG(28, ALT_B)
151#define GPIO28_MS_DAT3 PIN_CFG(28, ALT_C)
152
153#define GPIO29_GPIO PIN_CFG(29, GPIO)
154#define GPIO29_MC0_DAT4 PIN_CFG(29, ALT_A)
155#define GPIO29_SPI3_CLK PIN_CFG(29, ALT_B)
156#define GPIO29_U2_RXD PIN_CFG(29, ALT_C)
157
158#define GPIO30_GPIO PIN_CFG(30, GPIO)
159#define GPIO30_MC0_DAT5 PIN_CFG(30, ALT_A)
160#define GPIO30_SPI3_RXD PIN_CFG(30, ALT_B)
161#define GPIO30_U2_TXD PIN_CFG(30, ALT_C)
162
163#define GPIO31_GPIO PIN_CFG(31, GPIO)
164#define GPIO31_MC0_DAT6 PIN_CFG(31, ALT_A)
165#define GPIO31_SPI3_FRM PIN_CFG(31, ALT_B)
166#define GPIO31_U2_CTSn PIN_CFG(31, ALT_C)
167
168#define GPIO32_GPIO PIN_CFG(32, GPIO)
169#define GPIO32_MC0_DAT7 PIN_CFG(32, ALT_A)
170#define GPIO32_SPI3_TXD PIN_CFG(32, ALT_B)
171#define GPIO32_U2_RTSn PIN_CFG(32, ALT_C)
172
173#define GPIO33_GPIO PIN_CFG(33, GPIO)
174#define GPIO33_MSP1_TXD PIN_CFG(33, ALT_A)
175#define GPIO33_MSP1_RXD PIN_CFG(33, ALT_B)
176#define GPIO33_U0_DTRn PIN_CFG(33, ALT_C)
177
178#define GPIO34_GPIO PIN_CFG(34, GPIO)
179#define GPIO34_MSP1_TFS PIN_CFG(34, ALT_A)
180#define GPIO34_NONE PIN_CFG(34, ALT_B)
181#define GPIO34_U0_DCDn PIN_CFG(34, ALT_C)
182
183#define GPIO35_GPIO PIN_CFG(35, GPIO)
184#define GPIO35_MSP1_TCK PIN_CFG(35, ALT_A)
185#define GPIO35_NONE PIN_CFG(35, ALT_B)
186#define GPIO35_U0_DSRn PIN_CFG(35, ALT_C)
187
188#define GPIO36_GPIO PIN_CFG(36, GPIO)
189#define GPIO36_MSP1_RXD PIN_CFG(36, ALT_A)
190#define GPIO36_MSP1_TXD PIN_CFG(36, ALT_B)
191#define GPIO36_U0_RIn PIN_CFG(36, ALT_C)
192
193#define GPIO64_GPIO PIN_CFG(64, GPIO)
194#define GPIO64_LCDB_DE PIN_CFG(64, ALT_A)
195#define GPIO64_KP_O1 PIN_CFG(64, ALT_B)
196#define GPIO64_IP_GPIO4 PIN_CFG(64, ALT_C)
197
198#define GPIO65_GPIO PIN_CFG(65, GPIO)
199#define GPIO65_LCDB_HSO PIN_CFG(65, ALT_A)
200#define GPIO65_KP_O0 PIN_CFG(65, ALT_B)
201#define GPIO65_IP_GPIO5 PIN_CFG(65, ALT_C)
202
203#define GPIO66_GPIO PIN_CFG(66, GPIO)
204#define GPIO66_LCDB_VSO PIN_CFG(66, ALT_A)
205#define GPIO66_KP_I1 PIN_CFG(66, ALT_B)
206#define GPIO66_IP_GPIO6 PIN_CFG(66, ALT_C)
207
208#define GPIO67_GPIO PIN_CFG(67, GPIO)
209#define GPIO67_LCDB_CLK PIN_CFG(67, ALT_A)
210#define GPIO67_KP_I0 PIN_CFG(67, ALT_B)
211#define GPIO67_IP_GPIO7 PIN_CFG(67, ALT_C)
212
213#define GPIO68_GPIO PIN_CFG(68, GPIO)
214#define GPIO68_LCD_VSI0 PIN_CFG(68, ALT_A)
215#define GPIO68_KP_O7 PIN_CFG(68, ALT_B)
216#define GPIO68_SM_CLE PIN_CFG(68, ALT_C)
217
218#define GPIO69_GPIO PIN_CFG(69, GPIO)
219#define GPIO69_LCD_VSI1 PIN_CFG(69, ALT_A)
220#define GPIO69_KP_I7 PIN_CFG(69, ALT_B)
221#define GPIO69_SM_ALE PIN_CFG(69, ALT_C)
222
223#define GPIO70_GPIO PIN_CFG(70, GPIO)
224#define GPIO70_LCD_D0 PIN_CFG(70, ALT_A)
225#define GPIO70_KP_O5 PIN_CFG(70, ALT_B)
226#define GPIO70_STMAPE_CLK PIN_CFG(70, ALT_C)
227
228#define GPIO71_GPIO PIN_CFG(71, GPIO)
229#define GPIO71_LCD_D1 PIN_CFG(71, ALT_A)
230#define GPIO71_KP_O4 PIN_CFG(71, ALT_B)
231#define GPIO71_STMAPE_DAT3 PIN_CFG(71, ALT_C)
232
233#define GPIO72_GPIO PIN_CFG(72, GPIO)
234#define GPIO72_LCD_D2 PIN_CFG(72, ALT_A)
235#define GPIO72_KP_O3 PIN_CFG(72, ALT_B)
236#define GPIO72_STMAPE_DAT2 PIN_CFG(72, ALT_C)
237
238#define GPIO73_GPIO PIN_CFG(73, GPIO)
239#define GPIO73_LCD_D3 PIN_CFG(73, ALT_A)
240#define GPIO73_KP_O2 PIN_CFG(73, ALT_B)
241#define GPIO73_STMAPE_DAT1 PIN_CFG(73, ALT_C)
242
243#define GPIO74_GPIO PIN_CFG(74, GPIO)
244#define GPIO74_LCD_D4 PIN_CFG(74, ALT_A)
245#define GPIO74_KP_I5 PIN_CFG(74, ALT_B)
246#define GPIO74_STMAPE_DAT0 PIN_CFG(74, ALT_C)
247
248#define GPIO75_GPIO PIN_CFG(75, GPIO)
249#define GPIO75_LCD_D5 PIN_CFG(75, ALT_A)
250#define GPIO75_KP_I4 PIN_CFG(75, ALT_B)
251#define GPIO75_U2_RXD PIN_CFG(75, ALT_C)
252
253#define GPIO76_GPIO PIN_CFG(76, GPIO)
254#define GPIO76_LCD_D6 PIN_CFG(76, ALT_A)
255#define GPIO76_KP_I3 PIN_CFG(76, ALT_B)
256#define GPIO76_U2_TXD PIN_CFG(76, ALT_C)
257
258#define GPIO77_GPIO PIN_CFG(77, GPIO)
259#define GPIO77_LCD_D7 PIN_CFG(77, ALT_A)
260#define GPIO77_KP_I2 PIN_CFG(77, ALT_B)
261#define GPIO77_NONE PIN_CFG(77, ALT_C)
262
263#define GPIO78_GPIO PIN_CFG(78, GPIO)
264#define GPIO78_LCD_D8 PIN_CFG(78, ALT_A)
265#define GPIO78_KP_O6 PIN_CFG(78, ALT_B)
266#define GPIO78_IP_GPIO2 PIN_CFG(78, ALT_C)
267
268#define GPIO79_GPIO PIN_CFG(79, GPIO)
269#define GPIO79_LCD_D9 PIN_CFG(79, ALT_A)
270#define GPIO79_KP_I6 PIN_CFG(79, ALT_B)
271#define GPIO79_IP_GPIO3 PIN_CFG(79, ALT_C)
272
273#define GPIO80_GPIO PIN_CFG(80, GPIO)
274#define GPIO80_LCD_D10 PIN_CFG(80, ALT_A)
275#define GPIO80_KP_SKA0 PIN_CFG(80, ALT_B)
276#define GPIO80_IP_GPIO4 PIN_CFG(80, ALT_C)
277
278#define GPIO81_GPIO PIN_CFG(81, GPIO)
279#define GPIO81_LCD_D11 PIN_CFG(81, ALT_A)
280#define GPIO81_KP_SKB0 PIN_CFG(81, ALT_B)
281#define GPIO81_IP_GPIO5 PIN_CFG(81, ALT_C)
282
283#define GPIO82_GPIO PIN_CFG(82, GPIO)
284#define GPIO82_LCD_D12 PIN_CFG(82, ALT_A)
285#define GPIO82_KP_O5 PIN_CFG(82, ALT_B)
286
287#define GPIO83_GPIO PIN_CFG(83, GPIO)
288#define GPIO83_LCD_D13 PIN_CFG(83, ALT_A)
289#define GPIO83_KP_O4 PIN_CFG(83, ALT_B)
290
291#define GPIO84_GPIO PIN_CFG(84, GPIO)
292#define GPIO84_LCD_D14 PIN_CFG(84, ALT_A)
293#define GPIO84_KP_I5 PIN_CFG(84, ALT_B)
294
295#define GPIO85_GPIO PIN_CFG(85, GPIO)
296#define GPIO85_LCD_D15 PIN_CFG(85, ALT_A)
297#define GPIO85_KP_I4 PIN_CFG(85, ALT_B)
298
299#define GPIO86_GPIO PIN_CFG(86, GPIO)
300#define GPIO86_LCD_D16 PIN_CFG(86, ALT_A)
301#define GPIO86_SM_ADQ0 PIN_CFG(86, ALT_B)
302#define GPIO86_MC5_DAT0 PIN_CFG(86, ALT_C)
303
304#define GPIO87_GPIO PIN_CFG(87, GPIO)
305#define GPIO87_LCD_D17 PIN_CFG(87, ALT_A)
306#define GPIO87_SM_ADQ1 PIN_CFG(87, ALT_B)
307#define GPIO87_MC5_DAT1 PIN_CFG(87, ALT_C)
308
309#define GPIO88_GPIO PIN_CFG(88, GPIO)
310#define GPIO88_LCD_D18 PIN_CFG(88, ALT_A)
311#define GPIO88_SM_ADQ2 PIN_CFG(88, ALT_B)
312#define GPIO88_MC5_DAT2 PIN_CFG(88, ALT_C)
313
314#define GPIO89_GPIO PIN_CFG(89, GPIO)
315#define GPIO89_LCD_D19 PIN_CFG(89, ALT_A)
316#define GPIO89_SM_ADQ3 PIN_CFG(89, ALT_B)
317#define GPIO89_MC5_DAT3 PIN_CFG(89, ALT_C)
318
319#define GPIO90_GPIO PIN_CFG(90, GPIO)
320#define GPIO90_LCD_D20 PIN_CFG(90, ALT_A)
321#define GPIO90_SM_ADQ4 PIN_CFG(90, ALT_B)
322#define GPIO90_MC5_CMD PIN_CFG(90, ALT_C)
323
324#define GPIO91_GPIO PIN_CFG(91, GPIO)
325#define GPIO91_LCD_D21 PIN_CFG(91, ALT_A)
326#define GPIO91_SM_ADQ5 PIN_CFG(91, ALT_B)
327#define GPIO91_MC5_FBCLK PIN_CFG(91, ALT_C)
328
329#define GPIO92_GPIO PIN_CFG(92, GPIO)
330#define GPIO92_LCD_D22 PIN_CFG(92, ALT_A)
331#define GPIO92_SM_ADQ6 PIN_CFG(92, ALT_B)
332#define GPIO92_MC5_CLK PIN_CFG(92, ALT_C)
333
334#define GPIO93_GPIO PIN_CFG(93, GPIO)
335#define GPIO93_LCD_D23 PIN_CFG(93, ALT_A)
336#define GPIO93_SM_ADQ7 PIN_CFG(93, ALT_B)
337#define GPIO93_MC5_DAT4 PIN_CFG(93, ALT_C)
338
339#define GPIO94_GPIO PIN_CFG(94, GPIO)
340#define GPIO94_KP_O7 PIN_CFG(94, ALT_A)
341#define GPIO94_SM_ADVn PIN_CFG(94, ALT_B)
342#define GPIO94_MC5_DAT5 PIN_CFG(94, ALT_C)
343
344#define GPIO95_GPIO PIN_CFG(95, GPIO)
345#define GPIO95_KP_I7 PIN_CFG(95, ALT_A)
346#define GPIO95_SM_CS0n PIN_CFG(95, ALT_B)
347#define GPIO95_SM_PS0n PIN_CFG(95, ALT_C)
348
349#define GPIO96_GPIO PIN_CFG(96, GPIO)
350#define GPIO96_KP_O6 PIN_CFG(96, ALT_A)
351#define GPIO96_SM_OEn PIN_CFG(96, ALT_B)
352#define GPIO96_MC5_DAT6 PIN_CFG(96, ALT_C)
353
354#define GPIO97_GPIO PIN_CFG(97, GPIO)
355#define GPIO97_KP_I6 PIN_CFG(97, ALT_A)
356#define GPIO97_SM_WEn PIN_CFG(97, ALT_B)
357#define GPIO97_MC5_DAT7 PIN_CFG(97, ALT_C)
358
359#define GPIO128_GPIO PIN_CFG(128, GPIO)
360#define GPIO128_MC2_CLK PIN_CFG(128, ALT_A)
361#define GPIO128_SM_CKO PIN_CFG(128, ALT_B)
362
363#define GPIO129_GPIO PIN_CFG(129, GPIO)
364#define GPIO129_MC2_CMD PIN_CFG(129, ALT_A)
365#define GPIO129_SM_WAIT0n PIN_CFG(129, ALT_B)
366
367#define GPIO130_GPIO PIN_CFG(130, GPIO)
368#define GPIO130_MC2_FBCLK PIN_CFG(130, ALT_A)
369#define GPIO130_SM_FBCLK PIN_CFG(130, ALT_B)
370#define GPIO130_MC2_RSTN PIN_CFG(130, ALT_C)
371
372#define GPIO131_GPIO PIN_CFG(131, GPIO)
373#define GPIO131_MC2_DAT0 PIN_CFG(131, ALT_A)
374#define GPIO131_SM_ADQ8 PIN_CFG(131, ALT_B)
375
376#define GPIO132_GPIO PIN_CFG(132, GPIO)
377#define GPIO132_MC2_DAT1 PIN_CFG(132, ALT_A)
378#define GPIO132_SM_ADQ9 PIN_CFG(132, ALT_B)
379
380#define GPIO133_GPIO PIN_CFG(133, GPIO)
381#define GPIO133_MC2_DAT2 PIN_CFG(133, ALT_A)
382#define GPIO133_SM_ADQ10 PIN_CFG(133, ALT_B)
383
384#define GPIO134_GPIO PIN_CFG(134, GPIO)
385#define GPIO134_MC2_DAT3 PIN_CFG(134, ALT_A)
386#define GPIO134_SM_ADQ11 PIN_CFG(134, ALT_B)
387
388#define GPIO135_GPIO PIN_CFG(135, GPIO)
389#define GPIO135_MC2_DAT4 PIN_CFG(135, ALT_A)
390#define GPIO135_SM_ADQ12 PIN_CFG(135, ALT_B)
391
392#define GPIO136_GPIO PIN_CFG(136, GPIO)
393#define GPIO136_MC2_DAT5 PIN_CFG(136, ALT_A)
394#define GPIO136_SM_ADQ13 PIN_CFG(136, ALT_B)
395
396#define GPIO137_GPIO PIN_CFG(137, GPIO)
397#define GPIO137_MC2_DAT6 PIN_CFG(137, ALT_A)
398#define GPIO137_SM_ADQ14 PIN_CFG(137, ALT_B)
399
400#define GPIO138_GPIO PIN_CFG(138, GPIO)
401#define GPIO138_MC2_DAT7 PIN_CFG(138, ALT_A)
402#define GPIO138_SM_ADQ15 PIN_CFG(138, ALT_B)
403
404#define GPIO139_GPIO PIN_CFG(139, GPIO)
405#define GPIO139_SSP1_RXD PIN_CFG(139, ALT_A)
406#define GPIO139_SM_WAIT1n PIN_CFG(139, ALT_B)
407#define GPIO139_KP_O8 PIN_CFG(139, ALT_C)
408
409#define GPIO140_GPIO PIN_CFG(140, GPIO)
410#define GPIO140_SSP1_TXD PIN_CFG(140, ALT_A)
411#define GPIO140_IP_GPIO7 PIN_CFG(140, ALT_B)
412#define GPIO140_KP_SKA1 PIN_CFG(140, ALT_C)
413
414#define GPIO141_GPIO PIN_CFG(141, GPIO)
415#define GPIO141_SSP1_CLK PIN_CFG(141, ALT_A)
416#define GPIO141_IP_GPIO2 PIN_CFG(141, ALT_B)
417#define GPIO141_KP_O9 PIN_CFG(141, ALT_C)
418
419#define GPIO142_GPIO PIN_CFG(142, GPIO)
420#define GPIO142_SSP1_FRM PIN_CFG(142, ALT_A)
421#define GPIO142_IP_GPIO3 PIN_CFG(142, ALT_B)
422#define GPIO142_KP_SKB1 PIN_CFG(142, ALT_C)
423
424#define GPIO143_GPIO PIN_CFG(143, GPIO)
425#define GPIO143_SSP0_CLK PIN_CFG(143, ALT_A)
426
427#define GPIO144_GPIO PIN_CFG(144, GPIO)
428#define GPIO144_SSP0_FRM PIN_CFG(144, ALT_A)
429
430#define GPIO145_GPIO PIN_CFG(145, GPIO)
431#define GPIO145_SSP0_RXD PIN_CFG(145, ALT_A)
432
433#define GPIO146_GPIO PIN_CFG(146, GPIO)
434#define GPIO146_SSP0_TXD PIN_CFG(146, ALT_A)
435
436#define GPIO147_GPIO PIN_CFG(147, GPIO)
437#define GPIO147_I2C0_SCL PIN_CFG_PULL(147, ALT_A, UP)
438
439#define GPIO148_GPIO PIN_CFG(148, GPIO)
440#define GPIO148_I2C0_SDA PIN_CFG_PULL(148, ALT_A, UP)
441
442#define GPIO149_GPIO PIN_CFG(149, GPIO)
443#define GPIO149_IP_GPIO0 PIN_CFG(149, ALT_A)
444#define GPIO149_SM_CS1n PIN_CFG(149, ALT_B)
445#define GPIO149_SM_PS1n PIN_CFG(149, ALT_C)
446
447#define GPIO150_GPIO PIN_CFG(150, GPIO)
448#define GPIO150_IP_GPIO1 PIN_CFG(150, ALT_A)
449#define GPIO150_LCDA_CLK PIN_CFG(150, ALT_B)
450
451#define GPIO151_GPIO PIN_CFG(151, GPIO)
452#define GPIO151_KP_SKA0 PIN_CFG(151, ALT_A)
453#define GPIO151_LCD_VSI0 PIN_CFG(151, ALT_B)
454#define GPIO151_KP_O8 PIN_CFG(151, ALT_C)
455
456#define GPIO152_GPIO PIN_CFG(152, GPIO)
457#define GPIO152_KP_SKB0 PIN_CFG(152, ALT_A)
458#define GPIO152_LCD_VSI1 PIN_CFG(152, ALT_B)
459#define GPIO152_KP_O9 PIN_CFG(152, ALT_C)
460
461#define GPIO153_GPIO PIN_CFG(153, GPIO)
462#define GPIO153_KP_I7 PIN_CFG(153, ALT_A)
463#define GPIO153_LCD_D24 PIN_CFG(153, ALT_B)
464#define GPIO153_U2_RXD PIN_CFG(153, ALT_C)
465
466#define GPIO154_GPIO PIN_CFG(154, GPIO)
467#define GPIO154_KP_I6 PIN_CFG(154, ALT_A)
468#define GPIO154_LCD_D25 PIN_CFG(154, ALT_B)
469#define GPIO154_U2_TXD PIN_CFG(154, ALT_C)
470
471#define GPIO155_GPIO PIN_CFG(155, GPIO)
472#define GPIO155_KP_I5 PIN_CFG(155, ALT_A)
473#define GPIO155_LCD_D26 PIN_CFG(155, ALT_B)
474#define GPIO155_STMAPE_CLK PIN_CFG(155, ALT_C)
475
476#define GPIO156_GPIO PIN_CFG(156, GPIO)
477#define GPIO156_KP_I4 PIN_CFG(156, ALT_A)
478#define GPIO156_LCD_D27 PIN_CFG(156, ALT_B)
479#define GPIO156_STMAPE_DAT3 PIN_CFG(156, ALT_C)
480
481#define GPIO157_GPIO PIN_CFG(157, GPIO)
482#define GPIO157_KP_O7 PIN_CFG(157, ALT_A)
483#define GPIO157_LCD_D28 PIN_CFG(157, ALT_B)
484#define GPIO157_STMAPE_DAT2 PIN_CFG(157, ALT_C)
485
486#define GPIO158_GPIO PIN_CFG(158, GPIO)
487#define GPIO158_KP_O6 PIN_CFG(158, ALT_A)
488#define GPIO158_LCD_D29 PIN_CFG(158, ALT_B)
489#define GPIO158_STMAPE_DAT1 PIN_CFG(158, ALT_C)
490
491#define GPIO159_GPIO PIN_CFG(159, GPIO)
492#define GPIO159_KP_O5 PIN_CFG(159, ALT_A)
493#define GPIO159_LCD_D30 PIN_CFG(159, ALT_B)
494#define GPIO159_STMAPE_DAT0 PIN_CFG(159, ALT_C)
495
496#define GPIO160_GPIO PIN_CFG(160, GPIO)
497#define GPIO160_KP_O4 PIN_CFG(160, ALT_A)
498#define GPIO160_LCD_D31 PIN_CFG(160, ALT_B)
499#define GPIO160_NONE PIN_CFG(160, ALT_C)
500
501#define GPIO161_GPIO PIN_CFG(161, GPIO)
502#define GPIO161_KP_I3 PIN_CFG(161, ALT_A)
503#define GPIO161_LCD_D32 PIN_CFG(161, ALT_B)
504#define GPIO161_UARTMOD_RXD PIN_CFG(161, ALT_C)
505
506#define GPIO162_GPIO PIN_CFG(162, GPIO)
507#define GPIO162_KP_I2 PIN_CFG(162, ALT_A)
508#define GPIO162_LCD_D33 PIN_CFG(162, ALT_B)
509#define GPIO162_UARTMOD_TXD PIN_CFG(162, ALT_C)
510
511#define GPIO163_GPIO PIN_CFG(163, GPIO)
512#define GPIO163_KP_I1 PIN_CFG(163, ALT_A)
513#define GPIO163_LCD_D34 PIN_CFG(163, ALT_B)
514#define GPIO163_STMMOD_CLK PIN_CFG(163, ALT_C)
515
516#define GPIO164_GPIO PIN_CFG(164, GPIO)
517#define GPIO164_KP_I0 PIN_CFG(164, ALT_A)
518#define GPIO164_LCD_D35 PIN_CFG(164, ALT_B)
519#define GPIO164_STMMOD_DAT3 PIN_CFG(164, ALT_C)
520
521#define GPIO165_GPIO PIN_CFG(165, GPIO)
522#define GPIO165_KP_O3 PIN_CFG(165, ALT_A)
523#define GPIO165_LCD_D36 PIN_CFG(165, ALT_B)
524#define GPIO165_STMMOD_DAT2 PIN_CFG(165, ALT_C)
525
526#define GPIO166_GPIO PIN_CFG(166, GPIO)
527#define GPIO166_KP_O2 PIN_CFG(166, ALT_A)
528#define GPIO166_LCD_D37 PIN_CFG(166, ALT_B)
529#define GPIO166_STMMOD_DAT1 PIN_CFG(166, ALT_C)
530
531#define GPIO167_GPIO PIN_CFG(167, GPIO)
532#define GPIO167_KP_O1 PIN_CFG(167, ALT_A)
533#define GPIO167_LCD_D38 PIN_CFG(167, ALT_B)
534#define GPIO167_STMMOD_DAT0 PIN_CFG(167, ALT_C)
535
536#define GPIO168_GPIO PIN_CFG(168, GPIO)
537#define GPIO168_KP_O0 PIN_CFG(168, ALT_A)
538#define GPIO168_LCD_D39 PIN_CFG(168, ALT_B)
539#define GPIO168_NONE PIN_CFG(168, ALT_C)
540
541#define GPIO169_GPIO PIN_CFG(169, GPIO)
542#define GPIO169_RF_PURn PIN_CFG(169, ALT_A)
543#define GPIO169_LCDA_DE PIN_CFG(169, ALT_B)
544#define GPIO169_USBSIM_PDC PIN_CFG(169, ALT_C)
545
546#define GPIO170_GPIO PIN_CFG(170, GPIO)
547#define GPIO170_MODEM_STATE PIN_CFG(170, ALT_A)
548#define GPIO170_LCDA_VSO PIN_CFG(170, ALT_B)
549#define GPIO170_KP_SKA1 PIN_CFG(170, ALT_C)
550
551#define GPIO171_GPIO PIN_CFG(171, GPIO)
552#define GPIO171_MODEM_PWREN PIN_CFG(171, ALT_A)
553#define GPIO171_LCDA_HSO PIN_CFG(171, ALT_B)
554#define GPIO171_KP_SKB1 PIN_CFG(171, ALT_C)
555
556#define GPIO192_GPIO PIN_CFG(192, GPIO)
557#define GPIO192_MSP2_SCK PIN_CFG(192, ALT_A)
558
559#define GPIO193_GPIO PIN_CFG(193, GPIO)
560#define GPIO193_MSP2_TXD PIN_CFG(193, ALT_A)
561
562#define GPIO194_GPIO PIN_CFG(194, GPIO)
563#define GPIO194_MSP2_TCK PIN_CFG(194, ALT_A)
564
565#define GPIO195_GPIO PIN_CFG(195, GPIO)
566#define GPIO195_MSP2_TFS PIN_CFG(195, ALT_A)
567
568#define GPIO196_GPIO PIN_CFG(196, GPIO)
569#define GPIO196_MSP2_RXD PIN_CFG(196, ALT_A)
570
571#define GPIO197_GPIO PIN_CFG(197, GPIO)
572#define GPIO197_MC4_DAT3 PIN_CFG(197, ALT_A)
573
574#define GPIO198_GPIO PIN_CFG(198, GPIO)
575#define GPIO198_MC4_DAT2 PIN_CFG(198, ALT_A)
576
577#define GPIO199_GPIO PIN_CFG(199, GPIO)
578#define GPIO199_MC4_DAT1 PIN_CFG(199, ALT_A)
579
580#define GPIO200_GPIO PIN_CFG(200, GPIO)
581#define GPIO200_MC4_DAT0 PIN_CFG(200, ALT_A)
582
583#define GPIO201_GPIO PIN_CFG(201, GPIO)
584#define GPIO201_MC4_CMD PIN_CFG(201, ALT_A)
585
586#define GPIO202_GPIO PIN_CFG(202, GPIO)
587#define GPIO202_MC4_FBCLK PIN_CFG(202, ALT_A)
588#define GPIO202_PWL PIN_CFG(202, ALT_B)
589#define GPIO202_MC4_RSTN PIN_CFG(202, ALT_C)
590
591#define GPIO203_GPIO PIN_CFG(203, GPIO)
592#define GPIO203_MC4_CLK PIN_CFG(203, ALT_A)
593
594#define GPIO204_GPIO PIN_CFG(204, GPIO)
595#define GPIO204_MC4_DAT7 PIN_CFG(204, ALT_A)
596
597#define GPIO205_GPIO PIN_CFG(205, GPIO)
598#define GPIO205_MC4_DAT6 PIN_CFG(205, ALT_A)
599
600#define GPIO206_GPIO PIN_CFG(206, GPIO)
601#define GPIO206_MC4_DAT5 PIN_CFG(206, ALT_A)
602
603#define GPIO207_GPIO PIN_CFG(207, GPIO)
604#define GPIO207_MC4_DAT4 PIN_CFG(207, ALT_A)
605
606#define GPIO208_GPIO PIN_CFG(208, GPIO)
607#define GPIO208_MC1_CLK PIN_CFG(208, ALT_A)
608
609#define GPIO209_GPIO PIN_CFG(209, GPIO)
610#define GPIO209_MC1_FBCLK PIN_CFG(209, ALT_A)
611#define GPIO209_SPI1_CLK PIN_CFG(209, ALT_B)
612
613#define GPIO210_GPIO PIN_CFG(210, GPIO)
614#define GPIO210_MC1_CMD PIN_CFG(210, ALT_A)
615
616#define GPIO211_GPIO PIN_CFG(211, GPIO)
617#define GPIO211_MC1_DAT0 PIN_CFG(211, ALT_A)
618
619#define GPIO212_GPIO PIN_CFG(212, GPIO)
620#define GPIO212_MC1_DAT1 PIN_CFG(212, ALT_A)
621#define GPIO212_SPI1_FRM PIN_CFG(212, ALT_B)
622
623#define GPIO213_GPIO PIN_CFG(213, GPIO)
624#define GPIO213_MC1_DAT2 PIN_CFG(213, ALT_A)
625#define GPIO213_SPI1_TXD PIN_CFG(213, ALT_B)
626
627#define GPIO214_GPIO PIN_CFG(214, GPIO)
628#define GPIO214_MC1_DAT3 PIN_CFG(214, ALT_A)
629#define GPIO214_SPI1_RXD PIN_CFG(214, ALT_B)
630
631#define GPIO215_GPIO PIN_CFG(215, GPIO)
632#define GPIO215_MC1_CMDDIR PIN_CFG(215, ALT_A)
633#define GPIO215_MC3_DAT2DIR PIN_CFG(215, ALT_B)
634#define GPIO215_CLKOUT1 PIN_CFG(215, ALT_C)
635
636#define GPIO216_GPIO PIN_CFG(216, GPIO)
637#define GPIO216_MC1_DAT2DIR PIN_CFG(216, ALT_A)
638#define GPIO216_MC3_CMDDIR PIN_CFG(216, ALT_B)
639#define GPIO216_I2C3_SDA PIN_CFG_PULL(216, ALT_C, UP)
640
641#define GPIO217_GPIO PIN_CFG(217, GPIO)
642#define GPIO217_MC1_DAT0DIR PIN_CFG(217, ALT_A)
643#define GPIO217_MC3_DAT31DIR PIN_CFG(217, ALT_B)
644#define GPIO217_CLKOUT2 PIN_CFG(217, ALT_C)
645
646#define GPIO218_GPIO PIN_CFG(218, GPIO)
647#define GPIO218_MC1_DAT31DIR PIN_CFG(218, ALT_A)
648#define GPIO218_MC3_DAT0DIR PIN_CFG(218, ALT_B)
649#define GPIO218_I2C3_SCL PIN_CFG_PULL(218, ALT_C, UP)
650
651#define GPIO219_GPIO PIN_CFG(219, GPIO)
652#define GPIO219_HSIR_FLA0 PIN_CFG(219, ALT_A)
653#define GPIO219_MC3_CLK PIN_CFG(219, ALT_B)
654
655#define GPIO220_GPIO PIN_CFG(220, GPIO)
656#define GPIO220_HSIR_DAT0 PIN_CFG(220, ALT_A)
657#define GPIO220_MC3_FBCLK PIN_CFG(220, ALT_B)
658#define GPIO220_SPI0_CLK PIN_CFG(220, ALT_C)
659
660#define GPIO221_GPIO PIN_CFG(221, GPIO)
661#define GPIO221_HSIR_RDY0 PIN_CFG(221, ALT_A)
662#define GPIO221_MC3_CMD PIN_CFG(221, ALT_B)
663
664#define GPIO222_GPIO PIN_CFG(222, GPIO)
665#define GPIO222_HSIT_FLA0 PIN_CFG(222, ALT_A)
666#define GPIO222_MC3_DAT0 PIN_CFG(222, ALT_B)
667
668#define GPIO223_GPIO PIN_CFG(223, GPIO)
669#define GPIO223_HSIT_DAT0 PIN_CFG(223, ALT_A)
670#define GPIO223_MC3_DAT1 PIN_CFG(223, ALT_B)
671#define GPIO223_SPI0_FRM PIN_CFG(223, ALT_C)
672
673#define GPIO224_GPIO PIN_CFG(224, GPIO)
674#define GPIO224_HSIT_RDY0 PIN_CFG(224, ALT_A)
675#define GPIO224_MC3_DAT2 PIN_CFG(224, ALT_B)
676#define GPIO224_SPI0_TXD PIN_CFG(224, ALT_C)
677
678#define GPIO225_GPIO PIN_CFG(225, GPIO)
679#define GPIO225_HSIT_CAWAKE0 PIN_CFG(225, ALT_A)
680#define GPIO225_MC3_DAT3 PIN_CFG(225, ALT_B)
681#define GPIO225_SPI0_RXD PIN_CFG(225, ALT_C)
682
683#define GPIO226_GPIO PIN_CFG(226, GPIO)
684#define GPIO226_HSIT_ACWAKE0 PIN_CFG(226, ALT_A)
685#define GPIO226_PWL PIN_CFG(226, ALT_B)
686#define GPIO226_USBSIM_PDC PIN_CFG(226, ALT_C)
687
688#define GPIO227_GPIO PIN_CFG(227, GPIO)
689#define GPIO227_CLKOUT1 PIN_CFG(227, ALT_A)
690
691#define GPIO228_GPIO PIN_CFG(228, GPIO)
692#define GPIO228_CLKOUT2 PIN_CFG(228, ALT_A)
693
694#define GPIO229_GPIO PIN_CFG(229, GPIO)
695#define GPIO229_CLKOUT1 PIN_CFG(229, ALT_A)
696#define GPIO229_PWL PIN_CFG(229, ALT_B)
697#define GPIO229_I2C3_SDA PIN_CFG_PULL(229, ALT_C, UP)
698
699#define GPIO230_GPIO PIN_CFG(230, GPIO)
700#define GPIO230_CLKOUT2 PIN_CFG(230, ALT_A)
701#define GPIO230_PWL PIN_CFG(230, ALT_B)
702#define GPIO230_I2C3_SCL PIN_CFG_PULL(230, ALT_C, UP)
703
704#define GPIO256_GPIO PIN_CFG(256, GPIO)
705#define GPIO256_USB_NXT PIN_CFG(256, ALT_A)
706
707#define GPIO257_GPIO PIN_CFG(257, GPIO)
708#define GPIO257_USB_STP PIN_CFG(257, ALT_A)
709
710#define GPIO258_GPIO PIN_CFG(258, GPIO)
711#define GPIO258_USB_XCLK PIN_CFG(258, ALT_A)
712#define GPIO258_NONE PIN_CFG(258, ALT_B)
713#define GPIO258_DDR_TRIG PIN_CFG(258, ALT_C)
714
715#define GPIO259_GPIO PIN_CFG(259, GPIO)
716#define GPIO259_USB_DIR PIN_CFG(259, ALT_A)
717
718#define GPIO260_GPIO PIN_CFG(260, GPIO)
719#define GPIO260_USB_DAT7 PIN_CFG(260, ALT_A)
720
721#define GPIO261_GPIO PIN_CFG(261, GPIO)
722#define GPIO261_USB_DAT6 PIN_CFG(261, ALT_A)
723
724#define GPIO262_GPIO PIN_CFG(262, GPIO)
725#define GPIO262_USB_DAT5 PIN_CFG(262, ALT_A)
726
727#define GPIO263_GPIO PIN_CFG(263, GPIO)
728#define GPIO263_USB_DAT4 PIN_CFG(263, ALT_A)
729
730#define GPIO264_GPIO PIN_CFG(264, GPIO)
731#define GPIO264_USB_DAT3 PIN_CFG(264, ALT_A)
732
733#define GPIO265_GPIO PIN_CFG(265, GPIO)
734#define GPIO265_USB_DAT2 PIN_CFG(265, ALT_A)
735
736#define GPIO266_GPIO PIN_CFG(266, GPIO)
737#define GPIO266_USB_DAT1 PIN_CFG(266, ALT_A)
738
739#define GPIO267_GPIO PIN_CFG(267, GPIO)
740#define GPIO267_USB_DAT0 PIN_CFG(267, ALT_A)
741
742#endif
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 3dff8641b03f..e38acb0f89c8 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -28,6 +28,7 @@
28#include <linux/amba/clcd.h> 28#include <linux/amba/clcd.h>
29#include <linux/amba/pl061.h> 29#include <linux/amba/pl061.h>
30#include <linux/amba/mmci.h> 30#include <linux/amba/mmci.h>
31#include <linux/amba/pl022.h>
31#include <linux/io.h> 32#include <linux/io.h>
32#include <linux/gfp.h> 33#include <linux/gfp.h>
33 34
@@ -354,6 +355,21 @@ static struct mmci_platform_data mmc0_plat_data = {
354 .gpio_cd = -1, 355 .gpio_cd = -1,
355}; 356};
356 357
358static struct resource char_lcd_resources[] = {
359 {
360 .start = VERSATILE_CHAR_LCD_BASE,
361 .end = (VERSATILE_CHAR_LCD_BASE + SZ_4K - 1),
362 .flags = IORESOURCE_MEM,
363 },
364};
365
366static struct platform_device char_lcd_device = {
367 .name = "arm-charlcd",
368 .id = -1,
369 .num_resources = ARRAY_SIZE(char_lcd_resources),
370 .resource = char_lcd_resources,
371};
372
357/* 373/*
358 * Clock handling 374 * Clock handling
359 */ 375 */
@@ -400,8 +416,13 @@ static struct clk ref24_clk = {
400 .rate = 24000000, 416 .rate = 24000000,
401}; 417};
402 418
419static struct clk dummy_apb_pclk;
420
403static struct clk_lookup lookups[] = { 421static struct clk_lookup lookups[] = {
404 { /* UART0 */ 422 { /* AMBA bus clock */
423 .con_id = "apb_pclk",
424 .clk = &dummy_apb_pclk,
425 }, { /* UART0 */
405 .dev_id = "dev:f1", 426 .dev_id = "dev:f1",
406 .clk = &ref24_clk, 427 .clk = &ref24_clk,
407 }, { /* UART1 */ 428 }, { /* UART1 */
@@ -425,6 +446,9 @@ static struct clk_lookup lookups[] = {
425 }, { /* MMC1 */ 446 }, { /* MMC1 */
426 .dev_id = "fpga:0b", 447 .dev_id = "fpga:0b",
427 .clk = &ref24_clk, 448 .clk = &ref24_clk,
449 }, { /* SSP */
450 .dev_id = "dev:f4",
451 .clk = &ref24_clk,
428 }, { /* CLCD */ 452 }, { /* CLCD */
429 .dev_id = "dev:20", 453 .dev_id = "dev:20",
430 .clk = &osc4_clk, 454 .clk = &osc4_clk,
@@ -703,6 +727,12 @@ static struct pl061_platform_data gpio1_plat_data = {
703 .irq_base = IRQ_GPIO1_START, 727 .irq_base = IRQ_GPIO1_START,
704}; 728};
705 729
730static struct pl022_ssp_controller ssp0_plat_data = {
731 .bus_id = 0,
732 .enable_dma = 0,
733 .num_chipselect = 1,
734};
735
706#define AACI_IRQ { IRQ_AACI, NO_IRQ } 736#define AACI_IRQ { IRQ_AACI, NO_IRQ }
707#define AACI_DMA { 0x80, 0x81 } 737#define AACI_DMA { 0x80, 0x81 }
708#define MMCI0_IRQ { IRQ_MMCI0A,IRQ_SIC_MMCI0B } 738#define MMCI0_IRQ { IRQ_MMCI0A,IRQ_SIC_MMCI0B }
@@ -772,7 +802,7 @@ AMBA_DEVICE(sci0, "dev:f0", SCI, NULL);
772AMBA_DEVICE(uart0, "dev:f1", UART0, NULL); 802AMBA_DEVICE(uart0, "dev:f1", UART0, NULL);
773AMBA_DEVICE(uart1, "dev:f2", UART1, NULL); 803AMBA_DEVICE(uart1, "dev:f2", UART1, NULL);
774AMBA_DEVICE(uart2, "dev:f3", UART2, NULL); 804AMBA_DEVICE(uart2, "dev:f3", UART2, NULL);
775AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL); 805AMBA_DEVICE(ssp0, "dev:f4", SSP, &ssp0_plat_data);
776 806
777static struct amba_device *amba_devs[] __initdata = { 807static struct amba_device *amba_devs[] __initdata = {
778 &dmac_device, 808 &dmac_device,
@@ -843,6 +873,7 @@ void __init versatile_init(void)
843 platform_device_register(&versatile_flash_device); 873 platform_device_register(&versatile_flash_device);
844 platform_device_register(&versatile_i2c_device); 874 platform_device_register(&versatile_i2c_device);
845 platform_device_register(&smc91x_device); 875 platform_device_register(&smc91x_device);
876 platform_device_register(&char_lcd_device);
846 877
847 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 878 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
848 struct amba_device *d = amba_devs[i]; 879 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index 334f0df4e948..13c7e5f90a82 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -304,7 +304,7 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)
304} 304}
305 305
306 306
307struct pci_bus *pci_versatile_scan_bus(int nr, struct pci_sys_data *sys) 307struct pci_bus * __init pci_versatile_scan_bus(int nr, struct pci_sys_data *sys)
308{ 308{
309 return pci_scan_bus(sys->busnr, &pci_versatile_ops, sys); 309 return pci_scan_bus(sys->busnr, &pci_versatile_ops, sys);
310} 310}
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 6353459bb567..577df6cccb08 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -16,6 +16,7 @@
16#include <asm/hardware/gic.h> 16#include <asm/hardware/gic.h>
17#include <asm/mach-types.h> 17#include <asm/mach-types.h>
18#include <asm/pmu.h> 18#include <asm/pmu.h>
19#include <asm/smp_twd.h>
19 20
20#include <mach/clkdev.h> 21#include <mach/clkdev.h>
21#include <mach/ct-ca9x4.h> 22#include <mach/ct-ca9x4.h>
@@ -53,6 +54,7 @@ static struct map_desc ct_ca9x4_io_desc[] __initdata = {
53 54
54static void __init ct_ca9x4_map_io(void) 55static void __init ct_ca9x4_map_io(void)
55{ 56{
57 twd_base = MMIO_P2V(A9_MPCORE_TWD);
56 v2m_map_io(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc)); 58 v2m_map_io(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc));
57} 59}
58 60
diff --git a/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h b/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
index 8650f04136ef..f9e2f8d22962 100644
--- a/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
+++ b/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
@@ -28,6 +28,7 @@
28#define A9_MPCORE_SCU (CT_CA9X4_MPIC + 0x0000) 28#define A9_MPCORE_SCU (CT_CA9X4_MPIC + 0x0000)
29#define A9_MPCORE_GIC_CPU (CT_CA9X4_MPIC + 0x0100) 29#define A9_MPCORE_GIC_CPU (CT_CA9X4_MPIC + 0x0100)
30#define A9_MPCORE_GIT (CT_CA9X4_MPIC + 0x0200) 30#define A9_MPCORE_GIT (CT_CA9X4_MPIC + 0x0200)
31#define A9_MPCORE_TWD (CT_CA9X4_MPIC + 0x0600)
31#define A9_MPCORE_GIC_DIST (CT_CA9X4_MPIC + 0x1000) 32#define A9_MPCORE_GIC_DIST (CT_CA9X4_MPIC + 0x1000)
32 33
33/* 34/*
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index d250711b8c7a..d6db3453908b 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -298,8 +298,13 @@ static struct clk osc2_clk = {
298 .rate = 24000000, 298 .rate = 24000000,
299}; 299};
300 300
301static struct clk dummy_apb_pclk;
302
301static struct clk_lookup v2m_lookups[] = { 303static struct clk_lookup v2m_lookups[] = {
302 { /* UART0 */ 304 { /* AMBA bus clock */
305 .con_id = "apb_pclk",
306 .clk = &dummy_apb_pclk,
307 }, { /* UART0 */
303 .dev_id = "mb:uart0", 308 .dev_id = "mb:uart0",
304 .clk = &osc2_clk, 309 .clk = &osc2_clk,
305 }, { /* UART1 */ 310 }, { /* UART1 */
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index b2eda4dc1c34..7a1fa6adb7c3 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -36,6 +36,8 @@
36#include <mach/nuc900_spi.h> 36#include <mach/nuc900_spi.h>
37#include <mach/map.h> 37#include <mach/map.h>
38#include <mach/fb.h> 38#include <mach/fb.h>
39#include <mach/regs-ldm.h>
40#include <mach/w90p910_keypad.h>
39 41
40#include "cpu.h" 42#include "cpu.h"
41 43
@@ -207,7 +209,7 @@ static struct nuc900_spi_info nuc900_spiflash_data = {
207 .divider = 24, 209 .divider = 24,
208 .sleep = 0, 210 .sleep = 0,
209 .txnum = 0, 211 .txnum = 0,
210 .txbitlen = 1, 212 .txbitlen = 8,
211 .bus_num = 0, 213 .bus_num = 0,
212}; 214};
213 215
@@ -256,7 +258,7 @@ static struct spi_board_info nuc900_spi_board_info[] __initdata = {
256 .modalias = "m25p80", 258 .modalias = "m25p80",
257 .max_speed_hz = 20000000, 259 .max_speed_hz = 20000000,
258 .bus_num = 0, 260 .bus_num = 0,
259 .chip_select = 1, 261 .chip_select = 0,
260 .platform_data = &nuc900_spi_flash_data, 262 .platform_data = &nuc900_spi_flash_data,
261 .mode = SPI_MODE_0, 263 .mode = SPI_MODE_0,
262 }, 264 },
@@ -361,6 +363,39 @@ struct platform_device nuc900_device_fmi = {
361 363
362/* KPI controller*/ 364/* KPI controller*/
363 365
366static int nuc900_keymap[] = {
367 KEY(0, 0, KEY_A),
368 KEY(0, 1, KEY_B),
369 KEY(0, 2, KEY_C),
370 KEY(0, 3, KEY_D),
371
372 KEY(1, 0, KEY_E),
373 KEY(1, 1, KEY_F),
374 KEY(1, 2, KEY_G),
375 KEY(1, 3, KEY_H),
376
377 KEY(2, 0, KEY_I),
378 KEY(2, 1, KEY_J),
379 KEY(2, 2, KEY_K),
380 KEY(2, 3, KEY_L),
381
382 KEY(3, 0, KEY_M),
383 KEY(3, 1, KEY_N),
384 KEY(3, 2, KEY_O),
385 KEY(3, 3, KEY_P),
386};
387
388static struct matrix_keymap_data nuc900_map_data = {
389 .keymap = nuc900_keymap,
390 .keymap_size = ARRAY_SIZE(nuc900_keymap),
391};
392
393struct w90p910_keypad_platform_data nuc900_keypad_info = {
394 .keymap_data = &nuc900_map_data,
395 .prescale = 0xfa,
396 .debounce = 0x50,
397};
398
364static struct resource nuc900_kpi_resource[] = { 399static struct resource nuc900_kpi_resource[] = {
365 [0] = { 400 [0] = {
366 .start = W90X900_PA_KPI, 401 .start = W90X900_PA_KPI,
@@ -380,9 +415,49 @@ struct platform_device nuc900_device_kpi = {
380 .id = -1, 415 .id = -1,
381 .num_resources = ARRAY_SIZE(nuc900_kpi_resource), 416 .num_resources = ARRAY_SIZE(nuc900_kpi_resource),
382 .resource = nuc900_kpi_resource, 417 .resource = nuc900_kpi_resource,
418 .dev = {
419 .platform_data = &nuc900_keypad_info,
420 }
383}; 421};
384 422
385#ifdef CONFIG_FB_NUC900 423/* LCD controller*/
424
425static struct nuc900fb_display __initdata nuc900_lcd_info[] = {
426 /* Giantplus Technology GPM1040A0 320x240 Color TFT LCD */
427 [0] = {
428 .type = LCM_DCCS_VA_SRC_RGB565,
429 .width = 320,
430 .height = 240,
431 .xres = 320,
432 .yres = 240,
433 .bpp = 16,
434 .pixclock = 200000,
435 .left_margin = 34,
436 .right_margin = 54,
437 .hsync_len = 10,
438 .upper_margin = 18,
439 .lower_margin = 4,
440 .vsync_len = 1,
441 .dccs = 0x8e00041a,
442 .devctl = 0x060800c0,
443 .fbctrl = 0x00a000a0,
444 .scale = 0x04000400,
445 },
446};
447
448static struct nuc900fb_mach_info nuc900_fb_info __initdata = {
449#if defined(CONFIG_GPM1040A0_320X240)
450 .displays = &nuc900_lcd_info[0],
451#else
452 .displays = nuc900_lcd_info,
453#endif
454 .num_displays = ARRAY_SIZE(nuc900_lcd_info),
455 .default_display = 0,
456 .gpio_dir = 0x00000004,
457 .gpio_dir_mask = 0xFFFFFFFD,
458 .gpio_data = 0x00000004,
459 .gpio_data_mask = 0xFFFFFFFD,
460};
386 461
387static struct resource nuc900_lcd_resource[] = { 462static struct resource nuc900_lcd_resource[] = {
388 [0] = { 463 [0] = {
@@ -406,23 +481,10 @@ struct platform_device nuc900_device_lcd = {
406 .dev = { 481 .dev = {
407 .dma_mask = &nuc900_device_lcd_dmamask, 482 .dma_mask = &nuc900_device_lcd_dmamask,
408 .coherent_dma_mask = -1, 483 .coherent_dma_mask = -1,
484 .platform_data = &nuc900_fb_info,
409 } 485 }
410}; 486};
411 487
412void nuc900_fb_set_platdata(struct nuc900fb_mach_info *pd)
413{
414 struct nuc900fb_mach_info *npd;
415
416 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
417 if (npd) {
418 memcpy(npd, pd, sizeof(*npd));
419 nuc900_device_lcd.dev.platform_data = npd;
420 } else {
421 printk(KERN_ERR "no memory for LCD platform data\n");
422 }
423}
424#endif
425
426/* AUDIO controller*/ 488/* AUDIO controller*/
427static u64 nuc900_device_audio_dmamask = -1; 489static u64 nuc900_device_audio_dmamask = -1;
428static struct resource nuc900_ac97_resource[] = { 490static struct resource nuc900_ac97_resource[] = {
diff --git a/arch/arm/mach-w90x900/include/mach/regs-gcr.h b/arch/arm/mach-w90x900/include/mach/regs-gcr.h
new file mode 100644
index 000000000000..6087abd93ef5
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/regs-gcr.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/regs-gcr.h
3 *
4 * Copyright (c) 2010 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 */
15
16#ifndef __ASM_ARCH_REGS_GCR_H
17#define __ASM_ARCH_REGS_GCR_H
18
19/* Global control registers */
20
21#define GCR_BA W90X900_VA_GCR
22#define REG_PDID (GCR_BA+0x000)
23#define REG_PWRON (GCR_BA+0x004)
24#define REG_ARBCON (GCR_BA+0x008)
25#define REG_MFSEL (GCR_BA+0x00C)
26#define REG_EBIDPE (GCR_BA+0x010)
27#define REG_LCDDPE (GCR_BA+0x014)
28#define REG_GPIOCPE (GCR_BA+0x018)
29#define REG_GPIODPE (GCR_BA+0x01C)
30#define REG_GPIOEPE (GCR_BA+0x020)
31#define REG_GPIOFPE (GCR_BA+0x024)
32#define REG_GPIOGPE (GCR_BA+0x028)
33#define REG_GPIOHPE (GCR_BA+0x02C)
34#define REG_GPIOIPE (GCR_BA+0x030)
35#define REG_GTMP1 (GCR_BA+0x034)
36#define REG_GTMP2 (GCR_BA+0x038)
37#define REG_GTMP3 (GCR_BA+0x03C)
38
39#endif /* __ASM_ARCH_REGS_GCR_H */
diff --git a/arch/arm/mach-w90x900/mach-nuc950evb.c b/arch/arm/mach-w90x900/mach-nuc950evb.c
index b3edc3cccf52..04d295f89eb0 100644
--- a/arch/arm/mach-w90x900/mach-nuc950evb.c
+++ b/arch/arm/mach-w90x900/mach-nuc950evb.c
@@ -20,51 +20,10 @@
20#include <asm/mach/map.h> 20#include <asm/mach/map.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <mach/map.h> 22#include <mach/map.h>
23#include <mach/regs-ldm.h>
24#include <mach/fb.h> 23#include <mach/fb.h>
25 24
26#include "nuc950.h" 25#include "nuc950.h"
27 26
28#ifdef CONFIG_FB_NUC900
29/* LCD Controller */
30static struct nuc900fb_display __initdata nuc950_lcd_info[] = {
31 /* Giantplus Technology GPM1040A0 320x240 Color TFT LCD */
32 [0] = {
33 .type = LCM_DCCS_VA_SRC_RGB565,
34 .width = 320,
35 .height = 240,
36 .xres = 320,
37 .yres = 240,
38 .bpp = 16,
39 .pixclock = 200000,
40 .left_margin = 34,
41 .right_margin = 54,
42 .hsync_len = 10,
43 .upper_margin = 18,
44 .lower_margin = 4,
45 .vsync_len = 1,
46 .dccs = 0x8e00041a,
47 .devctl = 0x060800c0,
48 .fbctrl = 0x00a000a0,
49 .scale = 0x04000400,
50 },
51};
52
53static struct nuc900fb_mach_info nuc950_fb_info __initdata = {
54#if defined(CONFIG_GPM1040A0_320X240)
55 .displays = &nuc950_lcd_info[0],
56#else
57 .displays = nuc950_lcd_info,
58#endif
59 .num_displays = ARRAY_SIZE(nuc950_lcd_info),
60 .default_display = 0,
61 .gpio_dir = 0x00000004,
62 .gpio_dir_mask = 0xFFFFFFFD,
63 .gpio_data = 0x00000004,
64 .gpio_data_mask = 0xFFFFFFFD,
65};
66#endif
67
68static void __init nuc950evb_map_io(void) 27static void __init nuc950evb_map_io(void)
69{ 28{
70 nuc950_map_io(); 29 nuc950_map_io();
@@ -74,9 +33,6 @@ static void __init nuc950evb_map_io(void)
74static void __init nuc950evb_init(void) 33static void __init nuc950evb_init(void)
75{ 34{
76 nuc950_board_init(); 35 nuc950_board_init();
77#ifdef CONFIG_FB_NUC900
78 nuc900_fb_set_platdata(&nuc950_fb_info);
79#endif
80} 36}
81 37
82MACHINE_START(W90P950EVB, "W90P950EVB") 38MACHINE_START(W90P950EVB, "W90P950EVB")
diff --git a/arch/arm/mach-w90x900/nuc910.c b/arch/arm/mach-w90x900/nuc910.c
index 656f03b3b629..1523f4136985 100644
--- a/arch/arm/mach-w90x900/nuc910.c
+++ b/arch/arm/mach-w90x900/nuc910.c
@@ -26,6 +26,8 @@
26static struct platform_device *nuc910_dev[] __initdata = { 26static struct platform_device *nuc910_dev[] __initdata = {
27 &nuc900_device_ts, 27 &nuc900_device_ts,
28 &nuc900_device_rtc, 28 &nuc900_device_rtc,
29 &nuc900_device_lcd,
30 &nuc900_device_kpi,
29}; 31};
30 32
31/* define specific CPU platform io map */ 33/* define specific CPU platform io map */
diff --git a/arch/arm/mach-w90x900/nuc950.c b/arch/arm/mach-w90x900/nuc950.c
index 4d1f1ab044c4..5704f74a50ee 100644
--- a/arch/arm/mach-w90x900/nuc950.c
+++ b/arch/arm/mach-w90x900/nuc950.c
@@ -26,9 +26,7 @@
26static struct platform_device *nuc950_dev[] __initdata = { 26static struct platform_device *nuc950_dev[] __initdata = {
27 &nuc900_device_kpi, 27 &nuc900_device_kpi,
28 &nuc900_device_fmi, 28 &nuc900_device_fmi,
29#ifdef CONFIG_FB_NUC900
30 &nuc900_device_lcd, 29 &nuc900_device_lcd,
31#endif
32}; 30};
33 31
34/* define specific CPU platform io map */ 32/* define specific CPU platform io map */
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 101105e52610..87ec141fcaa6 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -717,17 +717,6 @@ config TLS_REG_EMUL
717 a few prototypes like that in existence) and therefore access to 717 a few prototypes like that in existence) and therefore access to
718 that required register must be emulated. 718 that required register must be emulated.
719 719
720config HAS_TLS_REG
721 bool
722 depends on !TLS_REG_EMUL
723 default y if SMP || CPU_32v7
724 help
725 This selects support for the CP15 thread register.
726 It is defined to be available on some ARMv6 processors (including
727 all SMP capable ARMv6's) or later processors. User space may
728 assume directly accessing that register and always obtain the
729 expected value only on ARMv7 and above.
730
731config NEEDS_SYSCALL_FOR_CMPXCHG 720config NEEDS_SYSCALL_FOR_CMPXCHG
732 bool 721 bool
733 help 722 help
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index e8d34a80851c..d63b6c413758 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -15,7 +15,6 @@ endif
15obj-$(CONFIG_MODULES) += proc-syms.o 15obj-$(CONFIG_MODULES) += proc-syms.o
16 16
17obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o 17obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o
18obj-$(CONFIG_DISCONTIGMEM) += discontig.o
19obj-$(CONFIG_HIGHMEM) += highmem.o 18obj-$(CONFIG_HIGHMEM) += highmem.o
20 19
21obj-$(CONFIG_CPU_ABRT_NOMMU) += abort-nommu.o 20obj-$(CONFIG_CPU_ABRT_NOMMU) += abort-nommu.o
diff --git a/arch/arm/mm/discontig.c b/arch/arm/mm/discontig.c
deleted file mode 100644
index c8c0c4b0f0a3..000000000000
--- a/arch/arm/mm/discontig.c
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * linux/arch/arm/mm/discontig.c
3 *
4 * Discontiguous memory support.
5 *
6 * Initial code: Copyright (C) 1999-2000 Nicolas Pitre
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#include <linux/module.h>
13#include <linux/mmzone.h>
14#include <linux/bootmem.h>
15
16#if MAX_NUMNODES != 4 && MAX_NUMNODES != 16
17# error Fix Me Please
18#endif
19
20/*
21 * Our node_data structure for discontiguous memory.
22 */
23
24pg_data_t discontig_node_data[MAX_NUMNODES] = {
25 { .bdata = &bootmem_node_data[0] },
26 { .bdata = &bootmem_node_data[1] },
27 { .bdata = &bootmem_node_data[2] },
28 { .bdata = &bootmem_node_data[3] },
29#if MAX_NUMNODES == 16
30 { .bdata = &bootmem_node_data[4] },
31 { .bdata = &bootmem_node_data[5] },
32 { .bdata = &bootmem_node_data[6] },
33 { .bdata = &bootmem_node_data[7] },
34 { .bdata = &bootmem_node_data[8] },
35 { .bdata = &bootmem_node_data[9] },
36 { .bdata = &bootmem_node_data[10] },
37 { .bdata = &bootmem_node_data[11] },
38 { .bdata = &bootmem_node_data[12] },
39 { .bdata = &bootmem_node_data[13] },
40 { .bdata = &bootmem_node_data[14] },
41 { .bdata = &bootmem_node_data[15] },
42#endif
43};
44
45EXPORT_SYMBOL(discontig_node_data);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index f6a999465323..599d121c81e7 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -17,6 +17,7 @@
17#include <linux/initrd.h> 17#include <linux/initrd.h>
18#include <linux/highmem.h> 18#include <linux/highmem.h>
19#include <linux/gfp.h> 19#include <linux/gfp.h>
20#include <linux/memblock.h>
20 21
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
22#include <asm/sections.h> 23#include <asm/sections.h>
@@ -79,38 +80,37 @@ struct meminfo meminfo;
79void show_mem(void) 80void show_mem(void)
80{ 81{
81 int free = 0, total = 0, reserved = 0; 82 int free = 0, total = 0, reserved = 0;
82 int shared = 0, cached = 0, slab = 0, node, i; 83 int shared = 0, cached = 0, slab = 0, i;
83 struct meminfo * mi = &meminfo; 84 struct meminfo * mi = &meminfo;
84 85
85 printk("Mem-info:\n"); 86 printk("Mem-info:\n");
86 show_free_areas(); 87 show_free_areas();
87 for_each_online_node(node) { 88
88 for_each_nodebank (i,mi,node) { 89 for_each_bank (i, mi) {
89 struct membank *bank = &mi->bank[i]; 90 struct membank *bank = &mi->bank[i];
90 unsigned int pfn1, pfn2; 91 unsigned int pfn1, pfn2;
91 struct page *page, *end; 92 struct page *page, *end;
92 93
93 pfn1 = bank_pfn_start(bank); 94 pfn1 = bank_pfn_start(bank);
94 pfn2 = bank_pfn_end(bank); 95 pfn2 = bank_pfn_end(bank);
95 96
96 page = pfn_to_page(pfn1); 97 page = pfn_to_page(pfn1);
97 end = pfn_to_page(pfn2 - 1) + 1; 98 end = pfn_to_page(pfn2 - 1) + 1;
98 99
99 do { 100 do {
100 total++; 101 total++;
101 if (PageReserved(page)) 102 if (PageReserved(page))
102 reserved++; 103 reserved++;
103 else if (PageSwapCache(page)) 104 else if (PageSwapCache(page))
104 cached++; 105 cached++;
105 else if (PageSlab(page)) 106 else if (PageSlab(page))
106 slab++; 107 slab++;
107 else if (!page_count(page)) 108 else if (!page_count(page))
108 free++; 109 free++;
109 else 110 else
110 shared += page_count(page) - 1; 111 shared += page_count(page) - 1;
111 page++; 112 page++;
112 } while (page < end); 113 } while (page < end);
113 }
114 } 114 }
115 115
116 printk("%d pages of RAM\n", total); 116 printk("%d pages of RAM\n", total);
@@ -121,7 +121,7 @@ void show_mem(void)
121 printk("%d pages swap cached\n", cached); 121 printk("%d pages swap cached\n", cached);
122} 122}
123 123
124static void __init find_node_limits(int node, struct meminfo *mi, 124static void __init find_limits(struct meminfo *mi,
125 unsigned long *min, unsigned long *max_low, unsigned long *max_high) 125 unsigned long *min, unsigned long *max_low, unsigned long *max_high)
126{ 126{
127 int i; 127 int i;
@@ -129,7 +129,7 @@ static void __init find_node_limits(int node, struct meminfo *mi,
129 *min = -1UL; 129 *min = -1UL;
130 *max_low = *max_high = 0; 130 *max_low = *max_high = 0;
131 131
132 for_each_nodebank(i, mi, node) { 132 for_each_bank (i, mi) {
133 struct membank *bank = &mi->bank[i]; 133 struct membank *bank = &mi->bank[i];
134 unsigned long start, end; 134 unsigned long start, end;
135 135
@@ -147,155 +147,64 @@ static void __init find_node_limits(int node, struct meminfo *mi,
147 } 147 }
148} 148}
149 149
150/* 150static void __init arm_bootmem_init(struct meminfo *mi,
151 * FIXME: We really want to avoid allocating the bootmap bitmap
152 * over the top of the initrd. Hopefully, this is located towards
153 * the start of a bank, so if we allocate the bootmap bitmap at
154 * the end, we won't clash.
155 */
156static unsigned int __init
157find_bootmap_pfn(int node, struct meminfo *mi, unsigned int bootmap_pages)
158{
159 unsigned int start_pfn, i, bootmap_pfn;
160
161 start_pfn = PAGE_ALIGN(__pa(_end)) >> PAGE_SHIFT;
162 bootmap_pfn = 0;
163
164 for_each_nodebank(i, mi, node) {
165 struct membank *bank = &mi->bank[i];
166 unsigned int start, end;
167
168 start = bank_pfn_start(bank);
169 end = bank_pfn_end(bank);
170
171 if (end < start_pfn)
172 continue;
173
174 if (start < start_pfn)
175 start = start_pfn;
176
177 if (end <= start)
178 continue;
179
180 if (end - start >= bootmap_pages) {
181 bootmap_pfn = start;
182 break;
183 }
184 }
185
186 if (bootmap_pfn == 0)
187 BUG();
188
189 return bootmap_pfn;
190}
191
192static int __init check_initrd(struct meminfo *mi)
193{
194 int initrd_node = -2;
195#ifdef CONFIG_BLK_DEV_INITRD
196 unsigned long end = phys_initrd_start + phys_initrd_size;
197
198 /*
199 * Make sure that the initrd is within a valid area of
200 * memory.
201 */
202 if (phys_initrd_size) {
203 unsigned int i;
204
205 initrd_node = -1;
206
207 for (i = 0; i < mi->nr_banks; i++) {
208 struct membank *bank = &mi->bank[i];
209 if (bank_phys_start(bank) <= phys_initrd_start &&
210 end <= bank_phys_end(bank))
211 initrd_node = bank->node;
212 }
213 }
214
215 if (initrd_node == -1) {
216 printk(KERN_ERR "INITRD: 0x%08lx+0x%08lx extends beyond "
217 "physical memory - disabling initrd\n",
218 phys_initrd_start, phys_initrd_size);
219 phys_initrd_start = phys_initrd_size = 0;
220 }
221#endif
222
223 return initrd_node;
224}
225
226static void __init bootmem_init_node(int node, struct meminfo *mi,
227 unsigned long start_pfn, unsigned long end_pfn) 151 unsigned long start_pfn, unsigned long end_pfn)
228{ 152{
229 unsigned long boot_pfn;
230 unsigned int boot_pages; 153 unsigned int boot_pages;
154 phys_addr_t bitmap;
231 pg_data_t *pgdat; 155 pg_data_t *pgdat;
232 int i; 156 int i;
233 157
234 /* 158 /*
235 * Allocate the bootmem bitmap page. 159 * Allocate the bootmem bitmap page. This must be in a region
160 * of memory which has already been mapped.
236 */ 161 */
237 boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); 162 boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
238 boot_pfn = find_bootmap_pfn(node, mi, boot_pages); 163 bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES,
164 __pfn_to_phys(end_pfn));
239 165
240 /* 166 /*
241 * Initialise the bootmem allocator for this node, handing the 167 * Initialise the bootmem allocator, handing the
242 * memory banks over to bootmem. 168 * memory banks over to bootmem.
243 */ 169 */
244 node_set_online(node); 170 node_set_online(0);
245 pgdat = NODE_DATA(node); 171 pgdat = NODE_DATA(0);
246 init_bootmem_node(pgdat, boot_pfn, start_pfn, end_pfn); 172 init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
247 173
248 for_each_nodebank(i, mi, node) { 174 for_each_bank(i, mi) {
249 struct membank *bank = &mi->bank[i]; 175 struct membank *bank = &mi->bank[i];
250 if (!bank->highmem) 176 if (!bank->highmem)
251 free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); 177 free_bootmem(bank_phys_start(bank), bank_phys_size(bank));
252 } 178 }
253 179
254 /* 180 /*
255 * Reserve the bootmem bitmap for this node. 181 * Reserve the memblock reserved regions in bootmem.
256 */ 182 */
257 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, 183 for (i = 0; i < memblock.reserved.cnt; i++) {
258 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); 184 phys_addr_t start = memblock_start_pfn(&memblock.reserved, i);
259} 185 if (start >= start_pfn &&
260 186 memblock_end_pfn(&memblock.reserved, i) <= end_pfn)
261static void __init bootmem_reserve_initrd(int node) 187 reserve_bootmem_node(pgdat, __pfn_to_phys(start),
262{ 188 memblock_size_bytes(&memblock.reserved, i),
263#ifdef CONFIG_BLK_DEV_INITRD 189 BOOTMEM_DEFAULT);
264 pg_data_t *pgdat = NODE_DATA(node);
265 int res;
266
267 res = reserve_bootmem_node(pgdat, phys_initrd_start,
268 phys_initrd_size, BOOTMEM_EXCLUSIVE);
269
270 if (res == 0) {
271 initrd_start = __phys_to_virt(phys_initrd_start);
272 initrd_end = initrd_start + phys_initrd_size;
273 } else {
274 printk(KERN_ERR
275 "INITRD: 0x%08lx+0x%08lx overlaps in-use "
276 "memory region - disabling initrd\n",
277 phys_initrd_start, phys_initrd_size);
278 } 190 }
279#endif
280} 191}
281 192
282static void __init bootmem_free_node(int node, struct meminfo *mi) 193static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min,
194 unsigned long max_low, unsigned long max_high)
283{ 195{
284 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; 196 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
285 unsigned long min, max_low, max_high;
286 int i; 197 int i;
287 198
288 find_node_limits(node, mi, &min, &max_low, &max_high);
289
290 /* 199 /*
291 * initialise the zones within this node. 200 * initialise the zones.
292 */ 201 */
293 memset(zone_size, 0, sizeof(zone_size)); 202 memset(zone_size, 0, sizeof(zone_size));
294 203
295 /* 204 /*
296 * The size of this node has already been determined. If we need 205 * The memory size has already been determined. If we need
297 * to do anything fancy with the allocation of this memory to the 206 * to do anything fancy with the allocation of this memory
298 * zones, now is the time to do it. 207 * to the zones, now is the time to do it.
299 */ 208 */
300 zone_size[0] = max_low - min; 209 zone_size[0] = max_low - min;
301#ifdef CONFIG_HIGHMEM 210#ifdef CONFIG_HIGHMEM
@@ -303,11 +212,11 @@ static void __init bootmem_free_node(int node, struct meminfo *mi)
303#endif 212#endif
304 213
305 /* 214 /*
306 * For each bank in this node, calculate the size of the holes. 215 * Calculate the size of the holes.
307 * holes = node_size - sum(bank_sizes_in_node) 216 * holes = node_size - sum(bank_sizes)
308 */ 217 */
309 memcpy(zhole_size, zone_size, sizeof(zhole_size)); 218 memcpy(zhole_size, zone_size, sizeof(zhole_size));
310 for_each_nodebank(i, mi, node) { 219 for_each_bank(i, mi) {
311 int idx = 0; 220 int idx = 0;
312#ifdef CONFIG_HIGHMEM 221#ifdef CONFIG_HIGHMEM
313 if (mi->bank[i].highmem) 222 if (mi->bank[i].highmem)
@@ -320,24 +229,23 @@ static void __init bootmem_free_node(int node, struct meminfo *mi)
320 * Adjust the sizes according to any special requirements for 229 * Adjust the sizes according to any special requirements for
321 * this machine type. 230 * this machine type.
322 */ 231 */
323 arch_adjust_zones(node, zone_size, zhole_size); 232 arch_adjust_zones(zone_size, zhole_size);
324 233
325 free_area_init_node(node, zone_size, min, zhole_size); 234 free_area_init_node(0, zone_size, min, zhole_size);
326} 235}
327 236
328#ifndef CONFIG_SPARSEMEM 237#ifndef CONFIG_SPARSEMEM
329int pfn_valid(unsigned long pfn) 238int pfn_valid(unsigned long pfn)
330{ 239{
331 struct meminfo *mi = &meminfo; 240 struct memblock_region *mem = &memblock.memory;
332 unsigned int left = 0, right = mi->nr_banks; 241 unsigned int left = 0, right = mem->cnt;
333 242
334 do { 243 do {
335 unsigned int mid = (right + left) / 2; 244 unsigned int mid = (right + left) / 2;
336 struct membank *bank = &mi->bank[mid];
337 245
338 if (pfn < bank_pfn_start(bank)) 246 if (pfn < memblock_start_pfn(mem, mid))
339 right = mid; 247 right = mid;
340 else if (pfn >= bank_pfn_end(bank)) 248 else if (pfn >= memblock_end_pfn(mem, mid))
341 left = mid + 1; 249 left = mid + 1;
342 else 250 else
343 return 1; 251 return 1;
@@ -346,73 +254,69 @@ int pfn_valid(unsigned long pfn)
346} 254}
347EXPORT_SYMBOL(pfn_valid); 255EXPORT_SYMBOL(pfn_valid);
348 256
349static void arm_memory_present(struct meminfo *mi, int node) 257static void arm_memory_present(void)
350{ 258{
351} 259}
352#else 260#else
353static void arm_memory_present(struct meminfo *mi, int node) 261static void arm_memory_present(void)
354{ 262{
355 int i; 263 int i;
356 for_each_nodebank(i, mi, node) { 264 for (i = 0; i < memblock.memory.cnt; i++)
357 struct membank *bank = &mi->bank[i]; 265 memory_present(0, memblock_start_pfn(&memblock.memory, i),
358 memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank)); 266 memblock_end_pfn(&memblock.memory, i));
359 }
360} 267}
361#endif 268#endif
362 269
363void __init bootmem_init(void) 270void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
364{ 271{
365 struct meminfo *mi = &meminfo; 272 int i;
366 unsigned long min, max_low, max_high;
367 int node, initrd_node;
368 273
369 /* 274 memblock_init();
370 * Locate which node contains the ramdisk image, if any. 275 for (i = 0; i < mi->nr_banks; i++)
371 */ 276 memblock_add(mi->bank[i].start, mi->bank[i].size);
372 initrd_node = check_initrd(mi);
373 277
374 max_low = max_high = 0; 278 /* Register the kernel text, kernel data and initrd with memblock. */
279#ifdef CONFIG_XIP_KERNEL
280 memblock_reserve(__pa(_data), _end - _data);
281#else
282 memblock_reserve(__pa(_stext), _end - _stext);
283#endif
284#ifdef CONFIG_BLK_DEV_INITRD
285 if (phys_initrd_size) {
286 memblock_reserve(phys_initrd_start, phys_initrd_size);
375 287
376 /* 288 /* Now convert initrd to virtual addresses */
377 * Run through each node initialising the bootmem allocator. 289 initrd_start = __phys_to_virt(phys_initrd_start);
378 */ 290 initrd_end = initrd_start + phys_initrd_size;
379 for_each_node(node) { 291 }
380 unsigned long node_low, node_high; 292#endif
381 293
382 find_node_limits(node, mi, &min, &node_low, &node_high); 294 arm_mm_memblock_reserve();
383 295
384 if (node_low > max_low) 296 /* reserve any platform specific memblock areas */
385 max_low = node_low; 297 if (mdesc->reserve)
386 if (node_high > max_high) 298 mdesc->reserve();
387 max_high = node_high;
388 299
389 /* 300 memblock_analyze();
390 * If there is no memory in this node, ignore it. 301 memblock_dump_all();
391 * (We can't have nodes which have no lowmem) 302}
392 */
393 if (node_low == 0)
394 continue;
395 303
396 bootmem_init_node(node, mi, min, node_low); 304void __init bootmem_init(void)
305{
306 struct meminfo *mi = &meminfo;
307 unsigned long min, max_low, max_high;
397 308
398 /* 309 max_low = max_high = 0;
399 * Reserve any special node zero regions.
400 */
401 if (node == 0)
402 reserve_node_zero(NODE_DATA(node));
403 310
404 /* 311 find_limits(mi, &min, &max_low, &max_high);
405 * If the initrd is in this node, reserve its memory.
406 */
407 if (node == initrd_node)
408 bootmem_reserve_initrd(node);
409 312
410 /* 313 arm_bootmem_init(mi, min, max_low);
411 * Sparsemem tries to allocate bootmem in memory_present(), 314
412 * so must be done after the fixed reservations 315 /*
413 */ 316 * Sparsemem tries to allocate bootmem in memory_present(),
414 arm_memory_present(mi, node); 317 * so must be done after the fixed reservations
415 } 318 */
319 arm_memory_present();
416 320
417 /* 321 /*
418 * sparse_init() needs the bootmem allocator up and running. 322 * sparse_init() needs the bootmem allocator up and running.
@@ -420,12 +324,11 @@ void __init bootmem_init(void)
420 sparse_init(); 324 sparse_init();
421 325
422 /* 326 /*
423 * Now free memory in each node - free_area_init_node needs 327 * Now free the memory - free_area_init_node needs
424 * the sparse mem_map arrays initialized by sparse_init() 328 * the sparse mem_map arrays initialized by sparse_init()
425 * for memmap_init_zone(), otherwise all PFNs are invalid. 329 * for memmap_init_zone(), otherwise all PFNs are invalid.
426 */ 330 */
427 for_each_node(node) 331 arm_bootmem_free(mi, min, max_low, max_high);
428 bootmem_free_node(node, mi);
429 332
430 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1; 333 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1;
431 334
@@ -460,7 +363,7 @@ static inline int free_area(unsigned long pfn, unsigned long end, char *s)
460} 363}
461 364
462static inline void 365static inline void
463free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn) 366free_memmap(unsigned long start_pfn, unsigned long end_pfn)
464{ 367{
465 struct page *start_pg, *end_pg; 368 struct page *start_pg, *end_pg;
466 unsigned long pg, pgend; 369 unsigned long pg, pgend;
@@ -483,13 +386,13 @@ free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn)
483 * free the section of the memmap array. 386 * free the section of the memmap array.
484 */ 387 */
485 if (pg < pgend) 388 if (pg < pgend)
486 free_bootmem_node(NODE_DATA(node), pg, pgend - pg); 389 free_bootmem(pg, pgend - pg);
487} 390}
488 391
489/* 392/*
490 * The mem_map array can get very big. Free the unused area of the memory map. 393 * The mem_map array can get very big. Free the unused area of the memory map.
491 */ 394 */
492static void __init free_unused_memmap_node(int node, struct meminfo *mi) 395static void __init free_unused_memmap(struct meminfo *mi)
493{ 396{
494 unsigned long bank_start, prev_bank_end = 0; 397 unsigned long bank_start, prev_bank_end = 0;
495 unsigned int i; 398 unsigned int i;
@@ -499,7 +402,7 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
499 * may not be the case, especially if the user has provided the 402 * may not be the case, especially if the user has provided the
500 * information on the command line. 403 * information on the command line.
501 */ 404 */
502 for_each_nodebank(i, mi, node) { 405 for_each_bank(i, mi) {
503 struct membank *bank = &mi->bank[i]; 406 struct membank *bank = &mi->bank[i];
504 407
505 bank_start = bank_pfn_start(bank); 408 bank_start = bank_pfn_start(bank);
@@ -514,7 +417,7 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
514 * between the current bank and the previous, free it. 417 * between the current bank and the previous, free it.
515 */ 418 */
516 if (prev_bank_end && prev_bank_end != bank_start) 419 if (prev_bank_end && prev_bank_end != bank_start)
517 free_memmap(node, prev_bank_end, bank_start); 420 free_memmap(prev_bank_end, bank_start);
518 421
519 prev_bank_end = bank_pfn_end(bank); 422 prev_bank_end = bank_pfn_end(bank);
520 } 423 }
@@ -528,21 +431,14 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
528void __init mem_init(void) 431void __init mem_init(void)
529{ 432{
530 unsigned long reserved_pages, free_pages; 433 unsigned long reserved_pages, free_pages;
531 int i, node; 434 int i;
532 435
533#ifndef CONFIG_DISCONTIGMEM
534 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 436 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
535#endif
536 437
537 /* this will put all unused low memory onto the freelists */ 438 /* this will put all unused low memory onto the freelists */
538 for_each_online_node(node) { 439 free_unused_memmap(&meminfo);
539 pg_data_t *pgdat = NODE_DATA(node);
540
541 free_unused_memmap_node(node, &meminfo);
542 440
543 if (pgdat->node_spanned_pages != 0) 441 totalram_pages += free_all_bootmem();
544 totalram_pages += free_all_bootmem_node(pgdat);
545 }
546 442
547#ifdef CONFIG_SA1111 443#ifdef CONFIG_SA1111
548 /* now that our DMA memory is actually so designated, we can free it */ 444 /* now that our DMA memory is actually so designated, we can free it */
@@ -552,39 +448,35 @@ void __init mem_init(void)
552 448
553#ifdef CONFIG_HIGHMEM 449#ifdef CONFIG_HIGHMEM
554 /* set highmem page free */ 450 /* set highmem page free */
555 for_each_online_node(node) { 451 for_each_bank (i, &meminfo) {
556 for_each_nodebank (i, &meminfo, node) { 452 unsigned long start = bank_pfn_start(&meminfo.bank[i]);
557 unsigned long start = bank_pfn_start(&meminfo.bank[i]); 453 unsigned long end = bank_pfn_end(&meminfo.bank[i]);
558 unsigned long end = bank_pfn_end(&meminfo.bank[i]); 454 if (start >= max_low_pfn + PHYS_PFN_OFFSET)
559 if (start >= max_low_pfn + PHYS_PFN_OFFSET) 455 totalhigh_pages += free_area(start, end, NULL);
560 totalhigh_pages += free_area(start, end, NULL);
561 }
562 } 456 }
563 totalram_pages += totalhigh_pages; 457 totalram_pages += totalhigh_pages;
564#endif 458#endif
565 459
566 reserved_pages = free_pages = 0; 460 reserved_pages = free_pages = 0;
567 461
568 for_each_online_node(node) { 462 for_each_bank(i, &meminfo) {
569 for_each_nodebank(i, &meminfo, node) { 463 struct membank *bank = &meminfo.bank[i];
570 struct membank *bank = &meminfo.bank[i]; 464 unsigned int pfn1, pfn2;
571 unsigned int pfn1, pfn2; 465 struct page *page, *end;
572 struct page *page, *end; 466
573 467 pfn1 = bank_pfn_start(bank);
574 pfn1 = bank_pfn_start(bank); 468 pfn2 = bank_pfn_end(bank);
575 pfn2 = bank_pfn_end(bank); 469
576 470 page = pfn_to_page(pfn1);
577 page = pfn_to_page(pfn1); 471 end = pfn_to_page(pfn2 - 1) + 1;
578 end = pfn_to_page(pfn2 - 1) + 1; 472
579 473 do {
580 do { 474 if (PageReserved(page))
581 if (PageReserved(page)) 475 reserved_pages++;
582 reserved_pages++; 476 else if (!page_count(page))
583 else if (!page_count(page)) 477 free_pages++;
584 free_pages++; 478 page++;
585 page++; 479 } while (page < end);
586 } while (page < end);
587 }
588 } 480 }
589 481
590 /* 482 /*
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 28c8b950ef04..03f11935ed08 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -268,6 +268,12 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
268 if (pfn >= 0x100000 && (__pfn_to_phys(pfn) & ~SUPERSECTION_MASK)) 268 if (pfn >= 0x100000 && (__pfn_to_phys(pfn) & ~SUPERSECTION_MASK))
269 return NULL; 269 return NULL;
270 270
271 /*
272 * Don't allow RAM to be mapped - this causes problems with ARMv6+
273 */
274 if (WARN_ON(pfn_valid(pfn)))
275 return NULL;
276
271 type = get_mem_type(mtype); 277 type = get_mem_type(mtype);
272 if (!type) 278 if (!type)
273 return NULL; 279 return NULL;
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index 815d08eecbb0..6630620380a4 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -28,7 +28,5 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
28 28
29#endif 29#endif
30 30
31struct pglist_data;
32
33void __init bootmem_init(void); 31void __init bootmem_init(void);
34void reserve_node_zero(struct pglist_data *pgdat); 32void arm_mm_memblock_reserve(void);
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 285894171186..d5541adc3520 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -11,13 +11,12 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/bootmem.h>
15#include <linux/mman.h> 14#include <linux/mman.h>
16#include <linux/nodemask.h> 15#include <linux/nodemask.h>
16#include <linux/memblock.h>
17#include <linux/sort.h> 17#include <linux/sort.h>
18 18
19#include <asm/cputype.h> 19#include <asm/cputype.h>
20#include <asm/mach-types.h>
21#include <asm/sections.h> 20#include <asm/sections.h>
22#include <asm/cachetype.h> 21#include <asm/cachetype.h>
23#include <asm/setup.h> 22#include <asm/setup.h>
@@ -488,18 +487,28 @@ static void __init build_mem_type_table(void)
488 487
489#define vectors_base() (vectors_high() ? 0xffff0000 : 0) 488#define vectors_base() (vectors_high() ? 0xffff0000 : 0)
490 489
491static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr, 490static void __init *early_alloc(unsigned long sz)
492 unsigned long end, unsigned long pfn,
493 const struct mem_type *type)
494{ 491{
495 pte_t *pte; 492 void *ptr = __va(memblock_alloc(sz, sz));
493 memset(ptr, 0, sz);
494 return ptr;
495}
496 496
497static pte_t * __init early_pte_alloc(pmd_t *pmd, unsigned long addr, unsigned long prot)
498{
497 if (pmd_none(*pmd)) { 499 if (pmd_none(*pmd)) {
498 pte = alloc_bootmem_low_pages(2 * PTRS_PER_PTE * sizeof(pte_t)); 500 pte_t *pte = early_alloc(2 * PTRS_PER_PTE * sizeof(pte_t));
499 __pmd_populate(pmd, __pa(pte) | type->prot_l1); 501 __pmd_populate(pmd, __pa(pte) | prot);
500 } 502 }
503 BUG_ON(pmd_bad(*pmd));
504 return pte_offset_kernel(pmd, addr);
505}
501 506
502 pte = pte_offset_kernel(pmd, addr); 507static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
508 unsigned long end, unsigned long pfn,
509 const struct mem_type *type)
510{
511 pte_t *pte = early_pte_alloc(pmd, addr, type->prot_l1);
503 do { 512 do {
504 set_pte_ext(pte, pfn_pte(pfn, __pgprot(type->prot_pte)), 0); 513 set_pte_ext(pte, pfn_pte(pfn, __pgprot(type->prot_pte)), 0);
505 pfn++; 514 pfn++;
@@ -668,7 +677,7 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
668 create_mapping(io_desc + i); 677 create_mapping(io_desc + i);
669} 678}
670 679
671static unsigned long __initdata vmalloc_reserve = SZ_128M; 680static void * __initdata vmalloc_min = (void *)(VMALLOC_END - SZ_128M);
672 681
673/* 682/*
674 * vmalloc=size forces the vmalloc area to be exactly 'size' 683 * vmalloc=size forces the vmalloc area to be exactly 'size'
@@ -677,7 +686,7 @@ static unsigned long __initdata vmalloc_reserve = SZ_128M;
677 */ 686 */
678static int __init early_vmalloc(char *arg) 687static int __init early_vmalloc(char *arg)
679{ 688{
680 vmalloc_reserve = memparse(arg, NULL); 689 unsigned long vmalloc_reserve = memparse(arg, NULL);
681 690
682 if (vmalloc_reserve < SZ_16M) { 691 if (vmalloc_reserve < SZ_16M) {
683 vmalloc_reserve = SZ_16M; 692 vmalloc_reserve = SZ_16M;
@@ -692,22 +701,26 @@ static int __init early_vmalloc(char *arg)
692 "vmalloc area is too big, limiting to %luMB\n", 701 "vmalloc area is too big, limiting to %luMB\n",
693 vmalloc_reserve >> 20); 702 vmalloc_reserve >> 20);
694 } 703 }
704
705 vmalloc_min = (void *)(VMALLOC_END - vmalloc_reserve);
695 return 0; 706 return 0;
696} 707}
697early_param("vmalloc", early_vmalloc); 708early_param("vmalloc", early_vmalloc);
698 709
699#define VMALLOC_MIN (void *)(VMALLOC_END - vmalloc_reserve) 710phys_addr_t lowmem_end_addr;
700 711
701static void __init sanity_check_meminfo(void) 712static void __init sanity_check_meminfo(void)
702{ 713{
703 int i, j, highmem = 0; 714 int i, j, highmem = 0;
704 715
716 lowmem_end_addr = __pa(vmalloc_min - 1) + 1;
717
705 for (i = 0, j = 0; i < meminfo.nr_banks; i++) { 718 for (i = 0, j = 0; i < meminfo.nr_banks; i++) {
706 struct membank *bank = &meminfo.bank[j]; 719 struct membank *bank = &meminfo.bank[j];
707 *bank = meminfo.bank[i]; 720 *bank = meminfo.bank[i];
708 721
709#ifdef CONFIG_HIGHMEM 722#ifdef CONFIG_HIGHMEM
710 if (__va(bank->start) > VMALLOC_MIN || 723 if (__va(bank->start) > vmalloc_min ||
711 __va(bank->start) < (void *)PAGE_OFFSET) 724 __va(bank->start) < (void *)PAGE_OFFSET)
712 highmem = 1; 725 highmem = 1;
713 726
@@ -717,8 +730,8 @@ static void __init sanity_check_meminfo(void)
717 * Split those memory banks which are partially overlapping 730 * Split those memory banks which are partially overlapping
718 * the vmalloc area greatly simplifying things later. 731 * the vmalloc area greatly simplifying things later.
719 */ 732 */
720 if (__va(bank->start) < VMALLOC_MIN && 733 if (__va(bank->start) < vmalloc_min &&
721 bank->size > VMALLOC_MIN - __va(bank->start)) { 734 bank->size > vmalloc_min - __va(bank->start)) {
722 if (meminfo.nr_banks >= NR_BANKS) { 735 if (meminfo.nr_banks >= NR_BANKS) {
723 printk(KERN_CRIT "NR_BANKS too low, " 736 printk(KERN_CRIT "NR_BANKS too low, "
724 "ignoring high memory\n"); 737 "ignoring high memory\n");
@@ -727,12 +740,12 @@ static void __init sanity_check_meminfo(void)
727 (meminfo.nr_banks - i) * sizeof(*bank)); 740 (meminfo.nr_banks - i) * sizeof(*bank));
728 meminfo.nr_banks++; 741 meminfo.nr_banks++;
729 i++; 742 i++;
730 bank[1].size -= VMALLOC_MIN - __va(bank->start); 743 bank[1].size -= vmalloc_min - __va(bank->start);
731 bank[1].start = __pa(VMALLOC_MIN - 1) + 1; 744 bank[1].start = __pa(vmalloc_min - 1) + 1;
732 bank[1].highmem = highmem = 1; 745 bank[1].highmem = highmem = 1;
733 j++; 746 j++;
734 } 747 }
735 bank->size = VMALLOC_MIN - __va(bank->start); 748 bank->size = vmalloc_min - __va(bank->start);
736 } 749 }
737#else 750#else
738 bank->highmem = highmem; 751 bank->highmem = highmem;
@@ -741,7 +754,7 @@ static void __init sanity_check_meminfo(void)
741 * Check whether this memory bank would entirely overlap 754 * Check whether this memory bank would entirely overlap
742 * the vmalloc area. 755 * the vmalloc area.
743 */ 756 */
744 if (__va(bank->start) >= VMALLOC_MIN || 757 if (__va(bank->start) >= vmalloc_min ||
745 __va(bank->start) < (void *)PAGE_OFFSET) { 758 __va(bank->start) < (void *)PAGE_OFFSET) {
746 printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx " 759 printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx "
747 "(vmalloc region overlap).\n", 760 "(vmalloc region overlap).\n",
@@ -753,9 +766,9 @@ static void __init sanity_check_meminfo(void)
753 * Check whether this memory bank would partially overlap 766 * Check whether this memory bank would partially overlap
754 * the vmalloc area. 767 * the vmalloc area.
755 */ 768 */
756 if (__va(bank->start + bank->size) > VMALLOC_MIN || 769 if (__va(bank->start + bank->size) > vmalloc_min ||
757 __va(bank->start + bank->size) < __va(bank->start)) { 770 __va(bank->start + bank->size) < __va(bank->start)) {
758 unsigned long newsize = VMALLOC_MIN - __va(bank->start); 771 unsigned long newsize = vmalloc_min - __va(bank->start);
759 printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx " 772 printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx "
760 "to -%.8lx (vmalloc region overlap).\n", 773 "to -%.8lx (vmalloc region overlap).\n",
761 bank->start, bank->start + bank->size - 1, 774 bank->start, bank->start + bank->size - 1,
@@ -827,101 +840,23 @@ static inline void prepare_page_table(void)
827} 840}
828 841
829/* 842/*
830 * Reserve the various regions of node 0 843 * Reserve the special regions of memory
831 */ 844 */
832void __init reserve_node_zero(pg_data_t *pgdat) 845void __init arm_mm_memblock_reserve(void)
833{ 846{
834 unsigned long res_size = 0;
835
836 /*
837 * Register the kernel text and data with bootmem.
838 * Note that this can only be in node 0.
839 */
840#ifdef CONFIG_XIP_KERNEL
841 reserve_bootmem_node(pgdat, __pa(_data), _end - _data,
842 BOOTMEM_DEFAULT);
843#else
844 reserve_bootmem_node(pgdat, __pa(_stext), _end - _stext,
845 BOOTMEM_DEFAULT);
846#endif
847
848 /* 847 /*
849 * Reserve the page tables. These are already in use, 848 * Reserve the page tables. These are already in use,
850 * and can only be in node 0. 849 * and can only be in node 0.
851 */ 850 */
852 reserve_bootmem_node(pgdat, __pa(swapper_pg_dir), 851 memblock_reserve(__pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(pgd_t));
853 PTRS_PER_PGD * sizeof(pgd_t), BOOTMEM_DEFAULT);
854
855 /*
856 * Hmm... This should go elsewhere, but we really really need to
857 * stop things allocating the low memory; ideally we need a better
858 * implementation of GFP_DMA which does not assume that DMA-able
859 * memory starts at zero.
860 */
861 if (machine_is_integrator() || machine_is_cintegrator())
862 res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
863
864 /*
865 * These should likewise go elsewhere. They pre-reserve the
866 * screen memory region at the start of main system memory.
867 */
868 if (machine_is_edb7211())
869 res_size = 0x00020000;
870 if (machine_is_p720t())
871 res_size = 0x00014000;
872
873 /* H1940, RX3715 and RX1950 need to reserve this for suspend */
874
875 if (machine_is_h1940() || machine_is_rx3715()
876 || machine_is_rx1950()) {
877 reserve_bootmem_node(pgdat, 0x30003000, 0x1000,
878 BOOTMEM_DEFAULT);
879 reserve_bootmem_node(pgdat, 0x30081000, 0x1000,
880 BOOTMEM_DEFAULT);
881 }
882
883 if (machine_is_palmld() || machine_is_palmtx()) {
884 reserve_bootmem_node(pgdat, 0xa0000000, 0x1000,
885 BOOTMEM_EXCLUSIVE);
886 reserve_bootmem_node(pgdat, 0xa0200000, 0x1000,
887 BOOTMEM_EXCLUSIVE);
888 }
889
890 if (machine_is_treo680() || machine_is_centro()) {
891 reserve_bootmem_node(pgdat, 0xa0000000, 0x1000,
892 BOOTMEM_EXCLUSIVE);
893 reserve_bootmem_node(pgdat, 0xa2000000, 0x1000,
894 BOOTMEM_EXCLUSIVE);
895 }
896
897 if (machine_is_palmt5())
898 reserve_bootmem_node(pgdat, 0xa0200000, 0x1000,
899 BOOTMEM_EXCLUSIVE);
900
901 /*
902 * U300 - This platform family can share physical memory
903 * between two ARM cpus, one running Linux and the other
904 * running another OS.
905 */
906 if (machine_is_u300()) {
907#ifdef CONFIG_MACH_U300_SINGLE_RAM
908#if ((CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1) == 1) && \
909 CONFIG_MACH_U300_2MB_ALIGNMENT_FIX
910 res_size = 0x00100000;
911#endif
912#endif
913 }
914 852
915#ifdef CONFIG_SA1111 853#ifdef CONFIG_SA1111
916 /* 854 /*
917 * Because of the SA1111 DMA bug, we want to preserve our 855 * Because of the SA1111 DMA bug, we want to preserve our
918 * precious DMA-able memory... 856 * precious DMA-able memory...
919 */ 857 */
920 res_size = __pa(swapper_pg_dir) - PHYS_OFFSET; 858 memblock_reserve(PHYS_OFFSET, __pa(swapper_pg_dir) - PHYS_OFFSET);
921#endif 859#endif
922 if (res_size)
923 reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size,
924 BOOTMEM_DEFAULT);
925} 860}
926 861
927/* 862/*
@@ -940,7 +875,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
940 /* 875 /*
941 * Allocate the vector page early. 876 * Allocate the vector page early.
942 */ 877 */
943 vectors = alloc_bootmem_low_pages(PAGE_SIZE); 878 vectors = early_alloc(PAGE_SIZE);
944 879
945 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE) 880 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
946 pmd_clear(pmd_off_k(addr)); 881 pmd_clear(pmd_off_k(addr));
@@ -1011,11 +946,8 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
1011static void __init kmap_init(void) 946static void __init kmap_init(void)
1012{ 947{
1013#ifdef CONFIG_HIGHMEM 948#ifdef CONFIG_HIGHMEM
1014 pmd_t *pmd = pmd_off_k(PKMAP_BASE); 949 pkmap_page_table = early_pte_alloc(pmd_off_k(PKMAP_BASE),
1015 pte_t *pte = alloc_bootmem_low_pages(2 * PTRS_PER_PTE * sizeof(pte_t)); 950 PKMAP_BASE, _PAGE_KERNEL_TABLE);
1016 BUG_ON(!pmd_none(*pmd) || !pte);
1017 __pmd_populate(pmd, __pa(pte) | _PAGE_KERNEL_TABLE);
1018 pkmap_page_table = pte + PTRS_PER_PTE;
1019#endif 951#endif
1020} 952}
1021 953
@@ -1066,17 +998,16 @@ void __init paging_init(struct machine_desc *mdesc)
1066 sanity_check_meminfo(); 998 sanity_check_meminfo();
1067 prepare_page_table(); 999 prepare_page_table();
1068 map_lowmem(); 1000 map_lowmem();
1069 bootmem_init();
1070 devicemaps_init(mdesc); 1001 devicemaps_init(mdesc);
1071 kmap_init(); 1002 kmap_init();
1072 1003
1073 top_pmd = pmd_off_k(0xffff0000); 1004 top_pmd = pmd_off_k(0xffff0000);
1074 1005
1075 /* 1006 /* allocate the zero page. */
1076 * allocate the zero page. Note that this always succeeds and 1007 zero_page = early_alloc(PAGE_SIZE);
1077 * returns a zeroed result. 1008
1078 */ 1009 bootmem_init();
1079 zero_page = alloc_bootmem_low_pages(PAGE_SIZE); 1010
1080 empty_zero_page = virt_to_page(zero_page); 1011 empty_zero_page = virt_to_page(zero_page);
1081 __flush_dcache_page(NULL, empty_zero_page); 1012 __flush_dcache_page(NULL, empty_zero_page);
1082} 1013}
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 33b327379f07..687d02319a41 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -6,8 +6,8 @@
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/mm.h> 7#include <linux/mm.h>
8#include <linux/pagemap.h> 8#include <linux/pagemap.h>
9#include <linux/bootmem.h>
10#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/memblock.h>
11 11
12#include <asm/cacheflush.h> 12#include <asm/cacheflush.h>
13#include <asm/sections.h> 13#include <asm/sections.h>
@@ -17,30 +17,14 @@
17 17
18#include "mm.h" 18#include "mm.h"
19 19
20/* 20void __init arm_mm_memblock_reserve(void)
21 * Reserve the various regions of node 0
22 */
23void __init reserve_node_zero(pg_data_t *pgdat)
24{ 21{
25 /* 22 /*
26 * Register the kernel text and data with bootmem.
27 * Note that this can only be in node 0.
28 */
29#ifdef CONFIG_XIP_KERNEL
30 reserve_bootmem_node(pgdat, __pa(_data), _end - _data,
31 BOOTMEM_DEFAULT);
32#else
33 reserve_bootmem_node(pgdat, __pa(_stext), _end - _stext,
34 BOOTMEM_DEFAULT);
35#endif
36
37 /*
38 * Register the exception vector page. 23 * Register the exception vector page.
39 * some architectures which the DRAM is the exception vector to trap, 24 * some architectures which the DRAM is the exception vector to trap,
40 * alloc_page breaks with error, although it is not NULL, but "0." 25 * alloc_page breaks with error, although it is not NULL, but "0."
41 */ 26 */
42 reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE, 27 memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
43 BOOTMEM_DEFAULT);
44} 28}
45 29
46/* 30/*
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 7a5337ed7d68..2f5a3c23a0fe 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -239,7 +239,8 @@ __v6_proc_info:
239 b __v6_setup 239 b __v6_setup
240 .long cpu_arch_name 240 .long cpu_arch_name
241 .long cpu_elf_name 241 .long cpu_elf_name
242 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_JAVA 242 /* See also feat_v6_fixup() for HWCAP_TLS */
243 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_JAVA|HWCAP_TLS
243 .long cpu_v6_name 244 .long cpu_v6_name
244 .long v6_processor_functions 245 .long v6_processor_functions
245 .long v6wbi_tlb_fns 246 .long v6wbi_tlb_fns
@@ -262,7 +263,7 @@ __pj4_v6_proc_info:
262 b __v6_setup 263 b __v6_setup
263 .long cpu_arch_name 264 .long cpu_arch_name
264 .long cpu_elf_name 265 .long cpu_elf_name
265 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP 266 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS
266 .long cpu_pj4_name 267 .long cpu_pj4_name
267 .long v6_processor_functions 268 .long v6_processor_functions
268 .long v6wbi_tlb_fns 269 .long v6wbi_tlb_fns
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 7aaf88a3b7aa..8071bcd4c995 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -344,7 +344,7 @@ __v7_proc_info:
344 b __v7_setup 344 b __v7_setup
345 .long cpu_arch_name 345 .long cpu_arch_name
346 .long cpu_elf_name 346 .long cpu_elf_name
347 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP 347 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS
348 .long cpu_v7_name 348 .long cpu_v7_name
349 .long v7_processor_functions 349 .long v7_processor_functions
350 .long v7wbi_tlb_fns 350 .long v7wbi_tlb_fns
diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
index 6c8a02ad98e3..85d3e55ca4a9 100644
--- a/arch/arm/plat-iop/time.c
+++ b/arch/arm/plat-iop/time.c
@@ -29,6 +29,11 @@
29#include <mach/time.h> 29#include <mach/time.h>
30 30
31/* 31/*
32 * Minimum clocksource/clockevent timer range in seconds
33 */
34#define IOP_MIN_RANGE 4
35
36/*
32 * IOP clocksource (free-running timer 1). 37 * IOP clocksource (free-running timer 1).
33 */ 38 */
34static cycle_t iop_clocksource_read(struct clocksource *unused) 39static cycle_t iop_clocksource_read(struct clocksource *unused)
@@ -44,27 +49,6 @@ static struct clocksource iop_clocksource = {
44 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 49 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
45}; 50};
46 51
47static void __init iop_clocksource_set_hz(struct clocksource *cs, unsigned int hz)
48{
49 u64 temp;
50 u32 shift;
51
52 /* Find shift and mult values for hz. */
53 shift = 32;
54 do {
55 temp = (u64) NSEC_PER_SEC << shift;
56 do_div(temp, hz);
57 if ((temp >> 32) == 0)
58 break;
59 } while (--shift != 0);
60
61 cs->shift = shift;
62 cs->mult = (u32) temp;
63
64 printk(KERN_INFO "clocksource: %s uses shift %u mult %#x\n",
65 cs->name, cs->shift, cs->mult);
66}
67
68/* 52/*
69 * IOP sched_clock() implementation via its clocksource. 53 * IOP sched_clock() implementation via its clocksource.
70 */ 54 */
@@ -130,27 +114,6 @@ static struct clock_event_device iop_clockevent = {
130 .set_mode = iop_set_mode, 114 .set_mode = iop_set_mode,
131}; 115};
132 116
133static void __init iop_clockevent_set_hz(struct clock_event_device *ce, unsigned int hz)
134{
135 u64 temp;
136 u32 shift;
137
138 /* Find shift and mult values for hz. */
139 shift = 32;
140 do {
141 temp = (u64) hz << shift;
142 do_div(temp, NSEC_PER_SEC);
143 if ((temp >> 32) == 0)
144 break;
145 } while (--shift != 0);
146
147 ce->shift = shift;
148 ce->mult = (u32) temp;
149
150 printk(KERN_INFO "clockevent: %s uses shift %u mult %#lx\n",
151 ce->name, ce->shift, ce->mult);
152}
153
154static irqreturn_t 117static irqreturn_t
155iop_timer_interrupt(int irq, void *dev_id) 118iop_timer_interrupt(int irq, void *dev_id)
156{ 119{
@@ -190,7 +153,8 @@ void __init iop_init_time(unsigned long tick_rate)
190 */ 153 */
191 write_tmr0(timer_ctl & ~IOP_TMR_EN); 154 write_tmr0(timer_ctl & ~IOP_TMR_EN);
192 setup_irq(IRQ_IOP_TIMER0, &iop_timer_irq); 155 setup_irq(IRQ_IOP_TIMER0, &iop_timer_irq);
193 iop_clockevent_set_hz(&iop_clockevent, tick_rate); 156 clockevents_calc_mult_shift(&iop_clockevent,
157 tick_rate, IOP_MIN_RANGE);
194 iop_clockevent.max_delta_ns = 158 iop_clockevent.max_delta_ns =
195 clockevent_delta2ns(0xfffffffe, &iop_clockevent); 159 clockevent_delta2ns(0xfffffffe, &iop_clockevent);
196 iop_clockevent.min_delta_ns = 160 iop_clockevent.min_delta_ns =
@@ -207,6 +171,7 @@ void __init iop_init_time(unsigned long tick_rate)
207 write_trr1(0xffffffff); 171 write_trr1(0xffffffff);
208 write_tcr1(0xffffffff); 172 write_tcr1(0xffffffff);
209 write_tmr1(timer_ctl); 173 write_tmr1(timer_ctl);
210 iop_clocksource_set_hz(&iop_clocksource, tick_rate); 174 clocksource_calc_mult_shift(&iop_clocksource, tick_rate,
175 IOP_MIN_RANGE);
211 clocksource_register(&iop_clocksource); 176 clocksource_register(&iop_clocksource);
212} 177}
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c
index 5a6ef252c38b..977c8f9a07a2 100644
--- a/arch/arm/plat-nomadik/gpio.c
+++ b/arch/arm/plat-nomadik/gpio.c
@@ -23,6 +23,7 @@
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25 25
26#include <plat/pincfg.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <mach/gpio.h> 28#include <mach/gpio.h>
28 29
@@ -46,28 +47,217 @@ struct nmk_gpio_chip {
46 u32 edge_falling; 47 u32 edge_falling;
47}; 48};
48 49
50static void __nmk_gpio_set_mode(struct nmk_gpio_chip *nmk_chip,
51 unsigned offset, int gpio_mode)
52{
53 u32 bit = 1 << offset;
54 u32 afunc, bfunc;
55
56 afunc = readl(nmk_chip->addr + NMK_GPIO_AFSLA) & ~bit;
57 bfunc = readl(nmk_chip->addr + NMK_GPIO_AFSLB) & ~bit;
58 if (gpio_mode & NMK_GPIO_ALT_A)
59 afunc |= bit;
60 if (gpio_mode & NMK_GPIO_ALT_B)
61 bfunc |= bit;
62 writel(afunc, nmk_chip->addr + NMK_GPIO_AFSLA);
63 writel(bfunc, nmk_chip->addr + NMK_GPIO_AFSLB);
64}
65
66static void __nmk_gpio_set_slpm(struct nmk_gpio_chip *nmk_chip,
67 unsigned offset, enum nmk_gpio_slpm mode)
68{
69 u32 bit = 1 << offset;
70 u32 slpm;
71
72 slpm = readl(nmk_chip->addr + NMK_GPIO_SLPC);
73 if (mode == NMK_GPIO_SLPM_NOCHANGE)
74 slpm |= bit;
75 else
76 slpm &= ~bit;
77 writel(slpm, nmk_chip->addr + NMK_GPIO_SLPC);
78}
79
80static void __nmk_gpio_set_pull(struct nmk_gpio_chip *nmk_chip,
81 unsigned offset, enum nmk_gpio_pull pull)
82{
83 u32 bit = 1 << offset;
84 u32 pdis;
85
86 pdis = readl(nmk_chip->addr + NMK_GPIO_PDIS);
87 if (pull == NMK_GPIO_PULL_NONE)
88 pdis |= bit;
89 else
90 pdis &= ~bit;
91 writel(pdis, nmk_chip->addr + NMK_GPIO_PDIS);
92
93 if (pull == NMK_GPIO_PULL_UP)
94 writel(bit, nmk_chip->addr + NMK_GPIO_DATS);
95 else if (pull == NMK_GPIO_PULL_DOWN)
96 writel(bit, nmk_chip->addr + NMK_GPIO_DATC);
97}
98
99static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip,
100 unsigned offset)
101{
102 writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRC);
103}
104
105static void __nmk_config_pin(struct nmk_gpio_chip *nmk_chip, unsigned offset,
106 pin_cfg_t cfg)
107{
108 static const char *afnames[] = {
109 [NMK_GPIO_ALT_GPIO] = "GPIO",
110 [NMK_GPIO_ALT_A] = "A",
111 [NMK_GPIO_ALT_B] = "B",
112 [NMK_GPIO_ALT_C] = "C"
113 };
114 static const char *pullnames[] = {
115 [NMK_GPIO_PULL_NONE] = "none",
116 [NMK_GPIO_PULL_UP] = "up",
117 [NMK_GPIO_PULL_DOWN] = "down",
118 [3] /* illegal */ = "??"
119 };
120 static const char *slpmnames[] = {
121 [NMK_GPIO_SLPM_INPUT] = "input",
122 [NMK_GPIO_SLPM_NOCHANGE] = "no-change",
123 };
124
125 int pin = PIN_NUM(cfg);
126 int pull = PIN_PULL(cfg);
127 int af = PIN_ALT(cfg);
128 int slpm = PIN_SLPM(cfg);
129
130 dev_dbg(nmk_chip->chip.dev, "pin %d: af %s, pull %s, slpm %s\n",
131 pin, afnames[af], pullnames[pull], slpmnames[slpm]);
132
133 __nmk_gpio_make_input(nmk_chip, offset);
134 __nmk_gpio_set_pull(nmk_chip, offset, pull);
135 __nmk_gpio_set_slpm(nmk_chip, offset, slpm);
136 __nmk_gpio_set_mode(nmk_chip, offset, af);
137}
138
139/**
140 * nmk_config_pin - configure a pin's mux attributes
141 * @cfg: pin confguration
142 *
143 * Configures a pin's mode (alternate function or GPIO), its pull up status,
144 * and its sleep mode based on the specified configuration. The @cfg is
145 * usually one of the SoC specific macros defined in mach/<soc>-pins.h. These
146 * are constructed using, and can be further enhanced with, the macros in
147 * plat/pincfg.h.
148 *
149 * If a pin's mode is set to GPIO, it is configured as an input to avoid
150 * side-effects. The gpio can be manipulated later using standard GPIO API
151 * calls.
152 */
153int nmk_config_pin(pin_cfg_t cfg)
154{
155 struct nmk_gpio_chip *nmk_chip;
156 int gpio = PIN_NUM(cfg);
157 unsigned long flags;
158
159 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));
160 if (!nmk_chip)
161 return -EINVAL;
162
163 spin_lock_irqsave(&nmk_chip->lock, flags);
164 __nmk_config_pin(nmk_chip, gpio - nmk_chip->chip.base, cfg);
165 spin_unlock_irqrestore(&nmk_chip->lock, flags);
166
167 return 0;
168}
169EXPORT_SYMBOL(nmk_config_pin);
170
171/**
172 * nmk_config_pins - configure several pins at once
173 * @cfgs: array of pin configurations
174 * @num: number of elments in the array
175 *
176 * Configures several pins using nmk_config_pin(). Refer to that function for
177 * further information.
178 */
179int nmk_config_pins(pin_cfg_t *cfgs, int num)
180{
181 int ret = 0;
182 int i;
183
184 for (i = 0; i < num; i++) {
185 int ret = nmk_config_pin(cfgs[i]);
186 if (ret)
187 break;
188 }
189
190 return ret;
191}
192EXPORT_SYMBOL(nmk_config_pins);
193
194/**
195 * nmk_gpio_set_slpm() - configure the sleep mode of a pin
196 * @gpio: pin number
197 * @mode: NMK_GPIO_SLPM_INPUT or NMK_GPIO_SLPM_NOCHANGE,
198 *
199 * Sets the sleep mode of a pin. If @mode is NMK_GPIO_SLPM_INPUT, the pin is
200 * changed to an input (with pullup/down enabled) in sleep and deep sleep. If
201 * @mode is NMK_GPIO_SLPM_NOCHANGE, the pin remains in the state it was
202 * configured even when in sleep and deep sleep.
203 */
204int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode)
205{
206 struct nmk_gpio_chip *nmk_chip;
207 unsigned long flags;
208
209 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));
210 if (!nmk_chip)
211 return -EINVAL;
212
213 spin_lock_irqsave(&nmk_chip->lock, flags);
214 __nmk_gpio_set_slpm(nmk_chip, gpio - nmk_chip->chip.base, mode);
215 spin_unlock_irqrestore(&nmk_chip->lock, flags);
216
217 return 0;
218}
219
220/**
221 * nmk_gpio_set_pull() - enable/disable pull up/down on a gpio
222 * @gpio: pin number
223 * @pull: one of NMK_GPIO_PULL_DOWN, NMK_GPIO_PULL_UP, and NMK_GPIO_PULL_NONE
224 *
225 * Enables/disables pull up/down on a specified pin. This only takes effect if
226 * the pin is configured as an input (either explicitly or by the alternate
227 * function).
228 *
229 * NOTE: If enabling the pull up/down, the caller must ensure that the GPIO is
230 * configured as an input. Otherwise, due to the way the controller registers
231 * work, this function will change the value output on the pin.
232 */
233int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull)
234{
235 struct nmk_gpio_chip *nmk_chip;
236 unsigned long flags;
237
238 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));
239 if (!nmk_chip)
240 return -EINVAL;
241
242 spin_lock_irqsave(&nmk_chip->lock, flags);
243 __nmk_gpio_set_pull(nmk_chip, gpio - nmk_chip->chip.base, pull);
244 spin_unlock_irqrestore(&nmk_chip->lock, flags);
245
246 return 0;
247}
248
49/* Mode functions */ 249/* Mode functions */
50int nmk_gpio_set_mode(int gpio, int gpio_mode) 250int nmk_gpio_set_mode(int gpio, int gpio_mode)
51{ 251{
52 struct nmk_gpio_chip *nmk_chip; 252 struct nmk_gpio_chip *nmk_chip;
53 unsigned long flags; 253 unsigned long flags;
54 u32 afunc, bfunc, bit;
55 254
56 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio)); 255 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));
57 if (!nmk_chip) 256 if (!nmk_chip)
58 return -EINVAL; 257 return -EINVAL;
59 258
60 bit = 1 << (gpio - nmk_chip->chip.base);
61
62 spin_lock_irqsave(&nmk_chip->lock, flags); 259 spin_lock_irqsave(&nmk_chip->lock, flags);
63 afunc = readl(nmk_chip->addr + NMK_GPIO_AFSLA) & ~bit; 260 __nmk_gpio_set_mode(nmk_chip, gpio - nmk_chip->chip.base, gpio_mode);
64 bfunc = readl(nmk_chip->addr + NMK_GPIO_AFSLB) & ~bit;
65 if (gpio_mode & NMK_GPIO_ALT_A)
66 afunc |= bit;
67 if (gpio_mode & NMK_GPIO_ALT_B)
68 bfunc |= bit;
69 writel(afunc, nmk_chip->addr + NMK_GPIO_AFSLA);
70 writel(bfunc, nmk_chip->addr + NMK_GPIO_AFSLB);
71 spin_unlock_irqrestore(&nmk_chip->lock, flags); 261 spin_unlock_irqrestore(&nmk_chip->lock, flags);
72 262
73 return 0; 263 return 0;
@@ -111,32 +301,41 @@ static void nmk_gpio_irq_ack(unsigned int irq)
111 writel(nmk_gpio_get_bitmask(gpio), nmk_chip->addr + NMK_GPIO_IC); 301 writel(nmk_gpio_get_bitmask(gpio), nmk_chip->addr + NMK_GPIO_IC);
112} 302}
113 303
304enum nmk_gpio_irq_type {
305 NORMAL,
306 WAKE,
307};
308
114static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip, 309static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip,
115 int gpio, bool enable) 310 int gpio, enum nmk_gpio_irq_type which,
311 bool enable)
116{ 312{
313 u32 rimsc = which == WAKE ? NMK_GPIO_RWIMSC : NMK_GPIO_RIMSC;
314 u32 fimsc = which == WAKE ? NMK_GPIO_FWIMSC : NMK_GPIO_FIMSC;
117 u32 bitmask = nmk_gpio_get_bitmask(gpio); 315 u32 bitmask = nmk_gpio_get_bitmask(gpio);
118 u32 reg; 316 u32 reg;
119 317
120 /* we must individually set/clear the two edges */ 318 /* we must individually set/clear the two edges */
121 if (nmk_chip->edge_rising & bitmask) { 319 if (nmk_chip->edge_rising & bitmask) {
122 reg = readl(nmk_chip->addr + NMK_GPIO_RIMSC); 320 reg = readl(nmk_chip->addr + rimsc);
123 if (enable) 321 if (enable)
124 reg |= bitmask; 322 reg |= bitmask;
125 else 323 else
126 reg &= ~bitmask; 324 reg &= ~bitmask;
127 writel(reg, nmk_chip->addr + NMK_GPIO_RIMSC); 325 writel(reg, nmk_chip->addr + rimsc);
128 } 326 }
129 if (nmk_chip->edge_falling & bitmask) { 327 if (nmk_chip->edge_falling & bitmask) {
130 reg = readl(nmk_chip->addr + NMK_GPIO_FIMSC); 328 reg = readl(nmk_chip->addr + fimsc);
131 if (enable) 329 if (enable)
132 reg |= bitmask; 330 reg |= bitmask;
133 else 331 else
134 reg &= ~bitmask; 332 reg &= ~bitmask;
135 writel(reg, nmk_chip->addr + NMK_GPIO_FIMSC); 333 writel(reg, nmk_chip->addr + fimsc);
136 } 334 }
137} 335}
138 336
139static void nmk_gpio_irq_modify(unsigned int irq, bool enable) 337static int nmk_gpio_irq_modify(unsigned int irq, enum nmk_gpio_irq_type which,
338 bool enable)
140{ 339{
141 int gpio; 340 int gpio;
142 struct nmk_gpio_chip *nmk_chip; 341 struct nmk_gpio_chip *nmk_chip;
@@ -147,26 +346,35 @@ static void nmk_gpio_irq_modify(unsigned int irq, bool enable)
147 nmk_chip = get_irq_chip_data(irq); 346 nmk_chip = get_irq_chip_data(irq);
148 bitmask = nmk_gpio_get_bitmask(gpio); 347 bitmask = nmk_gpio_get_bitmask(gpio);
149 if (!nmk_chip) 348 if (!nmk_chip)
150 return; 349 return -EINVAL;
151 350
152 spin_lock_irqsave(&nmk_chip->lock, flags); 351 spin_lock_irqsave(&nmk_chip->lock, flags);
153 __nmk_gpio_irq_modify(nmk_chip, gpio, enable); 352 __nmk_gpio_irq_modify(nmk_chip, gpio, which, enable);
154 spin_unlock_irqrestore(&nmk_chip->lock, flags); 353 spin_unlock_irqrestore(&nmk_chip->lock, flags);
354
355 return 0;
155} 356}
156 357
157static void nmk_gpio_irq_mask(unsigned int irq) 358static void nmk_gpio_irq_mask(unsigned int irq)
158{ 359{
159 nmk_gpio_irq_modify(irq, false); 360 nmk_gpio_irq_modify(irq, NORMAL, false);
160}; 361}
161 362
162static void nmk_gpio_irq_unmask(unsigned int irq) 363static void nmk_gpio_irq_unmask(unsigned int irq)
163{ 364{
164 nmk_gpio_irq_modify(irq, true); 365 nmk_gpio_irq_modify(irq, NORMAL, true);
366}
367
368static int nmk_gpio_irq_set_wake(unsigned int irq, unsigned int on)
369{
370 return nmk_gpio_irq_modify(irq, WAKE, on);
165} 371}
166 372
167static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type) 373static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
168{ 374{
169 bool enabled = !(irq_to_desc(irq)->status & IRQ_DISABLED); 375 struct irq_desc *desc = irq_to_desc(irq);
376 bool enabled = !(desc->status & IRQ_DISABLED);
377 bool wake = desc->wake_depth;
170 int gpio; 378 int gpio;
171 struct nmk_gpio_chip *nmk_chip; 379 struct nmk_gpio_chip *nmk_chip;
172 unsigned long flags; 380 unsigned long flags;
@@ -186,7 +394,10 @@ static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
186 spin_lock_irqsave(&nmk_chip->lock, flags); 394 spin_lock_irqsave(&nmk_chip->lock, flags);
187 395
188 if (enabled) 396 if (enabled)
189 __nmk_gpio_irq_modify(nmk_chip, gpio, false); 397 __nmk_gpio_irq_modify(nmk_chip, gpio, NORMAL, false);
398
399 if (wake)
400 __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, false);
190 401
191 nmk_chip->edge_rising &= ~bitmask; 402 nmk_chip->edge_rising &= ~bitmask;
192 if (type & IRQ_TYPE_EDGE_RISING) 403 if (type & IRQ_TYPE_EDGE_RISING)
@@ -197,7 +408,10 @@ static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
197 nmk_chip->edge_falling |= bitmask; 408 nmk_chip->edge_falling |= bitmask;
198 409
199 if (enabled) 410 if (enabled)
200 __nmk_gpio_irq_modify(nmk_chip, gpio, true); 411 __nmk_gpio_irq_modify(nmk_chip, gpio, NORMAL, true);
412
413 if (wake)
414 __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, true);
201 415
202 spin_unlock_irqrestore(&nmk_chip->lock, flags); 416 spin_unlock_irqrestore(&nmk_chip->lock, flags);
203 417
@@ -210,6 +424,7 @@ static struct irq_chip nmk_gpio_irq_chip = {
210 .mask = nmk_gpio_irq_mask, 424 .mask = nmk_gpio_irq_mask,
211 .unmask = nmk_gpio_irq_unmask, 425 .unmask = nmk_gpio_irq_unmask,
212 .set_type = nmk_gpio_irq_set_type, 426 .set_type = nmk_gpio_irq_set_type,
427 .set_wake = nmk_gpio_irq_set_wake,
213}; 428};
214 429
215static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 430static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
@@ -266,16 +481,6 @@ static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset)
266 return 0; 481 return 0;
267} 482}
268 483
269static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset,
270 int val)
271{
272 struct nmk_gpio_chip *nmk_chip =
273 container_of(chip, struct nmk_gpio_chip, chip);
274
275 writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRS);
276 return 0;
277}
278
279static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset) 484static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset)
280{ 485{
281 struct nmk_gpio_chip *nmk_chip = 486 struct nmk_gpio_chip *nmk_chip =
@@ -298,12 +503,33 @@ static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset,
298 writel(bit, nmk_chip->addr + NMK_GPIO_DATC); 503 writel(bit, nmk_chip->addr + NMK_GPIO_DATC);
299} 504}
300 505
506static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset,
507 int val)
508{
509 struct nmk_gpio_chip *nmk_chip =
510 container_of(chip, struct nmk_gpio_chip, chip);
511
512 writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRS);
513 nmk_gpio_set_output(chip, offset, val);
514
515 return 0;
516}
517
518static int nmk_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
519{
520 struct nmk_gpio_chip *nmk_chip =
521 container_of(chip, struct nmk_gpio_chip, chip);
522
523 return NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base) + offset;
524}
525
301/* This structure is replicated for each GPIO block allocated at probe time */ 526/* This structure is replicated for each GPIO block allocated at probe time */
302static struct gpio_chip nmk_gpio_template = { 527static struct gpio_chip nmk_gpio_template = {
303 .direction_input = nmk_gpio_make_input, 528 .direction_input = nmk_gpio_make_input,
304 .get = nmk_gpio_get_input, 529 .get = nmk_gpio_get_input,
305 .direction_output = nmk_gpio_make_output, 530 .direction_output = nmk_gpio_make_output,
306 .set = nmk_gpio_set_output, 531 .set = nmk_gpio_set_output,
532 .to_irq = nmk_gpio_to_irq,
307 .ngpio = NMK_GPIO_PER_CHIP, 533 .ngpio = NMK_GPIO_PER_CHIP,
308 .can_sleep = 0, 534 .can_sleep = 0,
309}; 535};
@@ -393,30 +619,12 @@ out:
393 return ret; 619 return ret;
394} 620}
395 621
396static int __exit nmk_gpio_remove(struct platform_device *dev)
397{
398 struct nmk_gpio_chip *nmk_chip;
399 struct resource *res;
400
401 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
402
403 nmk_chip = platform_get_drvdata(dev);
404 gpiochip_remove(&nmk_chip->chip);
405 clk_disable(nmk_chip->clk);
406 clk_put(nmk_chip->clk);
407 kfree(nmk_chip);
408 release_mem_region(res->start, resource_size(res));
409 return 0;
410}
411
412
413static struct platform_driver nmk_gpio_driver = { 622static struct platform_driver nmk_gpio_driver = {
414 .driver = { 623 .driver = {
415 .owner = THIS_MODULE, 624 .owner = THIS_MODULE,
416 .name = "gpio", 625 .name = "gpio",
417 }, 626 },
418 .probe = nmk_gpio_probe, 627 .probe = nmk_gpio_probe,
419 .remove = __exit_p(nmk_gpio_remove),
420 .suspend = NULL, /* to be done */ 628 .suspend = NULL, /* to be done */
421 .resume = NULL, 629 .resume = NULL,
422}; 630};
@@ -426,7 +634,7 @@ static int __init nmk_gpio_init(void)
426 return platform_driver_register(&nmk_gpio_driver); 634 return platform_driver_register(&nmk_gpio_driver);
427} 635}
428 636
429arch_initcall(nmk_gpio_init); 637core_initcall(nmk_gpio_init);
430 638
431MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini"); 639MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini");
432MODULE_DESCRIPTION("Nomadik GPIO Driver"); 640MODULE_DESCRIPTION("Nomadik GPIO Driver");
diff --git a/arch/arm/plat-nomadik/include/plat/gpio.h b/arch/arm/plat-nomadik/include/plat/gpio.h
index 4200811249ca..aba355101f49 100644
--- a/arch/arm/plat-nomadik/include/plat/gpio.h
+++ b/arch/arm/plat-nomadik/include/plat/gpio.h
@@ -55,6 +55,21 @@
55#define NMK_GPIO_ALT_B 2 55#define NMK_GPIO_ALT_B 2
56#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B) 56#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B)
57 57
58/* Pull up/down values */
59enum nmk_gpio_pull {
60 NMK_GPIO_PULL_NONE,
61 NMK_GPIO_PULL_UP,
62 NMK_GPIO_PULL_DOWN,
63};
64
65/* Sleep mode */
66enum nmk_gpio_slpm {
67 NMK_GPIO_SLPM_INPUT,
68 NMK_GPIO_SLPM_NOCHANGE,
69};
70
71extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode);
72extern int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull);
58extern int nmk_gpio_set_mode(int gpio, int gpio_mode); 73extern int nmk_gpio_set_mode(int gpio, int gpio_mode);
59extern int nmk_gpio_get_mode(int gpio); 74extern int nmk_gpio_get_mode(int gpio);
60 75
diff --git a/arch/arm/plat-nomadik/include/plat/mtu.h b/arch/arm/plat-nomadik/include/plat/mtu.h
index 42c907258b14..65704a3d4241 100644
--- a/arch/arm/plat-nomadik/include/plat/mtu.h
+++ b/arch/arm/plat-nomadik/include/plat/mtu.h
@@ -1,6 +1,12 @@
1#ifndef __PLAT_MTU_H 1#ifndef __PLAT_MTU_H
2#define __PLAT_MTU_H 2#define __PLAT_MTU_H
3 3
4/*
5 * Guaranteed runtime conversion range in seconds for
6 * the clocksource and clockevent.
7 */
8#define MTU_MIN_RANGE 4
9
4/* should be set by the platform code */ 10/* should be set by the platform code */
5extern void __iomem *mtu_base; 11extern void __iomem *mtu_base;
6 12
diff --git a/arch/arm/plat-nomadik/include/plat/pincfg.h b/arch/arm/plat-nomadik/include/plat/pincfg.h
new file mode 100644
index 000000000000..7eed11c1038d
--- /dev/null
+++ b/arch/arm/plat-nomadik/include/plat/pincfg.h
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License, version 2
5 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
6 *
7 * Based on arch/arm/mach-pxa/include/mach/mfp.h:
8 * Copyright (C) 2007 Marvell International Ltd.
9 * eric miao <eric.miao@marvell.com>
10 */
11
12#ifndef __PLAT_PINCFG_H
13#define __PLAT_PINCFG_H
14
15/*
16 * pin configurations are represented by 32-bit integers:
17 *
18 * bit 0.. 8 - Pin Number (512 Pins Maximum)
19 * bit 9..10 - Alternate Function Selection
20 * bit 11..12 - Pull up/down state
21 * bit 13 - Sleep mode behaviour
22 *
23 * to facilitate the definition, the following macros are provided
24 *
25 * PIN_CFG_DEFAULT - default config (0):
26 * pull up/down = disabled
27 * sleep mode = input
28 *
29 * PIN_CFG - default config with alternate function
30 * PIN_CFG_PULL - default config with alternate function and pull up/down
31 */
32
33typedef unsigned long pin_cfg_t;
34
35#define PIN_NUM_MASK 0x1ff
36#define PIN_NUM(x) ((x) & PIN_NUM_MASK)
37
38#define PIN_ALT_SHIFT 9
39#define PIN_ALT_MASK (0x3 << PIN_ALT_SHIFT)
40#define PIN_ALT(x) (((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT)
41#define PIN_GPIO (NMK_GPIO_ALT_GPIO << PIN_ALT_SHIFT)
42#define PIN_ALT_A (NMK_GPIO_ALT_A << PIN_ALT_SHIFT)
43#define PIN_ALT_B (NMK_GPIO_ALT_B << PIN_ALT_SHIFT)
44#define PIN_ALT_C (NMK_GPIO_ALT_C << PIN_ALT_SHIFT)
45
46#define PIN_PULL_SHIFT 11
47#define PIN_PULL_MASK (0x3 << PIN_PULL_SHIFT)
48#define PIN_PULL(x) (((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT)
49#define PIN_PULL_NONE (NMK_GPIO_PULL_NONE << PIN_PULL_SHIFT)
50#define PIN_PULL_UP (NMK_GPIO_PULL_UP << PIN_PULL_SHIFT)
51#define PIN_PULL_DOWN (NMK_GPIO_PULL_DOWN << PIN_PULL_SHIFT)
52
53#define PIN_SLPM_SHIFT 13
54#define PIN_SLPM_MASK (0x1 << PIN_SLPM_SHIFT)
55#define PIN_SLPM(x) (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT)
56#define PIN_SLPM_INPUT (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT)
57#define PIN_SLPM_NOCHANGE (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT)
58
59#define PIN_CFG_DEFAULT (PIN_PULL_NONE | PIN_SLPM_INPUT)
60
61#define PIN_CFG(num, alt) \
62 (PIN_CFG_DEFAULT |\
63 (PIN_NUM(num) | PIN_##alt))
64
65#define PIN_CFG_PULL(num, alt, pull) \
66 ((PIN_CFG_DEFAULT & ~PIN_PULL_MASK) |\
67 (PIN_NUM(num) | PIN_##alt | PIN_PULL_##pull))
68
69extern int nmk_config_pin(pin_cfg_t cfg);
70extern int nmk_config_pins(pin_cfg_t *cfgs, int num);
71
72#endif
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c
index 08aaa4a7f65f..ea3ca86c5283 100644
--- a/arch/arm/plat-nomadik/timer.c
+++ b/arch/arm/plat-nomadik/timer.c
@@ -42,7 +42,6 @@ static struct clocksource nmdk_clksrc = {
42 .rating = 200, 42 .rating = 200,
43 .read = nmdk_read_timer_dummy, 43 .read = nmdk_read_timer_dummy,
44 .mask = CLOCKSOURCE_MASK(32), 44 .mask = CLOCKSOURCE_MASK(32),
45 .shift = 20,
46 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 45 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
47}; 46};
48 47
@@ -82,6 +81,12 @@ static void nmdk_clkevt_mode(enum clock_event_mode mode,
82 case CLOCK_EVT_MODE_UNUSED: 81 case CLOCK_EVT_MODE_UNUSED:
83 /* disable irq */ 82 /* disable irq */
84 writel(0, mtu_base + MTU_IMSC); 83 writel(0, mtu_base + MTU_IMSC);
84 /* disable timer */
85 cr = readl(mtu_base + MTU_CR(1));
86 cr &= ~MTU_CRn_ENA;
87 writel(cr, mtu_base + MTU_CR(1));
88 /* load some high default value */
89 writel(0xffffffff, mtu_base + MTU_LR(1));
85 break; 90 break;
86 case CLOCK_EVT_MODE_RESUME: 91 case CLOCK_EVT_MODE_RESUME:
87 break; 92 break;
@@ -98,7 +103,6 @@ static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev)
98static struct clock_event_device nmdk_clkevt = { 103static struct clock_event_device nmdk_clkevt = {
99 .name = "mtu_1", 104 .name = "mtu_1",
100 .features = CLOCK_EVT_FEAT_ONESHOT, 105 .features = CLOCK_EVT_FEAT_ONESHOT,
101 .shift = 32,
102 .rating = 200, 106 .rating = 200,
103 .set_mode = nmdk_clkevt_mode, 107 .set_mode = nmdk_clkevt_mode,
104 .set_next_event = nmdk_clkevt_next, 108 .set_next_event = nmdk_clkevt_next,
@@ -151,6 +155,7 @@ void __init nmdk_timer_init(void)
151 } else { 155 } else {
152 cr |= MTU_CRn_PRESCALE_1; 156 cr |= MTU_CRn_PRESCALE_1;
153 } 157 }
158 clocksource_calc_mult_shift(&nmdk_clksrc, rate, MTU_MIN_RANGE);
154 159
155 /* Timer 0 is the free running clocksource */ 160 /* Timer 0 is the free running clocksource */
156 writel(cr, mtu_base + MTU_CR(0)); 161 writel(cr, mtu_base + MTU_CR(0));
@@ -158,7 +163,6 @@ void __init nmdk_timer_init(void)
158 writel(0, mtu_base + MTU_BGLR(0)); 163 writel(0, mtu_base + MTU_BGLR(0));
159 writel(cr | MTU_CRn_ENA, mtu_base + MTU_CR(0)); 164 writel(cr | MTU_CRn_ENA, mtu_base + MTU_CR(0));
160 165
161 nmdk_clksrc.mult = clocksource_hz2mult(rate, nmdk_clksrc.shift);
162 /* Now the scheduling clock is ready */ 166 /* Now the scheduling clock is ready */
163 nmdk_clksrc.read = nmdk_read_timer; 167 nmdk_clksrc.read = nmdk_read_timer;
164 168
@@ -175,8 +179,10 @@ void __init nmdk_timer_init(void)
175 } else { 179 } else {
176 cr |= MTU_CRn_PRESCALE_1; 180 cr |= MTU_CRn_PRESCALE_1;
177 } 181 }
182 clockevents_calc_mult_shift(&nmdk_clkevt, rate, MTU_MIN_RANGE);
183
178 writel(cr | MTU_CRn_ONESHOT, mtu_base + MTU_CR(1)); /* off, currently */ 184 writel(cr | MTU_CRn_ONESHOT, mtu_base + MTU_CR(1)); /* off, currently */
179 nmdk_clkevt.mult = div_sc(rate, NSEC_PER_SEC, nmdk_clkevt.shift); 185
180 nmdk_clkevt.max_delta_ns = 186 nmdk_clkevt.max_delta_ns =
181 clockevent_delta2ns(0xffffffff, &nmdk_clkevt); 187 clockevent_delta2ns(0xffffffff, &nmdk_clkevt);
182 nmdk_clkevt.min_delta_ns = 188 nmdk_clkevt.min_delta_ns =
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 219c01e82bc5..ebed82699eb2 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -22,6 +22,7 @@
22#include <linux/serial_reg.h> 22#include <linux/serial_reg.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/omapfb.h>
25 26
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <asm/system.h> 28#include <asm/system.h>
@@ -35,6 +36,7 @@
35#include <plat/mux.h> 36#include <plat/mux.h>
36#include <plat/fpga.h> 37#include <plat/fpga.h>
37#include <plat/serial.h> 38#include <plat/serial.h>
39#include <plat/vram.h>
38 40
39#include <plat/clock.h> 41#include <plat/clock.h>
40 42
@@ -81,6 +83,12 @@ const void *omap_get_var_config(u16 tag, size_t *len)
81} 83}
82EXPORT_SYMBOL(omap_get_var_config); 84EXPORT_SYMBOL(omap_get_var_config);
83 85
86void __init omap_reserve(void)
87{
88 omapfb_reserve_sdram_memblock();
89 omap_vram_reserve_sdram_memblock();
90}
91
84/* 92/*
85 * 32KHz clocksource ... always available, on pretty most chips except 93 * 32KHz clocksource ... always available, on pretty most chips except
86 * OMAP 730 and 1510. Other timers could be used as clocksources, with 94 * OMAP 730 and 1510. Other timers could be used as clocksources, with
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index d3eea4f47533..0054b9501a53 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -26,7 +26,7 @@
26#include <linux/mm.h> 26#include <linux/mm.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/bootmem.h> 29#include <linux/memblock.h>
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/omapfb.h> 31#include <linux/omapfb.h>
32 32
@@ -171,49 +171,78 @@ static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg,
171 return 0; 171 return 0;
172} 172}
173 173
174static int valid_sdram(unsigned long addr, unsigned long size)
175{
176 struct memblock_property res;
177
178 res.base = addr;
179 res.size = size;
180 return !memblock_find(&res) && res.base == addr && res.size == size;
181}
182
183static int reserve_sdram(unsigned long addr, unsigned long size)
184{
185 if (memblock_is_region_reserved(addr, size))
186 return -EBUSY;
187 if (memblock_reserve(addr, size))
188 return -ENOMEM;
189 return 0;
190}
191
174/* 192/*
175 * Called from map_io. We need to call to this early enough so that we 193 * Called from map_io. We need to call to this early enough so that we
176 * can reserve the fixed SDRAM regions before VM could get hold of them. 194 * can reserve the fixed SDRAM regions before VM could get hold of them.
177 */ 195 */
178void __init omapfb_reserve_sdram(void) 196void __init omapfb_reserve_sdram_memblock(void)
179{ 197{
180 struct bootmem_data *bdata; 198 unsigned long reserved = 0;
181 unsigned long sdram_start, sdram_size; 199 int i;
182 unsigned long reserved;
183 int i;
184 200
185 if (config_invalid) 201 if (config_invalid)
186 return; 202 return;
187 203
188 bdata = NODE_DATA(0)->bdata;
189 sdram_start = bdata->node_min_pfn << PAGE_SHIFT;
190 sdram_size = (bdata->node_low_pfn << PAGE_SHIFT) - sdram_start;
191 reserved = 0;
192 for (i = 0; ; i++) { 204 for (i = 0; ; i++) {
193 struct omapfb_mem_region rg; 205 struct omapfb_mem_region rg;
194 206
195 if (get_fbmem_region(i, &rg) < 0) 207 if (get_fbmem_region(i, &rg) < 0)
196 break; 208 break;
209
197 if (i == OMAPFB_PLANE_NUM) { 210 if (i == OMAPFB_PLANE_NUM) {
198 printk(KERN_ERR 211 pr_err("Extraneous FB mem configuration entries\n");
199 "Extraneous FB mem configuration entries\n");
200 config_invalid = 1; 212 config_invalid = 1;
201 return; 213 return;
202 } 214 }
215
203 /* Check if it's our memory type. */ 216 /* Check if it's our memory type. */
204 if (set_fbmem_region_type(&rg, OMAPFB_MEMTYPE_SDRAM, 217 if (rg.type != OMAPFB_MEMTYPE_SDRAM)
205 sdram_start, sdram_size) < 0 ||
206 (rg.type != OMAPFB_MEMTYPE_SDRAM))
207 continue; 218 continue;
208 BUG_ON(omapfb_config.mem_desc.region[i].size); 219
209 if (check_fbmem_region(i, &rg, sdram_start, sdram_size) < 0) { 220 /* Check if the region falls within SDRAM */
221 if (rg.paddr && !valid_sdram(rg.paddr, rg.size))
222 continue;
223
224 if (rg.size == 0) {
225 pr_err("Zero size for FB region %d\n", i);
210 config_invalid = 1; 226 config_invalid = 1;
211 return; 227 return;
212 } 228 }
229
213 if (rg.paddr) { 230 if (rg.paddr) {
214 reserve_bootmem(rg.paddr, rg.size, BOOTMEM_DEFAULT); 231 if (reserve_sdram(rg.paddr, rg.size)) {
232 pr_err("Trying to use reserved memory for FB region %d\n",
233 i);
234 config_invalid = 1;
235 return;
236 }
215 reserved += rg.size; 237 reserved += rg.size;
216 } 238 }
239
240 if (omapfb_config.mem_desc.region[i].size) {
241 pr_err("FB region %d already set\n", i);
242 config_invalid = 1;
243 return;
244 }
245
217 omapfb_config.mem_desc.region[i] = rg; 246 omapfb_config.mem_desc.region[i] = rg;
218 configured_regions++; 247 configured_regions++;
219 } 248 }
@@ -359,7 +388,10 @@ static inline int omap_init_fb(void)
359 388
360arch_initcall(omap_init_fb); 389arch_initcall(omap_init_fb);
361 390
362void omapfb_reserve_sdram(void) {} 391void omapfb_reserve_sdram_memblock(void)
392{
393}
394
363unsigned long omapfb_reserve_sram(unsigned long sram_pstart, 395unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
364 unsigned long sram_vstart, 396 unsigned long sram_vstart,
365 unsigned long sram_size, 397 unsigned long sram_size,
@@ -375,7 +407,10 @@ void omapfb_set_platform_data(struct omapfb_platform_data *data)
375{ 407{
376} 408}
377 409
378void omapfb_reserve_sdram(void) {} 410void omapfb_reserve_sdram_memblock(void)
411{
412}
413
379unsigned long omapfb_reserve_sram(unsigned long sram_pstart, 414unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
380 unsigned long sram_vstart, 415 unsigned long sram_vstart,
381 unsigned long sram_size, 416 unsigned long sram_size,
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index d265018f5e6b..5e4afbee0fd7 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -34,6 +34,8 @@ struct sys_timer;
34extern void omap_map_common_io(void); 34extern void omap_map_common_io(void);
35extern struct sys_timer omap_timer; 35extern struct sys_timer omap_timer;
36 36
37extern void omap_reserve(void);
38
37/* 39/*
38 * IO bases for various OMAP processors 40 * IO bases for various OMAP processors
39 * Except the tap base, rest all the io bases 41 * Except the tap base, rest all the io bases
diff --git a/arch/arm/plat-omap/include/plat/vram.h b/arch/arm/plat-omap/include/plat/vram.h
index edd4987758a6..0aa4ecd12c7d 100644
--- a/arch/arm/plat-omap/include/plat/vram.h
+++ b/arch/arm/plat-omap/include/plat/vram.h
@@ -38,7 +38,7 @@ extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram,
38extern void omap_vram_set_sdram_vram(u32 size, u32 start); 38extern void omap_vram_set_sdram_vram(u32 size, u32 start);
39extern void omap_vram_set_sram_vram(u32 size, u32 start); 39extern void omap_vram_set_sram_vram(u32 size, u32 start);
40 40
41extern void omap_vram_reserve_sdram(void); 41extern void omap_vram_reserve_sdram_memblock(void);
42extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, 42extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
43 unsigned long sram_vstart, 43 unsigned long sram_vstart,
44 unsigned long sram_size, 44 unsigned long sram_size,
@@ -48,7 +48,7 @@ extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
48static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { } 48static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { }
49static inline void omap_vram_set_sram_vram(u32 size, u32 start) { } 49static inline void omap_vram_set_sram_vram(u32 size, u32 start) { }
50 50
51static inline void omap_vram_reserve_sdram(void) { } 51static inline void omap_vram_reserve_sdram_memblock(void) { }
52static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, 52static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
53 unsigned long sram_vstart, 53 unsigned long sram_vstart,
54 unsigned long sram_size, 54 unsigned long sram_size,
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
index a1025d38f383..ab211652e4ca 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/plat-spear/time.c
@@ -58,6 +58,11 @@
58 58
59#define INT_STATUS 0x1 59#define INT_STATUS 0x1
60 60
61/*
62 * Minimum clocksource/clockevent timer range in seconds
63 */
64#define SPEAR_MIN_RANGE 4
65
61static __iomem void *gpt_base; 66static __iomem void *gpt_base;
62static struct clk *gpt_clk; 67static struct clk *gpt_clk;
63 68
@@ -66,44 +71,6 @@ static void clockevent_set_mode(enum clock_event_mode mode,
66static int clockevent_next_event(unsigned long evt, 71static int clockevent_next_event(unsigned long evt,
67 struct clock_event_device *clk_event_dev); 72 struct clock_event_device *clk_event_dev);
68 73
69/*
70 * Following clocksource_set_clock and clockevent_set_clock picked
71 * from arch/mips/kernel/time.c
72 */
73
74void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
75{
76 u64 temp;
77 u32 shift;
78
79 /* Find a shift value */
80 for (shift = 32; shift > 0; shift--) {
81 temp = (u64) NSEC_PER_SEC << shift;
82 do_div(temp, clock);
83 if ((temp >> 32) == 0)
84 break;
85 }
86 cs->shift = shift;
87 cs->mult = (u32) temp;
88}
89
90void __init clockevent_set_clock(struct clock_event_device *cd,
91 unsigned int clock)
92{
93 u64 temp;
94 u32 shift;
95
96 /* Find a shift value */
97 for (shift = 32; shift > 0; shift--) {
98 temp = (u64) clock << shift;
99 do_div(temp, NSEC_PER_SEC);
100 if ((temp >> 32) == 0)
101 break;
102 }
103 cd->shift = shift;
104 cd->mult = (u32) temp;
105}
106
107static cycle_t clocksource_read_cycles(struct clocksource *cs) 74static cycle_t clocksource_read_cycles(struct clocksource *cs)
108{ 75{
109 return (cycle_t) readw(gpt_base + COUNT(CLKSRC)); 76 return (cycle_t) readw(gpt_base + COUNT(CLKSRC));
@@ -138,7 +105,7 @@ static void spear_clocksource_init(void)
138 val |= CTRL_ENABLE ; 105 val |= CTRL_ENABLE ;
139 writew(val, gpt_base + CR(CLKSRC)); 106 writew(val, gpt_base + CR(CLKSRC));
140 107
141 clocksource_set_clock(&clksrc, tick_rate); 108 clocksource_calc_mult_shift(&clksrc, tick_rate, SPEAR_MIN_RANGE);
142 109
143 /* register the clocksource */ 110 /* register the clocksource */
144 clocksource_register(&clksrc); 111 clocksource_register(&clksrc);
@@ -233,7 +200,7 @@ static void __init spear_clockevent_init(void)
233 tick_rate = clk_get_rate(gpt_clk); 200 tick_rate = clk_get_rate(gpt_clk);
234 tick_rate >>= CTRL_PRESCALER16; 201 tick_rate >>= CTRL_PRESCALER16;
235 202
236 clockevent_set_clock(&clkevt, tick_rate); 203 clockevents_calc_mult_shift(&clkevt, tick_rate, SPEAR_MIN_RANGE);
237 204
238 clkevt.max_delta_ns = clockevent_delta2ns(0xfff0, 205 clkevt.max_delta_ns = clockevent_delta2ns(0xfff0,
239 &clkevt); 206 &clkevt);
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile
index 9b1a66816aa6..5cf88e8427b1 100644
--- a/arch/arm/plat-versatile/Makefile
+++ b/arch/arm/plat-versatile/Makefile
@@ -2,3 +2,7 @@ obj-y := clock.o
2obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o 2obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
3obj-$(CONFIG_ARCH_REALVIEW) += sched-clock.o 3obj-$(CONFIG_ARCH_REALVIEW) += sched-clock.o
4obj-$(CONFIG_ARCH_VERSATILE) += sched-clock.o 4obj-$(CONFIG_ARCH_VERSATILE) += sched-clock.o
5ifeq ($(CONFIG_LEDS_CLASS),y)
6obj-$(CONFIG_ARCH_REALVIEW) += leds.o
7obj-$(CONFIG_ARCH_VERSATILE) += leds.o
8endif
diff --git a/arch/arm/plat-versatile/leds.c b/arch/arm/plat-versatile/leds.c
new file mode 100644
index 000000000000..3169fa555ea6
--- /dev/null
+++ b/arch/arm/plat-versatile/leds.c
@@ -0,0 +1,103 @@
1/*
2 * Driver for the 8 user LEDs found on the RealViews and Versatiles
3 * Based on DaVinci's DM365 board code
4 *
5 * License terms: GNU General Public License (GPL) version 2
6 * Author: Linus Walleij <triad@df.lth.se>
7 */
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/io.h>
11#include <linux/slab.h>
12#include <linux/leds.h>
13
14#include <mach/hardware.h>
15#include <mach/platform.h>
16
17#ifdef VERSATILE_SYS_BASE
18#define LEDREG (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET)
19#endif
20
21#ifdef REALVIEW_SYS_BASE
22#define LEDREG (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET)
23#endif
24
25struct versatile_led {
26 struct led_classdev cdev;
27 u8 mask;
28};
29
30/*
31 * The triggers lines up below will only be used if the
32 * LED triggers are compiled in.
33 */
34static const struct {
35 const char *name;
36 const char *trigger;
37} versatile_leds[] = {
38 { "versatile:0", "heartbeat", },
39 { "versatile:1", "mmc0", },
40 { "versatile:2", },
41 { "versatile:3", },
42 { "versatile:4", },
43 { "versatile:5", },
44 { "versatile:6", },
45 { "versatile:7", },
46};
47
48static void versatile_led_set(struct led_classdev *cdev,
49 enum led_brightness b)
50{
51 struct versatile_led *led = container_of(cdev,
52 struct versatile_led, cdev);
53 u32 reg = readl(LEDREG);
54
55 if (b != LED_OFF)
56 reg |= led->mask;
57 else
58 reg &= ~led->mask;
59 writel(reg, LEDREG);
60}
61
62static enum led_brightness versatile_led_get(struct led_classdev *cdev)
63{
64 struct versatile_led *led = container_of(cdev,
65 struct versatile_led, cdev);
66 u32 reg = readl(LEDREG);
67
68 return (reg & led->mask) ? LED_FULL : LED_OFF;
69}
70
71static int __init versatile_leds_init(void)
72{
73 int i;
74
75 /* All ON */
76 writel(0xff, LEDREG);
77 for (i = 0; i < ARRAY_SIZE(versatile_leds); i++) {
78 struct versatile_led *led;
79
80 led = kzalloc(sizeof(*led), GFP_KERNEL);
81 if (!led)
82 break;
83
84 led->cdev.name = versatile_leds[i].name;
85 led->cdev.brightness_set = versatile_led_set;
86 led->cdev.brightness_get = versatile_led_get;
87 led->cdev.default_trigger = versatile_leds[i].trigger;
88 led->mask = BIT(i);
89
90 if (led_classdev_register(NULL, &led->cdev) < 0) {
91 kfree(led);
92 break;
93 }
94 }
95
96 return 0;
97}
98
99/*
100 * Since we may have triggers on any subsystem, defer registration
101 * until after subsystem_init.
102 */
103fs_initcall(versatile_leds_init);
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 315a540c7ce5..8063a322c790 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -15,6 +15,7 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/init.h> 16#include <linux/init.h>
17 17
18#include <asm/cputype.h>
18#include <asm/thread_notify.h> 19#include <asm/thread_notify.h>
19#include <asm/vfp.h> 20#include <asm/vfp.h>
20 21
@@ -549,10 +550,13 @@ static int __init vfp_init(void)
549 /* 550 /*
550 * Check for the presence of the Advanced SIMD 551 * Check for the presence of the Advanced SIMD
551 * load/store instructions, integer and single 552 * load/store instructions, integer and single
552 * precision floating point operations. 553 * precision floating point operations. Only check
554 * for NEON if the hardware has the MVFR registers.
553 */ 555 */
554 if ((fmrx(MVFR1) & 0x000fff00) == 0x00011100) 556 if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) {
555 elf_hwcap |= HWCAP_NEON; 557 if ((fmrx(MVFR1) & 0x000fff00) == 0x00011100)
558 elf_hwcap |= HWCAP_NEON;
559 }
556#endif 560#endif
557 } 561 }
558 return 0; 562 return 0;