aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/arm/mach-sa1100
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r--arch/arm/mach-sa1100/Kconfig16
-rw-r--r--arch/arm/mach-sa1100/Makefile5
-rw-r--r--arch/arm/mach-sa1100/assabet.c2
-rw-r--r--arch/arm/mach-sa1100/badge4.c2
-rw-r--r--arch/arm/mach-sa1100/cerf.c4
-rw-r--r--arch/arm/mach-sa1100/collie.c5
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1100.c60
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1110.c57
-rw-r--r--arch/arm/mach-sa1100/generic.c65
-rw-r--r--arch/arm/mach-sa1100/h3100.c2
-rw-r--r--arch/arm/mach-sa1100/h3600.c2
-rw-r--r--arch/arm/mach-sa1100/hackkit.c2
-rw-r--r--arch/arm/mach-sa1100/include/mach/SA-1100.h2
-rw-r--r--arch/arm/mach-sa1100/include/mach/debug-macro.S36
-rw-r--r--arch/arm/mach-sa1100/include/mach/hardware.h8
-rw-r--r--arch/arm/mach-sa1100/include/mach/memory.h14
-rw-r--r--arch/arm/mach-sa1100/include/mach/nanoengine.h52
-rw-r--r--arch/arm/mach-sa1100/irq.c119
-rw-r--r--arch/arm/mach-sa1100/jornada720.c2
-rw-r--r--arch/arm/mach-sa1100/jornada720_ssp.c4
-rw-r--r--arch/arm/mach-sa1100/lart.c2
-rw-r--r--arch/arm/mach-sa1100/nanoengine.c119
-rw-r--r--arch/arm/mach-sa1100/neponset.c16
-rw-r--r--arch/arm/mach-sa1100/pci-nanoengine.c284
-rw-r--r--arch/arm/mach-sa1100/pleb.c4
-rw-r--r--arch/arm/mach-sa1100/pm.c14
-rw-r--r--arch/arm/mach-sa1100/shannon.c2
-rw-r--r--arch/arm/mach-sa1100/simpad.c9
-rw-r--r--arch/arm/mach-sa1100/sleep.S72
-rw-r--r--arch/arm/mach-sa1100/time.c58
30 files changed, 716 insertions, 323 deletions
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index fd4c52b7ccb6..42625e4d949a 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -90,8 +90,8 @@ config SA1100_JORNADA720
90 # FIXME: select CPU_FREQ_SA11x0 90 # FIXME: select CPU_FREQ_SA11x0
91 help 91 help
92 Say Y here if you want to build a kernel for the HP Jornada 720 92 Say Y here if you want to build a kernel for the HP Jornada 720
93 handheld computer. See <http://www.hp.com/jornada/products/720> 93 handheld computer. See
94 for details. 94 <http://h10025.www1.hp.com/ewfrf/wc/product?product=61677&cc=us&lc=en&dlc=en&product=61677#>
95 95
96config SA1100_JORNADA720_SSP 96config SA1100_JORNADA720_SSP
97 bool "HP Jornada 720 Extended SSP driver" 97 bool "HP Jornada 720 Extended SSP driver"
@@ -118,6 +118,16 @@ config SA1100_LART
118 (also known as the LART). See <http://www.lartmaker.nl/> for 118 (also known as the LART). See <http://www.lartmaker.nl/> for
119 information on the LART. 119 information on the LART.
120 120
121config SA1100_NANOENGINE
122 bool "nanoEngine"
123 select CPU_FREQ_SA1110
124 select PCI
125 select PCI_NANOENGINE
126 help
127 Say Y here if you are using the Bright Star Engineering nanoEngine.
128 See <http://www.brightstareng.com/arm/nanoeng.htm> for information
129 on the BSE nanoEngine.
130
121config SA1100_PLEB 131config SA1100_PLEB
122 bool "PLEB" 132 bool "PLEB"
123 select CPU_FREQ_SA1100 133 select CPU_FREQ_SA1100
@@ -145,7 +155,7 @@ config SA1100_SIMPAD
145 FLASH. The SL4 version got 64 MB RAM and 32 MB FLASH and a 155 FLASH. The SL4 version got 64 MB RAM and 32 MB FLASH and a
146 PCMCIA-Slot. The version for the Germany Telecom (DTAG) is the same 156 PCMCIA-Slot. The version for the Germany Telecom (DTAG) is the same
147 like CL4 in additional it has a PCMCIA-Slot. For more information 157 like CL4 in additional it has a PCMCIA-Slot. For more information
148 visit <http://www.my-siemens.com/> or <http://www.siemens.ch/>. 158 visit <http://www.usa.siemens.com/> or <http://www.siemens.ch/>.
149 159
150config SA1100_SSP 160config SA1100_SSP
151 tristate "Generic PIO SSP" 161 tristate "Generic PIO SSP"
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 89349c1dd7a6..41252d22e659 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -37,6 +37,9 @@ obj-$(CONFIG_SA1100_JORNADA720_SSP) += jornada720_ssp.o
37obj-$(CONFIG_SA1100_LART) += lart.o 37obj-$(CONFIG_SA1100_LART) += lart.o
38led-$(CONFIG_SA1100_LART) += leds-lart.o 38led-$(CONFIG_SA1100_LART) += leds-lart.o
39 39
40obj-$(CONFIG_SA1100_NANOENGINE) += nanoengine.o
41obj-$(CONFIG_PCI_NANOENGINE) += pci-nanoengine.o
42
40obj-$(CONFIG_SA1100_PLEB) += pleb.o 43obj-$(CONFIG_SA1100_PLEB) += pleb.o
41 44
42obj-$(CONFIG_SA1100_SHANNON) += shannon.o 45obj-$(CONFIG_SA1100_SHANNON) += shannon.o
@@ -47,7 +50,7 @@ led-$(CONFIG_SA1100_SIMPAD) += leds-simpad.o
47# LEDs support 50# LEDs support
48obj-$(CONFIG_LEDS) += $(led-y) 51obj-$(CONFIG_LEDS) += $(led-y)
49 52
50# Miscelaneous functions 53# Miscellaneous functions
51obj-$(CONFIG_PM) += pm.o sleep.o 54obj-$(CONFIG_PM) += pm.o sleep.o
52obj-$(CONFIG_SA1100_SSP) += ssp.o 55obj-$(CONFIG_SA1100_SSP) += ssp.o
53 56
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 169e5b87dbff..5778274a8260 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -447,8 +447,6 @@ static void __init assabet_map_io(void)
447 447
448 448
449MACHINE_START(ASSABET, "Intel-Assabet") 449MACHINE_START(ASSABET, "Intel-Assabet")
450 .phys_io = 0x80000000,
451 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
452 .boot_params = 0xc0000100, 450 .boot_params = 0xc0000100,
453 .fixup = fixup_assabet, 451 .fixup = fixup_assabet,
454 .map_io = assabet_map_io, 452 .map_io = assabet_map_io,
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index 259cb2c15fff..4f19ff868b00 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -302,8 +302,6 @@ static void __init badge4_map_io(void)
302} 302}
303 303
304MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4") 304MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4")
305 .phys_io = 0x80000000,
306 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
307 .boot_params = 0xc0000100, 305 .boot_params = 0xc0000100,
308 .map_io = badge4_map_io, 306 .map_io = badge4_map_io,
309 .init_irq = sa1100_init_irq, 307 .init_irq = sa1100_init_irq,
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c
index bc950ef418af..7f3da4b11ec9 100644
--- a/arch/arm/mach-sa1100/cerf.c
+++ b/arch/arm/mach-sa1100/cerf.c
@@ -96,7 +96,7 @@ static struct resource cerf_flash_resource = {
96static void __init cerf_init_irq(void) 96static void __init cerf_init_irq(void)
97{ 97{
98 sa1100_init_irq(); 98 sa1100_init_irq();
99 set_irq_type(CERF_ETH_IRQ, IRQ_TYPE_EDGE_RISING); 99 irq_set_irq_type(CERF_ETH_IRQ, IRQ_TYPE_EDGE_RISING);
100} 100}
101 101
102static struct map_desc cerf_io_desc[] __initdata = { 102static struct map_desc cerf_io_desc[] __initdata = {
@@ -135,8 +135,6 @@ static void __init cerf_init(void)
135 135
136MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") 136MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
137 /* Maintainer: support@intrinsyc.com */ 137 /* Maintainer: support@intrinsyc.com */
138 .phys_io = 0x80000000,
139 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
140 .map_io = cerf_map_io, 138 .map_io = cerf_map_io,
141 .init_irq = cerf_init_irq, 139 .init_irq = cerf_init_irq,
142 .timer = &sa1100_timer, 140 .timer = &sa1100_timer,
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 16e682d5dbb7..bd3e1bfdd6aa 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -241,6 +241,9 @@ static struct locomo_platform_data locomo_info = {
241struct platform_device collie_locomo_device = { 241struct platform_device collie_locomo_device = {
242 .name = "locomo", 242 .name = "locomo",
243 .id = 0, 243 .id = 0,
244 .dev = {
245 .platform_data = &locomo_info,
246 },
244 .num_resources = ARRAY_SIZE(locomo_resources), 247 .num_resources = ARRAY_SIZE(locomo_resources),
245 .resource = locomo_resources, 248 .resource = locomo_resources,
246}; 249};
@@ -379,8 +382,6 @@ static void __init collie_map_io(void)
379} 382}
380 383
381MACHINE_START(COLLIE, "Sharp-Collie") 384MACHINE_START(COLLIE, "Sharp-Collie")
382 .phys_io = 0x80000000,
383 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
384 .map_io = collie_map_io, 385 .map_io = collie_map_io,
385 .init_irq = sa1100_init_irq, 386 .init_irq = sa1100_init_irq,
386 .timer = &sa1100_timer, 387 .timer = &sa1100_timer,
diff --git a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c
index ef817876a5d6..aaa8acf76b7b 100644
--- a/arch/arm/mach-sa1100/cpu-sa1100.c
+++ b/arch/arm/mach-sa1100/cpu-sa1100.c
@@ -13,7 +13,7 @@
13 * This software has been developed while working on the LART 13 * This software has been developed while working on the LART
14 * computing board (http://www.lartmaker.nl/), which is 14 * computing board (http://www.lartmaker.nl/), which is
15 * sponsored by the Mobile Multi-media Communications 15 * sponsored by the Mobile Multi-media Communications
16 * (http://www.mmc.tudelft.nl/) and Ubiquitous Communications 16 * (http://www.mobimedia.org/) and Ubiquitous Communications
17 * (http://www.ubicom.tudelft.nl/) projects. 17 * (http://www.ubicom.tudelft.nl/) projects.
18 * 18 *
19 * The authors can be reached at: 19 * The authors can be reached at:
@@ -68,7 +68,7 @@
68 * clock change in ROM and jump to that code from the kernel. The main 68 * clock change in ROM and jump to that code from the kernel. The main
69 * disadvantage is that the ROM has to be modified, which is not 69 * disadvantage is that the ROM has to be modified, which is not
70 * possible on all SA-1100 platforms. Another disadvantage is that 70 * possible on all SA-1100 platforms. Another disadvantage is that
71 * jumping to ROM makes clock switching unecessary complicated. 71 * jumping to ROM makes clock switching unnecessary complicated.
72 * 72 *
73 * The idea behind this driver is that the memory configuration can be 73 * The idea behind this driver is that the memory configuration can be
74 * changed while running from DRAM (even with interrupts turned on!) 74 * changed while running from DRAM (even with interrupts turned on!)
@@ -94,48 +94,47 @@
94 94
95#include "generic.h" 95#include "generic.h"
96 96
97typedef struct { 97struct sa1100_dram_regs {
98 int speed; 98 int speed;
99 u32 mdcnfg; 99 u32 mdcnfg;
100 u32 mdcas0; 100 u32 mdcas0;
101 u32 mdcas1; 101 u32 mdcas1;
102 u32 mdcas2; 102 u32 mdcas2;
103} sa1100_dram_regs_t; 103};
104 104
105 105
106static struct cpufreq_driver sa1100_driver; 106static struct cpufreq_driver sa1100_driver;
107 107
108static sa1100_dram_regs_t sa1100_dram_settings[] = 108static struct sa1100_dram_regs sa1100_dram_settings[] = {
109{ 109 /*speed, mdcnfg, mdcas0, mdcas1, mdcas2, clock freq */
110 /* speed, mdcnfg, mdcas0, mdcas1, mdcas2 clock frequency */ 110 { 59000, 0x00dc88a3, 0xcccccccf, 0xfffffffc, 0xffffffff},/* 59.0 MHz */
111 { 59000, 0x00dc88a3, 0xcccccccf, 0xfffffffc, 0xffffffff }, /* 59.0 MHz */ 111 { 73700, 0x011490a3, 0xcccccccf, 0xfffffffc, 0xffffffff},/* 73.7 MHz */
112 { 73700, 0x011490a3, 0xcccccccf, 0xfffffffc, 0xffffffff }, /* 73.7 MHz */ 112 { 88500, 0x014e90a3, 0xcccccccf, 0xfffffffc, 0xffffffff},/* 88.5 MHz */
113 { 88500, 0x014e90a3, 0xcccccccf, 0xfffffffc, 0xffffffff }, /* 88.5 MHz */ 113 {103200, 0x01889923, 0xcccccccf, 0xfffffffc, 0xffffffff},/* 103.2 MHz */
114 { 103200, 0x01889923, 0xcccccccf, 0xfffffffc, 0xffffffff }, /* 103.2 MHz */ 114 {118000, 0x01c29923, 0x9999998f, 0xfffffff9, 0xffffffff},/* 118.0 MHz */
115 { 118000, 0x01c29923, 0x9999998f, 0xfffffff9, 0xffffffff }, /* 118.0 MHz */ 115 {132700, 0x01fb2123, 0x9999998f, 0xfffffff9, 0xffffffff},/* 132.7 MHz */
116 { 132700, 0x01fb2123, 0x9999998f, 0xfffffff9, 0xffffffff }, /* 132.7 MHz */ 116 {147500, 0x02352123, 0x3333330f, 0xfffffff3, 0xffffffff},/* 147.5 MHz */
117 { 147500, 0x02352123, 0x3333330f, 0xfffffff3, 0xffffffff }, /* 147.5 MHz */ 117 {162200, 0x026b29a3, 0x38e38e1f, 0xfff8e38e, 0xffffffff},/* 162.2 MHz */
118 { 162200, 0x026b29a3, 0x38e38e1f, 0xfff8e38e, 0xffffffff }, /* 162.2 MHz */ 118 {176900, 0x02a329a3, 0x71c71c1f, 0xfff1c71c, 0xffffffff},/* 176.9 MHz */
119 { 176900, 0x02a329a3, 0x71c71c1f, 0xfff1c71c, 0xffffffff }, /* 176.9 MHz */ 119 {191700, 0x02dd31a3, 0xe38e383f, 0xffe38e38, 0xffffffff},/* 191.7 MHz */
120 { 191700, 0x02dd31a3, 0xe38e383f, 0xffe38e38, 0xffffffff }, /* 191.7 MHz */ 120 {206400, 0x03153223, 0xc71c703f, 0xffc71c71, 0xffffffff},/* 206.4 MHz */
121 { 206400, 0x03153223, 0xc71c703f, 0xffc71c71, 0xffffffff }, /* 206.4 MHz */ 121 {221200, 0x034fba23, 0xc71c703f, 0xffc71c71, 0xffffffff},/* 221.2 MHz */
122 { 221200, 0x034fba23, 0xc71c703f, 0xffc71c71, 0xffffffff }, /* 221.2 MHz */ 122 {235900, 0x03853a23, 0xe1e1e07f, 0xe1e1e1e1, 0xffffffe1},/* 235.9 MHz */
123 { 235900, 0x03853a23, 0xe1e1e07f, 0xe1e1e1e1, 0xffffffe1 }, /* 235.9 MHz */ 123 {250700, 0x03bf3aa3, 0xc3c3c07f, 0xc3c3c3c3, 0xffffffc3},/* 250.7 MHz */
124 { 250700, 0x03bf3aa3, 0xc3c3c07f, 0xc3c3c3c3, 0xffffffc3 }, /* 250.7 MHz */ 124 {265400, 0x03f7c2a3, 0xc3c3c07f, 0xc3c3c3c3, 0xffffffc3},/* 265.4 MHz */
125 { 265400, 0x03f7c2a3, 0xc3c3c07f, 0xc3c3c3c3, 0xffffffc3 }, /* 265.4 MHz */ 125 {280200, 0x0431c2a3, 0x878780ff, 0x87878787, 0xffffff87},/* 280.2 MHz */
126 { 280200, 0x0431c2a3, 0x878780ff, 0x87878787, 0xffffff87 }, /* 280.2 MHz */
127 { 0, 0, 0, 0, 0 } /* last entry */ 126 { 0, 0, 0, 0, 0 } /* last entry */
128}; 127};
129 128
130static void sa1100_update_dram_timings(int current_speed, int new_speed) 129static void sa1100_update_dram_timings(int current_speed, int new_speed)
131{ 130{
132 sa1100_dram_regs_t *settings = sa1100_dram_settings; 131 struct sa1100_dram_regs *settings = sa1100_dram_settings;
133 132
134 /* find speed */ 133 /* find speed */
135 while (settings->speed != 0) { 134 while (settings->speed != 0) {
136 if(new_speed == settings->speed) 135 if (new_speed == settings->speed)
137 break; 136 break;
138 137
139 settings++; 138 settings++;
140 } 139 }
141 140
@@ -149,7 +148,7 @@ static void sa1100_update_dram_timings(int current_speed, int new_speed)
149 /* We're going FASTER, so first relax the memory 148 /* We're going FASTER, so first relax the memory
150 * timings before changing the core frequency 149 * timings before changing the core frequency
151 */ 150 */
152 151
153 /* Half the memory access clock */ 152 /* Half the memory access clock */
154 MDCNFG |= MDCNFG_CDB2; 153 MDCNFG |= MDCNFG_CDB2;
155 154
@@ -184,16 +183,15 @@ static int sa1100_target(struct cpufreq_policy *policy,
184{ 183{
185 unsigned int cur = sa11x0_getspeed(0); 184 unsigned int cur = sa11x0_getspeed(0);
186 unsigned int new_ppcr; 185 unsigned int new_ppcr;
187
188 struct cpufreq_freqs freqs; 186 struct cpufreq_freqs freqs;
189 switch(relation){ 187
188 new_ppcr = sa11x0_freq_to_ppcr(target_freq);
189 switch (relation) {
190 case CPUFREQ_RELATION_L: 190 case CPUFREQ_RELATION_L:
191 new_ppcr = sa11x0_freq_to_ppcr(target_freq);
192 if (sa11x0_ppcr_to_freq(new_ppcr) > policy->max) 191 if (sa11x0_ppcr_to_freq(new_ppcr) > policy->max)
193 new_ppcr--; 192 new_ppcr--;
194 break; 193 break;
195 case CPUFREQ_RELATION_H: 194 case CPUFREQ_RELATION_H:
196 new_ppcr = sa11x0_freq_to_ppcr(target_freq);
197 if ((sa11x0_ppcr_to_freq(new_ppcr) > target_freq) && 195 if ((sa11x0_ppcr_to_freq(new_ppcr) > target_freq) &&
198 (sa11x0_ppcr_to_freq(new_ppcr - 1) >= policy->min)) 196 (sa11x0_ppcr_to_freq(new_ppcr - 1) >= policy->min))
199 new_ppcr--; 197 new_ppcr--;
diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c
index 7252874d328b..675bf8ef97e8 100644
--- a/arch/arm/mach-sa1100/cpu-sa1110.c
+++ b/arch/arm/mach-sa1100/cpu-sa1110.c
@@ -16,28 +16,24 @@
16 * 16 *
17 * The SDRAM type can be passed on the command line as cpu_sa1110.sdram=type 17 * The SDRAM type can be passed on the command line as cpu_sa1110.sdram=type
18 */ 18 */
19#include <linux/moduleparam.h>
20#include <linux/types.h>
21#include <linux/kernel.h>
22#include <linux/sched.h>
23#include <linux/cpufreq.h> 19#include <linux/cpufreq.h>
24#include <linux/delay.h> 20#include <linux/delay.h>
25#include <linux/init.h> 21#include <linux/init.h>
26#include <linux/io.h> 22#include <linux/kernel.h>
23#include <linux/moduleparam.h>
24#include <linux/types.h>
27 25
28#include <mach/hardware.h>
29#include <asm/cputype.h> 26#include <asm/cputype.h>
30#include <asm/mach-types.h> 27#include <asm/mach-types.h>
31#include <asm/system.h> 28
29#include <mach/hardware.h>
32 30
33#include "generic.h" 31#include "generic.h"
34 32
35#undef DEBUG 33#undef DEBUG
36 34
37static struct cpufreq_driver sa1110_driver;
38
39struct sdram_params { 35struct sdram_params {
40 const char name[16]; 36 const char name[20];
41 u_char rows; /* bits */ 37 u_char rows; /* bits */
42 u_char cas_latency; /* cycles */ 38 u_char cas_latency; /* cycles */
43 u_char tck; /* clock cycle time (ns) */ 39 u_char tck; /* clock cycle time (ns) */
@@ -107,6 +103,15 @@ static struct sdram_params sdram_tbl[] __initdata = {
107 .twr = 8, 103 .twr = 8,
108 .refresh = 64000, 104 .refresh = 64000,
109 .cas_latency = 3, 105 .cas_latency = 3,
106 }, { /* Micron MT48LC8M16A2TG-75 */
107 .name = "MT48LC8M16A2TG-75",
108 .rows = 12,
109 .tck = 8,
110 .trcd = 20,
111 .trp = 20,
112 .twr = 8,
113 .refresh = 64000,
114 .cas_latency = 3,
110 }, 115 },
111}; 116};
112 117
@@ -180,11 +185,13 @@ sdram_calculate_timing(struct sdram_info *sd, u_int cpu_khz,
180 sd->mdrefr |= MDREFR_K1DB2; 185 sd->mdrefr |= MDREFR_K1DB2;
181 186
182 /* initial number of '1's in MDCAS + 1 */ 187 /* initial number of '1's in MDCAS + 1 */
183 set_mdcas(sd->mdcas, sd_khz >= 62000, ns_to_cycles(sdram->trcd, mem_khz)); 188 set_mdcas(sd->mdcas, sd_khz >= 62000,
189 ns_to_cycles(sdram->trcd, mem_khz));
184 190
185#ifdef DEBUG 191#ifdef DEBUG
186 printk("MDCNFG: %08x MDREFR: %08x MDCAS0: %08x MDCAS1: %08x MDCAS2: %08x\n", 192 printk(KERN_DEBUG "MDCNFG: %08x MDREFR: %08x MDCAS0: %08x MDCAS1: %08x MDCAS2: %08x\n",
187 sd->mdcnfg, sd->mdrefr, sd->mdcas[0], sd->mdcas[1], sd->mdcas[2]); 193 sd->mdcnfg, sd->mdrefr, sd->mdcas[0], sd->mdcas[1],
194 sd->mdcas[2]);
188#endif 195#endif
189} 196}
190 197
@@ -213,7 +220,7 @@ sdram_update_refresh(u_int cpu_khz, struct sdram_params *sdram)
213 220
214#ifdef DEBUG 221#ifdef DEBUG
215 mdelay(250); 222 mdelay(250);
216 printk("new dri value = %d\n", dri); 223 printk(KERN_DEBUG "new dri value = %d\n", dri);
217#endif 224#endif
218 225
219 sdram_set_refresh(dri); 226 sdram_set_refresh(dri);
@@ -232,7 +239,7 @@ static int sa1110_target(struct cpufreq_policy *policy,
232 unsigned long flags; 239 unsigned long flags;
233 unsigned int ppcr, unused; 240 unsigned int ppcr, unused;
234 241
235 switch(relation){ 242 switch (relation) {
236 case CPUFREQ_RELATION_L: 243 case CPUFREQ_RELATION_L:
237 ppcr = sa11x0_freq_to_ppcr(target_freq); 244 ppcr = sa11x0_freq_to_ppcr(target_freq);
238 if (sa11x0_ppcr_to_freq(ppcr) > policy->max) 245 if (sa11x0_ppcr_to_freq(ppcr) > policy->max)
@@ -280,11 +287,10 @@ static int sa1110_target(struct cpufreq_policy *policy,
280 * We wait 20ms to be safe. 287 * We wait 20ms to be safe.
281 */ 288 */
282 sdram_set_refresh(2); 289 sdram_set_refresh(2);
283 if (!irqs_disabled()) { 290 if (!irqs_disabled())
284 msleep(20); 291 msleep(20);
285 } else { 292 else
286 mdelay(20); 293 mdelay(20);
287 }
288 294
289 /* 295 /*
290 * Reprogram the DRAM timings with interrupts disabled, and 296 * Reprogram the DRAM timings with interrupts disabled, and
@@ -295,7 +301,7 @@ static int sa1110_target(struct cpufreq_policy *policy,
295 local_irq_save(flags); 301 local_irq_save(flags);
296 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (0)); 302 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (0));
297 udelay(10); 303 udelay(10);
298 __asm__ __volatile__(" \n\ 304 __asm__ __volatile__("\n\
299 b 2f \n\ 305 b 2f \n\
300 .align 5 \n\ 306 .align 5 \n\
3011: str %3, [%1, #0] @ MDCNFG \n\ 3071: str %3, [%1, #0] @ MDCNFG \n\
@@ -336,7 +342,9 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
336 return 0; 342 return 0;
337} 343}
338 344
339static struct cpufreq_driver sa1110_driver = { 345/* sa1110_driver needs __refdata because it must remain after init registers
346 * it with cpufreq_register_driver() */
347static struct cpufreq_driver sa1110_driver __refdata = {
340 .flags = CPUFREQ_STICKY, 348 .flags = CPUFREQ_STICKY,
341 .verify = sa11x0_verify_speed, 349 .verify = sa11x0_verify_speed,
342 .target = sa1110_target, 350 .target = sa1110_target,
@@ -349,7 +357,8 @@ static struct sdram_params *sa1110_find_sdram(const char *name)
349{ 357{
350 struct sdram_params *sdram; 358 struct sdram_params *sdram;
351 359
352 for (sdram = sdram_tbl; sdram < sdram_tbl + ARRAY_SIZE(sdram_tbl); sdram++) 360 for (sdram = sdram_tbl; sdram < sdram_tbl + ARRAY_SIZE(sdram_tbl);
361 sdram++)
353 if (strcmp(name, sdram->name) == 0) 362 if (strcmp(name, sdram->name) == 0)
354 return sdram; 363 return sdram;
355 364
@@ -369,14 +378,14 @@ static int __init sa1110_clk_init(void)
369 if (!name[0]) { 378 if (!name[0]) {
370 if (machine_is_assabet()) 379 if (machine_is_assabet())
371 name = "TC59SM716-CL3"; 380 name = "TC59SM716-CL3";
372
373 if (machine_is_pt_system3()) 381 if (machine_is_pt_system3())
374 name = "K4S641632D"; 382 name = "K4S641632D";
375
376 if (machine_is_h3100()) 383 if (machine_is_h3100())
377 name = "KM416S4030CT"; 384 name = "KM416S4030CT";
378 if (machine_is_jornada720()) 385 if (machine_is_jornada720())
379 name = "K4S281632B-1H"; 386 name = "K4S281632B-1H";
387 if (machine_is_nanoengine())
388 name = "MT48LC8M16A2TG-75";
380 } 389 }
381 390
382 sdram = sa1110_find_sdram(name); 391 sdram = sa1110_find_sdram(name);
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 3c1fcd696714..e21f3470eece 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -16,14 +16,11 @@
16#include <linux/pm.h> 16#include <linux/pm.h>
17#include <linux/cpufreq.h> 17#include <linux/cpufreq.h>
18#include <linux/ioport.h> 18#include <linux/ioport.h>
19#include <linux/sched.h> /* just for sched_clock() - funny that */
20#include <linux/platform_device.h> 19#include <linux/platform_device.h>
21#include <linux/cnt32_to_63.h>
22 20
23#include <asm/div64.h> 21#include <asm/div64.h>
24#include <mach/hardware.h> 22#include <mach/hardware.h>
25#include <asm/system.h> 23#include <asm/system.h>
26#include <asm/pgtable.h>
27#include <asm/mach/map.h> 24#include <asm/mach/map.h>
28#include <asm/mach/flash.h> 25#include <asm/mach/flash.h>
29#include <asm/irq.h> 26#include <asm/irq.h>
@@ -110,27 +107,6 @@ unsigned int sa11x0_getspeed(unsigned int cpu)
110} 107}
111 108
112/* 109/*
113 * This is the SA11x0 sched_clock implementation. This has
114 * a resolution of 271ns, and a maximum value of 32025597s (370 days).
115 *
116 * The return value is guaranteed to be monotonic in that range as
117 * long as there is always less than 582 seconds between successive
118 * calls to this function.
119 *
120 * ( * 1E9 / 3686400 => * 78125 / 288)
121 */
122unsigned long long sched_clock(void)
123{
124 unsigned long long v = cnt32_to_63(OSCR);
125
126 /* the <<1 gets rid of the cnt_32_to_63 top bit saving on a bic insn */
127 v *= 78125<<1;
128 do_div(v, 288<<1);
129
130 return v;
131}
132
133/*
134 * Default power-off for SA1100 110 * Default power-off for SA1100
135 */ 111 */
136static void sa1100_power_off(void) 112static void sa1100_power_off(void)
@@ -163,10 +139,15 @@ static void sa11x0_register_device(struct platform_device *dev, void *data)
163 139
164static struct resource sa11x0udc_resources[] = { 140static struct resource sa11x0udc_resources[] = {
165 [0] = { 141 [0] = {
166 .start = 0x80000000, 142 .start = __PREG(Ser0UDCCR),
167 .end = 0x8000ffff, 143 .end = __PREG(Ser0UDCCR) + 0xffff,
168 .flags = IORESOURCE_MEM, 144 .flags = IORESOURCE_MEM,
169 }, 145 },
146 [1] = {
147 .start = IRQ_Ser0UDC,
148 .end = IRQ_Ser0UDC,
149 .flags = IORESOURCE_IRQ,
150 },
170}; 151};
171 152
172static u64 sa11x0udc_dma_mask = 0xffffffffUL; 153static u64 sa11x0udc_dma_mask = 0xffffffffUL;
@@ -184,10 +165,15 @@ static struct platform_device sa11x0udc_device = {
184 165
185static struct resource sa11x0uart1_resources[] = { 166static struct resource sa11x0uart1_resources[] = {
186 [0] = { 167 [0] = {
187 .start = 0x80010000, 168 .start = __PREG(Ser1UTCR0),
188 .end = 0x8001ffff, 169 .end = __PREG(Ser1UTCR0) + 0xffff,
189 .flags = IORESOURCE_MEM, 170 .flags = IORESOURCE_MEM,
190 }, 171 },
172 [1] = {
173 .start = IRQ_Ser1UART,
174 .end = IRQ_Ser1UART,
175 .flags = IORESOURCE_IRQ,
176 },
191}; 177};
192 178
193static struct platform_device sa11x0uart1_device = { 179static struct platform_device sa11x0uart1_device = {
@@ -199,10 +185,15 @@ static struct platform_device sa11x0uart1_device = {
199 185
200static struct resource sa11x0uart3_resources[] = { 186static struct resource sa11x0uart3_resources[] = {
201 [0] = { 187 [0] = {
202 .start = 0x80050000, 188 .start = __PREG(Ser3UTCR0),
203 .end = 0x8005ffff, 189 .end = __PREG(Ser3UTCR0) + 0xffff,
204 .flags = IORESOURCE_MEM, 190 .flags = IORESOURCE_MEM,
205 }, 191 },
192 [1] = {
193 .start = IRQ_Ser3UART,
194 .end = IRQ_Ser3UART,
195 .flags = IORESOURCE_IRQ,
196 },
206}; 197};
207 198
208static struct platform_device sa11x0uart3_device = { 199static struct platform_device sa11x0uart3_device = {
@@ -214,10 +205,15 @@ static struct platform_device sa11x0uart3_device = {
214 205
215static struct resource sa11x0mcp_resources[] = { 206static struct resource sa11x0mcp_resources[] = {
216 [0] = { 207 [0] = {
217 .start = 0x80060000, 208 .start = __PREG(Ser4MCCR0),
218 .end = 0x8006ffff, 209 .end = __PREG(Ser4MCCR0) + 0xffff,
219 .flags = IORESOURCE_MEM, 210 .flags = IORESOURCE_MEM,
220 }, 211 },
212 [1] = {
213 .start = IRQ_Ser4MCP,
214 .end = IRQ_Ser4MCP,
215 .flags = IORESOURCE_IRQ,
216 },
221}; 217};
222 218
223static u64 sa11x0mcp_dma_mask = 0xffffffffUL; 219static u64 sa11x0mcp_dma_mask = 0xffffffffUL;
@@ -244,6 +240,11 @@ static struct resource sa11x0ssp_resources[] = {
244 .end = 0x8007ffff, 240 .end = 0x8007ffff,
245 .flags = IORESOURCE_MEM, 241 .flags = IORESOURCE_MEM,
246 }, 242 },
243 [1] = {
244 .start = IRQ_Ser4SSP,
245 .end = IRQ_Ser4SSP,
246 .flags = IORESOURCE_IRQ,
247 },
247}; 248};
248 249
249static u64 sa11x0ssp_dma_mask = 0xffffffffUL; 250static u64 sa11x0ssp_dma_mask = 0xffffffffUL;
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c
index 0c7cea0dc013..03d7376cf8a0 100644
--- a/arch/arm/mach-sa1100/h3100.c
+++ b/arch/arm/mach-sa1100/h3100.c
@@ -84,8 +84,6 @@ static void __init h3100_mach_init(void)
84} 84}
85 85
86MACHINE_START(H3100, "Compaq iPAQ H3100") 86MACHINE_START(H3100, "Compaq iPAQ H3100")
87 .phys_io = 0x80000000,
88 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
89 .boot_params = 0xc0000100, 87 .boot_params = 0xc0000100,
90 .map_io = h3100_map_io, 88 .map_io = h3100_map_io,
91 .init_irq = sa1100_init_irq, 89 .init_irq = sa1100_init_irq,
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index af3b71459f8d..965f64a836f8 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -125,8 +125,6 @@ static void __init h3600_mach_init(void)
125} 125}
126 126
127MACHINE_START(H3600, "Compaq iPAQ H3600") 127MACHINE_START(H3600, "Compaq iPAQ H3600")
128 .phys_io = 0x80000000,
129 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
130 .boot_params = 0xc0000100, 128 .boot_params = 0xc0000100,
131 .map_io = h3600_map_io, 129 .map_io = h3600_map_io,
132 .init_irq = sa1100_init_irq, 130 .init_irq = sa1100_init_irq,
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index 51568dfc8e97..db5e434a17db 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -195,8 +195,6 @@ static void __init hackkit_init(void)
195 */ 195 */
196 196
197MACHINE_START(HACKKIT, "HackKit Cpu Board") 197MACHINE_START(HACKKIT, "HackKit Cpu Board")
198 .phys_io = 0x80000000,
199 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
200 .boot_params = 0xc0000100, 198 .boot_params = 0xc0000100,
201 .map_io = hackkit_map_io, 199 .map_io = hackkit_map_io,
202 .init_irq = sa1100_init_irq, 200 .init_irq = sa1100_init_irq,
diff --git a/arch/arm/mach-sa1100/include/mach/SA-1100.h b/arch/arm/mach-sa1100/include/mach/SA-1100.h
index 4f7ea012e1e5..bae8296f5dbf 100644
--- a/arch/arm/mach-sa1100/include/mach/SA-1100.h
+++ b/arch/arm/mach-sa1100/include/mach/SA-1100.h
@@ -1794,7 +1794,7 @@
1794 (DDAR_DevRd + DDAR_Brst4 + DDAR_16BitDev + \ 1794 (DDAR_DevRd + DDAR_Brst4 + DDAR_16BitDev + \
1795 DDAR_Ser4SSPRc + DDAR_DevAdd (__PREG(Ser4SSDR))) 1795 DDAR_Ser4SSPRc + DDAR_DevAdd (__PREG(Ser4SSDR)))
1796 1796
1797#define DCSR_RUN 0x00000001 /* DMA RUNing */ 1797#define DCSR_RUN 0x00000001 /* DMA running */
1798#define DCSR_IE 0x00000002 /* DMA Interrupt Enable */ 1798#define DCSR_IE 0x00000002 /* DMA Interrupt Enable */
1799#define DCSR_ERROR 0x00000004 /* DMA ERROR */ 1799#define DCSR_ERROR 0x00000004 /* DMA ERROR */
1800#define DCSR_DONEA 0x00000008 /* DONE DMA transfer buffer A */ 1800#define DCSR_DONEA 0x00000008 /* DONE DMA transfer buffer A */
diff --git a/arch/arm/mach-sa1100/include/mach/debug-macro.S b/arch/arm/mach-sa1100/include/mach/debug-macro.S
index 336adccea542..0cd0fc9635b6 100644
--- a/arch/arm/mach-sa1100/include/mach/debug-macro.S
+++ b/arch/arm/mach-sa1100/include/mach/debug-macro.S
@@ -12,33 +12,37 @@
12*/ 12*/
13#include <mach/hardware.h> 13#include <mach/hardware.h>
14 14
15 .macro addruart, rx, tmp 15 .macro addruart, rp, rv
16 mrc p15, 0, \rx, c1, c0 16 mrc p15, 0, \rp, c1, c0
17 tst \rx, #1 @ MMU enabled? 17 tst \rp, #1 @ MMU enabled?
18 moveq \rx, #0x80000000 @ physical base address 18 moveq \rp, #0x80000000 @ physical base address
19 movne \rx, #0xf8000000 @ virtual address 19 movne \rp, #0xf8000000 @ virtual address
20 20
21 @ We probe for the active serial port here, coherently with 21 @ We probe for the active serial port here, coherently with
22 @ the comment in arch/arm/mach-sa1100/include/mach/uncompress.h. 22 @ the comment in arch/arm/mach-sa1100/include/mach/uncompress.h.
23 @ We assume r1 can be clobbered. 23 @ We assume r1 can be clobbered.
24 24
25 @ see if Ser3 is active 25 @ see if Ser3 is active
26 add \rx, \rx, #0x00050000 26 add \rp, \rp, #0x00050000
27 ldr r1, [\rx, #UTCR3] 27 ldr \rv, [\rp, #UTCR3]
28 tst r1, #UTCR3_TXE 28 tst \rv, #UTCR3_TXE
29 29
30 @ if Ser3 is inactive, then try Ser1 30 @ if Ser3 is inactive, then try Ser1
31 addeq \rx, \rx, #(0x00010000 - 0x00050000) 31 addeq \rp, \rp, #(0x00010000 - 0x00050000)
32 ldreq r1, [\rx, #UTCR3] 32 ldreq \rv, [\rp, #UTCR3]
33 tsteq r1, #UTCR3_TXE 33 tsteq \rv, #UTCR3_TXE
34 34
35 @ if Ser1 is inactive, then try Ser2 35 @ if Ser1 is inactive, then try Ser2
36 addeq \rx, \rx, #(0x00030000 - 0x00010000) 36 addeq \rp, \rp, #(0x00030000 - 0x00010000)
37 ldreq r1, [\rx, #UTCR3] 37 ldreq \rv, [\rp, #UTCR3]
38 tsteq r1, #UTCR3_TXE 38 tsteq \rv, #UTCR3_TXE
39
40 @ clear top bits, and generate both phys and virt addresses
41 lsl \rp, \rp, #8
42 lsr \rp, \rp, #8
43 orr \rv, \rp, #0xf8000000 @ virtual
44 orr \rp, \rp, #0x80000000 @ physical
39 45
40 @ if all ports are inactive, then there is nothing we can do
41 moveq pc, lr
42 .endm 46 .endm
43 47
44 .macro senduart,rd,rx 48 .macro senduart,rd,rx
diff --git a/arch/arm/mach-sa1100/include/mach/hardware.h b/arch/arm/mach-sa1100/include/mach/hardware.h
index 99f5856d8de4..967ae7684390 100644
--- a/arch/arm/mach-sa1100/include/mach/hardware.h
+++ b/arch/arm/mach-sa1100/include/mach/hardware.h
@@ -76,4 +76,12 @@ static inline unsigned long get_clock_tick_rate(void)
76#include "SA-1101.h" 76#include "SA-1101.h"
77#endif 77#endif
78 78
79#if defined(CONFIG_ARCH_SA1100) && defined(CONFIG_PCI)
80#define PCIBIOS_MIN_IO 0
81#define PCIBIOS_MIN_MEM 0
82#define pcibios_assign_all_busses() 1
83#define HAVE_ARCH_PCI_SET_DMA_MASK 1
84#endif
85
86
79#endif /* _ASM_ARCH_HARDWARE_H */ 87#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-sa1100/include/mach/memory.h b/arch/arm/mach-sa1100/include/mach/memory.h
index 128a1dfa96b9..cff31ee246b7 100644
--- a/arch/arm/mach-sa1100/include/mach/memory.h
+++ b/arch/arm/mach-sa1100/include/mach/memory.h
@@ -12,20 +12,10 @@
12/* 12/*
13 * Physical DRAM offset is 0xc0000000 on the SA1100 13 * Physical DRAM offset is 0xc0000000 on the SA1100
14 */ 14 */
15#define PHYS_OFFSET UL(0xc0000000) 15#define PLAT_PHYS_OFFSET UL(0xc0000000)
16
17#ifndef __ASSEMBLY__
18 16
19#ifdef CONFIG_SA1111 17#ifdef CONFIG_SA1111
20void sa1111_adjust_zones(unsigned long *size, unsigned long *holes); 18#define ARM_DMA_ZONE_SIZE SZ_1M
21
22#define arch_adjust_zones(size, holes) \
23 sa1111_adjust_zones(size, holes)
24
25#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1)
26#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_1M)
27
28#endif
29#endif 19#endif
30 20
31/* 21/*
diff --git a/arch/arm/mach-sa1100/include/mach/nanoengine.h b/arch/arm/mach-sa1100/include/mach/nanoengine.h
new file mode 100644
index 000000000000..14f8382d0665
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/nanoengine.h
@@ -0,0 +1,52 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/nanoengine.h
3 *
4 * This file contains the hardware specific definitions for nanoEngine.
5 * Only include this file from SA1100-specific files.
6 *
7 * Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
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 version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14#ifndef __ASM_ARCH_NANOENGINE_H
15#define __ASM_ARCH_NANOENGINE_H
16
17#include <mach/irqs.h>
18
19#define GPIO_PC_READY0 GPIO_GPIO(11) /* ready for socket 0 (active high)*/
20#define GPIO_PC_READY1 GPIO_GPIO(12) /* ready for socket 1 (active high) */
21#define GPIO_PC_CD0 GPIO_GPIO(13) /* detect for socket 0 (active low) */
22#define GPIO_PC_CD1 GPIO_GPIO(14) /* detect for socket 1 (active low) */
23#define GPIO_PC_RESET0 GPIO_GPIO(15) /* reset socket 0 */
24#define GPIO_PC_RESET1 GPIO_GPIO(16) /* reset socket 1 */
25
26#define NANOENGINE_IRQ_GPIO_PCI IRQ_GPIO0
27#define NANOENGINE_IRQ_GPIO_PC_READY0 IRQ_GPIO11
28#define NANOENGINE_IRQ_GPIO_PC_READY1 IRQ_GPIO12
29#define NANOENGINE_IRQ_GPIO_PC_CD0 IRQ_GPIO13
30#define NANOENGINE_IRQ_GPIO_PC_CD1 IRQ_GPIO14
31
32/*
33 * nanoEngine Memory Map:
34 *
35 * 0000.0000 - 003F.0000 - 4 MB Flash
36 * C000.0000 - C1FF.FFFF - 32 MB SDRAM
37 * 1860.0000 - 186F.FFFF - 1 MB Internal PCI Memory Read/Write
38 * 18A1.0000 - 18A1.FFFF - 64 KB Internal PCI Config Space
39 * 4000.0000 - 47FF.FFFF - 128 MB External Bus I/O - Multiplexed Mode
40 * 4800.0000 - 4FFF.FFFF - 128 MB External Bus I/O - Non-Multiplexed Mode
41 *
42 */
43
44#define NANO_PCI_MEM_RW_PHYS 0x18600000
45#define NANO_PCI_MEM_RW_VIRT 0xf1000000
46#define NANO_PCI_MEM_RW_SIZE SZ_1M
47#define NANO_PCI_CONFIG_SPACE_PHYS 0x18A10000
48#define NANO_PCI_CONFIG_SPACE_VIRT 0xf2000000
49#define NANO_PCI_CONFIG_SPACE_SIZE SZ_64K
50
51#endif
52
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index 3093d46a9c6f..dfbf824a69fa 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -14,7 +14,7 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/sysdev.h> 17#include <linux/syscore_ops.h>
18 18
19#include <mach/hardware.h> 19#include <mach/hardware.h>
20#include <asm/mach/irq.h> 20#include <asm/mach/irq.h>
@@ -37,14 +37,14 @@ static int GPIO_IRQ_mask = (1 << 11) - 1;
37#define GPIO_11_27_IRQ(i) ((i) - 21) 37#define GPIO_11_27_IRQ(i) ((i) - 21)
38#define GPIO11_27_MASK(irq) (1 << GPIO_11_27_IRQ(irq)) 38#define GPIO11_27_MASK(irq) (1 << GPIO_11_27_IRQ(irq))
39 39
40static int sa1100_gpio_type(unsigned int irq, unsigned int type) 40static int sa1100_gpio_type(struct irq_data *d, unsigned int type)
41{ 41{
42 unsigned int mask; 42 unsigned int mask;
43 43
44 if (irq <= 10) 44 if (d->irq <= 10)
45 mask = 1 << irq; 45 mask = 1 << d->irq;
46 else 46 else
47 mask = GPIO11_27_MASK(irq); 47 mask = GPIO11_27_MASK(d->irq);
48 48
49 if (type == IRQ_TYPE_PROBE) { 49 if (type == IRQ_TYPE_PROBE) {
50 if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask) 50 if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask)
@@ -70,37 +70,37 @@ static int sa1100_gpio_type(unsigned int irq, unsigned int type)
70/* 70/*
71 * GPIO IRQs must be acknowledged. This is for IRQs from 0 to 10. 71 * GPIO IRQs must be acknowledged. This is for IRQs from 0 to 10.
72 */ 72 */
73static void sa1100_low_gpio_ack(unsigned int irq) 73static void sa1100_low_gpio_ack(struct irq_data *d)
74{ 74{
75 GEDR = (1 << irq); 75 GEDR = (1 << d->irq);
76} 76}
77 77
78static void sa1100_low_gpio_mask(unsigned int irq) 78static void sa1100_low_gpio_mask(struct irq_data *d)
79{ 79{
80 ICMR &= ~(1 << irq); 80 ICMR &= ~(1 << d->irq);
81} 81}
82 82
83static void sa1100_low_gpio_unmask(unsigned int irq) 83static void sa1100_low_gpio_unmask(struct irq_data *d)
84{ 84{
85 ICMR |= 1 << irq; 85 ICMR |= 1 << d->irq;
86} 86}
87 87
88static int sa1100_low_gpio_wake(unsigned int irq, unsigned int on) 88static int sa1100_low_gpio_wake(struct irq_data *d, unsigned int on)
89{ 89{
90 if (on) 90 if (on)
91 PWER |= 1 << irq; 91 PWER |= 1 << d->irq;
92 else 92 else
93 PWER &= ~(1 << irq); 93 PWER &= ~(1 << d->irq);
94 return 0; 94 return 0;
95} 95}
96 96
97static struct irq_chip sa1100_low_gpio_chip = { 97static struct irq_chip sa1100_low_gpio_chip = {
98 .name = "GPIO-l", 98 .name = "GPIO-l",
99 .ack = sa1100_low_gpio_ack, 99 .irq_ack = sa1100_low_gpio_ack,
100 .mask = sa1100_low_gpio_mask, 100 .irq_mask = sa1100_low_gpio_mask,
101 .unmask = sa1100_low_gpio_unmask, 101 .irq_unmask = sa1100_low_gpio_unmask,
102 .set_type = sa1100_gpio_type, 102 .irq_set_type = sa1100_gpio_type,
103 .set_wake = sa1100_low_gpio_wake, 103 .irq_set_wake = sa1100_low_gpio_wake,
104}; 104};
105 105
106/* 106/*
@@ -139,16 +139,16 @@ sa1100_high_gpio_handler(unsigned int irq, struct irq_desc *desc)
139 * In addition, the IRQs are all collected up into one bit in the 139 * In addition, the IRQs are all collected up into one bit in the
140 * interrupt controller registers. 140 * interrupt controller registers.
141 */ 141 */
142static void sa1100_high_gpio_ack(unsigned int irq) 142static void sa1100_high_gpio_ack(struct irq_data *d)
143{ 143{
144 unsigned int mask = GPIO11_27_MASK(irq); 144 unsigned int mask = GPIO11_27_MASK(d->irq);
145 145
146 GEDR = mask; 146 GEDR = mask;
147} 147}
148 148
149static void sa1100_high_gpio_mask(unsigned int irq) 149static void sa1100_high_gpio_mask(struct irq_data *d)
150{ 150{
151 unsigned int mask = GPIO11_27_MASK(irq); 151 unsigned int mask = GPIO11_27_MASK(d->irq);
152 152
153 GPIO_IRQ_mask &= ~mask; 153 GPIO_IRQ_mask &= ~mask;
154 154
@@ -156,9 +156,9 @@ static void sa1100_high_gpio_mask(unsigned int irq)
156 GFER &= ~mask; 156 GFER &= ~mask;
157} 157}
158 158
159static void sa1100_high_gpio_unmask(unsigned int irq) 159static void sa1100_high_gpio_unmask(struct irq_data *d)
160{ 160{
161 unsigned int mask = GPIO11_27_MASK(irq); 161 unsigned int mask = GPIO11_27_MASK(d->irq);
162 162
163 GPIO_IRQ_mask |= mask; 163 GPIO_IRQ_mask |= mask;
164 164
@@ -166,44 +166,44 @@ static void sa1100_high_gpio_unmask(unsigned int irq)
166 GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask; 166 GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask;
167} 167}
168 168
169static int sa1100_high_gpio_wake(unsigned int irq, unsigned int on) 169static int sa1100_high_gpio_wake(struct irq_data *d, unsigned int on)
170{ 170{
171 if (on) 171 if (on)
172 PWER |= GPIO11_27_MASK(irq); 172 PWER |= GPIO11_27_MASK(d->irq);
173 else 173 else
174 PWER &= ~GPIO11_27_MASK(irq); 174 PWER &= ~GPIO11_27_MASK(d->irq);
175 return 0; 175 return 0;
176} 176}
177 177
178static struct irq_chip sa1100_high_gpio_chip = { 178static struct irq_chip sa1100_high_gpio_chip = {
179 .name = "GPIO-h", 179 .name = "GPIO-h",
180 .ack = sa1100_high_gpio_ack, 180 .irq_ack = sa1100_high_gpio_ack,
181 .mask = sa1100_high_gpio_mask, 181 .irq_mask = sa1100_high_gpio_mask,
182 .unmask = sa1100_high_gpio_unmask, 182 .irq_unmask = sa1100_high_gpio_unmask,
183 .set_type = sa1100_gpio_type, 183 .irq_set_type = sa1100_gpio_type,
184 .set_wake = sa1100_high_gpio_wake, 184 .irq_set_wake = sa1100_high_gpio_wake,
185}; 185};
186 186
187/* 187/*
188 * We don't need to ACK IRQs on the SA1100 unless they're GPIOs 188 * We don't need to ACK IRQs on the SA1100 unless they're GPIOs
189 * this is for internal IRQs i.e. from 11 to 31. 189 * this is for internal IRQs i.e. from 11 to 31.
190 */ 190 */
191static void sa1100_mask_irq(unsigned int irq) 191static void sa1100_mask_irq(struct irq_data *d)
192{ 192{
193 ICMR &= ~(1 << irq); 193 ICMR &= ~(1 << d->irq);
194} 194}
195 195
196static void sa1100_unmask_irq(unsigned int irq) 196static void sa1100_unmask_irq(struct irq_data *d)
197{ 197{
198 ICMR |= (1 << irq); 198 ICMR |= (1 << d->irq);
199} 199}
200 200
201/* 201/*
202 * Apart form GPIOs, only the RTC alarm can be a wakeup event. 202 * Apart form GPIOs, only the RTC alarm can be a wakeup event.
203 */ 203 */
204static int sa1100_set_wake(unsigned int irq, unsigned int on) 204static int sa1100_set_wake(struct irq_data *d, unsigned int on)
205{ 205{
206 if (irq == IRQ_RTCAlrm) { 206 if (d->irq == IRQ_RTCAlrm) {
207 if (on) 207 if (on)
208 PWER |= PWER_RTC; 208 PWER |= PWER_RTC;
209 else 209 else
@@ -215,10 +215,10 @@ static int sa1100_set_wake(unsigned int irq, unsigned int on)
215 215
216static struct irq_chip sa1100_normal_chip = { 216static struct irq_chip sa1100_normal_chip = {
217 .name = "SC", 217 .name = "SC",
218 .ack = sa1100_mask_irq, 218 .irq_ack = sa1100_mask_irq,
219 .mask = sa1100_mask_irq, 219 .irq_mask = sa1100_mask_irq,
220 .unmask = sa1100_unmask_irq, 220 .irq_unmask = sa1100_unmask_irq,
221 .set_wake = sa1100_set_wake, 221 .irq_set_wake = sa1100_set_wake,
222}; 222};
223 223
224static struct resource irq_resource = { 224static struct resource irq_resource = {
@@ -234,7 +234,7 @@ static struct sa1100irq_state {
234 unsigned int iccr; 234 unsigned int iccr;
235} sa1100irq_state; 235} sa1100irq_state;
236 236
237static int sa1100irq_suspend(struct sys_device *dev, pm_message_t state) 237static int sa1100irq_suspend(void)
238{ 238{
239 struct sa1100irq_state *st = &sa1100irq_state; 239 struct sa1100irq_state *st = &sa1100irq_state;
240 240
@@ -264,7 +264,7 @@ static int sa1100irq_suspend(struct sys_device *dev, pm_message_t state)
264 return 0; 264 return 0;
265} 265}
266 266
267static int sa1100irq_resume(struct sys_device *dev) 267static void sa1100irq_resume(void)
268{ 268{
269 struct sa1100irq_state *st = &sa1100irq_state; 269 struct sa1100irq_state *st = &sa1100irq_state;
270 270
@@ -277,24 +277,17 @@ static int sa1100irq_resume(struct sys_device *dev)
277 277
278 ICMR = st->icmr; 278 ICMR = st->icmr;
279 } 279 }
280 return 0;
281} 280}
282 281
283static struct sysdev_class sa1100irq_sysclass = { 282static struct syscore_ops sa1100irq_syscore_ops = {
284 .name = "sa11x0-irq",
285 .suspend = sa1100irq_suspend, 283 .suspend = sa1100irq_suspend,
286 .resume = sa1100irq_resume, 284 .resume = sa1100irq_resume,
287}; 285};
288 286
289static struct sys_device sa1100irq_device = {
290 .id = 0,
291 .cls = &sa1100irq_sysclass,
292};
293
294static int __init sa1100irq_init_devicefs(void) 287static int __init sa1100irq_init_devicefs(void)
295{ 288{
296 sysdev_class_register(&sa1100irq_sysclass); 289 register_syscore_ops(&sa1100irq_syscore_ops);
297 return sysdev_register(&sa1100irq_device); 290 return 0;
298} 291}
299 292
300device_initcall(sa1100irq_init_devicefs); 293device_initcall(sa1100irq_init_devicefs);
@@ -323,28 +316,28 @@ void __init sa1100_init_irq(void)
323 ICCR = 1; 316 ICCR = 1;
324 317
325 for (irq = 0; irq <= 10; irq++) { 318 for (irq = 0; irq <= 10; irq++) {
326 set_irq_chip(irq, &sa1100_low_gpio_chip); 319 irq_set_chip_and_handler(irq, &sa1100_low_gpio_chip,
327 set_irq_handler(irq, handle_edge_irq); 320 handle_edge_irq);
328 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 321 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
329 } 322 }
330 323
331 for (irq = 12; irq <= 31; irq++) { 324 for (irq = 12; irq <= 31; irq++) {
332 set_irq_chip(irq, &sa1100_normal_chip); 325 irq_set_chip_and_handler(irq, &sa1100_normal_chip,
333 set_irq_handler(irq, handle_level_irq); 326 handle_level_irq);
334 set_irq_flags(irq, IRQF_VALID); 327 set_irq_flags(irq, IRQF_VALID);
335 } 328 }
336 329
337 for (irq = 32; irq <= 48; irq++) { 330 for (irq = 32; irq <= 48; irq++) {
338 set_irq_chip(irq, &sa1100_high_gpio_chip); 331 irq_set_chip_and_handler(irq, &sa1100_high_gpio_chip,
339 set_irq_handler(irq, handle_edge_irq); 332 handle_edge_irq);
340 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 333 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
341 } 334 }
342 335
343 /* 336 /*
344 * Install handler for GPIO 11-27 edge detect interrupts 337 * Install handler for GPIO 11-27 edge detect interrupts
345 */ 338 */
346 set_irq_chip(IRQ_GPIO11_27, &sa1100_normal_chip); 339 irq_set_chip(IRQ_GPIO11_27, &sa1100_normal_chip);
347 set_irq_chained_handler(IRQ_GPIO11_27, sa1100_high_gpio_handler); 340 irq_set_chained_handler(IRQ_GPIO11_27, sa1100_high_gpio_handler);
348 341
349 sa1100_init_gpio(); 342 sa1100_init_gpio();
350} 343}
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index d3ec620618f1..491ac9f20fb4 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -364,8 +364,6 @@ static void __init jornada720_mach_init(void)
364 364
365MACHINE_START(JORNADA720, "HP Jornada 720") 365MACHINE_START(JORNADA720, "HP Jornada 720")
366 /* Maintainer: Kristoffer Ericson <Kristoffer.Ericson@gmail.com> */ 366 /* Maintainer: Kristoffer Ericson <Kristoffer.Ericson@gmail.com> */
367 .phys_io = 0x80000000,
368 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
369 .boot_params = 0xc0000100, 367 .boot_params = 0xc0000100,
370 .map_io = jornada720_map_io, 368 .map_io = jornada720_map_io,
371 .init_irq = sa1100_init_irq, 369 .init_irq = sa1100_init_irq,
diff --git a/arch/arm/mach-sa1100/jornada720_ssp.c b/arch/arm/mach-sa1100/jornada720_ssp.c
index 9d490c66891c..f50b00bd18a0 100644
--- a/arch/arm/mach-sa1100/jornada720_ssp.c
+++ b/arch/arm/mach-sa1100/jornada720_ssp.c
@@ -29,7 +29,7 @@ static unsigned long jornada_ssp_flags;
29/** 29/**
30 * jornada_ssp_reverse - reverses input byte 30 * jornada_ssp_reverse - reverses input byte
31 * 31 *
32 * we need to reverse all data we recieve from the mcu due to its physical location 32 * we need to reverse all data we receive from the mcu due to its physical location
33 * returns : 01110111 -> 11101110 33 * returns : 01110111 -> 11101110
34 */ 34 */
35u8 inline jornada_ssp_reverse(u8 byte) 35u8 inline jornada_ssp_reverse(u8 byte)
@@ -179,7 +179,7 @@ static int __devinit jornada_ssp_probe(struct platform_device *dev)
179 179
180static int jornada_ssp_remove(struct platform_device *dev) 180static int jornada_ssp_remove(struct platform_device *dev)
181{ 181{
182 /* Note that this doesnt actually remove the driver, since theres nothing to remove 182 /* Note that this doesn't actually remove the driver, since theres nothing to remove
183 * It just makes sure everything is turned off */ 183 * It just makes sure everything is turned off */
184 GPSR = GPIO_GPIO25; 184 GPSR = GPIO_GPIO25;
185 ssp_exit(); 185 ssp_exit();
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c
index 68069d6dc07a..7b9556b59057 100644
--- a/arch/arm/mach-sa1100/lart.c
+++ b/arch/arm/mach-sa1100/lart.c
@@ -61,8 +61,6 @@ static void __init lart_map_io(void)
61} 61}
62 62
63MACHINE_START(LART, "LART") 63MACHINE_START(LART, "LART")
64 .phys_io = 0x80000000,
65 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
66 .boot_params = 0xc0000100, 64 .boot_params = 0xc0000100,
67 .map_io = lart_map_io, 65 .map_io = lart_map_io,
68 .init_irq = sa1100_init_irq, 66 .init_irq = sa1100_init_irq,
diff --git a/arch/arm/mach-sa1100/nanoengine.c b/arch/arm/mach-sa1100/nanoengine.c
new file mode 100644
index 000000000000..72087f0658b7
--- /dev/null
+++ b/arch/arm/mach-sa1100/nanoengine.c
@@ -0,0 +1,119 @@
1/*
2 * linux/arch/arm/mach-sa1100/nanoengine.c
3 *
4 * Bright Star Engineering's nanoEngine board init code.
5 *
6 * Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/mtd/mtd.h>
17#include <linux/mtd/partitions.h>
18#include <linux/root_dev.h>
19
20#include <asm/mach-types.h>
21#include <asm/setup.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach/flash.h>
25#include <asm/mach/map.h>
26#include <asm/mach/serial_sa1100.h>
27
28#include <mach/hardware.h>
29#include <mach/nanoengine.h>
30
31#include "generic.h"
32
33/* Flash bank 0 */
34static struct mtd_partition nanoengine_partitions[] = {
35 {
36 .name = "nanoEngine boot firmware and parameter table",
37 .size = 0x00010000, /* 32K */
38 .offset = 0,
39 .mask_flags = MTD_WRITEABLE,
40 }, {
41 .name = "kernel/initrd reserved",
42 .size = 0x002f0000,
43 .offset = 0x00010000,
44 .mask_flags = MTD_WRITEABLE,
45 }, {
46 .name = "experimental filesystem allocation",
47 .size = 0x00100000,
48 .offset = 0x00300000,
49 .mask_flags = MTD_WRITEABLE,
50 }
51};
52
53static struct flash_platform_data nanoengine_flash_data = {
54 .map_name = "jedec_probe",
55 .parts = nanoengine_partitions,
56 .nr_parts = ARRAY_SIZE(nanoengine_partitions),
57};
58
59static struct resource nanoengine_flash_resources[] = {
60 {
61 .start = SA1100_CS0_PHYS,
62 .end = SA1100_CS0_PHYS + SZ_32M - 1,
63 .flags = IORESOURCE_MEM,
64 }, {
65 .start = SA1100_CS1_PHYS,
66 .end = SA1100_CS1_PHYS + SZ_32M - 1,
67 .flags = IORESOURCE_MEM,
68 }
69};
70
71static struct map_desc nanoengine_io_desc[] __initdata = {
72 {
73 /* System Registers */
74 .virtual = 0xf0000000,
75 .pfn = __phys_to_pfn(0x10000000),
76 .length = 0x00100000,
77 .type = MT_DEVICE
78 }, {
79 /* Internal PCI Memory Read/Write */
80 .virtual = NANO_PCI_MEM_RW_VIRT,
81 .pfn = __phys_to_pfn(NANO_PCI_MEM_RW_PHYS),
82 .length = NANO_PCI_MEM_RW_SIZE,
83 .type = MT_DEVICE
84 }, {
85 /* Internal PCI Config Space */
86 .virtual = NANO_PCI_CONFIG_SPACE_VIRT,
87 .pfn = __phys_to_pfn(NANO_PCI_CONFIG_SPACE_PHYS),
88 .length = NANO_PCI_CONFIG_SPACE_SIZE,
89 .type = MT_DEVICE
90 }
91};
92
93static void __init nanoengine_map_io(void)
94{
95 sa1100_map_io();
96 iotable_init(nanoengine_io_desc, ARRAY_SIZE(nanoengine_io_desc));
97
98 sa1100_register_uart(0, 1);
99 sa1100_register_uart(1, 2);
100 sa1100_register_uart(2, 3);
101 Ser1SDCR0 |= SDCR0_UART;
102 /* disable IRDA -- UART2 is used as a normal serial port */
103 Ser2UTCR4 = 0;
104 Ser2HSCR0 = 0;
105}
106
107static void __init nanoengine_init(void)
108{
109 sa11x0_register_mtd(&nanoengine_flash_data, nanoengine_flash_resources,
110 ARRAY_SIZE(nanoengine_flash_resources));
111}
112
113MACHINE_START(NANOENGINE, "BSE nanoEngine")
114 .boot_params = 0xc0000000,
115 .map_io = nanoengine_map_io,
116 .init_irq = sa1100_init_irq,
117 .timer = &sa1100_timer,
118 .init_machine = nanoengine_init,
119MACHINE_END
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index c601a75a333d..b4fa53a1427e 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -35,7 +35,7 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
35 /* 35 /*
36 * Acknowledge the parent IRQ. 36 * Acknowledge the parent IRQ.
37 */ 37 */
38 desc->chip->ack(irq); 38 desc->irq_data.chip->irq_ack(&desc->irq_data);
39 39
40 /* 40 /*
41 * Read the interrupt reason register. Let's have all 41 * Read the interrupt reason register. Let's have all
@@ -53,7 +53,7 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
53 * recheck the register for any pending IRQs. 53 * recheck the register for any pending IRQs.
54 */ 54 */
55 if (irr & (IRR_ETHERNET | IRR_USAR)) { 55 if (irr & (IRR_ETHERNET | IRR_USAR)) {
56 desc->chip->mask(irq); 56 desc->irq_data.chip->irq_mask(&desc->irq_data);
57 57
58 /* 58 /*
59 * Ack the interrupt now to prevent re-entering 59 * Ack the interrupt now to prevent re-entering
@@ -61,7 +61,7 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
61 * since we'll check the IRR register prior to 61 * since we'll check the IRR register prior to
62 * leaving. 62 * leaving.
63 */ 63 */
64 desc->chip->ack(irq); 64 desc->irq_data.chip->irq_ack(&desc->irq_data);
65 65
66 if (irr & IRR_ETHERNET) { 66 if (irr & IRR_ETHERNET) {
67 generic_handle_irq(IRQ_NEPONSET_SMC9196); 67 generic_handle_irq(IRQ_NEPONSET_SMC9196);
@@ -71,7 +71,7 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
71 generic_handle_irq(IRQ_NEPONSET_USAR); 71 generic_handle_irq(IRQ_NEPONSET_USAR);
72 } 72 }
73 73
74 desc->chip->unmask(irq); 74 desc->irq_data.chip->irq_unmask(&desc->irq_data);
75 } 75 }
76 76
77 if (irr & IRR_SA1111) { 77 if (irr & IRR_SA1111) {
@@ -145,8 +145,8 @@ static int __devinit neponset_probe(struct platform_device *dev)
145 /* 145 /*
146 * Install handler for GPIO25. 146 * Install handler for GPIO25.
147 */ 147 */
148 set_irq_type(IRQ_GPIO25, IRQ_TYPE_EDGE_RISING); 148 irq_set_irq_type(IRQ_GPIO25, IRQ_TYPE_EDGE_RISING);
149 set_irq_chained_handler(IRQ_GPIO25, neponset_irq_handler); 149 irq_set_chained_handler(IRQ_GPIO25, neponset_irq_handler);
150 150
151 /* 151 /*
152 * We would set IRQ_GPIO25 to be a wake-up IRQ, but 152 * We would set IRQ_GPIO25 to be a wake-up IRQ, but
@@ -161,9 +161,9 @@ static int __devinit neponset_probe(struct platform_device *dev)
161 * Setup other Neponset IRQs. SA1111 will be done by the 161 * Setup other Neponset IRQs. SA1111 will be done by the
162 * generic SA1111 code. 162 * generic SA1111 code.
163 */ 163 */
164 set_irq_handler(IRQ_NEPONSET_SMC9196, handle_simple_irq); 164 irq_set_handler(IRQ_NEPONSET_SMC9196, handle_simple_irq);
165 set_irq_flags(IRQ_NEPONSET_SMC9196, IRQF_VALID | IRQF_PROBE); 165 set_irq_flags(IRQ_NEPONSET_SMC9196, IRQF_VALID | IRQF_PROBE);
166 set_irq_handler(IRQ_NEPONSET_USAR, handle_simple_irq); 166 irq_set_handler(IRQ_NEPONSET_USAR, handle_simple_irq);
167 set_irq_flags(IRQ_NEPONSET_USAR, IRQF_VALID | IRQF_PROBE); 167 set_irq_flags(IRQ_NEPONSET_USAR, IRQF_VALID | IRQF_PROBE);
168 168
169 /* 169 /*
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c
new file mode 100644
index 000000000000..fba7a913f12b
--- /dev/null
+++ b/arch/arm/mach-sa1100/pci-nanoengine.c
@@ -0,0 +1,284 @@
1/*
2 * linux/arch/arm/mach-sa1100/pci-nanoengine.c
3 *
4 * PCI functions for BSE nanoEngine PCI
5 *
6 * Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#include <linux/kernel.h>
23#include <linux/irq.h>
24#include <linux/pci.h>
25#include <linux/spinlock.h>
26
27#include <asm/mach/pci.h>
28#include <asm/mach-types.h>
29
30#include <mach/nanoengine.h>
31
32static DEFINE_SPINLOCK(nano_lock);
33
34static int nanoengine_get_pci_address(struct pci_bus *bus,
35 unsigned int devfn, int where, unsigned long *address)
36{
37 int ret = PCIBIOS_DEVICE_NOT_FOUND;
38 unsigned int busnr = bus->number;
39
40 *address = NANO_PCI_CONFIG_SPACE_VIRT +
41 ((bus->number << 16) | (devfn << 8) | (where & ~3));
42
43 ret = (busnr > 255 || devfn > 255 || where > 255) ?
44 PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
45
46 return ret;
47}
48
49static int nanoengine_read_config(struct pci_bus *bus, unsigned int devfn, int where,
50 int size, u32 *val)
51{
52 int ret;
53 unsigned long address;
54 unsigned long flags;
55 u32 v;
56
57 /* nanoEngine PCI bridge does not return -1 for a non-existing
58 * device. We must fake the answer. We know that the only valid
59 * device is device zero at bus 0, which is the network chip. */
60 if (bus->number != 0 || (devfn >> 3) != 0) {
61 v = -1;
62 nanoengine_get_pci_address(bus, devfn, where, &address);
63 goto exit_function;
64 }
65
66 spin_lock_irqsave(&nano_lock, flags);
67
68 ret = nanoengine_get_pci_address(bus, devfn, where, &address);
69 if (ret != PCIBIOS_SUCCESSFUL)
70 return ret;
71 v = __raw_readl(address);
72
73 spin_unlock_irqrestore(&nano_lock, flags);
74
75 v >>= ((where & 3) * 8);
76 v &= (unsigned long)(-1) >> ((4 - size) * 8);
77
78exit_function:
79 *val = v;
80 return PCIBIOS_SUCCESSFUL;
81}
82
83static int nanoengine_write_config(struct pci_bus *bus, unsigned int devfn, int where,
84 int size, u32 val)
85{
86 int ret;
87 unsigned long address;
88 unsigned long flags;
89 unsigned shift;
90 u32 v;
91
92 shift = (where & 3) * 8;
93
94 spin_lock_irqsave(&nano_lock, flags);
95
96 ret = nanoengine_get_pci_address(bus, devfn, where, &address);
97 if (ret != PCIBIOS_SUCCESSFUL)
98 return ret;
99 v = __raw_readl(address);
100 switch (size) {
101 case 1:
102 v &= ~(0xFF << shift);
103 v |= val << shift;
104 break;
105 case 2:
106 v &= ~(0xFFFF << shift);
107 v |= val << shift;
108 break;
109 case 4:
110 v = val;
111 break;
112 }
113 __raw_writel(v, address);
114
115 spin_unlock_irqrestore(&nano_lock, flags);
116
117 return PCIBIOS_SUCCESSFUL;
118}
119
120static struct pci_ops pci_nano_ops = {
121 .read = nanoengine_read_config,
122 .write = nanoengine_write_config,
123};
124
125static int __init pci_nanoengine_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
126{
127 return NANOENGINE_IRQ_GPIO_PCI;
128}
129
130struct pci_bus * __init pci_nanoengine_scan_bus(int nr, struct pci_sys_data *sys)
131{
132 return pci_scan_bus(sys->busnr, &pci_nano_ops, sys);
133}
134
135static struct resource pci_io_ports = {
136 .name = "PCI IO",
137 .start = 0x400,
138 .end = 0x7FF,
139 .flags = IORESOURCE_IO,
140};
141
142static struct resource pci_non_prefetchable_memory = {
143 .name = "PCI non-prefetchable",
144 .start = NANO_PCI_MEM_RW_PHYS,
145 /* nanoEngine documentation says there is a 1 Megabyte window here,
146 * but PCI reports just 128 + 8 kbytes. */
147 .end = NANO_PCI_MEM_RW_PHYS + NANO_PCI_MEM_RW_SIZE - 1,
148/* .end = NANO_PCI_MEM_RW_PHYS + SZ_128K + SZ_8K - 1,*/
149 .flags = IORESOURCE_MEM,
150};
151
152/*
153 * nanoEngine PCI reports 1 Megabyte of prefetchable memory, but it
154 * overlaps with previously defined memory.
155 *
156 * Here is what happens:
157 *
158# dmesg
159...
160pci 0000:00:00.0: [8086:1209] type 0 class 0x000200
161pci 0000:00:00.0: reg 10: [mem 0x00021000-0x00021fff]
162pci 0000:00:00.0: reg 14: [io 0x0000-0x003f]
163pci 0000:00:00.0: reg 18: [mem 0x00000000-0x0001ffff]
164pci 0000:00:00.0: reg 30: [mem 0x00000000-0x000fffff pref]
165pci 0000:00:00.0: supports D1 D2
166pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot
167pci 0000:00:00.0: PME# disabled
168PCI: bus0: Fast back to back transfers enabled
169pci 0000:00:00.0: BAR 6: can't assign mem pref (size 0x100000)
170pci 0000:00:00.0: BAR 2: assigned [mem 0x18600000-0x1861ffff]
171pci 0000:00:00.0: BAR 2: set to [mem 0x18600000-0x1861ffff] (PCI address [0x0-0x1ffff])
172pci 0000:00:00.0: BAR 0: assigned [mem 0x18620000-0x18620fff]
173pci 0000:00:00.0: BAR 0: set to [mem 0x18620000-0x18620fff] (PCI address [0x20000-0x20fff])
174pci 0000:00:00.0: BAR 1: assigned [io 0x0400-0x043f]
175pci 0000:00:00.0: BAR 1: set to [io 0x0400-0x043f] (PCI address [0x0-0x3f])
176 *
177 * On the other hand, if we do not request the prefetchable memory resource,
178 * linux will alloc it first and the two non-prefetchable memory areas that
179 * are our real interest will not be mapped. So we choose to map it to an
180 * unused area. It gets recognized as expansion ROM, but becomes disabled.
181 *
182 * Here is what happens then:
183 *
184# dmesg
185...
186pci 0000:00:00.0: [8086:1209] type 0 class 0x000200
187pci 0000:00:00.0: reg 10: [mem 0x00021000-0x00021fff]
188pci 0000:00:00.0: reg 14: [io 0x0000-0x003f]
189pci 0000:00:00.0: reg 18: [mem 0x00000000-0x0001ffff]
190pci 0000:00:00.0: reg 30: [mem 0x00000000-0x000fffff pref]
191pci 0000:00:00.0: supports D1 D2
192pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot
193pci 0000:00:00.0: PME# disabled
194PCI: bus0: Fast back to back transfers enabled
195pci 0000:00:00.0: BAR 6: assigned [mem 0x78000000-0x780fffff pref]
196pci 0000:00:00.0: BAR 2: assigned [mem 0x18600000-0x1861ffff]
197pci 0000:00:00.0: BAR 2: set to [mem 0x18600000-0x1861ffff] (PCI address [0x0-0x1ffff])
198pci 0000:00:00.0: BAR 0: assigned [mem 0x18620000-0x18620fff]
199pci 0000:00:00.0: BAR 0: set to [mem 0x18620000-0x18620fff] (PCI address [0x20000-0x20fff])
200pci 0000:00:00.0: BAR 1: assigned [io 0x0400-0x043f]
201pci 0000:00:00.0: BAR 1: set to [io 0x0400-0x043f] (PCI address [0x0-0x3f])
202
203# lspci -vv -s 0000:00:00.0
20400:00.0 Class 0200: Device 8086:1209 (rev 09)
205 Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx-
206 Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR+ <PERR+ INTx-
207 Latency: 0 (2000ns min, 14000ns max), Cache Line Size: 32 bytes
208 Interrupt: pin A routed to IRQ 0
209 Region 0: Memory at 18620000 (32-bit, non-prefetchable) [size=4K]
210 Region 1: I/O ports at 0400 [size=64]
211 Region 2: [virtual] Memory at 18600000 (32-bit, non-prefetchable) [size=128K]
212 [virtual] Expansion ROM at 78000000 [disabled] [size=1M]
213 Capabilities: [dc] Power Management version 2
214 Flags: PMEClk- DSI+ D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-)
215 Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=2 PME-
216 Kernel driver in use: e100
217 Kernel modules: e100
218 *
219 */
220static struct resource pci_prefetchable_memory = {
221 .name = "PCI prefetchable",
222 .start = 0x78000000,
223 .end = 0x78000000 + NANO_PCI_MEM_RW_SIZE - 1,
224 .flags = IORESOURCE_MEM | IORESOURCE_PREFETCH,
225};
226
227static int __init pci_nanoengine_setup_resources(struct resource **resource)
228{
229 if (request_resource(&ioport_resource, &pci_io_ports)) {
230 printk(KERN_ERR "PCI: unable to allocate io port region\n");
231 return -EBUSY;
232 }
233 if (request_resource(&iomem_resource, &pci_non_prefetchable_memory)) {
234 release_resource(&pci_io_ports);
235 printk(KERN_ERR "PCI: unable to allocate non prefetchable\n");
236 return -EBUSY;
237 }
238 if (request_resource(&iomem_resource, &pci_prefetchable_memory)) {
239 release_resource(&pci_io_ports);
240 release_resource(&pci_non_prefetchable_memory);
241 printk(KERN_ERR "PCI: unable to allocate prefetchable\n");
242 return -EBUSY;
243 }
244 resource[0] = &pci_io_ports;
245 resource[1] = &pci_non_prefetchable_memory;
246 resource[2] = &pci_prefetchable_memory;
247
248 return 1;
249}
250
251int __init pci_nanoengine_setup(int nr, struct pci_sys_data *sys)
252{
253 int ret = 0;
254
255 if (nr == 0) {
256 sys->mem_offset = NANO_PCI_MEM_RW_PHYS;
257 sys->io_offset = 0x400;
258 ret = pci_nanoengine_setup_resources(sys->resource);
259 /* Enable alternate memory bus master mode, see
260 * "Intel StrongARM SA1110 Developer's Manual",
261 * section 10.8, "Alternate Memory Bus Master Mode". */
262 GPDR = (GPDR & ~GPIO_MBREQ) | GPIO_MBGNT;
263 GAFR |= GPIO_MBGNT | GPIO_MBREQ;
264 TUCR |= TUCR_MBGPIO;
265 }
266
267 return ret;
268}
269
270static struct hw_pci nanoengine_pci __initdata = {
271 .map_irq = pci_nanoengine_map_irq,
272 .nr_controllers = 1,
273 .scan = pci_nanoengine_scan_bus,
274 .setup = pci_nanoengine_setup,
275};
276
277static int __init nanoengine_pci_init(void)
278{
279 if (machine_is_nanoengine())
280 pci_common_init(&nanoengine_pci);
281 return 0;
282}
283
284subsys_initcall(nanoengine_pci_init);
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c
index 1ccd6018d3a3..65161f2bea29 100644
--- a/arch/arm/mach-sa1100/pleb.c
+++ b/arch/arm/mach-sa1100/pleb.c
@@ -142,12 +142,10 @@ static void __init pleb_map_io(void)
142 142
143 GPDR &= ~GPIO_ETH0_IRQ; 143 GPDR &= ~GPIO_ETH0_IRQ;
144 144
145 set_irq_type(GPIO_ETH0_IRQ, IRQ_TYPE_EDGE_FALLING); 145 irq_set_irq_type(GPIO_ETH0_IRQ, IRQ_TYPE_EDGE_FALLING);
146} 146}
147 147
148MACHINE_START(PLEB, "PLEB") 148MACHINE_START(PLEB, "PLEB")
149 .phys_io = 0x80000000,
150 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
151 .map_io = pleb_map_io, 149 .map_io = pleb_map_io,
152 .init_irq = sa1100_init_irq, 150 .init_irq = sa1100_init_irq,
153 .timer = &sa1100_timer, 151 .timer = &sa1100_timer,
diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index c83fdc80edfd..c4661aab22fb 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -32,8 +32,7 @@
32#include <asm/system.h> 32#include <asm/system.h>
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34 34
35extern void sa1100_cpu_suspend(void); 35extern void sa1100_cpu_suspend(long);
36extern void sa1100_cpu_resume(void);
37 36
38#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x 37#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
39#define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x] 38#define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x]
@@ -73,10 +72,10 @@ static int sa11x0_pm_enter(suspend_state_t state)
73 RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR; 72 RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR;
74 73
75 /* set resume return address */ 74 /* set resume return address */
76 PSPR = virt_to_phys(sa1100_cpu_resume); 75 PSPR = virt_to_phys(cpu_resume);
77 76
78 /* go zzz */ 77 /* go zzz */
79 sa1100_cpu_suspend(); 78 sa1100_cpu_suspend(PLAT_PHYS_OFFSET - PAGE_OFFSET);
80 79
81 cpu_init(); 80 cpu_init();
82 81
@@ -115,12 +114,7 @@ static int sa11x0_pm_enter(suspend_state_t state)
115 return 0; 114 return 0;
116} 115}
117 116
118unsigned long sleep_phys_sp(void *sp) 117static const struct platform_suspend_ops sa11x0_pm_ops = {
119{
120 return virt_to_phys(sp);
121}
122
123static struct platform_suspend_ops sa11x0_pm_ops = {
124 .enter = sa11x0_pm_enter, 118 .enter = sa11x0_pm_enter,
125 .valid = suspend_valid_only_mem, 119 .valid = suspend_valid_only_mem,
126}; 120};
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c
index 85e82bb73d7e..7917b2405579 100644
--- a/arch/arm/mach-sa1100/shannon.c
+++ b/arch/arm/mach-sa1100/shannon.c
@@ -82,8 +82,6 @@ static void __init shannon_map_io(void)
82} 82}
83 83
84MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)") 84MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)")
85 .phys_io = 0x80000000,
86 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
87 .boot_params = 0xc0000100, 85 .boot_params = 0xc0000100,
88 .map_io = shannon_map_io, 86 .map_io = shannon_map_io,
89 .init_irq = sa1100_init_irq, 87 .init_irq = sa1100_init_irq,
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index 49cfd64663ac..cfb76077bd25 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -166,9 +166,6 @@ static void __init simpad_map_io(void)
166 PCFR = 0; 166 PCFR = 0;
167 PSDR = 0; 167 PSDR = 0;
168 168
169 sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
170 ARRAY_SIZE(simpad_flash_resources));
171 sa11x0_register_mcp(&simpad_mcp_data);
172} 169}
173 170
174static void simpad_power_off(void) 171static void simpad_power_off(void)
@@ -216,6 +213,10 @@ static int __init simpad_init(void)
216 213
217 pm_power_off = simpad_power_off; 214 pm_power_off = simpad_power_off;
218 215
216 sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
217 ARRAY_SIZE(simpad_flash_resources));
218 sa11x0_register_mcp(&simpad_mcp_data);
219
219 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 220 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
220 if(ret) 221 if(ret)
221 printk(KERN_WARNING "simpad: Unable to register mq200 framebuffer device"); 222 printk(KERN_WARNING "simpad: Unable to register mq200 framebuffer device");
@@ -228,8 +229,6 @@ arch_initcall(simpad_init);
228 229
229MACHINE_START(SIMPAD, "Simpad") 230MACHINE_START(SIMPAD, "Simpad")
230 /* Maintainer: Holger Freyther */ 231 /* Maintainer: Holger Freyther */
231 .phys_io = 0x80000000,
232 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
233 .boot_params = 0xc0000100, 232 .boot_params = 0xc0000100,
234 .map_io = simpad_map_io, 233 .map_io = simpad_map_io,
235 .init_irq = sa1100_init_irq, 234 .init_irq = sa1100_init_irq,
diff --git a/arch/arm/mach-sa1100/sleep.S b/arch/arm/mach-sa1100/sleep.S
index 80f31bad707c..04f2a618d4ef 100644
--- a/arch/arm/mach-sa1100/sleep.S
+++ b/arch/arm/mach-sa1100/sleep.S
@@ -20,12 +20,7 @@
20#include <asm/assembler.h> 20#include <asm/assembler.h>
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22 22
23
24
25 .text 23 .text
26
27
28
29/* 24/*
30 * sa1100_cpu_suspend() 25 * sa1100_cpu_suspend()
31 * 26 *
@@ -34,27 +29,10 @@
34 */ 29 */
35 30
36ENTRY(sa1100_cpu_suspend) 31ENTRY(sa1100_cpu_suspend)
37
38 stmfd sp!, {r4 - r12, lr} @ save registers on stack 32 stmfd sp!, {r4 - r12, lr} @ save registers on stack
39 33 mov r1, r0
40 @ get coprocessor registers 34 ldr r3, =sa1100_cpu_resume @ return function
41 mrc p15, 0, r4, c3, c0, 0 @ domain ID 35 bl cpu_suspend
42 mrc p15, 0, r5, c2, c0, 0 @ translation table base addr
43 mrc p15, 0, r6, c13, c0, 0 @ PID
44 mrc p15, 0, r7, c1, c0, 0 @ control reg
45
46 @ store them plus current virtual stack ptr on stack
47 mov r8, sp
48 stmfd sp!, {r4 - r8}
49
50 @ preserve phys address of stack
51 mov r0, sp
52 bl sleep_phys_sp
53 ldr r1, =sleep_save_sp
54 str r0, [r1]
55
56 @ clean data cache and invalidate WB
57 bl v4wb_flush_kern_cache_all
58 36
59 @ disable clock switching 37 @ disable clock switching
60 mcr p15, 0, r1, c15, c2, 2 38 mcr p15, 0, r1, c15, c2, 2
@@ -166,50 +144,8 @@ sa1110_sdram_controller_fix:
166 * cpu_sa1100_resume() 144 * cpu_sa1100_resume()
167 * 145 *
168 * entry point from bootloader into kernel during resume 146 * entry point from bootloader into kernel during resume
169 *
170 * Note: Yes, part of the following code is located into the .data section.
171 * This is to allow sleep_save_sp to be accessed with a relative load
172 * while we can't rely on any MMU translation. We could have put
173 * sleep_save_sp in the .text section as well, but some setups might
174 * insist on it to be truly read-only.
175 */ 147 */
176
177 .data
178 .align 5
179ENTRY(sa1100_cpu_resume)
180 mov r0, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
181 msr cpsr_c, r0 @ set SVC, irqs off
182
183 ldr r0, sleep_save_sp @ stack phys addr
184 ldr r2, =resume_after_mmu @ its absolute virtual address
185 ldmfd r0, {r4 - r7, sp} @ CP regs + virt stack ptr
186
187 mov r1, #0
188 mcr p15, 0, r1, c8, c7, 0 @ flush I+D TLBs
189 mcr p15, 0, r1, c7, c7, 0 @ flush I&D cache
190 mcr p15, 0, r1, c9, c0, 0 @ invalidate RB
191 mcr p15, 0, r1, c9, c0, 5 @ allow user space to use RB
192
193 mcr p15, 0, r4, c3, c0, 0 @ domain ID
194 mcr p15, 0, r5, c2, c0, 0 @ translation table base addr
195 mcr p15, 0, r6, c13, c0, 0 @ PID
196 b resume_turn_on_mmu @ cache align execution
197
198 .align 5 148 .align 5
199resume_turn_on_mmu: 149sa1100_cpu_resume:
200 mcr p15, 0, r7, c1, c0, 0 @ turn on MMU, caches, etc.
201 nop
202 mov pc, r2 @ jump to virtual addr
203 nop
204 nop
205 nop
206
207sleep_save_sp:
208 .word 0 @ preserve stack phys ptr here
209
210 .text
211resume_after_mmu:
212 mcr p15, 0, r1, c15, c1, 2 @ enable clock switching 150 mcr p15, 0, r1, c15, c1, 2 @ enable clock switching
213 ldmfd sp!, {r4 - r12, pc} @ return to caller 151 ldmfd sp!, {r4 - r12, pc} @ return to caller
214
215
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index 74b6e0e570b6..fa6602491d54 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -12,12 +12,39 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/sched.h> /* just for sched_clock() - funny that */
15#include <linux/timex.h> 16#include <linux/timex.h>
16#include <linux/clockchips.h> 17#include <linux/clockchips.h>
17 18
18#include <asm/mach/time.h> 19#include <asm/mach/time.h>
20#include <asm/sched_clock.h>
19#include <mach/hardware.h> 21#include <mach/hardware.h>
20 22
23/*
24 * This is the SA11x0 sched_clock implementation.
25 */
26static DEFINE_CLOCK_DATA(cd);
27
28/*
29 * Constants generated by clocks_calc_mult_shift(m, s, 3.6864MHz,
30 * NSEC_PER_SEC, 60).
31 * This gives a resolution of about 271ns and a wrap period of about 19min.
32 */
33#define SC_MULT 2275555556u
34#define SC_SHIFT 23
35
36unsigned long long notrace sched_clock(void)
37{
38 u32 cyc = OSCR;
39 return cyc_to_fixed_sched_clock(&cd, cyc, (u32)~0, SC_MULT, SC_SHIFT);
40}
41
42static void notrace sa1100_update_sched_clock(void)
43{
44 u32 cyc = OSCR;
45 update_sched_clock(&cd, cyc, (u32)~0);
46}
47
21#define MIN_OSCR_DELTA 2 48#define MIN_OSCR_DELTA 2
22 49
23static irqreturn_t sa1100_ost0_interrupt(int irq, void *dev_id) 50static irqreturn_t sa1100_ost0_interrupt(int irq, void *dev_id)
@@ -65,26 +92,11 @@ sa1100_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c)
65static struct clock_event_device ckevt_sa1100_osmr0 = { 92static struct clock_event_device ckevt_sa1100_osmr0 = {
66 .name = "osmr0", 93 .name = "osmr0",
67 .features = CLOCK_EVT_FEAT_ONESHOT, 94 .features = CLOCK_EVT_FEAT_ONESHOT,
68 .shift = 32,
69 .rating = 200, 95 .rating = 200,
70 .set_next_event = sa1100_osmr0_set_next_event, 96 .set_next_event = sa1100_osmr0_set_next_event,
71 .set_mode = sa1100_osmr0_set_mode, 97 .set_mode = sa1100_osmr0_set_mode,
72}; 98};
73 99
74static cycle_t sa1100_read_oscr(struct clocksource *s)
75{
76 return OSCR;
77}
78
79static struct clocksource cksrc_sa1100_oscr = {
80 .name = "oscr",
81 .rating = 200,
82 .read = sa1100_read_oscr,
83 .mask = CLOCKSOURCE_MASK(32),
84 .shift = 20,
85 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
86};
87
88static struct irqaction sa1100_timer_irq = { 100static struct irqaction sa1100_timer_irq = {
89 .name = "ost0", 101 .name = "ost0",
90 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 102 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
@@ -94,23 +106,23 @@ static struct irqaction sa1100_timer_irq = {
94 106
95static void __init sa1100_timer_init(void) 107static void __init sa1100_timer_init(void)
96{ 108{
97 OIER = 0; /* disable any timer interrupts */ 109 OIER = 0;
98 OSSR = 0xf; /* clear status on all timers */ 110 OSSR = OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3;
99 111
100 ckevt_sa1100_osmr0.mult = 112 init_fixed_sched_clock(&cd, sa1100_update_sched_clock, 32,
101 div_sc(3686400, NSEC_PER_SEC, ckevt_sa1100_osmr0.shift); 113 3686400, SC_MULT, SC_SHIFT);
114
115 clockevents_calc_mult_shift(&ckevt_sa1100_osmr0, 3686400, 4);
102 ckevt_sa1100_osmr0.max_delta_ns = 116 ckevt_sa1100_osmr0.max_delta_ns =
103 clockevent_delta2ns(0x7fffffff, &ckevt_sa1100_osmr0); 117 clockevent_delta2ns(0x7fffffff, &ckevt_sa1100_osmr0);
104 ckevt_sa1100_osmr0.min_delta_ns = 118 ckevt_sa1100_osmr0.min_delta_ns =
105 clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_sa1100_osmr0) + 1; 119 clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_sa1100_osmr0) + 1;
106 ckevt_sa1100_osmr0.cpumask = cpumask_of(0); 120 ckevt_sa1100_osmr0.cpumask = cpumask_of(0);
107 121
108 cksrc_sa1100_oscr.mult =
109 clocksource_hz2mult(CLOCK_TICK_RATE, cksrc_sa1100_oscr.shift);
110
111 setup_irq(IRQ_OST0, &sa1100_timer_irq); 122 setup_irq(IRQ_OST0, &sa1100_timer_irq);
112 123
113 clocksource_register(&cksrc_sa1100_oscr); 124 clocksource_mmio_init(&OSCR, "oscr", CLOCK_TICK_RATE, 200, 32,
125 clocksource_mmio_readl_up);
114 clockevents_register_device(&ckevt_sa1100_osmr0); 126 clockevents_register_device(&ckevt_sa1100_osmr0);
115} 127}
116 128