aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2010-11-03 11:29:35 -0400
committerEric Miao <eric.y.miao@gmail.com>2010-12-16 01:31:16 -0500
commitad68bb9f7a3cd47396635a5e3895215af57579da (patch)
tree6d9890bc0112b637e95afa0129a08fc20e325234 /arch/arm
parent851982c1b6ca18cedf6d01e4529a0c1ddb30771e (diff)
ARM: pxa: Access SMEMC via virtual addresses
This is important because on PXA3xx, the physical mapping of SMEMC registers differs from the one on PXA2xx. In order to get PCMCIA working on both PXA2xx and PXA320, the PCMCIA driver was adjusted accordingly as well. Also, various places in the kernel had to be patched to use __raw_read/__raw_write. Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-pxa/cm-x2xx.c13
-rw-r--r--arch/arm/mach-pxa/cpufreq-pxa2xx.c10
-rw-r--r--arch/arm/mach-pxa/csb726.c7
-rw-r--r--arch/arm/mach-pxa/generic.c1
-rw-r--r--arch/arm/mach-pxa/h5000.c9
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa2xx-regs.h55
-rw-r--r--arch/arm/mach-pxa/include/mach/smemc.h74
-rw-r--r--arch/arm/mach-pxa/lpd270.c3
-rw-r--r--arch/arm/mach-pxa/lubbock.c3
-rw-r--r--arch/arm/mach-pxa/mainstone.c3
-rw-r--r--arch/arm/mach-pxa/pxa25x.c5
-rw-r--r--arch/arm/mach-pxa/pxa27x.c11
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c5
-rw-r--r--arch/arm/mach-pxa/sleep.S2
-rw-r--r--arch/arm/mach-pxa/smemc.c51
-rw-r--r--arch/arm/mach-pxa/spitz.c6
-rw-r--r--arch/arm/mach-pxa/stargate2.c3
-rw-r--r--arch/arm/mach-pxa/tosa.c7
-rw-r--r--arch/arm/mach-pxa/trizeps4.c3
-rw-r--r--arch/arm/mach-pxa/xcep.c5
-rw-r--r--arch/arm/mach-pxa/zeus.c8
21 files changed, 156 insertions, 128 deletions
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index 47e242005fac..b734d8468168 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -24,6 +24,7 @@
24#include <mach/pxa2xx-regs.h> 24#include <mach/pxa2xx-regs.h>
25#include <mach/audio.h> 25#include <mach/audio.h>
26#include <mach/pxafb.h> 26#include <mach/pxafb.h>
27#include <mach/smemc.h>
27 28
28#include <asm/hardware/it8152.h> 29#include <asm/hardware/it8152.h>
29 30
@@ -392,9 +393,9 @@ static int cmx2xx_suspend(struct sys_device *dev, pm_message_t state)
392 cmx2xx_pci_suspend(); 393 cmx2xx_pci_suspend();
393 394
394 /* save MSC registers */ 395 /* save MSC registers */
395 sleep_save_msc[0] = MSC0; 396 sleep_save_msc[0] = __raw_readl(MSC0);
396 sleep_save_msc[1] = MSC1; 397 sleep_save_msc[1] = __raw_readl(MSC1);
397 sleep_save_msc[2] = MSC2; 398 sleep_save_msc[2] = __raw_readl(MSC2);
398 399
399 /* setup power saving mode registers */ 400 /* setup power saving mode registers */
400 PCFR = 0x0; 401 PCFR = 0x0;
@@ -416,9 +417,9 @@ static int cmx2xx_resume(struct sys_device *dev)
416 cmx2xx_pci_resume(); 417 cmx2xx_pci_resume();
417 418
418 /* restore MSC registers */ 419 /* restore MSC registers */
419 MSC0 = sleep_save_msc[0]; 420 __raw_writel(sleep_save_msc[0], MSC0);
420 MSC1 = sleep_save_msc[1]; 421 __raw_writel(sleep_save_msc[1], MSC1);
421 MSC2 = sleep_save_msc[2]; 422 __raw_writel(sleep_save_msc[2], MSC2);
422 423
423 return 0; 424 return 0;
424} 425}
diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
index 58093d9e07be..6a7aeab42f6c 100644
--- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c
+++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
@@ -38,8 +38,10 @@
38#include <linux/cpufreq.h> 38#include <linux/cpufreq.h>
39#include <linux/err.h> 39#include <linux/err.h>
40#include <linux/regulator/consumer.h> 40#include <linux/regulator/consumer.h>
41#include <linux/io.h>
41 42
42#include <mach/pxa2xx-regs.h> 43#include <mach/pxa2xx-regs.h>
44#include <mach/smemc.h>
43 45
44#ifdef DEBUG 46#ifdef DEBUG
45static unsigned int freq_debug; 47static unsigned int freq_debug;
@@ -242,7 +244,7 @@ static void pxa27x_guess_max_freq(void)
242 244
243static void init_sdram_rows(void) 245static void init_sdram_rows(void)
244{ 246{
245 uint32_t mdcnfg = MDCNFG; 247 uint32_t mdcnfg = __raw_readl(MDCNFG);
246 unsigned int drac2 = 0, drac0 = 0; 248 unsigned int drac2 = 0, drac0 = 0;
247 249
248 if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3)) 250 if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
@@ -331,8 +333,8 @@ static int pxa_set_target(struct cpufreq_policy *policy,
331 * we need to preset the smaller DRI before the change. If we're 333 * we need to preset the smaller DRI before the change. If we're
332 * speeding up we need to set the larger DRI value after the change. 334 * speeding up we need to set the larger DRI value after the change.
333 */ 335 */
334 preset_mdrefr = postset_mdrefr = MDREFR; 336 preset_mdrefr = postset_mdrefr = __raw_readl(MDREFR);
335 if ((MDREFR & MDREFR_DRI_MASK) > mdrefr_dri(new_freq_mem)) { 337 if ((preset_mdrefr & MDREFR_DRI_MASK) > mdrefr_dri(new_freq_mem)) {
336 preset_mdrefr = (preset_mdrefr & ~MDREFR_DRI_MASK); 338 preset_mdrefr = (preset_mdrefr & ~MDREFR_DRI_MASK);
337 preset_mdrefr |= mdrefr_dri(new_freq_mem); 339 preset_mdrefr |= mdrefr_dri(new_freq_mem);
338 } 340 }
@@ -370,7 +372,7 @@ static int pxa_set_target(struct cpufreq_policy *policy,
3703: nop \n\ 3723: nop \n\
371 " 373 "
372 : "=&r" (unused) 374 : "=&r" (unused)
373 : "r" (&MDREFR), "r" (cclkcfg), 375 : "r" (MDREFR), "r" (cclkcfg),
374 "r" (preset_mdrefr), "r" (postset_mdrefr) 376 "r" (preset_mdrefr), "r" (postset_mdrefr)
375 : "r4", "r5"); 377 : "r4", "r5");
376 local_irq_restore(flags); 378 local_irq_restore(flags);
diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c
index 225a2a117812..a305424a967d 100644
--- a/arch/arm/mach-pxa/csb726.c
+++ b/arch/arm/mach-pxa/csb726.c
@@ -27,6 +27,7 @@
27#include <mach/ohci.h> 27#include <mach/ohci.h>
28#include <mach/pxa2xx-regs.h> 28#include <mach/pxa2xx-regs.h>
29#include <mach/audio.h> 29#include <mach/audio.h>
30#include <mach/smemc.h>
30 31
31#include "generic.h" 32#include "generic.h"
32#include "devices.h" 33#include "devices.h"
@@ -255,9 +256,9 @@ static struct platform_device *devices[] __initdata = {
255static void __init csb726_init(void) 256static void __init csb726_init(void)
256{ 257{
257 pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config)); 258 pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config));
258/* MSC1 = 0x7ffc3ffc; *//* LAN9215/EXP_CS */ 259/* __raw_writel(0x7ffc3ffc, MSC1); *//* LAN9215/EXP_CS */
259/* MSC2 = 0x06697ff4; *//* none/SM501 */ 260/* __raw_writel(0x06697ff4, MSC2); *//* none/SM501 */
260 MSC2 = (MSC2 & ~0xffff) | 0x7ff4; /* SM501 */ 261 __raw_writel((__raw_readl(MSC2) & ~0xffff) | 0x7ff4, MSC2); /* SM501 */
261 262
262 pxa_set_ffuart_info(NULL); 263 pxa_set_ffuart_info(NULL);
263 pxa_set_btuart_info(NULL); 264 pxa_set_btuart_info(NULL);
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 6a5f37935378..d4ce8f9233d7 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -28,6 +28,7 @@
28 28
29#include <mach/reset.h> 29#include <mach/reset.h>
30#include <mach/gpio.h> 30#include <mach/gpio.h>
31#include <mach/smemc.h>
31 32
32#include "generic.h" 33#include "generic.h"
33 34
diff --git a/arch/arm/mach-pxa/h5000.c b/arch/arm/mach-pxa/h5000.c
index 0ef16351bf9d..657db469de1f 100644
--- a/arch/arm/mach-pxa/h5000.c
+++ b/arch/arm/mach-pxa/h5000.c
@@ -32,6 +32,7 @@
32#include <mach/pxa25x.h> 32#include <mach/pxa25x.h>
33#include <mach/h5000.h> 33#include <mach/h5000.h>
34#include <mach/udc.h> 34#include <mach/udc.h>
35#include <mach/smemc.h>
35 36
36#include "generic.h" 37#include "generic.h"
37 38
@@ -172,11 +173,11 @@ static unsigned long h5000_pin_config[] __initdata = {
172 173
173static void fix_msc(void) 174static void fix_msc(void)
174{ 175{
175 MSC0 = 0x129c24f2; 176 __raw_writel(0x129c24f2, MSC0);
176 MSC1 = 0x7ff424fa; 177 __raw_writel(0x7ff424fa, MSC1);
177 MSC2 = 0x7ff47ff4; 178 __raw_writel(0x7ff47ff4, MSC2);
178 179
179 MDREFR |= 0x02080000; 180 __raw_writel(__raw_readl(MDREFR) | 0x02080000, MDREFR);
180} 181}
181 182
182/* 183/*
diff --git a/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h b/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
index dd0fc1c95cc0..ee6ced1cea7f 100644
--- a/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
+++ b/arch/arm/mach-pxa/include/mach/pxa2xx-regs.h
@@ -17,61 +17,6 @@
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18 18
19/* 19/*
20 * Memory controller
21 */
22
23#define MDCNFG __REG(0x48000000) /* SDRAM Configuration Register 0 */
24#define MDREFR __REG(0x48000004) /* SDRAM Refresh Control Register */
25#define MSC0 __REG(0x48000008) /* Static Memory Control Register 0 */
26#define MSC1 __REG(0x4800000C) /* Static Memory Control Register 1 */
27#define MSC2 __REG(0x48000010) /* Static Memory Control Register 2 */
28#define MECR __REG(0x48000014) /* Expansion Memory (PCMCIA/Compact Flash) Bus Configuration */
29#define SXLCR __REG(0x48000018) /* LCR value to be written to SDRAM-Timing Synchronous Flash */
30#define SXCNFG __REG(0x4800001C) /* Synchronous Static Memory Control Register */
31#define SXMRS __REG(0x48000024) /* MRS value to be written to Synchronous Flash or SMROM */
32#define MCMEM0 __REG(0x48000028) /* Card interface Common Memory Space Socket 0 Timing */
33#define MCMEM1 __REG(0x4800002C) /* Card interface Common Memory Space Socket 1 Timing */
34#define MCATT0 __REG(0x48000030) /* Card interface Attribute Space Socket 0 Timing Configuration */
35#define MCATT1 __REG(0x48000034) /* Card interface Attribute Space Socket 1 Timing Configuration */
36#define MCIO0 __REG(0x48000038) /* Card interface I/O Space Socket 0 Timing Configuration */
37#define MCIO1 __REG(0x4800003C) /* Card interface I/O Space Socket 1 Timing Configuration */
38#define MDMRS __REG(0x48000040) /* MRS value to be written to SDRAM */
39#define BOOT_DEF __REG(0x48000044) /* Read-Only Boot-Time Register. Contains BOOT_SEL and PKG_SEL */
40
41/*
42 * More handy macros for PCMCIA
43 *
44 * Arg is socket number
45 */
46#define MCMEM(s) __REG2(0x48000028, (s)<<2 ) /* Card interface Common Memory Space Socket s Timing */
47#define MCATT(s) __REG2(0x48000030, (s)<<2 ) /* Card interface Attribute Space Socket s Timing Configuration */
48#define MCIO(s) __REG2(0x48000038, (s)<<2 ) /* Card interface I/O Space Socket s Timing Configuration */
49
50/* MECR register defines */
51#define MECR_NOS (1 << 0) /* Number Of Sockets: 0 -> 1 sock, 1 -> 2 sock */
52#define MECR_CIT (1 << 1) /* Card Is There: 0 -> no card, 1 -> card inserted */
53
54#define MDCNFG_DE0 (1 << 0) /* SDRAM Bank 0 Enable */
55#define MDCNFG_DE1 (1 << 1) /* SDRAM Bank 1 Enable */
56#define MDCNFG_DE2 (1 << 16) /* SDRAM Bank 2 Enable */
57#define MDCNFG_DE3 (1 << 17) /* SDRAM Bank 3 Enable */
58
59#define MDREFR_K0DB4 (1 << 29) /* SDCLK0 Divide by 4 Control/Status */
60#define MDREFR_K2FREE (1 << 25) /* SDRAM Free-Running Control */
61#define MDREFR_K1FREE (1 << 24) /* SDRAM Free-Running Control */
62#define MDREFR_K0FREE (1 << 23) /* SDRAM Free-Running Control */
63#define MDREFR_SLFRSH (1 << 22) /* SDRAM Self-Refresh Control/Status */
64#define MDREFR_APD (1 << 20) /* SDRAM/SSRAM Auto-Power-Down Enable */
65#define MDREFR_K2DB2 (1 << 19) /* SDCLK2 Divide by 2 Control/Status */
66#define MDREFR_K2RUN (1 << 18) /* SDCLK2 Run Control/Status */
67#define MDREFR_K1DB2 (1 << 17) /* SDCLK1 Divide by 2 Control/Status */
68#define MDREFR_K1RUN (1 << 16) /* SDCLK1 Run Control/Status */
69#define MDREFR_E1PIN (1 << 15) /* SDCKE1 Level Control/Status */
70#define MDREFR_K0DB2 (1 << 14) /* SDCLK0 Divide by 2 Control/Status */
71#define MDREFR_K0RUN (1 << 13) /* SDCLK0 Run Control/Status */
72#define MDREFR_E0PIN (1 << 12) /* SDCKE0 Level Control/Status */
73
74/*
75 * Power Manager 20 * Power Manager
76 */ 21 */
77 22
diff --git a/arch/arm/mach-pxa/include/mach/smemc.h b/arch/arm/mach-pxa/include/mach/smemc.h
new file mode 100644
index 000000000000..654adc90c9a0
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/smemc.h
@@ -0,0 +1,74 @@
1/*
2 * Static memory controller register definitions for PXA CPUs
3 *
4 * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __SMEMC_REGS_H
12#define __SMEMC_REGS_H
13
14#define PXA2XX_SMEMC_BASE 0x48000000
15#define PXA3XX_SMEMC_BASE 0x4a000000
16#define SMEMC_VIRT 0xf6000000
17
18#define MDCNFG (SMEMC_VIRT + 0x00) /* SDRAM Configuration Register 0 */
19#define MDREFR (SMEMC_VIRT + 0x04) /* SDRAM Refresh Control Register */
20#define MSC0 (SMEMC_VIRT + 0x08) /* Static Memory Control Register 0 */
21#define MSC1 (SMEMC_VIRT + 0x0C) /* Static Memory Control Register 1 */
22#define MSC2 (SMEMC_VIRT + 0x10) /* Static Memory Control Register 2 */
23#define MECR (SMEMC_VIRT + 0x14) /* Expansion Memory (PCMCIA/Compact Flash) Bus Configuration */
24#define SXLCR (SMEMC_VIRT + 0x18) /* LCR value to be written to SDRAM-Timing Synchronous Flash */
25#define SXCNFG (SMEMC_VIRT + 0x1C) /* Synchronous Static Memory Control Register */
26#define SXMRS (SMEMC_VIRT + 0x24) /* MRS value to be written to Synchronous Flash or SMROM */
27#define MCMEM0 (SMEMC_VIRT + 0x28) /* Card interface Common Memory Space Socket 0 Timing */
28#define MCMEM1 (SMEMC_VIRT + 0x2C) /* Card interface Common Memory Space Socket 1 Timing */
29#define MCATT0 (SMEMC_VIRT + 0x30) /* Card interface Attribute Space Socket 0 Timing Configuration */
30#define MCATT1 (SMEMC_VIRT + 0x34) /* Card interface Attribute Space Socket 1 Timing Configuration */
31#define MCIO0 (SMEMC_VIRT + 0x38) /* Card interface I/O Space Socket 0 Timing Configuration */
32#define MCIO1 (SMEMC_VIRT + 0x3C) /* Card interface I/O Space Socket 1 Timing Configuration */
33#define MDMRS (SMEMC_VIRT + 0x40) /* MRS value to be written to SDRAM */
34#define BOOT_DEF (SMEMC_VIRT + 0x44) /* Read-Only Boot-Time Register. Contains BOOT_SEL and PKG_SEL */
35#define MEMCLKCFG (SMEMC_VIRT + 0x68) /* Clock Configuration */
36#define CSADRCFG0 (SMEMC_VIRT + 0x80) /* Address Configuration Register for CS0 */
37#define CSADRCFG1 (SMEMC_VIRT + 0x84) /* Address Configuration Register for CS1 */
38#define CSADRCFG2 (SMEMC_VIRT + 0x88) /* Address Configuration Register for CS2 */
39#define CSADRCFG3 (SMEMC_VIRT + 0x8C) /* Address Configuration Register for CS3 */
40
41/*
42 * More handy macros for PCMCIA
43 *
44 * Arg is socket number
45 */
46#define MCMEM(s) (SMEMC_VIRT + 0x28 + ((s)<<2)) /* Card interface Common Memory Space Socket s Timing */
47#define MCATT(s) (SMEMC_VIRT + 0x30 + ((s)<<2)) /* Card interface Attribute Space Socket s Timing Configuration */
48#define MCIO(s) (SMEMC_VIRT + 0x38 + ((s)<<2)) /* Card interface I/O Space Socket s Timing Configuration */
49
50/* MECR register defines */
51#define MECR_NOS (1 << 0) /* Number Of Sockets: 0 -> 1 sock, 1 -> 2 sock */
52#define MECR_CIT (1 << 1) /* Card Is There: 0 -> no card, 1 -> card inserted */
53
54#define MDCNFG_DE0 (1 << 0) /* SDRAM Bank 0 Enable */
55#define MDCNFG_DE1 (1 << 1) /* SDRAM Bank 1 Enable */
56#define MDCNFG_DE2 (1 << 16) /* SDRAM Bank 2 Enable */
57#define MDCNFG_DE3 (1 << 17) /* SDRAM Bank 3 Enable */
58
59#define MDREFR_K0DB4 (1 << 29) /* SDCLK0 Divide by 4 Control/Status */
60#define MDREFR_K2FREE (1 << 25) /* SDRAM Free-Running Control */
61#define MDREFR_K1FREE (1 << 24) /* SDRAM Free-Running Control */
62#define MDREFR_K0FREE (1 << 23) /* SDRAM Free-Running Control */
63#define MDREFR_SLFRSH (1 << 22) /* SDRAM Self-Refresh Control/Status */
64#define MDREFR_APD (1 << 20) /* SDRAM/SSRAM Auto-Power-Down Enable */
65#define MDREFR_K2DB2 (1 << 19) /* SDCLK2 Divide by 2 Control/Status */
66#define MDREFR_K2RUN (1 << 18) /* SDCLK2 Run Control/Status */
67#define MDREFR_K1DB2 (1 << 17) /* SDCLK1 Divide by 2 Control/Status */
68#define MDREFR_K1RUN (1 << 16) /* SDCLK1 Run Control/Status */
69#define MDREFR_E1PIN (1 << 15) /* SDCKE1 Level Control/Status */
70#define MDREFR_K0DB2 (1 << 14) /* SDCLK0 Divide by 2 Control/Status */
71#define MDREFR_K0RUN (1 << 13) /* SDCLK0 Run Control/Status */
72#define MDREFR_E0PIN (1 << 12) /* SDCKE0 Level Control/Status */
73
74#endif
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index db615d578c0e..8ab62a677807 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -46,6 +46,7 @@
46#include <mach/mmc.h> 46#include <mach/mmc.h>
47#include <mach/irda.h> 47#include <mach/irda.h>
48#include <mach/ohci.h> 48#include <mach/ohci.h>
49#include <mach/smemc.h>
49 50
50#include "generic.h" 51#include "generic.h"
51#include "devices.h" 52#include "devices.h"
@@ -463,7 +464,7 @@ static void __init lpd270_init(void)
463 pxa_set_btuart_info(NULL); 464 pxa_set_btuart_info(NULL);
464 pxa_set_stuart_info(NULL); 465 pxa_set_stuart_info(NULL);
465 466
466 lpd270_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4; 467 lpd270_flash_data[0].width = (__raw_readl(BOOT_DEF) & 1) ? 2 : 4;
467 lpd270_flash_data[1].width = 4; 468 lpd270_flash_data[1].width = 4;
468 469
469 /* 470 /*
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 5b1cc1c01c67..d3375486c8cd 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -50,6 +50,7 @@
50#include <mach/pxafb.h> 50#include <mach/pxafb.h>
51#include <mach/mmc.h> 51#include <mach/mmc.h>
52#include <mach/pm.h> 52#include <mach/pm.h>
53#include <mach/smemc.h>
53 54
54#include "generic.h" 55#include "generic.h"
55#include "clock.h" 56#include "clock.h"
@@ -525,7 +526,7 @@ static void __init lubbock_init(void)
525 pxa_set_ac97_info(NULL); 526 pxa_set_ac97_info(NULL);
526 527
527 lubbock_flash_data[0].width = lubbock_flash_data[1].width = 528 lubbock_flash_data[0].width = lubbock_flash_data[1].width =
528 (BOOT_DEF & 1) ? 2 : 4; 529 (__raw_readl(BOOT_DEF) & 1) ? 2 : 4;
529 /* Compensate for the nROMBT switch which swaps the flash banks */ 530 /* Compensate for the nROMBT switch which swaps the flash banks */
530 printk(KERN_NOTICE "Lubbock configured to boot from %s (bank %d)\n", 531 printk(KERN_NOTICE "Lubbock configured to boot from %s (bank %d)\n",
531 flashboot?"Flash":"ROM", flashboot); 532 flashboot?"Flash":"ROM", flashboot);
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 8bef7c8bcbb7..740c03590e3b 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -51,6 +51,7 @@
51#include <mach/irda.h> 51#include <mach/irda.h>
52#include <mach/ohci.h> 52#include <mach/ohci.h>
53#include <plat/pxa27x_keypad.h> 53#include <plat/pxa27x_keypad.h>
54#include <mach/smemc.h>
54 55
55#include "generic.h" 56#include "generic.h"
56#include "devices.h" 57#include "devices.h"
@@ -565,7 +566,7 @@ static void __init mainstone_init(void)
565 pxa_set_btuart_info(NULL); 566 pxa_set_btuart_info(NULL);
566 pxa_set_stuart_info(NULL); 567 pxa_set_stuart_info(NULL);
567 568
568 mst_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4; 569 mst_flash_data[0].width = (__raw_readl(BOOT_DEF) & 1) ? 2 : 4;
569 mst_flash_data[1].width = 4; 570 mst_flash_data[1].width = 4;
570 571
571 /* Compensate for SW7 which swaps the flash banks */ 572 /* Compensate for SW7 which swaps the flash banks */
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 67200ce25e1c..23136b6afa8e 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -31,6 +31,7 @@
31#include <mach/reset.h> 31#include <mach/reset.h>
32#include <mach/pm.h> 32#include <mach/pm.h>
33#include <mach/dma.h> 33#include <mach/dma.h>
34#include <mach/smemc.h>
34 35
35#include "generic.h" 36#include "generic.h"
36#include "devices.h" 37#include "devices.h"
@@ -323,8 +324,8 @@ void __init pxa26x_init_irq(void)
323 324
324static struct map_desc pxa25x_io_desc[] __initdata = { 325static struct map_desc pxa25x_io_desc[] __initdata = {
325 { /* Mem Ctl */ 326 { /* Mem Ctl */
326 .virtual = 0xf6000000, 327 .virtual = SMEMC_VIRT,
327 .pfn = __phys_to_pfn(0x48000000), 328 .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE),
328 .length = 0x00200000, 329 .length = 0x00200000,
329 .type = MT_DEVICE 330 .type = MT_DEVICE
330 }, 331 },
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 71dbee42edf9..839548d94185 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -17,6 +17,7 @@
17#include <linux/suspend.h> 17#include <linux/suspend.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20#include <linux/io.h>
20 21
21#include <asm/mach/map.h> 22#include <asm/mach/map.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
@@ -28,6 +29,8 @@
28#include <mach/ohci.h> 29#include <mach/ohci.h>
29#include <mach/pm.h> 30#include <mach/pm.h>
30#include <mach/dma.h> 31#include <mach/dma.h>
32#include <mach/smemc.h>
33
31#include <plat/i2c.h> 34#include <plat/i2c.h>
32 35
33#include "generic.h" 36#include "generic.h"
@@ -255,7 +258,7 @@ enum {
255 258
256void pxa27x_cpu_pm_save(unsigned long *sleep_save) 259void pxa27x_cpu_pm_save(unsigned long *sleep_save)
257{ 260{
258 SAVE(MDREFR); 261 sleep_save[SLEEP_SAVE_MDREFR] = __raw_readl(MDREFR);
259 SAVE(PCFR); 262 SAVE(PCFR);
260 263
261 SAVE(CKEN); 264 SAVE(CKEN);
@@ -264,7 +267,7 @@ void pxa27x_cpu_pm_save(unsigned long *sleep_save)
264 267
265void pxa27x_cpu_pm_restore(unsigned long *sleep_save) 268void pxa27x_cpu_pm_restore(unsigned long *sleep_save)
266{ 269{
267 RESTORE(MDREFR); 270 __raw_writel(sleep_save[SLEEP_SAVE_MDREFR], MDREFR);
268 RESTORE(PCFR); 271 RESTORE(PCFR);
269 272
270 PSSR = PSSR_RDH | PSSR_PH; 273 PSSR = PSSR_RDH | PSSR_PH;
@@ -373,8 +376,8 @@ void __init pxa27x_init_irq(void)
373 376
374static struct map_desc pxa27x_io_desc[] __initdata = { 377static struct map_desc pxa27x_io_desc[] __initdata = {
375 { /* Mem Ctl */ 378 { /* Mem Ctl */
376 .virtual = 0xf6000000, 379 .virtual = SMEMC_VIRT,
377 .pfn = __phys_to_pfn(0x48000000), 380 .pfn = __phys_to_pfn(PXA2XX_SMEMC_BASE),
378 .length = 0x00200000, 381 .length = 0x00200000,
379 .type = MT_DEVICE 382 .type = MT_DEVICE
380 }, { /* IMem ctl */ 383 }, { /* IMem ctl */
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 5480a94e6469..dc658ad234e1 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -31,6 +31,7 @@
31#include <mach/pm.h> 31#include <mach/pm.h>
32#include <mach/dma.h> 32#include <mach/dma.h>
33#include <mach/regs-intc.h> 33#include <mach/regs-intc.h>
34#include <mach/smemc.h>
34#include <plat/i2c.h> 35#include <plat/i2c.h>
35 36
36#include "generic.h" 37#include "generic.h"
@@ -583,8 +584,8 @@ void __init pxa3xx_init_irq(void)
583 584
584static struct map_desc pxa3xx_io_desc[] __initdata = { 585static struct map_desc pxa3xx_io_desc[] __initdata = {
585 { /* Mem Ctl */ 586 { /* Mem Ctl */
586 .virtual = 0xf6000000, 587 .virtual = SMEMC_VIRT,
587 .pfn = __phys_to_pfn(0x4a000000), 588 .pfn = __phys_to_pfn(PXA3XX_SMEMC_BASE),
588 .length = 0x00200000, 589 .length = 0x00200000,
589 .type = MT_DEVICE 590 .type = MT_DEVICE
590 } 591 }
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index 52c30b01a671..2f5b08aeb52e 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -14,7 +14,7 @@
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <asm/assembler.h> 15#include <asm/assembler.h>
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17 17#include <mach/smemc.h>
18#include <mach/pxa2xx-regs.h> 18#include <mach/pxa2xx-regs.h>
19 19
20#define MDREFR_KDIV 0x200a4000 // all banks 20#define MDREFR_KDIV 0x200a4000 // all banks
diff --git a/arch/arm/mach-pxa/smemc.c b/arch/arm/mach-pxa/smemc.c
index d6f6904132a6..232b7316ec08 100644
--- a/arch/arm/mach-pxa/smemc.c
+++ b/arch/arm/mach-pxa/smemc.c
@@ -9,50 +9,37 @@
9#include <linux/sysdev.h> 9#include <linux/sysdev.h>
10 10
11#include <mach/hardware.h> 11#include <mach/hardware.h>
12 12#include <mach/smemc.h>
13#define SMEMC_PHYS_BASE (0x4A000000)
14#define SMEMC_PHYS_SIZE (0x90)
15
16#define MSC0 (0x08) /* Static Memory Controller Register 0 */
17#define MSC1 (0x0C) /* Static Memory Controller Register 1 */
18#define SXCNFG (0x1C) /* Synchronous Static Memory Control Register */
19#define MEMCLKCFG (0x68) /* Clock Configuration */
20#define CSADRCFG0 (0x80) /* Address Configuration Register for CS0 */
21#define CSADRCFG1 (0x84) /* Address Configuration Register for CS1 */
22#define CSADRCFG2 (0x88) /* Address Configuration Register for CS2 */
23#define CSADRCFG3 (0x8C) /* Address Configuration Register for CS3 */
24 13
25#ifdef CONFIG_PM 14#ifdef CONFIG_PM
26static void __iomem *smemc_mmio_base;
27
28static unsigned long msc[2]; 15static unsigned long msc[2];
29static unsigned long sxcnfg, memclkcfg; 16static unsigned long sxcnfg, memclkcfg;
30static unsigned long csadrcfg[4]; 17static unsigned long csadrcfg[4];
31 18
32static int pxa3xx_smemc_suspend(struct sys_device *dev, pm_message_t state) 19static int pxa3xx_smemc_suspend(struct sys_device *dev, pm_message_t state)
33{ 20{
34 msc[0] = __raw_readl(smemc_mmio_base + MSC0); 21 msc[0] = __raw_readl(MSC0);
35 msc[1] = __raw_readl(smemc_mmio_base + MSC1); 22 msc[1] = __raw_readl(MSC1);
36 sxcnfg = __raw_readl(smemc_mmio_base + SXCNFG); 23 sxcnfg = __raw_readl(SXCNFG);
37 memclkcfg = __raw_readl(smemc_mmio_base + MEMCLKCFG); 24 memclkcfg = __raw_readl(MEMCLKCFG);
38 csadrcfg[0] = __raw_readl(smemc_mmio_base + CSADRCFG0); 25 csadrcfg[0] = __raw_readl(CSADRCFG0);
39 csadrcfg[1] = __raw_readl(smemc_mmio_base + CSADRCFG1); 26 csadrcfg[1] = __raw_readl(CSADRCFG1);
40 csadrcfg[2] = __raw_readl(smemc_mmio_base + CSADRCFG2); 27 csadrcfg[2] = __raw_readl(CSADRCFG2);
41 csadrcfg[3] = __raw_readl(smemc_mmio_base + CSADRCFG3); 28 csadrcfg[3] = __raw_readl(CSADRCFG3);
42 29
43 return 0; 30 return 0;
44} 31}
45 32
46static int pxa3xx_smemc_resume(struct sys_device *dev) 33static int pxa3xx_smemc_resume(struct sys_device *dev)
47{ 34{
48 __raw_writel(msc[0], smemc_mmio_base + MSC0); 35 __raw_writel(msc[0], MSC0);
49 __raw_writel(msc[1], smemc_mmio_base + MSC1); 36 __raw_writel(msc[1], MSC1);
50 __raw_writel(sxcnfg, smemc_mmio_base + SXCNFG); 37 __raw_writel(sxcnfg, SXCNFG);
51 __raw_writel(memclkcfg, smemc_mmio_base + MEMCLKCFG); 38 __raw_writel(memclkcfg, MEMCLKCFG);
52 __raw_writel(csadrcfg[0], smemc_mmio_base + CSADRCFG0); 39 __raw_writel(csadrcfg[0], CSADRCFG0);
53 __raw_writel(csadrcfg[1], smemc_mmio_base + CSADRCFG1); 40 __raw_writel(csadrcfg[1], CSADRCFG1);
54 __raw_writel(csadrcfg[2], smemc_mmio_base + CSADRCFG2); 41 __raw_writel(csadrcfg[2], CSADRCFG2);
55 __raw_writel(csadrcfg[3], smemc_mmio_base + CSADRCFG3); 42 __raw_writel(csadrcfg[3], CSADRCFG3);
56 43
57 return 0; 44 return 0;
58} 45}
@@ -73,10 +60,6 @@ static int __init smemc_init(void)
73 int ret = 0; 60 int ret = 0;
74 61
75 if (cpu_is_pxa3xx()) { 62 if (cpu_is_pxa3xx()) {
76 smemc_mmio_base = ioremap(SMEMC_PHYS_BASE, SMEMC_PHYS_SIZE);
77 if (smemc_mmio_base == NULL)
78 return -ENODEV;
79
80 ret = sysdev_class_register(&smemc_sysclass); 63 ret = sysdev_class_register(&smemc_sysclass);
81 if (ret) 64 if (ret)
82 return ret; 65 return ret;
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 38bcc2a0c515..0499a69e7673 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -45,6 +45,7 @@
45#include <mach/pxa2xx_spi.h> 45#include <mach/pxa2xx_spi.h>
46#include <mach/spitz.h> 46#include <mach/spitz.h>
47#include <mach/sharpsl_pm.h> 47#include <mach/sharpsl_pm.h>
48#include <mach/smemc.h>
48 49
49#include <plat/i2c.h> 50#include <plat/i2c.h>
50 51
@@ -930,9 +931,10 @@ static void spitz_poweroff(void)
930 931
931static void spitz_restart(char mode, const char *cmd) 932static void spitz_restart(char mode, const char *cmd)
932{ 933{
934 uint32_t msc0 = __raw_readl(MSC0);
933 /* Bootloader magic for a reboot */ 935 /* Bootloader magic for a reboot */
934 if ((MSC0 & 0xffff0000) == 0x7ff00000) 936 if ((msc0 & 0xffff0000) == 0x7ff00000)
935 MSC0 = (MSC0 & 0xffff) | 0x7ee00000; 937 __raw_writel((msc0 & 0xffff) | 0x7ee00000, MSC0);
936 938
937 spitz_poweroff(); 939 spitz_poweroff();
938} 940}
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
index 19f5378e766d..3498a1423943 100644
--- a/arch/arm/mach-pxa/stargate2.c
+++ b/arch/arm/mach-pxa/stargate2.c
@@ -48,6 +48,7 @@
48#include <mach/udc.h> 48#include <mach/udc.h>
49#include <mach/pxa2xx_spi.h> 49#include <mach/pxa2xx_spi.h>
50#include <mach/pxa27x-udc.h> 50#include <mach/pxa27x-udc.h>
51#include <mach/smemc.h>
51 52
52#include <linux/spi/spi.h> 53#include <linux/spi/spi.h>
53#include <linux/mfd/da903x.h> 54#include <linux/mfd/da903x.h>
@@ -976,7 +977,7 @@ static void __init stargate2_init(void)
976{ 977{
977 /* This is probably a board specific hack as this must be set 978 /* This is probably a board specific hack as this must be set
978 prior to connecting the MFP stuff up. */ 979 prior to connecting the MFP stuff up. */
979 MECR &= ~MECR_NOS; 980 __raw_writel(__raw_readl(MECR) & ~MECR_NOS, MECR);
980 981
981 pxa2xx_mfp_config(ARRAY_AND_SIZE(stargate2_pin_config)); 982 pxa2xx_mfp_config(ARRAY_AND_SIZE(stargate2_pin_config));
982 983
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 38833858cf82..57d61ee9b226 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -46,6 +46,7 @@
46#include <mach/tosa_bt.h> 46#include <mach/tosa_bt.h>
47#include <mach/pxa2xx_spi.h> 47#include <mach/pxa2xx_spi.h>
48#include <mach/audio.h> 48#include <mach/audio.h>
49#include <mach/smemc.h>
49 50
50#include <asm/mach/arch.h> 51#include <asm/mach/arch.h>
51#include <mach/tosa.h> 52#include <mach/tosa.h>
@@ -893,9 +894,11 @@ static void tosa_poweroff(void)
893 894
894static void tosa_restart(char mode, const char *cmd) 895static void tosa_restart(char mode, const char *cmd)
895{ 896{
897 uint32_t msc0 = __raw_readl(MSC0);
898
896 /* Bootloader magic for a reboot */ 899 /* Bootloader magic for a reboot */
897 if((MSC0 & 0xffff0000) == 0x7ff00000) 900 if((msc0 & 0xffff0000) == 0x7ff00000)
898 MSC0 = (MSC0 & 0xffff) | 0x7ee00000; 901 __raw_writel((msc0 & 0xffff) | 0x7ee00000, MSC0);
899 902
900 tosa_poweroff(); 903 tosa_poweroff();
901} 904}
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index ab3b933e3461..43fc9ca14594 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -47,6 +47,7 @@
47#include <mach/mmc.h> 47#include <mach/mmc.h>
48#include <mach/irda.h> 48#include <mach/irda.h>
49#include <mach/ohci.h> 49#include <mach/ohci.h>
50#include <mach/smemc.h>
50#include <plat/i2c.h> 51#include <plat/i2c.h>
51 52
52#include "generic.h" 53#include "generic.h"
@@ -542,7 +543,7 @@ static void __init trizeps4_map_io(void)
542 pxa27x_map_io(); 543 pxa27x_map_io();
543 iotable_init(trizeps4_io_desc, ARRAY_SIZE(trizeps4_io_desc)); 544 iotable_init(trizeps4_io_desc, ARRAY_SIZE(trizeps4_io_desc));
544 545
545 if ((MSC0 & 0x8) && (BOOT_DEF & 0x1)) { 546 if ((__raw_readl(MSC0) & 0x8) && (__raw_readl(BOOT_DEF) & 0x1)) {
546 /* if flash is 16 bit wide its a Trizeps4 WL */ 547 /* if flash is 16 bit wide its a Trizeps4 WL */
547 __machine_arch_type = MACH_TYPE_TRIZEPS4WL; 548 __machine_arch_type = MACH_TYPE_TRIZEPS4WL;
548 trizeps4_flash_data[0].width = 2; 549 trizeps4_flash_data[0].width = 2;
diff --git a/arch/arm/mach-pxa/xcep.c b/arch/arm/mach-pxa/xcep.c
index 99744f4d05a1..51c0281c6e0a 100644
--- a/arch/arm/mach-pxa/xcep.c
+++ b/arch/arm/mach-pxa/xcep.c
@@ -31,6 +31,7 @@
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/pxa2xx-regs.h> 32#include <mach/pxa2xx-regs.h>
33#include <mach/mfp-pxa25x.h> 33#include <mach/mfp-pxa25x.h>
34#include <mach/smemc.h>
34 35
35#include "generic.h" 36#include "generic.h"
36 37
@@ -172,9 +173,9 @@ static void __init xcep_init(void)
172 173
173 /* See Intel XScale Developer's Guide for details */ 174 /* See Intel XScale Developer's Guide for details */
174 /* Set RDF and RDN to appropriate values (chip select 3 (smc91x)) */ 175 /* Set RDF and RDN to appropriate values (chip select 3 (smc91x)) */
175 MSC1 = (MSC1 & 0xffff) | 0xD5540000; 176 __raw_writel((__raw_readl(MSC1) & 0xffff) | 0xD5540000, MSC1);
176 /* Set RDF and RDN to appropriate values (chip select 5 (fpga)) */ 177 /* Set RDF and RDN to appropriate values (chip select 5 (fpga)) */
177 MSC2 = (MSC2 & 0xffff) | 0x72A00000; 178 __raw_writel((__raw_readl(MSC2) & 0xffff) | 0x72A00000, MSC2);
178 179
179 platform_add_devices(ARRAY_AND_SIZE(devices)); 180 platform_add_devices(ARRAY_AND_SIZE(devices));
180 pxa_set_i2c_info(&xcep_i2c_platform_data); 181 pxa_set_i2c_info(&xcep_i2c_platform_data);
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index 0909df2151e8..c87f2b35ee05 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -47,6 +47,7 @@
47#include <mach/audio.h> 47#include <mach/audio.h>
48#include <mach/arcom-pcmcia.h> 48#include <mach/arcom-pcmcia.h>
49#include <mach/zeus.h> 49#include <mach/zeus.h>
50#include <mach/smemc.h>
50 51
51#include "generic.h" 52#include "generic.h"
52 53
@@ -823,13 +824,16 @@ static mfp_cfg_t zeus_pin_config[] __initdata = {
823static void __init zeus_init(void) 824static void __init zeus_init(void)
824{ 825{
825 u16 dm9000_msc = DM9K_MSC_VALUE; 826 u16 dm9000_msc = DM9K_MSC_VALUE;
827 u32 msc0, msc1;
826 828
827 system_rev = __raw_readw(ZEUS_CPLD_VERSION); 829 system_rev = __raw_readw(ZEUS_CPLD_VERSION);
828 pr_info("Zeus CPLD V%dI%d\n", (system_rev & 0xf0) >> 4, (system_rev & 0x0f)); 830 pr_info("Zeus CPLD V%dI%d\n", (system_rev & 0xf0) >> 4, (system_rev & 0x0f));
829 831
830 /* Fix timings for dm9000s (CS1/CS2)*/ 832 /* Fix timings for dm9000s (CS1/CS2)*/
831 MSC0 = (MSC0 & 0xffff) | (dm9000_msc << 16); 833 msc0 = __raw_readl(MSC0) & 0x0000ffff | (dm9000_msc << 16);
832 MSC1 = (MSC1 & 0xffff0000) | dm9000_msc; 834 msc1 = __raw_readl(MSC1) & 0xffff0000 | dm9000_msc;
835 __raw_writel(msc0, MSC0);
836 __raw_writel(msc1, MSC1);
833 837
834 pm_power_off = zeus_power_off; 838 pm_power_off = zeus_power_off;
835 zeus_setup_apm(); 839 zeus_setup_apm();