Commit 1e582fc7 authored by Ben Dooks's avatar Ben Dooks Committed by Russell King

[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: default avatarBen Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 3fc3a25b
...@@ -22,6 +22,7 @@ obj-$(CONFIG_CPU_S3C2400) += s3c2400-gpio.o ...@@ -22,6 +22,7 @@ obj-$(CONFIG_CPU_S3C2400) += s3c2400-gpio.o
obj-$(CONFIG_CPU_S3C2410) += s3c2410.o obj-$(CONFIG_CPU_S3C2410) += s3c2410.o
obj-$(CONFIG_CPU_S3C2410) += s3c2410-gpio.o obj-$(CONFIG_CPU_S3C2410) += s3c2410-gpio.o
obj-$(CONFIG_CPU_S3C2410) += s3c2410-irq.o
obj-$(CONFIG_CPU_S3C2410_DMA) += s3c2410-dma.o obj-$(CONFIG_CPU_S3C2410_DMA) += s3c2410-dma.o
# Power Management support # Power Management support
......
...@@ -586,6 +586,59 @@ s3c_irq_demux_extint(unsigned int irq, ...@@ -586,6 +586,59 @@ s3c_irq_demux_extint(unsigned int irq,
} }
} }
#ifdef CONFIG_PM
static struct sleep_save irq_save[] = {
SAVE_ITEM(S3C2410_INTMSK),
SAVE_ITEM(S3C2410_INTSUBMSK),
};
/* the extint values move between the s3c2410/s3c2440 and the s3c2412
* so we use an array to hold them, and to calculate the address of
* the register at run-time
*/
static unsigned long save_extint[3];
static unsigned long save_eintflt[4];
static unsigned long save_eintmask;
int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(save_extint); i++)
save_extint[i] = __raw_readl(S3C24XX_EXTINT0 + (i*4));
for (i = 0; i < ARRAY_SIZE(save_eintflt); i++)
save_eintflt[i] = __raw_readl(S3C24XX_EINFLT0 + (i*4));
s3c2410_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
save_eintmask = __raw_readl(S3C24XX_EINTMASK);
return 0;
}
int s3c24xx_irq_resume(struct sys_device *dev)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(save_extint); i++)
__raw_writel(save_extint[i], S3C24XX_EXTINT0 + (i*4));
for (i = 0; i < ARRAY_SIZE(save_eintflt); i++)
__raw_writel(save_eintflt[i], S3C24XX_EINFLT0 + (i*4));
s3c2410_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
__raw_writel(save_eintmask, S3C24XX_EINTMASK);
return 0;
}
#else
#define s3c24xx_irq_suspend NULL
#define s3c24xx_irq_resume NULL
#endif
/* s3c24xx_init_irq /* s3c24xx_init_irq
* *
* Initialise S3C2410 IRQ system * Initialise S3C2410 IRQ system
......
/* linux/arch/arm/mach-s3c2410/pm.c /* linux/arch/arm/mach-s3c2410/pm.c
* *
* Copyright (c) 2004 Simtec Electronics * Copyright (c) 2004,2006 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk> * Ben Dooks <ben@simtec.co.uk>
* *
* S3C2410 Power Manager (Suspend-To-RAM) support * S3C24XX Power Manager (Suspend-To-RAM) support
* *
* See Documentation/arm/Samsung-S3C24XX/Suspend.txt for more information * See Documentation/arm/Samsung-S3C24XX/Suspend.txt for more information
* *
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
* Parts based on arch/arm/mach-pxa/pm.c * Parts based on arch/arm/mach-pxa/pm.c
* *
* Thanks to Dimitry Andric for debugging * Thanks to Dimitry Andric for debugging
*
* Modifications:
* 10-Mar-2005 LCVR Changed S3C2410_VA_UART to S3C24XX_VA_UART
*/ */
#include <linux/init.h> #include <linux/init.h>
...@@ -92,19 +89,6 @@ static struct sleep_save core_save[] = { ...@@ -92,19 +89,6 @@ static struct sleep_save core_save[] = {
SAVE_ITEM(S3C2410_REFRESH), SAVE_ITEM(S3C2410_REFRESH),
}; };
/* this lot should be really saved by the IRQ code */
static struct sleep_save irq_save[] = {
SAVE_ITEM(S3C2410_EXTINT0),
SAVE_ITEM(S3C2410_EXTINT1),
SAVE_ITEM(S3C2410_EXTINT2),
SAVE_ITEM(S3C2410_EINFLT0),
SAVE_ITEM(S3C2410_EINFLT1),
SAVE_ITEM(S3C2410_EINFLT2),
SAVE_ITEM(S3C2410_EINFLT3),
SAVE_ITEM(S3C2410_EINTMASK),
SAVE_ITEM(S3C2410_INTMSK)
};
static struct sleep_save gpio_save[] = { static struct sleep_save gpio_save[] = {
SAVE_ITEM(S3C2410_GPACON), SAVE_ITEM(S3C2410_GPACON),
SAVE_ITEM(S3C2410_GPADAT), SAVE_ITEM(S3C2410_GPADAT),
...@@ -564,7 +548,6 @@ static int s3c2410_pm_enter(suspend_state_t state) ...@@ -564,7 +548,6 @@ static int s3c2410_pm_enter(suspend_state_t state)
/* save all necessary core registers not covered by the drivers */ /* save all necessary core registers not covered by the drivers */
s3c2410_pm_do_save(gpio_save, ARRAY_SIZE(gpio_save)); s3c2410_pm_do_save(gpio_save, ARRAY_SIZE(gpio_save));
s3c2410_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
s3c2410_pm_do_save(core_save, ARRAY_SIZE(core_save)); s3c2410_pm_do_save(core_save, ARRAY_SIZE(core_save));
s3c2410_pm_do_save(uart_save, ARRAY_SIZE(uart_save)); s3c2410_pm_do_save(uart_save, ARRAY_SIZE(uart_save));
...@@ -608,7 +591,6 @@ static int s3c2410_pm_enter(suspend_state_t state) ...@@ -608,7 +591,6 @@ static int s3c2410_pm_enter(suspend_state_t state)
s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save)); s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
s3c2410_pm_do_restore(gpio_save, ARRAY_SIZE(gpio_save)); s3c2410_pm_do_restore(gpio_save, ARRAY_SIZE(gpio_save));
s3c2410_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
s3c2410_pm_do_restore(uart_save, ARRAY_SIZE(uart_save)); s3c2410_pm_do_restore(uart_save, ARRAY_SIZE(uart_save));
s3c2410_pm_debug_init(); s3c2410_pm_debug_init();
......
...@@ -57,3 +57,11 @@ struct sleep_save { ...@@ -57,3 +57,11 @@ struct sleep_save {
extern void s3c2410_pm_do_save(struct sleep_save *ptr, int count); extern void s3c2410_pm_do_save(struct sleep_save *ptr, int count);
extern void s3c2410_pm_do_restore(struct sleep_save *ptr, int count); extern void s3c2410_pm_do_restore(struct sleep_save *ptr, int count);
#ifdef CONFIG_PM
extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
extern int s3c24xx_irq_resume(struct sys_device *dev);
#else
#define s3c24xx_irq_suspend NULL
#define s3c24xx_irq_resume NULL
#endif
/* linux/arch/arm/mach-s3c2410/s3c2410-irq.c
*
* Copyright (c) 2006 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/ptrace.h>
#include <linux/sysdev.h>
#include "cpu.h"
#include "pm.h"
static int s3c2410_irq_add(struct sys_device *sysdev)
{
return 0;
}
static struct sysdev_driver s3c2410_irq_driver = {
.add = s3c2410_irq_add,
.suspend = s3c24xx_irq_suspend,
.resume = s3c24xx_irq_resume,
};
static int s3c2410_irq_init(void)
{
return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_irq_driver);
}
arch_initcall(s3c2410_irq_init);
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "cpu.h" #include "cpu.h"
#include "irq.h" #include "irq.h"
#include "pm.h"
/* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by /* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by
* having them turn up in both the INT* and the EINT* registers. Whilst * 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,6 +121,8 @@ static int s3c2412_irq_add(struct sys_device *sysdev)
static struct sysdev_driver s3c2412_irq_driver = { static struct sysdev_driver s3c2412_irq_driver = {
.add = s3c2412_irq_add, .add = s3c2412_irq_add,
.suspend = s3c24xx_irq_suspend,
.resume = s3c24xx_irq_resume,
}; };
static int s3c2412_irq_init(void) static int s3c2412_irq_init(void)
......
...@@ -121,6 +121,8 @@ static int s3c244x_irq_add(struct sys_device *sysdev) ...@@ -121,6 +121,8 @@ static int s3c244x_irq_add(struct sys_device *sysdev)
static struct sysdev_driver s3c2440_irq_driver = { static struct sysdev_driver s3c2440_irq_driver = {
.add = s3c244x_irq_add, .add = s3c244x_irq_add,
.suspend = s3c24xx_irq_suspend,
.resume = s3c24xx_irq_resume,
}; };
static int s3c2440_irq_init(void) static int s3c2440_irq_init(void)
...@@ -132,8 +134,11 @@ arch_initcall(s3c2440_irq_init); ...@@ -132,8 +134,11 @@ arch_initcall(s3c2440_irq_init);
static struct sysdev_driver s3c2442_irq_driver = { static struct sysdev_driver s3c2442_irq_driver = {
.add = s3c244x_irq_add, .add = s3c244x_irq_add,
.suspend = s3c24xx_irq_suspend,
.resume = s3c24xx_irq_resume,
}; };
static int s3c2442_irq_init(void) static int s3c2442_irq_init(void)
{ {
return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_irq_driver); return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_irq_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment