aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-10-29 17:02:16 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-29 17:02:16 -0400
commitbe15cd72d256e5eb3261a781b8507fac83ab33f6 (patch)
tree1a8f95a9960e03149d27d935da25b768878feb3e
parente9d52234e35b27ea4ea5f2ab64ca47b1a0c740ab (diff)
parent37d07b72ef58f2d5ec7701ab75084fbeee0e503e (diff)
Merge master.kernel.org:/home/rmk/linux-2.6-arm
-rw-r--r--arch/arm/Makefile14
-rw-r--r--arch/arm/kernel/Makefile2
-rw-r--r--arch/arm/kernel/asm-offsets.c1
-rw-r--r--arch/arm/kernel/entry-armv.S3
-rw-r--r--arch/arm/kernel/head.S57
-rw-r--r--arch/arm/kernel/vmlinux.lds.S11
-rw-r--r--arch/arm/mach-sa1100/generic.c2
-rw-r--r--arch/arm/mach-sa1100/jornada720.c64
-rw-r--r--arch/arm/mm/init.c30
-rw-r--r--drivers/mtd/maps/sa1100-flash.c66
-rw-r--r--include/asm-arm/arch-aaec2000/memory.h2
-rw-r--r--include/asm-arm/arch-cl7500/memory.h2
-rw-r--r--include/asm-arm/arch-clps711x/memory.h2
-rw-r--r--include/asm-arm/arch-ebsa110/memory.h2
-rw-r--r--include/asm-arm/arch-ebsa285/memory.h10
-rw-r--r--include/asm-arm/arch-epxa10db/memory.h2
-rw-r--r--include/asm-arm/arch-h720x/memory.h2
-rw-r--r--include/asm-arm/arch-imx/memory.h2
-rw-r--r--include/asm-arm/arch-integrator/memory.h4
-rw-r--r--include/asm-arm/arch-iop3xx/memory.h4
-rw-r--r--include/asm-arm/arch-ixp2000/memory.h2
-rw-r--r--include/asm-arm/arch-ixp2000/platform.h50
-rw-r--r--include/asm-arm/arch-ixp4xx/ixp4xx-regs.h75
-rw-r--r--include/asm-arm/arch-ixp4xx/memory.h2
-rw-r--r--include/asm-arm/arch-l7200/memory.h2
-rw-r--r--include/asm-arm/arch-lh7a40x/memory.h2
-rw-r--r--include/asm-arm/arch-omap/memory.h6
-rw-r--r--include/asm-arm/arch-pxa/memory.h2
-rw-r--r--include/asm-arm/arch-rpc/memory.h2
-rw-r--r--include/asm-arm/arch-s3c2410/memory.h4
-rw-r--r--include/asm-arm/arch-sa1100/memory.h2
-rw-r--r--include/asm-arm/arch-shark/memory.h2
-rw-r--r--include/asm-arm/arch-versatile/memory.h2
-rw-r--r--include/asm-arm/mach/arch.h1
-rw-r--r--include/asm-arm/mach/flash.h2
-rw-r--r--include/asm-arm/mach/map.h4
-rw-r--r--include/asm-arm/memory.h25
37 files changed, 295 insertions, 172 deletions
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 299bc0468702..64cf480b0b02 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -8,7 +8,7 @@
8# Copyright (C) 1995-2001 by Russell King 8# Copyright (C) 1995-2001 by Russell King
9 9
10LDFLAGS_vmlinux :=-p --no-undefined -X 10LDFLAGS_vmlinux :=-p --no-undefined -X
11CPPFLAGS_vmlinux.lds = -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR) 11CPPFLAGS_vmlinux.lds = -DKERNEL_RAM_ADDR=$(TEXTADDR)
12OBJCOPYFLAGS :=-O binary -R .note -R .comment -S 12OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
13GZFLAGS :=-9 13GZFLAGS :=-9
14#CFLAGS +=-pipe 14#CFLAGS +=-pipe
@@ -108,27 +108,19 @@ export CFLAGS_3c589_cs.o
108endif 108endif
109 109
110TEXTADDR := $(textaddr-y) 110TEXTADDR := $(textaddr-y)
111ifeq ($(CONFIG_XIP_KERNEL),y)
112 DATAADDR := $(TEXTADDR)
113 xipaddr-$(CONFIG_ARCH_CO285) := 0x5f000000
114 xipaddr-y ?= 0xbf000000
115 # Replace phys addr with virt addr while keeping offset from base.
116 TEXTADDR := $(shell echo $(CONFIG_XIP_PHYS_ADDR) $(xipaddr-y) | \
117 awk --non-decimal-data '/[:xdigit:]/ \
118 { printf("0x%x\n", and($$1, 0x000fffff) + $$2) }' )
119endif
120 111
121ifeq ($(incdir-y),) 112ifeq ($(incdir-y),)
122incdir-y := $(machine-y) 113incdir-y := $(machine-y)
123endif 114endif
124INCDIR := arch-$(incdir-y) 115INCDIR := arch-$(incdir-y)
116
125ifneq ($(machine-y),) 117ifneq ($(machine-y),)
126MACHINE := arch/arm/mach-$(machine-y)/ 118MACHINE := arch/arm/mach-$(machine-y)/
127else 119else
128MACHINE := 120MACHINE :=
129endif 121endif
130 122
131export TEXTADDR DATAADDR GZFLAGS 123export TEXTADDR GZFLAGS
132 124
133# Do we have FASTFPE? 125# Do we have FASTFPE?
134FASTFPE :=arch/arm/fastfpe 126FASTFPE :=arch/arm/fastfpe
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 3e1b0327e4d7..c11169b5ed9a 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5AFLAGS_head.o := -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR) 5AFLAGS_head.o := -DKERNEL_RAM_ADDR=$(TEXTADDR)
6 6
7# Object file lists. 7# Object file lists.
8 8
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index c1ff4d1f1bfd..04d3082a7b94 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -94,7 +94,6 @@ int main(void)
94 DEFINE(VM_EXEC, VM_EXEC); 94 DEFINE(VM_EXEC, VM_EXEC);
95 BLANK(); 95 BLANK();
96 DEFINE(PAGE_SZ, PAGE_SIZE); 96 DEFINE(PAGE_SZ, PAGE_SIZE);
97 DEFINE(VIRT_OFFSET, PAGE_OFFSET);
98 BLANK(); 97 BLANK();
99 DEFINE(SYS_ERROR0, 0x9f0000); 98 DEFINE(SYS_ERROR0, 0x9f0000);
100 BLANK(); 99 BLANK();
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 93b5e8e5292e..be439cab92c6 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -15,6 +15,7 @@
15 */ 15 */
16#include <linux/config.h> 16#include <linux/config.h>
17 17
18#include <asm/memory.h>
18#include <asm/glue.h> 19#include <asm/glue.h>
19#include <asm/vfpmacros.h> 20#include <asm/vfpmacros.h>
20#include <asm/hardware.h> /* should be moved into entry-macro.S */ 21#include <asm/hardware.h> /* should be moved into entry-macro.S */
@@ -310,7 +311,7 @@ __pabt_svc:
310 311
311#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) 312#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
312 @ make sure our user space atomic helper is aborted 313 @ make sure our user space atomic helper is aborted
313 cmp r2, #VIRT_OFFSET 314 cmp r2, #TASK_SIZE
314 bichs r3, r3, #PSR_Z_BIT 315 bichs r3, r3, #PSR_Z_BIT
315#endif 316#endif
316 317
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 539626351348..8d8748407cbe 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -21,6 +21,7 @@
21#include <asm/procinfo.h> 21#include <asm/procinfo.h>
22#include <asm/ptrace.h> 22#include <asm/ptrace.h>
23#include <asm/asm-offsets.h> 23#include <asm/asm-offsets.h>
24#include <asm/memory.h>
24#include <asm/thread_info.h> 25#include <asm/thread_info.h>
25#include <asm/system.h> 26#include <asm/system.h>
26 27
@@ -33,52 +34,28 @@
33#define MACHINFO_PGOFFIO 12 34#define MACHINFO_PGOFFIO 12
34#define MACHINFO_NAME 16 35#define MACHINFO_NAME 16
35 36
36#ifndef CONFIG_XIP_KERNEL
37/* 37/*
38 * We place the page tables 16K below TEXTADDR. Therefore, we must make sure 38 * swapper_pg_dir is the virtual address of the initial page table.
39 * that TEXTADDR is correctly set. Currently, we expect the least significant 39 * We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must
40 * 16 bits to be 0x8000, but we could probably relax this restriction to 40 * make sure that KERNEL_RAM_ADDR is correctly set. Currently, we expect
41 * TEXTADDR >= PAGE_OFFSET + 0x4000 41 * the least significant 16 bits to be 0x8000, but we could probably
42 * 42 * relax this restriction to KERNEL_RAM_ADDR >= PAGE_OFFSET + 0x4000.
43 * Note that swapper_pg_dir is the virtual address of the page tables, and
44 * pgtbl gives us a position-independent reference to these tables. We can
45 * do this because stext == TEXTADDR
46 */ 43 */
47#if (TEXTADDR & 0xffff) != 0x8000 44#if (KERNEL_RAM_ADDR & 0xffff) != 0x8000
48#error TEXTADDR must start at 0xXXXX8000 45#error KERNEL_RAM_ADDR must start at 0xXXXX8000
49#endif 46#endif
50 47
51 .globl swapper_pg_dir 48 .globl swapper_pg_dir
52 .equ swapper_pg_dir, TEXTADDR - 0x4000 49 .equ swapper_pg_dir, KERNEL_RAM_ADDR - 0x4000
53 50
54 .macro pgtbl, rd, phys 51 .macro pgtbl, rd
55 adr \rd, stext 52 ldr \rd, =(__virt_to_phys(KERNEL_RAM_ADDR - 0x4000))
56 sub \rd, \rd, #0x4000
57 .endm 53 .endm
58#else
59/*
60 * XIP Kernel:
61 *
62 * We place the page tables 16K below DATAADDR. Therefore, we must make sure
63 * that DATAADDR is correctly set. Currently, we expect the least significant
64 * 16 bits to be 0x8000, but we could probably relax this restriction to
65 * DATAADDR >= PAGE_OFFSET + 0x4000
66 *
67 * Note that pgtbl is meant to return the physical address of swapper_pg_dir.
68 * We can't make it relative to the kernel position in this case since
69 * the kernel can physically be anywhere.
70 */
71#if (DATAADDR & 0xffff) != 0x8000
72#error DATAADDR must start at 0xXXXX8000
73#endif
74
75 .globl swapper_pg_dir
76 .equ swapper_pg_dir, DATAADDR - 0x4000
77 54
78 .macro pgtbl, rd, phys 55#ifdef CONFIG_XIP_KERNEL
79 ldr \rd, =((DATAADDR - 0x4000) - VIRT_OFFSET) 56#define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR)
80 add \rd, \rd, \phys 57#else
81 .endm 58#define TEXTADDR KERNEL_RAM_ADDR
82#endif 59#endif
83 60
84/* 61/*
@@ -279,7 +256,7 @@ __turn_mmu_on:
279 .type __create_page_tables, %function 256 .type __create_page_tables, %function
280__create_page_tables: 257__create_page_tables:
281 ldr r5, [r8, #MACHINFO_PHYSRAM] @ physram 258 ldr r5, [r8, #MACHINFO_PHYSRAM] @ physram
282 pgtbl r4, r5 @ page table address 259 pgtbl r4 @ page table address
283 260
284 /* 261 /*
285 * Clear the 16K level 1 swapper page table 262 * Clear the 16K level 1 swapper page table
@@ -324,7 +301,7 @@ __create_page_tables:
324 /* 301 /*
325 * Then map first 1MB of ram in case it contains our boot params. 302 * Then map first 1MB of ram in case it contains our boot params.
326 */ 303 */
327 add r0, r4, #VIRT_OFFSET >> 18 304 add r0, r4, #PAGE_OFFSET >> 18
328 orr r6, r5, r7 305 orr r6, r5, r7
329 str r6, [r0] 306 str r6, [r0]
330 307
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 0d5db5279c5c..80c8e4c8cefa 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -6,14 +6,23 @@
6#include <asm-generic/vmlinux.lds.h> 6#include <asm-generic/vmlinux.lds.h>
7#include <linux/config.h> 7#include <linux/config.h>
8#include <asm/thread_info.h> 8#include <asm/thread_info.h>
9#include <asm/memory.h>
9 10
10OUTPUT_ARCH(arm) 11OUTPUT_ARCH(arm)
11ENTRY(stext) 12ENTRY(stext)
13
12#ifndef __ARMEB__ 14#ifndef __ARMEB__
13jiffies = jiffies_64; 15jiffies = jiffies_64;
14#else 16#else
15jiffies = jiffies_64 + 4; 17jiffies = jiffies_64 + 4;
16#endif 18#endif
19
20#ifdef CONFIG_XIP_KERNEL
21#define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR)
22#else
23#define TEXTADDR KERNEL_RAM_ADDR
24#endif
25
17SECTIONS 26SECTIONS
18{ 27{
19 . = TEXTADDR; 28 . = TEXTADDR;
@@ -95,7 +104,7 @@ SECTIONS
95 104
96#ifdef CONFIG_XIP_KERNEL 105#ifdef CONFIG_XIP_KERNEL
97 __data_loc = ALIGN(4); /* location in binary */ 106 __data_loc = ALIGN(4); /* location in binary */
98 . = DATAADDR; 107 . = KERNEL_RAM_ADDR;
99#else 108#else
100 . = ALIGN(THREAD_SIZE); 109 . = ALIGN(THREAD_SIZE);
101 __data_loc = .; 110 __data_loc = .;
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 93619497779c..f94b0fbcdcc8 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -23,6 +23,7 @@
23#include <asm/system.h> 23#include <asm/system.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/mach/flash.h>
26#include <asm/irq.h> 27#include <asm/irq.h>
27 28
28#include "generic.h" 29#include "generic.h"
@@ -283,6 +284,7 @@ static struct platform_device sa11x0mtd_device = {
283void sa11x0_set_flash_data(struct flash_platform_data *flash, 284void sa11x0_set_flash_data(struct flash_platform_data *flash,
284 struct resource *res, int nr) 285 struct resource *res, int nr)
285{ 286{
287 flash->name = "sa1100";
286 sa11x0mtd_device.dev.platform_data = flash; 288 sa11x0mtd_device.dev.platform_data = flash;
287 sa11x0mtd_device.resource = res; 289 sa11x0mtd_device.resource = res;
288 sa11x0mtd_device.num_resources = nr; 290 sa11x0mtd_device.num_resources = nr;
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index 9c363bfcf310..89af0c831e8f 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -8,6 +8,8 @@
8#include <linux/delay.h> 8#include <linux/delay.h>
9#include <linux/device.h> 9#include <linux/device.h>
10#include <linux/ioport.h> 10#include <linux/ioport.h>
11#include <linux/mtd/mtd.h>
12#include <linux/mtd/partitions.h>
11 13
12#include <asm/hardware.h> 14#include <asm/hardware.h>
13#include <asm/hardware/sa1111.h> 15#include <asm/hardware/sa1111.h>
@@ -16,6 +18,7 @@
16#include <asm/setup.h> 18#include <asm/setup.h>
17 19
18#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach/flash.h>
19#include <asm/mach/map.h> 22#include <asm/mach/map.h>
20#include <asm/mach/serial_sa1100.h> 23#include <asm/mach/serial_sa1100.h>
21 24
@@ -108,6 +111,66 @@ static void __init jornada720_map_io(void)
108 sa1100_register_uart(1, 1); 111 sa1100_register_uart(1, 1);
109} 112}
110 113
114static struct mtd_partition jornada720_partitions[] = {
115 {
116 .name = "JORNADA720 boot firmware",
117 .size = 0x00040000,
118 .offset = 0,
119 .mask_flags = MTD_WRITEABLE, /* force read-only */
120 }, {
121 .name = "JORNADA720 kernel",
122 .size = 0x000c0000,
123 .offset = 0x00040000,
124 }, {
125 .name = "JORNADA720 params",
126 .size = 0x00040000,
127 .offset = 0x00100000,
128 }, {
129 .name = "JORNADA720 initrd",
130 .size = 0x00100000,
131 .offset = 0x00140000,
132 }, {
133 .name = "JORNADA720 root cramfs",
134 .size = 0x00300000,
135 .offset = 0x00240000,
136 }, {
137 .name = "JORNADA720 usr cramfs",
138 .size = 0x00800000,
139 .offset = 0x00540000,
140 }, {
141 .name = "JORNADA720 usr local",
142 .size = 0, /* will expand to the end of the flash */
143 .offset = 0x00d00000,
144 }
145};
146
147static void jornada720_set_vpp(int vpp)
148{
149 if (vpp)
150 PPSR |= 0x80;
151 else
152 PPSR &= ~0x80;
153 PPDR |= 0x80;
154}
155
156static struct flash_platform_data jornada720_flash_data = {
157 .map_name = "cfi_probe",
158 .set_vpp = jornada720_set_vpp,
159 .parts = jornada720_partitions,
160 .nr_parts = ARRAY_SIZE(jornada720_partitions),
161};
162
163static struct resource jornada720_flash_resource = {
164 .start = SA1100_CS0_PHYS,
165 .end = SA1100_CS0_PHYS + SZ_32M - 1,
166 .flags = IORESOURCE_MEM,
167};
168
169static void __init jornada720_mach_init(void)
170{
171 sa11x0_set_flash_data(&jornada720_flash_data, &jornada720_flash_resource, 1);
172}
173
111MACHINE_START(JORNADA720, "HP Jornada 720") 174MACHINE_START(JORNADA720, "HP Jornada 720")
112 /* Maintainer: Michael Gernoth <michael@gernoth.net> */ 175 /* Maintainer: Michael Gernoth <michael@gernoth.net> */
113 .phys_ram = 0xc0000000, 176 .phys_ram = 0xc0000000,
@@ -117,4 +180,5 @@ MACHINE_START(JORNADA720, "HP Jornada 720")
117 .map_io = jornada720_map_io, 180 .map_io = jornada720_map_io,
118 .init_irq = sa1100_init_irq, 181 .init_irq = sa1100_init_irq,
119 .timer = &sa1100_timer, 182 .timer = &sa1100_timer,
183 .init_machine = jornada720_mach_init,
120MACHINE_END 184MACHINE_END
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index f4496813615a..fd079ff1fc53 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -363,20 +363,16 @@ static void __init bootmem_init(struct meminfo *mi)
363 363
364 memcpy(&meminfo, mi, sizeof(meminfo)); 364 memcpy(&meminfo, mi, sizeof(meminfo));
365 365
366#ifdef CONFIG_XIP_KERNEL
367#error needs fixing
368 p->pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & PMD_MASK);
369 p->virtual = (unsigned long)&_stext & PMD_MASK;
370 p->length = ((unsigned long)&_etext - p->virtual + ~PMD_MASK) & PMD_MASK;
371 p->type = MT_ROM;
372 p ++;
373#endif
374
375 /* 366 /*
376 * Clear out all the mappings below the kernel image. 367 * Clear out all the mappings below the kernel image.
377 * FIXME: what about XIP?
378 */ 368 */
379 for (addr = 0; addr < PAGE_OFFSET; addr += PGDIR_SIZE) 369 for (addr = 0; addr < MODULE_START; addr += PGDIR_SIZE)
370 pmd_clear(pmd_off_k(addr));
371#ifdef CONFIG_XIP_KERNEL
372 /* The XIP kernel is mapped in the module area -- skip over it */
373 addr = ((unsigned long)&_etext + PGDIR_SIZE - 1) & PGDIR_MASK;
374#endif
375 for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE)
380 pmd_clear(pmd_off_k(addr)); 376 pmd_clear(pmd_off_k(addr));
381 377
382 /* 378 /*
@@ -436,6 +432,18 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
436 pmd_clear(pmd_off_k(addr)); 432 pmd_clear(pmd_off_k(addr));
437 433
438 /* 434 /*
435 * Map the kernel if it is XIP.
436 * It is always first in the modulearea.
437 */
438#ifdef CONFIG_XIP_KERNEL
439 map.pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & PGDIR_MASK);
440 map.virtual = MODULE_START;
441 map.length = ((unsigned long)&_etext - map.virtual + ~PGDIR_MASK) & PGDIR_MASK;
442 map.type = MT_ROM;
443 create_mapping(&map);
444#endif
445
446 /*
439 * Map the cache flushing regions. 447 * Map the cache flushing regions.
440 */ 448 */
441#ifdef FLUSH_BASE 449#ifdef FLUSH_BASE
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 6a8e0caf9fdc..c81bec7b14d5 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -130,20 +130,21 @@ struct sa_subdev_info {
130 char name[16]; 130 char name[16];
131 struct map_info map; 131 struct map_info map;
132 struct mtd_info *mtd; 132 struct mtd_info *mtd;
133 struct flash_platform_data *data; 133 struct flash_platform_data *plat;
134}; 134};
135 135
136struct sa_info { 136struct sa_info {
137 struct mtd_partition *parts; 137 struct mtd_partition *parts;
138 struct mtd_info *mtd; 138 struct mtd_info *mtd;
139 int num_subdev; 139 int num_subdev;
140 unsigned int nr_parts;
140 struct sa_subdev_info subdev[0]; 141 struct sa_subdev_info subdev[0];
141}; 142};
142 143
143static void sa1100_set_vpp(struct map_info *map, int on) 144static void sa1100_set_vpp(struct map_info *map, int on)
144{ 145{
145 struct sa_subdev_info *subdev = container_of(map, struct sa_subdev_info, map); 146 struct sa_subdev_info *subdev = container_of(map, struct sa_subdev_info, map);
146 subdev->data->set_vpp(on); 147 subdev->plat->set_vpp(on);
147} 148}
148 149
149static void sa1100_destroy_subdev(struct sa_subdev_info *subdev) 150static void sa1100_destroy_subdev(struct sa_subdev_info *subdev)
@@ -187,7 +188,7 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r
187 goto out; 188 goto out;
188 } 189 }
189 190
190 if (subdev->data->set_vpp) 191 if (subdev->plat->set_vpp)
191 subdev->map.set_vpp = sa1100_set_vpp; 192 subdev->map.set_vpp = sa1100_set_vpp;
192 193
193 subdev->map.phys = phys; 194 subdev->map.phys = phys;
@@ -204,7 +205,7 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r
204 * Now let's probe for the actual flash. Do it here since 205 * Now let's probe for the actual flash. Do it here since
205 * specific machine settings might have been set above. 206 * specific machine settings might have been set above.
206 */ 207 */
207 subdev->mtd = do_map_probe(subdev->data->map_name, &subdev->map); 208 subdev->mtd = do_map_probe(subdev->plat->map_name, &subdev->map);
208 if (subdev->mtd == NULL) { 209 if (subdev->mtd == NULL) {
209 ret = -ENXIO; 210 ret = -ENXIO;
210 goto err; 211 goto err;
@@ -223,13 +224,17 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r
223 return ret; 224 return ret;
224} 225}
225 226
226static void sa1100_destroy(struct sa_info *info) 227static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *plat)
227{ 228{
228 int i; 229 int i;
229 230
230 if (info->mtd) { 231 if (info->mtd) {
231 del_mtd_partitions(info->mtd); 232 if (info->nr_parts == 0)
232 233 del_mtd_device(info->mtd);
234#ifdef CONFIG_MTD_PARTITIONS
235 else
236 del_mtd_partitions(info->mtd);
237#endif
233#ifdef CONFIG_MTD_CONCAT 238#ifdef CONFIG_MTD_CONCAT
234 if (info->mtd != info->subdev[0].mtd) 239 if (info->mtd != info->subdev[0].mtd)
235 mtd_concat_destroy(info->mtd); 240 mtd_concat_destroy(info->mtd);
@@ -242,10 +247,13 @@ static void sa1100_destroy(struct sa_info *info)
242 for (i = info->num_subdev - 1; i >= 0; i--) 247 for (i = info->num_subdev - 1; i >= 0; i--)
243 sa1100_destroy_subdev(&info->subdev[i]); 248 sa1100_destroy_subdev(&info->subdev[i]);
244 kfree(info); 249 kfree(info);
250
251 if (plat->exit)
252 plat->exit();
245} 253}
246 254
247static struct sa_info *__init 255static struct sa_info *__init
248sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash) 256sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat)
249{ 257{
250 struct sa_info *info; 258 struct sa_info *info;
251 int nr, size, i, ret = 0; 259 int nr, size, i, ret = 0;
@@ -275,6 +283,12 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash
275 283
276 memset(info, 0, size); 284 memset(info, 0, size);
277 285
286 if (plat->init) {
287 ret = plat->init();
288 if (ret)
289 goto err;
290 }
291
278 /* 292 /*
279 * Claim and then map the memory regions. 293 * Claim and then map the memory regions.
280 */ 294 */
@@ -287,8 +301,8 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash
287 break; 301 break;
288 302
289 subdev->map.name = subdev->name; 303 subdev->map.name = subdev->name;
290 sprintf(subdev->name, "sa1100-%d", i); 304 sprintf(subdev->name, "%s-%d", plat->name, i);
291 subdev->data = flash; 305 subdev->plat = plat;
292 306
293 ret = sa1100_probe_subdev(subdev, res); 307 ret = sa1100_probe_subdev(subdev, res);
294 if (ret) 308 if (ret)
@@ -309,7 +323,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash
309 * otherwise fail. Either way, it'll be called "sa1100". 323 * otherwise fail. Either way, it'll be called "sa1100".
310 */ 324 */
311 if (info->num_subdev == 1) { 325 if (info->num_subdev == 1) {
312 strcpy(info->subdev[0].name, "sa1100"); 326 strcpy(info->subdev[0].name, plat->name);
313 info->mtd = info->subdev[0].mtd; 327 info->mtd = info->subdev[0].mtd;
314 ret = 0; 328 ret = 0;
315 } else if (info->num_subdev > 1) { 329 } else if (info->num_subdev > 1) {
@@ -322,7 +336,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash
322 cdev[i] = info->subdev[i].mtd; 336 cdev[i] = info->subdev[i].mtd;
323 337
324 info->mtd = mtd_concat_create(cdev, info->num_subdev, 338 info->mtd = mtd_concat_create(cdev, info->num_subdev,
325 "sa1100"); 339 plat->name);
326 if (info->mtd == NULL) 340 if (info->mtd == NULL)
327 ret = -ENXIO; 341 ret = -ENXIO;
328#else 342#else
@@ -336,7 +350,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *flash
336 return info; 350 return info;
337 351
338 err: 352 err:
339 sa1100_destroy(info); 353 sa1100_destroy(info, plat);
340 out: 354 out:
341 return ERR_PTR(ret); 355 return ERR_PTR(ret);
342} 356}
@@ -346,16 +360,16 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
346static int __init sa1100_mtd_probe(struct device *dev) 360static int __init sa1100_mtd_probe(struct device *dev)
347{ 361{
348 struct platform_device *pdev = to_platform_device(dev); 362 struct platform_device *pdev = to_platform_device(dev);
349 struct flash_platform_data *flash = pdev->dev.platform_data; 363 struct flash_platform_data *plat = pdev->dev.platform_data;
350 struct mtd_partition *parts; 364 struct mtd_partition *parts;
351 const char *part_type = NULL; 365 const char *part_type = NULL;
352 struct sa_info *info; 366 struct sa_info *info;
353 int err, nr_parts = 0; 367 int err, nr_parts = 0;
354 368
355 if (!flash) 369 if (!plat)
356 return -ENODEV; 370 return -ENODEV;
357 371
358 info = sa1100_setup_mtd(pdev, flash); 372 info = sa1100_setup_mtd(pdev, plat);
359 if (IS_ERR(info)) { 373 if (IS_ERR(info)) {
360 err = PTR_ERR(info); 374 err = PTR_ERR(info);
361 goto out; 375 goto out;
@@ -372,8 +386,8 @@ static int __init sa1100_mtd_probe(struct device *dev)
372 } else 386 } else
373#endif 387#endif
374 { 388 {
375 parts = flash->parts; 389 parts = plat->parts;
376 nr_parts = flash->nr_parts; 390 nr_parts = plat->nr_parts;
377 part_type = "static"; 391 part_type = "static";
378 } 392 }
379 393
@@ -387,6 +401,8 @@ static int __init sa1100_mtd_probe(struct device *dev)
387 add_mtd_partitions(info->mtd, parts, nr_parts); 401 add_mtd_partitions(info->mtd, parts, nr_parts);
388 } 402 }
389 403
404 info->nr_parts = nr_parts;
405
390 dev_set_drvdata(dev, info); 406 dev_set_drvdata(dev, info);
391 err = 0; 407 err = 0;
392 408
@@ -397,8 +413,11 @@ static int __init sa1100_mtd_probe(struct device *dev)
397static int __exit sa1100_mtd_remove(struct device *dev) 413static int __exit sa1100_mtd_remove(struct device *dev)
398{ 414{
399 struct sa_info *info = dev_get_drvdata(dev); 415 struct sa_info *info = dev_get_drvdata(dev);
416 struct flash_platform_data *plat = dev->platform_data;
417
400 dev_set_drvdata(dev, NULL); 418 dev_set_drvdata(dev, NULL);
401 sa1100_destroy(info); 419 sa1100_destroy(info, plat);
420
402 return 0; 421 return 0;
403} 422}
404 423
@@ -421,9 +440,17 @@ static int sa1100_mtd_resume(struct device *dev)
421 info->mtd->resume(info->mtd); 440 info->mtd->resume(info->mtd);
422 return 0; 441 return 0;
423} 442}
443
444static void sa1100_mtd_shutdown(struct device *dev)
445{
446 struct sa_info *info = dev_get_drvdata(dev);
447 if (info && info->mtd->suspend(info->mtd) == 0)
448 info->mtd->resume(info->mtd);
449}
424#else 450#else
425#define sa1100_mtd_suspend NULL 451#define sa1100_mtd_suspend NULL
426#define sa1100_mtd_resume NULL 452#define sa1100_mtd_resume NULL
453#define sa1100_mtd_shutdown NULL
427#endif 454#endif
428 455
429static struct device_driver sa1100_mtd_driver = { 456static struct device_driver sa1100_mtd_driver = {
@@ -433,6 +460,7 @@ static struct device_driver sa1100_mtd_driver = {
433 .remove = __exit_p(sa1100_mtd_remove), 460 .remove = __exit_p(sa1100_mtd_remove),
434 .suspend = sa1100_mtd_suspend, 461 .suspend = sa1100_mtd_suspend,
435 .resume = sa1100_mtd_resume, 462 .resume = sa1100_mtd_resume,
463 .shutdown = sa1100_mtd_shutdown,
436}; 464};
437 465
438static int __init sa1100_mtd_init(void) 466static int __init sa1100_mtd_init(void)
diff --git a/include/asm-arm/arch-aaec2000/memory.h b/include/asm-arm/arch-aaec2000/memory.h
index 79c90813bc3e..d8209f8911d6 100644
--- a/include/asm-arm/arch-aaec2000/memory.h
+++ b/include/asm-arm/arch-aaec2000/memory.h
@@ -13,7 +13,7 @@
13 13
14#include <linux/config.h> 14#include <linux/config.h>
15 15
16#define PHYS_OFFSET (0xf0000000UL) 16#define PHYS_OFFSET UL(0xf0000000)
17 17
18#define __virt_to_bus(x) __virt_to_phys(x) 18#define __virt_to_bus(x) __virt_to_phys(x)
19#define __bus_to_virt(x) __phys_to_virt(x) 19#define __bus_to_virt(x) __phys_to_virt(x)
diff --git a/include/asm-arm/arch-cl7500/memory.h b/include/asm-arm/arch-cl7500/memory.h
index 9776bba8e585..34f40a6cec30 100644
--- a/include/asm-arm/arch-cl7500/memory.h
+++ b/include/asm-arm/arch-cl7500/memory.h
@@ -17,7 +17,7 @@
17/* 17/*
18 * Physical DRAM offset. 18 * Physical DRAM offset.
19 */ 19 */
20#define PHYS_OFFSET (0x10000000UL) 20#define PHYS_OFFSET UL(0x10000000)
21 21
22/* 22/*
23 * These are exactly the same on the RiscPC as the 23 * These are exactly the same on the RiscPC as the
diff --git a/include/asm-arm/arch-clps711x/memory.h b/include/asm-arm/arch-clps711x/memory.h
index bd978947db42..61d8717406ce 100644
--- a/include/asm-arm/arch-clps711x/memory.h
+++ b/include/asm-arm/arch-clps711x/memory.h
@@ -25,7 +25,7 @@
25/* 25/*
26 * Physical DRAM offset. 26 * Physical DRAM offset.
27 */ 27 */
28#define PHYS_OFFSET (0xc0000000UL) 28#define PHYS_OFFSET UL(0xc0000000)
29 29
30/* 30/*
31 * Virtual view <-> DMA view memory address translations 31 * Virtual view <-> DMA view memory address translations
diff --git a/include/asm-arm/arch-ebsa110/memory.h b/include/asm-arm/arch-ebsa110/memory.h
index 5a9493e12275..02f144520c10 100644
--- a/include/asm-arm/arch-ebsa110/memory.h
+++ b/include/asm-arm/arch-ebsa110/memory.h
@@ -19,7 +19,7 @@
19/* 19/*
20 * Physical DRAM offset. 20 * Physical DRAM offset.
21 */ 21 */
22#define PHYS_OFFSET (0x00000000UL) 22#define PHYS_OFFSET UL(0x00000000)
23 23
24/* 24/*
25 * We keep this 1:1 so that we don't interfere 25 * We keep this 1:1 so that we don't interfere
diff --git a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h
index d0466f9987d3..09e335cd687d 100644
--- a/include/asm-arm/arch-ebsa285/memory.h
+++ b/include/asm-arm/arch-ebsa285/memory.h
@@ -46,14 +46,14 @@ extern unsigned long __bus_to_virt(unsigned long);
46#if defined(CONFIG_ARCH_FOOTBRIDGE) 46#if defined(CONFIG_ARCH_FOOTBRIDGE)
47 47
48/* Task size and page offset at 3GB */ 48/* Task size and page offset at 3GB */
49#define TASK_SIZE (0xbf000000UL) 49#define TASK_SIZE UL(0xbf000000)
50#define PAGE_OFFSET (0xc0000000UL) 50#define PAGE_OFFSET UL(0xc0000000)
51 51
52#elif defined(CONFIG_ARCH_CO285) 52#elif defined(CONFIG_ARCH_CO285)
53 53
54/* Task size and page offset at 1.5GB */ 54/* Task size and page offset at 1.5GB */
55#define TASK_SIZE (0x5f000000UL) 55#define TASK_SIZE UL(0x5f000000)
56#define PAGE_OFFSET (0x60000000UL) 56#define PAGE_OFFSET UL(0x60000000)
57 57
58#else 58#else
59 59
@@ -64,7 +64,7 @@ extern unsigned long __bus_to_virt(unsigned long);
64/* 64/*
65 * Physical DRAM offset. 65 * Physical DRAM offset.
66 */ 66 */
67#define PHYS_OFFSET (0x00000000UL) 67#define PHYS_OFFSET UL(0x00000000)
68 68
69/* 69/*
70 * This decides where the kernel will search for a free chunk of vm 70 * This decides where the kernel will search for a free chunk of vm
diff --git a/include/asm-arm/arch-epxa10db/memory.h b/include/asm-arm/arch-epxa10db/memory.h
index 3f86bf7f67f0..999541b6a9f5 100644
--- a/include/asm-arm/arch-epxa10db/memory.h
+++ b/include/asm-arm/arch-epxa10db/memory.h
@@ -23,7 +23,7 @@
23/* 23/*
24 * Physical DRAM offset. 24 * Physical DRAM offset.
25 */ 25 */
26#define PHYS_OFFSET (0x00000000UL) 26#define PHYS_OFFSET UL(0x00000000)
27 27
28/* 28/*
29 * Virtual view <-> DMA view memory address translations 29 * Virtual view <-> DMA view memory address translations
diff --git a/include/asm-arm/arch-h720x/memory.h b/include/asm-arm/arch-h720x/memory.h
index 5633447af268..4a1bfd78a0fe 100644
--- a/include/asm-arm/arch-h720x/memory.h
+++ b/include/asm-arm/arch-h720x/memory.h
@@ -11,7 +11,7 @@
11 * Page offset: 11 * Page offset:
12 * ( 0xc0000000UL ) 12 * ( 0xc0000000UL )
13 */ 13 */
14#define PHYS_OFFSET (0x40000000UL) 14#define PHYS_OFFSET UL(0x40000000)
15 15
16/* 16/*
17 * Virtual view <-> DMA view memory address translations 17 * Virtual view <-> DMA view memory address translations
diff --git a/include/asm-arm/arch-imx/memory.h b/include/asm-arm/arch-imx/memory.h
index 116a91fa14f1..d09ae32cd2f4 100644
--- a/include/asm-arm/arch-imx/memory.h
+++ b/include/asm-arm/arch-imx/memory.h
@@ -21,7 +21,7 @@
21#ifndef __ASM_ARCH_MMU_H 21#ifndef __ASM_ARCH_MMU_H
22#define __ASM_ARCH_MMU_H 22#define __ASM_ARCH_MMU_H
23 23
24#define PHYS_OFFSET (0x08000000UL) 24#define PHYS_OFFSET UL(0x08000000)
25 25
26/* 26/*
27 * Virtual view <-> DMA view memory address translations 27 * Virtual view <-> DMA view memory address translations
diff --git a/include/asm-arm/arch-integrator/memory.h b/include/asm-arm/arch-integrator/memory.h
index 2087ea7d28a9..1ab56d783e7c 100644
--- a/include/asm-arm/arch-integrator/memory.h
+++ b/include/asm-arm/arch-integrator/memory.h
@@ -23,8 +23,8 @@
23/* 23/*
24 * Physical DRAM offset. 24 * Physical DRAM offset.
25 */ 25 */
26#define PHYS_OFFSET (0x00000000UL) 26#define PHYS_OFFSET UL(0x00000000)
27#define BUS_OFFSET (0x80000000UL) 27#define BUS_OFFSET UL(0x80000000)
28 28
29/* 29/*
30 * Virtual view <-> DMA view memory address translations 30 * Virtual view <-> DMA view memory address translations
diff --git a/include/asm-arm/arch-iop3xx/memory.h b/include/asm-arm/arch-iop3xx/memory.h
index 45351f5cd904..bc62f4b13235 100644
--- a/include/asm-arm/arch-iop3xx/memory.h
+++ b/include/asm-arm/arch-iop3xx/memory.h
@@ -12,9 +12,9 @@
12 * Physical DRAM offset. 12 * Physical DRAM offset.
13 */ 13 */
14#ifndef CONFIG_ARCH_IOP331 14#ifndef CONFIG_ARCH_IOP331
15#define PHYS_OFFSET (0xa0000000UL) 15#define PHYS_OFFSET UL(0xa0000000)
16#else 16#else
17#define PHYS_OFFSET (0x00000000UL) 17#define PHYS_OFFSET UL(0x00000000)
18#endif 18#endif
19 19
20/* 20/*
diff --git a/include/asm-arm/arch-ixp2000/memory.h b/include/asm-arm/arch-ixp2000/memory.h
index d0f415c6dae9..21e1de51e3f6 100644
--- a/include/asm-arm/arch-ixp2000/memory.h
+++ b/include/asm-arm/arch-ixp2000/memory.h
@@ -13,7 +13,7 @@
13#ifndef __ASM_ARCH_MEMORY_H 13#ifndef __ASM_ARCH_MEMORY_H
14#define __ASM_ARCH_MEMORY_H 14#define __ASM_ARCH_MEMORY_H
15 15
16#define PHYS_OFFSET (0x00000000UL) 16#define PHYS_OFFSET UL(0x00000000)
17 17
18/* 18/*
19 * Virtual view <-> DMA view memory address translations 19 * Virtual view <-> DMA view memory address translations
diff --git a/include/asm-arm/arch-ixp2000/platform.h b/include/asm-arm/arch-ixp2000/platform.h
index abdcf51bd283..a66317ab2071 100644
--- a/include/asm-arm/arch-ixp2000/platform.h
+++ b/include/asm-arm/arch-ixp2000/platform.h
@@ -15,40 +15,40 @@
15 15
16#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
17 17
18static inline unsigned long ixp2000_reg_read(volatile void *reg)
19{
20 return *((volatile unsigned long *)reg);
21}
22
23static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)
24{
25 *((volatile unsigned long *)reg) = val;
26}
27
18/* 28/*
19 * The IXP2400 B0 silicon contains an erratum (#66) that causes writes 29 * On the IXP2400, we can't use XCB=000 due to chip bugs. We use
20 * to on-chip I/O register to not complete fully. What this means is 30 * XCB=101 instead, but that makes all I/O accesses bufferable. This
21 * that if you have a write to on-chip I/O followed by a back-to-back 31 * is not a problem in general, but we do have to be slightly more
22 * read or write, the first write will happen twice. OR...if it's 32 * careful because I/O writes are no longer automatically flushed out
23 * not a back-to-back transaction, the read or write will generate 33 * of the write buffer.
24 * incorrect data.
25 *
26 * The official work around for this is to set the on-chip I/O regions
27 * as XCB=101 and then force a read-back from the register.
28 * 34 *
35 * In cases where we want to make sure that a write has been flushed
36 * out of the write buffer before we proceed, for example when masking
37 * a device interrupt before re-enabling IRQs in CPSR, we can use this
38 * function, ixp2000_reg_wrb, which performs a write, a readback, and
39 * issues a dummy instruction dependent on the value of the readback
40 * (mov rX, rX) to make sure that the readback has completed before we
41 * continue.
29 */ 42 */
30#if defined(CONFIG_ARCH_ENP2611) || defined(CONFIG_ARCH_IXDP2400) || defined(CONFIG_ARCH_IXDP2401) 43static inline void ixp2000_reg_wrb(volatile void *reg, unsigned long val)
31
32#include <asm/system.h> /* Pickup local_irq_ functions */
33
34static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)
35{ 44{
36 unsigned long dummy; 45 unsigned long dummy;
37 unsigned long flags;
38 46
39 local_irq_save(flags);
40 *((volatile unsigned long *)reg) = val; 47 *((volatile unsigned long *)reg) = val;
41 barrier(); 48
42 dummy = *((volatile unsigned long *)reg); 49 dummy = *((volatile unsigned long *)reg);
43 local_irq_restore(flags); 50 __asm__ __volatile__("mov %0, %0" : "+r" (dummy));
44}
45#else
46static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)
47{
48 *((volatile unsigned long *)reg) = val;
49} 51}
50#endif /* IXDP2400 || IXDP2401 */
51#define ixp2000_reg_read(reg) (*((volatile unsigned long *)reg))
52 52
53/* 53/*
54 * Boards may multiplex different devices on the 2nd channel of 54 * Boards may multiplex different devices on the 2nd channel of
diff --git a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
index 004696a95bdb..2b149ed59149 100644
--- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
+++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
@@ -36,11 +36,11 @@
36 * 36 *
37 * 0x6000000 0x00004000 ioremap'd QMgr 37 * 0x6000000 0x00004000 ioremap'd QMgr
38 * 38 *
39 * 0xC0000000 0x00001000 0xffbfe000 PCI CFG 39 * 0xC0000000 0x00001000 0xffbff000 PCI CFG
40 * 40 *
41 * 0xC4000000 0x00001000 0xffbfd000 EXP CFG 41 * 0xC4000000 0x00001000 0xffbfe000 EXP CFG
42 * 42 *
43 * 0xC8000000 0x0000C000 0xffbf2000 On-Chip Peripherals 43 * 0xC8000000 0x00013000 0xffbeb000 On-Chip Peripherals
44 */ 44 */
45 45
46/* 46/*
@@ -52,22 +52,22 @@
52 * Expansion BUS Configuration registers 52 * Expansion BUS Configuration registers
53 */ 53 */
54#define IXP4XX_EXP_CFG_BASE_PHYS (0xC4000000) 54#define IXP4XX_EXP_CFG_BASE_PHYS (0xC4000000)
55#define IXP4XX_EXP_CFG_BASE_VIRT (0xFFBFD000) 55#define IXP4XX_EXP_CFG_BASE_VIRT (0xFFBFE000)
56#define IXP4XX_EXP_CFG_REGION_SIZE (0x00001000) 56#define IXP4XX_EXP_CFG_REGION_SIZE (0x00001000)
57 57
58/* 58/*
59 * PCI Config registers 59 * PCI Config registers
60 */ 60 */
61#define IXP4XX_PCI_CFG_BASE_PHYS (0xC0000000) 61#define IXP4XX_PCI_CFG_BASE_PHYS (0xC0000000)
62#define IXP4XX_PCI_CFG_BASE_VIRT (0xFFBFE000) 62#define IXP4XX_PCI_CFG_BASE_VIRT (0xFFBFF000)
63#define IXP4XX_PCI_CFG_REGION_SIZE (0x00001000) 63#define IXP4XX_PCI_CFG_REGION_SIZE (0x00001000)
64 64
65/* 65/*
66 * Peripheral space 66 * Peripheral space
67 */ 67 */
68#define IXP4XX_PERIPHERAL_BASE_PHYS (0xC8000000) 68#define IXP4XX_PERIPHERAL_BASE_PHYS (0xC8000000)
69#define IXP4XX_PERIPHERAL_BASE_VIRT (0xFFBF2000) 69#define IXP4XX_PERIPHERAL_BASE_VIRT (0xFFBEB000)
70#define IXP4XX_PERIPHERAL_REGION_SIZE (0x0000C000) 70#define IXP4XX_PERIPHERAL_REGION_SIZE (0x00013000)
71 71
72/* 72/*
73 * Debug UART 73 * Debug UART
@@ -115,25 +115,48 @@
115/* 115/*
116 * Peripheral Space Register Region Base Addresses 116 * Peripheral Space Register Region Base Addresses
117 */ 117 */
118#define IXP4XX_UART1_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x0000) 118#define IXP4XX_UART1_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x0000)
119#define IXP4XX_UART2_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x1000) 119#define IXP4XX_UART2_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x1000)
120#define IXP4XX_PMU_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x2000) 120#define IXP4XX_PMU_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x2000)
121#define IXP4XX_INTC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x3000) 121#define IXP4XX_INTC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x3000)
122#define IXP4XX_GPIO_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x4000) 122#define IXP4XX_GPIO_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x4000)
123#define IXP4XX_TIMER_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x5000) 123#define IXP4XX_TIMER_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x5000)
124#define IXP4XX_EthA_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x9000) 124#define IXP4XX_NPEA_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x6000)
125#define IXP4XX_EthB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xA000) 125#define IXP4XX_NPEB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x7000)
126#define IXP4XX_USB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xB000) 126#define IXP4XX_NPEC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x8000)
127 127#define IXP4XX_EthB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x9000)
128#define IXP4XX_UART1_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x0000) 128#define IXP4XX_EthC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xA000)
129#define IXP4XX_UART2_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x1000) 129#define IXP4XX_USB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xB000)
130#define IXP4XX_PMU_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x2000) 130/* ixp46X only */
131#define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000) 131#define IXP4XX_EthA_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xC000)
132#define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000) 132#define IXP4XX_EthB1_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xD000)
133#define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000) 133#define IXP4XX_EthB2_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xE000)
134#define IXP4XX_EthA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000) 134#define IXP4XX_EthB3_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xF000)
135#define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000) 135#define IXP4XX_TIMESYNC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x10000)
136#define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000) 136#define IXP4XX_I2C_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x11000)
137#define IXP4XX_SSP_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x12000)
138
139
140#define IXP4XX_UART1_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x0000)
141#define IXP4XX_UART2_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x1000)
142#define IXP4XX_PMU_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x2000)
143#define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000)
144#define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000)
145#define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
146#define IXP4XX_NPEA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_PHYS + 0x6000)
147#define IXP4XX_NPEB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_PHYS + 0x7000)
148#define IXP4XX_NPEC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_PHYS + 0x8000)
149#define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000)
150#define IXP4XX_EthC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000)
151#define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000)
152/* ixp46X only */
153#define IXP4XX_EthA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xC000)
154#define IXP4XX_EthB1_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xD000)
155#define IXP4XX_EthB2_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xE000)
156#define IXP4XX_EthB3_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xF000)
157#define IXP4XX_TIMESYNC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x10000)
158#define IXP4XX_I2C_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x11000)
159#define IXP4XX_SSP_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x12000)
137 160
138/* 161/*
139 * Constants to make it easy to access Interrupt Controller registers 162 * Constants to make it easy to access Interrupt Controller registers
diff --git a/include/asm-arm/arch-ixp4xx/memory.h b/include/asm-arm/arch-ixp4xx/memory.h
index d348548b592b..e024d0a1a669 100644
--- a/include/asm-arm/arch-ixp4xx/memory.h
+++ b/include/asm-arm/arch-ixp4xx/memory.h
@@ -12,7 +12,7 @@
12/* 12/*
13 * Physical DRAM offset. 13 * Physical DRAM offset.
14 */ 14 */
15#define PHYS_OFFSET (0x00000000UL) 15#define PHYS_OFFSET UL(0x00000000)
16 16
17#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
18 18
diff --git a/include/asm-arm/arch-l7200/memory.h b/include/asm-arm/arch-l7200/memory.h
index c5b9608cb137..9e50a171f78a 100644
--- a/include/asm-arm/arch-l7200/memory.h
+++ b/include/asm-arm/arch-l7200/memory.h
@@ -15,7 +15,7 @@
15/* 15/*
16 * Physical DRAM offset on the L7200 SDB. 16 * Physical DRAM offset on the L7200 SDB.
17 */ 17 */
18#define PHYS_OFFSET (0xf0000000UL) 18#define PHYS_OFFSET UL(0xf0000000)
19 19
20#define __virt_to_bus(x) __virt_to_phys(x) 20#define __virt_to_bus(x) __virt_to_phys(x)
21#define __bus_to_virt(x) __phys_to_virt(x) 21#define __bus_to_virt(x) __phys_to_virt(x)
diff --git a/include/asm-arm/arch-lh7a40x/memory.h b/include/asm-arm/arch-lh7a40x/memory.h
index c650e6feb9d5..c92bcb837629 100644
--- a/include/asm-arm/arch-lh7a40x/memory.h
+++ b/include/asm-arm/arch-lh7a40x/memory.h
@@ -17,7 +17,7 @@
17/* 17/*
18 * Physical DRAM offset. 18 * Physical DRAM offset.
19 */ 19 */
20#define PHYS_OFFSET (0xc0000000UL) 20#define PHYS_OFFSET UL(0xc0000000)
21 21
22/* 22/*
23 * Virtual view <-> DMA view memory address translations 23 * Virtual view <-> DMA view memory address translations
diff --git a/include/asm-arm/arch-omap/memory.h b/include/asm-arm/arch-omap/memory.h
index ef32d61eec7a..bf545b6e0a26 100644
--- a/include/asm-arm/arch-omap/memory.h
+++ b/include/asm-arm/arch-omap/memory.h
@@ -37,9 +37,9 @@
37 * Physical DRAM offset. 37 * Physical DRAM offset.
38 */ 38 */
39#if defined(CONFIG_ARCH_OMAP1) 39#if defined(CONFIG_ARCH_OMAP1)
40#define PHYS_OFFSET (0x10000000UL) 40#define PHYS_OFFSET UL(0x10000000)
41#elif defined(CONFIG_ARCH_OMAP2) 41#elif defined(CONFIG_ARCH_OMAP2)
42#define PHYS_OFFSET (0x80000000UL) 42#define PHYS_OFFSET UL(0x80000000)
43#endif 43#endif
44 44
45/* 45/*
@@ -66,7 +66,7 @@
66/* 66/*
67 * OMAP-1510 Local Bus address offset 67 * OMAP-1510 Local Bus address offset
68 */ 68 */
69#define OMAP1510_LB_OFFSET (0x30000000UL) 69#define OMAP1510_LB_OFFSET UL(0x30000000)
70 70
71#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) 71#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
72#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) 72#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
diff --git a/include/asm-arm/arch-pxa/memory.h b/include/asm-arm/arch-pxa/memory.h
index 58bad9748b5c..eaf6d43939e9 100644
--- a/include/asm-arm/arch-pxa/memory.h
+++ b/include/asm-arm/arch-pxa/memory.h
@@ -15,7 +15,7 @@
15/* 15/*
16 * Physical DRAM offset. 16 * Physical DRAM offset.
17 */ 17 */
18#define PHYS_OFFSET (0xa0000000UL) 18#define PHYS_OFFSET UL(0xa0000000)
19 19
20/* 20/*
21 * Virtual view <-> DMA view memory address translations 21 * Virtual view <-> DMA view memory address translations
diff --git a/include/asm-arm/arch-rpc/memory.h b/include/asm-arm/arch-rpc/memory.h
index 33fc75cdead0..0592cb3f0c74 100644
--- a/include/asm-arm/arch-rpc/memory.h
+++ b/include/asm-arm/arch-rpc/memory.h
@@ -21,7 +21,7 @@
21/* 21/*
22 * Physical DRAM offset. 22 * Physical DRAM offset.
23 */ 23 */
24#define PHYS_OFFSET (0x10000000UL) 24#define PHYS_OFFSET UL(0x10000000)
25 25
26/* 26/*
27 * These are exactly the same on the RiscPC as the 27 * These are exactly the same on the RiscPC as the
diff --git a/include/asm-arm/arch-s3c2410/memory.h b/include/asm-arm/arch-s3c2410/memory.h
index 3380ab1d0749..6ab834a14c8e 100644
--- a/include/asm-arm/arch-s3c2410/memory.h
+++ b/include/asm-arm/arch-s3c2410/memory.h
@@ -28,9 +28,9 @@
28 * and at 0x0C000000 for S3C2400 28 * and at 0x0C000000 for S3C2400
29 */ 29 */
30#ifdef CONFIG_CPU_S3C2400 30#ifdef CONFIG_CPU_S3C2400
31#define PHYS_OFFSET (0x0C000000UL) 31#define PHYS_OFFSET UL(0x0C000000)
32#else 32#else
33#define PHYS_OFFSET (0x30000000UL) 33#define PHYS_OFFSET UL(0x30000000)
34#endif 34#endif
35 35
36/* 36/*
diff --git a/include/asm-arm/arch-sa1100/memory.h b/include/asm-arm/arch-sa1100/memory.h
index 8743ff5c1b23..0fc555b4c912 100644
--- a/include/asm-arm/arch-sa1100/memory.h
+++ b/include/asm-arm/arch-sa1100/memory.h
@@ -13,7 +13,7 @@
13/* 13/*
14 * Physical DRAM offset is 0xc0000000 on the SA1100 14 * Physical DRAM offset is 0xc0000000 on the SA1100
15 */ 15 */
16#define PHYS_OFFSET (0xc0000000UL) 16#define PHYS_OFFSET UL(0xc0000000)
17 17
18#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
19 19
diff --git a/include/asm-arm/arch-shark/memory.h b/include/asm-arm/arch-shark/memory.h
index 8ff956d25463..95a29b4bc5d0 100644
--- a/include/asm-arm/arch-shark/memory.h
+++ b/include/asm-arm/arch-shark/memory.h
@@ -15,7 +15,7 @@
15/* 15/*
16 * Physical DRAM offset. 16 * Physical DRAM offset.
17 */ 17 */
18#define PHYS_OFFSET (0x08000000UL) 18#define PHYS_OFFSET UL(0x08000000)
19 19
20#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
21 21
diff --git a/include/asm-arm/arch-versatile/memory.h b/include/asm-arm/arch-versatile/memory.h
index 7b8b7cc422fa..a9370976cc5e 100644
--- a/include/asm-arm/arch-versatile/memory.h
+++ b/include/asm-arm/arch-versatile/memory.h
@@ -23,7 +23,7 @@
23/* 23/*
24 * Physical DRAM offset. 24 * Physical DRAM offset.
25 */ 25 */
26#define PHYS_OFFSET (0x00000000UL) 26#define PHYS_OFFSET UL(0x00000000)
27 27
28/* 28/*
29 * Virtual view <-> DMA view memory address translations 29 * Virtual view <-> DMA view memory address translations
diff --git a/include/asm-arm/mach/arch.h b/include/asm-arm/mach/arch.h
index 7273c6fd95b5..eb262e078c46 100644
--- a/include/asm-arm/mach/arch.h
+++ b/include/asm-arm/mach/arch.h
@@ -50,6 +50,7 @@ struct machine_desc {
50 */ 50 */
51#define MACHINE_START(_type,_name) \ 51#define MACHINE_START(_type,_name) \
52static const struct machine_desc __mach_desc_##_type \ 52static const struct machine_desc __mach_desc_##_type \
53 __attribute_used__ \
53 __attribute__((__section__(".arch.info.init"))) = { \ 54 __attribute__((__section__(".arch.info.init"))) = { \
54 .nr = MACH_TYPE_##_type, \ 55 .nr = MACH_TYPE_##_type, \
55 .name = _name, 56 .name = _name,
diff --git a/include/asm-arm/mach/flash.h b/include/asm-arm/mach/flash.h
index a92887d4b2cb..cd57436d9874 100644
--- a/include/asm-arm/mach/flash.h
+++ b/include/asm-arm/mach/flash.h
@@ -14,6 +14,7 @@ struct mtd_partition;
14 14
15/* 15/*
16 * map_name: the map probe function name 16 * map_name: the map probe function name
17 * name: flash device name (eg, as used with mtdparts=)
17 * width: width of mapped device 18 * width: width of mapped device
18 * init: method called at driver/device initialisation 19 * init: method called at driver/device initialisation
19 * exit: method called at driver/device removal 20 * exit: method called at driver/device removal
@@ -23,6 +24,7 @@ struct mtd_partition;
23 */ 24 */
24struct flash_platform_data { 25struct flash_platform_data {
25 const char *map_name; 26 const char *map_name;
27 const char *name;
26 unsigned int width; 28 unsigned int width;
27 int (*init)(void); 29 int (*init)(void);
28 void (*exit)(void); 30 void (*exit)(void);
diff --git a/include/asm-arm/mach/map.h b/include/asm-arm/mach/map.h
index 0619522bd926..b338936bde4f 100644
--- a/include/asm-arm/mach/map.h
+++ b/include/asm-arm/mach/map.h
@@ -27,8 +27,8 @@ struct meminfo;
27#define MT_ROM 6 27#define MT_ROM 6
28#define MT_IXP2000_DEVICE 7 28#define MT_IXP2000_DEVICE 7
29 29
30#define __phys_to_pfn(paddr) (paddr >> PAGE_SHIFT) 30#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
31#define __pfn_to_phys(pfn) (pfn << PAGE_SHIFT) 31#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
32 32
33extern void create_memmap_holes(struct meminfo *); 33extern void create_memmap_holes(struct meminfo *);
34extern void memtable_init(struct meminfo *); 34extern void memtable_init(struct meminfo *);
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h
index a8a933a775db..a547ee598c6c 100644
--- a/include/asm-arm/memory.h
+++ b/include/asm-arm/memory.h
@@ -12,6 +12,16 @@
12#ifndef __ASM_ARM_MEMORY_H 12#ifndef __ASM_ARM_MEMORY_H
13#define __ASM_ARM_MEMORY_H 13#define __ASM_ARM_MEMORY_H
14 14
15/*
16 * Allow for constants defined here to be used from assembly code
17 * by prepending the UL suffix only with actual C code compilation.
18 */
19#ifndef __ASSEMBLY__
20#define UL(x) (x##UL)
21#else
22#define UL(x) (x)
23#endif
24
15#include <linux/config.h> 25#include <linux/config.h>
16#include <linux/compiler.h> 26#include <linux/compiler.h>
17#include <asm/arch/memory.h> 27#include <asm/arch/memory.h>
@@ -21,20 +31,20 @@
21 * TASK_SIZE - the maximum size of a user space task. 31 * TASK_SIZE - the maximum size of a user space task.
22 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area 32 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
23 */ 33 */
24#define TASK_SIZE (0xbf000000UL) 34#define TASK_SIZE UL(0xbf000000)
25#define TASK_UNMAPPED_BASE (0x40000000UL) 35#define TASK_UNMAPPED_BASE UL(0x40000000)
26#endif 36#endif
27 37
28/* 38/*
29 * The maximum size of a 26-bit user space task. 39 * The maximum size of a 26-bit user space task.
30 */ 40 */
31#define TASK_SIZE_26 (0x04000000UL) 41#define TASK_SIZE_26 UL(0x04000000)
32 42
33/* 43/*
34 * Page offset: 3GB 44 * Page offset: 3GB
35 */ 45 */
36#ifndef PAGE_OFFSET 46#ifndef PAGE_OFFSET
37#define PAGE_OFFSET (0xc0000000UL) 47#define PAGE_OFFSET UL(0xc0000000)
38#endif 48#endif
39 49
40/* 50/*
@@ -58,6 +68,13 @@
58#error Top of user space clashes with start of module space 68#error Top of user space clashes with start of module space
59#endif 69#endif
60 70
71/*
72 * The XIP kernel gets mapped at the bottom of the module vm area.
73 * Since we use sections to map it, this macro replaces the physical address
74 * with its virtual address while keeping offset from the base section.
75 */
76#define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff))
77
61#ifndef __ASSEMBLY__ 78#ifndef __ASSEMBLY__
62 79
63/* 80/*