[MTD] [NAND] S3C2410 correctly set nFCE over resume

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Nov 28 06:59:14 EST 2007


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=03680b1e00d146df718c8a4eac34438566b70c85
Commit:     03680b1e00d146df718c8a4eac34438566b70c85
Parent:     73061e4c2dcfba17c6a0137a1199d3e00d03b14c
Author:     Ben Dooks <ben-linux at fluff.org>
AuthorDate: Mon Nov 19 23:28:07 2007 +0000
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Wed Nov 28 11:57:45 2007 +0000

    [MTD] [NAND] S3C2410 correctly set nFCE over resume
    
    Ensure the nFCE line is de-asserted over suspend and
    then re-initialised when the system resumes. This is
    to ensure that the NAND is kept in lowest power mode
    over suspend (power settings are only specified for
    nFCE inactive) as well as fixing the Simtec Osiris
    which relies on nFCE being inactive.
    
    Signed-off-by: Ben Dooks <ben-linux at fluff.org>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/nand/s3c2410.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 66f76e9..512acfc 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -120,6 +120,8 @@ struct s3c2410_nand_info {
 	int				sel_bit;
 	int				mtd_count;
 
+	unsigned long			save_nfconf;
+
 	enum s3c_cpu_type		cpu_type;
 };
 
@@ -810,6 +812,16 @@ static int s3c24xx_nand_suspend(struct platform_device *dev, pm_message_t pm)
 	struct s3c2410_nand_info *info = platform_get_drvdata(dev);
 
 	if (info) {
+		info->save_nfconf = readl(info->regs + S3C2410_NFCONF);
+
+		/* For the moment, we must ensure nFCE is high during
+		 * the time we are suspended. This really should be
+		 * handled by suspending the MTDs we are using, but
+		 * that is currently not the case. */
+
+		writel(info->save_nfconf | info->sel_bit,
+		       info->regs + S3C2410_NFCONF);
+
 		if (!allow_clk_stop(info))
 			clk_disable(info->clk);
 	}
@@ -820,11 +832,19 @@ static int s3c24xx_nand_suspend(struct platform_device *dev, pm_message_t pm)
 static int s3c24xx_nand_resume(struct platform_device *dev)
 {
 	struct s3c2410_nand_info *info = platform_get_drvdata(dev);
+	unsigned long nfconf;
 
 	if (info) {
 		clk_enable(info->clk);
 		s3c2410_nand_inithw(info, dev);
 
+		/* Restore the state of the nFCE line. */
+
+		nfconf = readl(info->regs + S3C2410_NFCONF);
+		nfconf &= ~info->sel_bit;
+		nfconf |= info->save_nfconf & info->sel_bit;
+		writel(nfconf, info->regs + S3C2410_NFCONF);
+
 		if (allow_clk_stop(info))
 			clk_disable(info->clk);
 	}



More information about the linux-mtd-cvs mailing list