diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-04 18:29:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-04 18:29:53 -0500 |
commit | 9ef9dc69d4167276c04590d67ee55de8380bc1ad (patch) | |
tree | f0afd03cd9184eda2fe14c41f09daec79a62682e /arch/arm/mach-pxa/smemc.c | |
parent | 2c8296f8cf0ec40867965dddef3dfe92f73b38f4 (diff) | |
parent | 0d899e1b0000ddf78a75d7dcf9a9029d6f7f8091 (diff) |
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (44 commits)
[ARM] 4822/1: RealView: Change the REALVIEW_MPCORE configuration option
[ARM] 4821/1: RealView: Remove the platform dependencies from localtimer.c
[ARM] 4820/1: RealView: Select the timer IRQ at run-time
[ARM] 4819/1: RealView: Fix entry-macro.S to work with multiple platforms
[ARM] 4818/1: RealView: Add core-tile detection
[ARM] 4817/1: RealView: Move the AMBA resource definitions to realview_eb.c
[ARM] 4816/1: RealView: Move the platform-specific definitions into board-eb.h
[ARM] 4815/1: RealView: Add clockevents suport for the local timers
[ARM] 4814/1: RealView: Add broadcasting clockevents support for ARM11MPCore
[ARM] 4813/1: Add SMP helper functions for clockevents support
[ARM] 4812/1: RealView: clockevents support for the RealView platforms
[ARM] 4811/1: RealView: clocksource support for the RealView platforms
[ARM] 4736/1: Export atags to userspace and allow kexec to use customised atags
[ARM] 4798/1: pcm027: fix missing header file
[ARM] 4803/1: pxa: fix building issue of poodle.c caused by patch 4737/1
[ARM] 4801/1: pxa: fix building issues of missing pxa2xx-regs.h
[ARM] pxa: introduce sysdev for pxa3xx static memory controller
[ARM] pxa: add preliminary suspend/resume code for pxa3xx
[ARM] pxa: introduce sysdev for GPIO register saving/restoring
[ARM] pxa: introduce sysdev for IRQ register saving/restoring
...
Diffstat (limited to 'arch/arm/mach-pxa/smemc.c')
-rw-r--r-- | arch/arm/mach-pxa/smemc.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/smemc.c b/arch/arm/mach-pxa/smemc.c new file mode 100644 index 000000000000..ad346addc028 --- /dev/null +++ b/arch/arm/mach-pxa/smemc.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * Static Memory Controller | ||
3 | */ | ||
4 | |||
5 | #include <linux/module.h> | ||
6 | #include <linux/kernel.h> | ||
7 | #include <linux/init.h> | ||
8 | #include <linux/io.h> | ||
9 | #include <linux/sysdev.h> | ||
10 | |||
11 | #define SMEMC_PHYS_BASE (0x4A000000) | ||
12 | #define SMEMC_PHYS_SIZE (0x90) | ||
13 | |||
14 | #define MSC0 (0x08) /* Static Memory Controller Register 0 */ | ||
15 | #define MSC1 (0x0C) /* Static Memory Controller Register 1 */ | ||
16 | #define SXCNFG (0x1C) /* Synchronous Static Memory Control Register */ | ||
17 | #define MEMCLKCFG (0x68) /* Clock Configuration */ | ||
18 | #define CSADRCFG0 (0x80) /* Address Configuration Register for CS0 */ | ||
19 | #define CSADRCFG1 (0x84) /* Address Configuration Register for CS1 */ | ||
20 | #define CSADRCFG2 (0x88) /* Address Configuration Register for CS2 */ | ||
21 | #define CSADRCFG3 (0x8C) /* Address Configuration Register for CS3 */ | ||
22 | |||
23 | #ifdef CONFIG_PM | ||
24 | static void __iomem *smemc_mmio_base; | ||
25 | |||
26 | static unsigned long msc[2]; | ||
27 | static unsigned long sxcnfg, memclkcfg; | ||
28 | static unsigned long csadrcfg[4]; | ||
29 | |||
30 | static int pxa3xx_smemc_suspend(struct sys_device *dev, pm_message_t state) | ||
31 | { | ||
32 | msc[0] = __raw_readl(smemc_mmio_base + MSC0); | ||
33 | msc[1] = __raw_readl(smemc_mmio_base + MSC1); | ||
34 | sxcnfg = __raw_readl(smemc_mmio_base + SXCNFG); | ||
35 | memclkcfg = __raw_readl(smemc_mmio_base + MEMCLKCFG); | ||
36 | csadrcfg[0] = __raw_readl(smemc_mmio_base + CSADRCFG0); | ||
37 | csadrcfg[1] = __raw_readl(smemc_mmio_base + CSADRCFG1); | ||
38 | csadrcfg[2] = __raw_readl(smemc_mmio_base + CSADRCFG2); | ||
39 | csadrcfg[3] = __raw_readl(smemc_mmio_base + CSADRCFG3); | ||
40 | |||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | static int pxa3xx_smemc_resume(struct sys_device *dev) | ||
45 | { | ||
46 | __raw_writel(msc[0], smemc_mmio_base + MSC0); | ||
47 | __raw_writel(msc[1], smemc_mmio_base + MSC1); | ||
48 | __raw_writel(sxcnfg, smemc_mmio_base + SXCNFG); | ||
49 | __raw_writel(memclkcfg, smemc_mmio_base + MEMCLKCFG); | ||
50 | __raw_writel(csadrcfg[0], smemc_mmio_base + CSADRCFG0); | ||
51 | __raw_writel(csadrcfg[1], smemc_mmio_base + CSADRCFG1); | ||
52 | __raw_writel(csadrcfg[2], smemc_mmio_base + CSADRCFG2); | ||
53 | __raw_writel(csadrcfg[3], smemc_mmio_base + CSADRCFG3); | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static struct sysdev_class smemc_sysclass = { | ||
59 | .name = "smemc", | ||
60 | .suspend = pxa3xx_smemc_suspend, | ||
61 | .resume = pxa3xx_smemc_resume, | ||
62 | }; | ||
63 | |||
64 | static struct sys_device smemc_sysdev = { | ||
65 | .id = 0, | ||
66 | .cls = &smemc_sysclass, | ||
67 | }; | ||
68 | |||
69 | static int __init smemc_init(void) | ||
70 | { | ||
71 | int ret = 0; | ||
72 | |||
73 | if (cpu_is_pxa3xx()) { | ||
74 | smemc_mmio_base = ioremap(SMEMC_PHYS_BASE, SMEMC_PHYS_SIZE); | ||
75 | if (smemc_mmio_base == NULL) | ||
76 | return -ENODEV; | ||
77 | |||
78 | ret = sysdev_class_register(&smemc_sysclass); | ||
79 | if (ret) | ||
80 | return ret; | ||
81 | |||
82 | ret = sysdev_register(&smemc_sysdev); | ||
83 | } | ||
84 | |||
85 | return ret; | ||
86 | } | ||
87 | subsys_initcall(smemc_init); | ||
88 | #endif | ||