aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2006-09-15 19:01:39 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-09-25 05:25:20 -0400
commit1e582fc73781da47eddd90c75bf97f191e4f450f (patch)
tree7cbfc0c3eb2b206dd3a39dbe6e00675b4c331a8b /arch
parent3fc3a25ba47735296984ddbb2e6ba504017ec3e1 (diff)
[ARM] 3801/1: S3C24XX: Move IRQ PM out of pm.c
Seperate the IRQ power management code out of the pm.c file, and add it to the relevant system class devices. Also make the suspend and resume code take notice of the fact these registers can be moved by compile time code. Add fix from Ilya Yanok to also save the INTSUBMSK over sleep. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-s3c2410/Makefile1
-rw-r--r--arch/arm/mach-s3c2410/irq.c53
-rw-r--r--arch/arm/mach-s3c2410/pm.c22
-rw-r--r--arch/arm/mach-s3c2410/pm.h8
-rw-r--r--arch/arm/mach-s3c2410/s3c2410-irq.c48
-rw-r--r--arch/arm/mach-s3c2410/s3c2412-irq.c3
-rw-r--r--arch/arm/mach-s3c2410/s3c2440-irq.c2
-rw-r--r--arch/arm/mach-s3c2410/s3c244x-irq.c9
8 files changed, 123 insertions, 23 deletions
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index a3509052f435..23f0909915db 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_CPU_S3C2400) += s3c2400-gpio.o
22 22
23obj-$(CONFIG_CPU_S3C2410) += s3c2410.o 23obj-$(CONFIG_CPU_S3C2410) += s3c2410.o
24obj-$(CONFIG_CPU_S3C2410) += s3c2410-gpio.o 24obj-$(CONFIG_CPU_S3C2410) += s3c2410-gpio.o
25obj-$(CONFIG_CPU_S3C2410) += s3c2410-irq.o
25obj-$(CONFIG_CPU_S3C2410_DMA) += s3c2410-dma.o 26obj-$(CONFIG_CPU_S3C2410_DMA) += s3c2410-dma.o
26 27
27# Power Management support 28# Power Management support
diff --git a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c
index cd6139b35999..9c7463bf8f86 100644
--- a/arch/arm/mach-s3c2410/irq.c
+++ b/arch/arm/mach-s3c2410/irq.c
@@ -586,6 +586,59 @@ s3c_irq_demux_extint(unsigned int irq,
586 } 586 }
587} 587}
588 588
589#ifdef CONFIG_PM
590
591static struct sleep_save irq_save[] = {
592 SAVE_ITEM(S3C2410_INTMSK),
593 SAVE_ITEM(S3C2410_INTSUBMSK),
594};
595
596/* the extint values move between the s3c2410/s3c2440 and the s3c2412
597 * so we use an array to hold them, and to calculate the address of
598 * the register at run-time
599*/
600
601static unsigned long save_extint[3];
602static unsigned long save_eintflt[4];
603static unsigned long save_eintmask;
604
605int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state)
606{
607 unsigned int i;
608
609 for (i = 0; i < ARRAY_SIZE(save_extint); i++)
610 save_extint[i] = __raw_readl(S3C24XX_EXTINT0 + (i*4));
611
612 for (i = 0; i < ARRAY_SIZE(save_eintflt); i++)
613 save_eintflt[i] = __raw_readl(S3C24XX_EINFLT0 + (i*4));
614
615 s3c2410_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
616 save_eintmask = __raw_readl(S3C24XX_EINTMASK);
617
618 return 0;
619}
620
621int s3c24xx_irq_resume(struct sys_device *dev)
622{
623 unsigned int i;
624
625 for (i = 0; i < ARRAY_SIZE(save_extint); i++)
626 __raw_writel(save_extint[i], S3C24XX_EXTINT0 + (i*4));
627
628 for (i = 0; i < ARRAY_SIZE(save_eintflt); i++)
629 __raw_writel(save_eintflt[i], S3C24XX_EINFLT0 + (i*4));
630
631 s3c2410_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
632 __raw_writel(save_eintmask, S3C24XX_EINTMASK);
633
634 return 0;
635}
636
637#else
638#define s3c24xx_irq_suspend NULL
639#define s3c24xx_irq_resume NULL
640#endif
641
589/* s3c24xx_init_irq 642/* s3c24xx_init_irq
590 * 643 *
591 * Initialise S3C2410 IRQ system 644 * Initialise S3C2410 IRQ system
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c
index a589fe76d915..164a5b5847d7 100644
--- a/arch/arm/mach-s3c2410/pm.c
+++ b/arch/arm/mach-s3c2410/pm.c
@@ -1,9 +1,9 @@
1/* linux/arch/arm/mach-s3c2410/pm.c 1/* linux/arch/arm/mach-s3c2410/pm.c
2 * 2 *
3 * Copyright (c) 2004 Simtec Electronics 3 * Copyright (c) 2004,2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * S3C2410 Power Manager (Suspend-To-RAM) support 6 * S3C24XX Power Manager (Suspend-To-RAM) support
7 * 7 *
8 * See Documentation/arm/Samsung-S3C24XX/Suspend.txt for more information 8 * See Documentation/arm/Samsung-S3C24XX/Suspend.txt for more information
9 * 9 *
@@ -24,9 +24,6 @@
24 * Parts based on arch/arm/mach-pxa/pm.c 24 * Parts based on arch/arm/mach-pxa/pm.c
25 * 25 *
26 * Thanks to Dimitry Andric for debugging 26 * Thanks to Dimitry Andric for debugging
27 *
28 * Modifications:
29 * 10-Mar-2005 LCVR Changed S3C2410_VA_UART to S3C24XX_VA_UART
30*/ 27*/
31 28
32#include <linux/init.h> 29#include <linux/init.h>
@@ -92,19 +89,6 @@ static struct sleep_save core_save[] = {
92 SAVE_ITEM(S3C2410_REFRESH), 89 SAVE_ITEM(S3C2410_REFRESH),
93}; 90};
94 91
95/* this lot should be really saved by the IRQ code */
96static struct sleep_save irq_save[] = {
97 SAVE_ITEM(S3C2410_EXTINT0),
98 SAVE_ITEM(S3C2410_EXTINT1),
99 SAVE_ITEM(S3C2410_EXTINT2),
100 SAVE_ITEM(S3C2410_EINFLT0),
101 SAVE_ITEM(S3C2410_EINFLT1),
102 SAVE_ITEM(S3C2410_EINFLT2),
103 SAVE_ITEM(S3C2410_EINFLT3),
104 SAVE_ITEM(S3C2410_EINTMASK),
105 SAVE_ITEM(S3C2410_INTMSK)
106};
107
108static struct sleep_save gpio_save[] = { 92static struct sleep_save gpio_save[] = {
109 SAVE_ITEM(S3C2410_GPACON), 93 SAVE_ITEM(S3C2410_GPACON),
110 SAVE_ITEM(S3C2410_GPADAT), 94 SAVE_ITEM(S3C2410_GPADAT),
@@ -564,7 +548,6 @@ static int s3c2410_pm_enter(suspend_state_t state)
564 /* save all necessary core registers not covered by the drivers */ 548 /* save all necessary core registers not covered by the drivers */
565 549
566 s3c2410_pm_do_save(gpio_save, ARRAY_SIZE(gpio_save)); 550 s3c2410_pm_do_save(gpio_save, ARRAY_SIZE(gpio_save));
567 s3c2410_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
568 s3c2410_pm_do_save(core_save, ARRAY_SIZE(core_save)); 551 s3c2410_pm_do_save(core_save, ARRAY_SIZE(core_save));
569 s3c2410_pm_do_save(uart_save, ARRAY_SIZE(uart_save)); 552 s3c2410_pm_do_save(uart_save, ARRAY_SIZE(uart_save));
570 553
@@ -608,7 +591,6 @@ static int s3c2410_pm_enter(suspend_state_t state)
608 591
609 s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save)); 592 s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
610 s3c2410_pm_do_restore(gpio_save, ARRAY_SIZE(gpio_save)); 593 s3c2410_pm_do_restore(gpio_save, ARRAY_SIZE(gpio_save));
611 s3c2410_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
612 s3c2410_pm_do_restore(uart_save, ARRAY_SIZE(uart_save)); 594 s3c2410_pm_do_restore(uart_save, ARRAY_SIZE(uart_save));
613 595
614 s3c2410_pm_debug_init(); 596 s3c2410_pm_debug_init();
diff --git a/arch/arm/mach-s3c2410/pm.h b/arch/arm/mach-s3c2410/pm.h
index 7a5e714c7386..b04e4ca0bb4d 100644
--- a/arch/arm/mach-s3c2410/pm.h
+++ b/arch/arm/mach-s3c2410/pm.h
@@ -57,3 +57,11 @@ struct sleep_save {
57 57
58extern void s3c2410_pm_do_save(struct sleep_save *ptr, int count); 58extern void s3c2410_pm_do_save(struct sleep_save *ptr, int count);
59extern void s3c2410_pm_do_restore(struct sleep_save *ptr, int count); 59extern void s3c2410_pm_do_restore(struct sleep_save *ptr, int count);
60
61#ifdef CONFIG_PM
62extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
63extern int s3c24xx_irq_resume(struct sys_device *dev);
64#else
65#define s3c24xx_irq_suspend NULL
66#define s3c24xx_irq_resume NULL
67#endif
diff --git a/arch/arm/mach-s3c2410/s3c2410-irq.c b/arch/arm/mach-s3c2410/s3c2410-irq.c
new file mode 100644
index 000000000000..c796c9c76e78
--- /dev/null
+++ b/arch/arm/mach-s3c2410/s3c2410-irq.c
@@ -0,0 +1,48 @@
1/* linux/arch/arm/mach-s3c2410/s3c2410-irq.c
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20*/
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/interrupt.h>
25#include <linux/ioport.h>
26#include <linux/ptrace.h>
27#include <linux/sysdev.h>
28
29#include "cpu.h"
30#include "pm.h"
31
32static int s3c2410_irq_add(struct sys_device *sysdev)
33{
34 return 0;
35}
36
37static struct sysdev_driver s3c2410_irq_driver = {
38 .add = s3c2410_irq_add,
39 .suspend = s3c24xx_irq_suspend,
40 .resume = s3c24xx_irq_resume,
41};
42
43static int s3c2410_irq_init(void)
44{
45 return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_irq_driver);
46}
47
48arch_initcall(s3c2410_irq_init);
diff --git a/arch/arm/mach-s3c2410/s3c2412-irq.c b/arch/arm/mach-s3c2410/s3c2412-irq.c
index c80ec93dfea9..7f741547658f 100644
--- a/arch/arm/mach-s3c2410/s3c2412-irq.c
+++ b/arch/arm/mach-s3c2410/s3c2412-irq.c
@@ -37,6 +37,7 @@
37 37
38#include "cpu.h" 38#include "cpu.h"
39#include "irq.h" 39#include "irq.h"
40#include "pm.h"
40 41
41/* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by 42/* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by
42 * having them turn up in both the INT* and the EINT* registers. Whilst 43 * having them turn up in both the INT* and the EINT* registers. Whilst
@@ -120,6 +121,8 @@ static int s3c2412_irq_add(struct sys_device *sysdev)
120 121
121static struct sysdev_driver s3c2412_irq_driver = { 122static struct sysdev_driver s3c2412_irq_driver = {
122 .add = s3c2412_irq_add, 123 .add = s3c2412_irq_add,
124 .suspend = s3c24xx_irq_suspend,
125 .resume = s3c24xx_irq_resume,
123}; 126};
124 127
125static int s3c2412_irq_init(void) 128static int s3c2412_irq_init(void)
diff --git a/arch/arm/mach-s3c2410/s3c2440-irq.c b/arch/arm/mach-s3c2410/s3c2440-irq.c
index 1667ba1fa43d..fc08febe2e54 100644
--- a/arch/arm/mach-s3c2410/s3c2440-irq.c
+++ b/arch/arm/mach-s3c2410/s3c2440-irq.c
@@ -119,7 +119,7 @@ static int s3c2440_irq_add(struct sys_device *sysdev)
119} 119}
120 120
121static struct sysdev_driver s3c2440_irq_driver = { 121static struct sysdev_driver s3c2440_irq_driver = {
122 .add = s3c2440_irq_add, 122 .add = s3c2440_irq_add,
123}; 123};
124 124
125static int s3c2440_irq_init(void) 125static int s3c2440_irq_init(void)
diff --git a/arch/arm/mach-s3c2410/s3c244x-irq.c b/arch/arm/mach-s3c2410/s3c244x-irq.c
index 44c5affa9b89..0d13546c3500 100644
--- a/arch/arm/mach-s3c2410/s3c244x-irq.c
+++ b/arch/arm/mach-s3c2410/s3c244x-irq.c
@@ -120,7 +120,9 @@ static int s3c244x_irq_add(struct sys_device *sysdev)
120} 120}
121 121
122static struct sysdev_driver s3c2440_irq_driver = { 122static struct sysdev_driver s3c2440_irq_driver = {
123 .add = s3c244x_irq_add, 123 .add = s3c244x_irq_add,
124 .suspend = s3c24xx_irq_suspend,
125 .resume = s3c24xx_irq_resume,
124}; 126};
125 127
126static int s3c2440_irq_init(void) 128static int s3c2440_irq_init(void)
@@ -131,9 +133,12 @@ static int s3c2440_irq_init(void)
131arch_initcall(s3c2440_irq_init); 133arch_initcall(s3c2440_irq_init);
132 134
133static struct sysdev_driver s3c2442_irq_driver = { 135static struct sysdev_driver s3c2442_irq_driver = {
134 .add = s3c244x_irq_add, 136 .add = s3c244x_irq_add,
137 .suspend = s3c24xx_irq_suspend,
138 .resume = s3c24xx_irq_resume,
135}; 139};
136 140
141
137static int s3c2442_irq_init(void) 142static int s3c2442_irq_init(void)
138{ 143{
139 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_irq_driver); 144 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_irq_driver);