[ARM] 4597/2: OSIRIS: ensure CPLD0 is preserved after suspend
authorBen Dooks <ben-linux@fluff.org>
Thu, 4 Oct 2007 22:16:42 +0000 (23:16 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 5 Oct 2007 20:21:40 +0000 (21:21 +0100)
Ensure that CPLD is restored to the original state
on resume, and that before going into suspend we
select the NAND bank we booted from for restarting.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-s3c2440/mach-osiris.c

index 0ba7e9060c7bba3ece0df5d9eacbdbeb86d71eac..be5377f128c473d7bb37ff4e8c449b1aa4b13074 100644 (file)
@@ -276,7 +276,17 @@ static unsigned char pm_osiris_ctrl0;
 
 static int osiris_pm_suspend(struct sys_device *sd, pm_message_t state)
 {
+       unsigned int tmp;
+
        pm_osiris_ctrl0 = __raw_readb(OSIRIS_VA_CTRL0);
+       tmp = pm_osiris_ctrl0 & ~OSIRIS_CTRL0_NANDSEL;
+
+       /* ensure correct NAND slot is selected on resume */
+       if ((pm_osiris_ctrl0 & OSIRIS_CTRL0_BOOT_INT) == 0)
+               tmp |= 2;
+
+       __raw_writeb(tmp, OSIRIS_VA_CTRL0);
+
        return 0;
 }
 
@@ -285,6 +295,8 @@ static int osiris_pm_resume(struct sys_device *sd)
        if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8)
                __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1);
 
+       __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0);
+
        return 0;
 }