[From nobody Sat Aug 16 21:14:12 2008
Return-Path: Received: from ganesha.gnumonks.org ([unix socket])
	by ganesha (Cyrus v2.1.18-IPv6-Debian-2.1.18-1+sarge2) with LMTP;
	Tue, 20 Nov 2007 00:30:10 +0100
X-Sieve: CMU Sieve 2.2
Return-path: &lt;linux-mtd-bounces+laforge=openmoko.org@lists.infradead.org&gt;
Received: from sita.openmoko.org ([88.198.124.203])
	by ganesha.gnumonks.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32)
	(Exim 4.50) id 1IuG4A-0001gU-0s
	for hwelte@hmw-consulting.de; Tue, 20 Nov 2007 00:30:10 +0100
Received: from bombadil.infradead.org ([18.85.46.34])
	by sita.openmoko.org with esmtp (Exim 4.50) id 1IuG9z-0007GI-H6
	for laforge@openmoko.org; Tue, 20 Nov 2007 00:36:21 +0100
Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org)
	by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux))
	id 1IuG2Q-0006DL-39; Mon, 19 Nov 2007 18:28:22 -0500
Received: from 87-194-8-8.bethere.co.uk ([87.194.8.8] helo=kira.home.fluff.org)
	by bombadil.infradead.org with esmtps (Exim 4.68 #1 (Red Hat Linux))
	id 1IuG2H-0006Bp-RG
	for linux-mtd@lists.infradead.org; Mon, 19 Nov 2007 18:28:20 -0500
Received: from ben by kira.home.fluff.org with local (Exim 4.68)
	(envelope-from &lt;ben@fluff.org.uk&gt;)
	id 1IuG2B-000296-3r; Mon, 19 Nov 2007 23:28:07 +0000
Date: Mon, 19 Nov 2007 23:28:07 +0000
From: Ben Dooks &lt;ben-linux@fluff.org&gt;
To: linux-mtd@lists.infradead.org
Bcc: patch-out@fluff.org
Message-ID: &lt;20071119232807.GA8229@fluff.org.uk&gt;
MIME-Version: 1.0
Content-Disposition: inline
X-Disclaimer: These are my own opinions, so there!
User-Agent: Mutt/1.5.16 (2007-06-11)
X-BeenThere: linux-mtd@lists.infradead.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Linux MTD discussion mailing list &lt;linux-mtd.lists.infradead.org&gt;
List-Unsubscribe: &lt;http://lists.infradead.org/mailman/listinfo/linux-mtd&gt;,
	&lt;mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe&gt;
List-Archive: &lt;http://lists.infradead.org/pipermail/linux-mtd&gt;
List-Post: &lt;mailto:linux-mtd@lists.infradead.org&gt;
List-Help: &lt;mailto:linux-mtd-request@lists.infradead.org?subject=help&gt;
List-Subscribe: &lt;http://lists.infradead.org/mailman/listinfo/linux-mtd&gt;,
	&lt;mailto:linux-mtd-request@lists.infradead.org?subject=subscribe&gt;
Content-Type: text/plain; charset=&quot;us-ascii&quot;
Content-Transfer-Encoding: 7bit
Sender: linux-mtd-bounces@lists.infradead.org
Errors-To: linux-mtd-bounces+laforge=openmoko.org+laforge=openmoko.org@lists.infradead.org
Subject: [PATCH] NAND: S3C2410 correctly set nFCE over resume
X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on sita.openmoko.org
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham 
	version=3.0.3
X-SA-Exim-Version: 4.2 (built Thu, 03 Mar 2005 10:44:12 +0100)
X-Spam-Score: 0.1 (/)
X-Spam-Report: SpamASsassin versoin 3.0.3 on ganesha.gnumonks.org summary:
	Content analysis details:   (0.1 points, 5.0 required)
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	0.1 FORGED_RCVD_HELO       Received: contains a forged HELO

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 &lt;ben-linux@fluff.org&gt;

diff -urpN -X linux-2.6.24-rc3/Documentation/dontdiff linux-2.6.24-rc3/drivers/mtd/nand/s3c2410.c linux-2.6.24-rc3-mtd1/drivers/mtd/nand/s3c2410.c
--- linux-2.6.24-rc3/drivers/mtd/nand/s3c2410.c	2007-11-19 16:12:05.000000000 +0000
+++ linux-2.6.24-rc3-mtd1/drivers/mtd/nand/s3c2410.c	2007-11-19 23:25:01.000000000 +0000
@@ -119,6 +119,8 @@ struct s3c2410_nand_info {
 	void __iomem			*sel_reg;
 	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 p
 	struct s3c2410_nand_info *info = platform_get_drvdata(dev);
 
 	if (info) {
+		info-&gt;save_nfconf = readl(info-&gt;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-&gt;save_nfconf | info-&gt;sel_bit,
+		       info-&gt;regs + S3C2410_NFCONF);
+
 		if (!allow_clk_stop(info))
 			clk_disable(info-&gt;clk);
 	}
@@ -820,10 +832,18 @@ static int s3c24xx_nand_suspend(struct p
 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-&gt;clk);
 		s3c2410_nand_inithw(info, dev);
+		
+		/* Restore the state of the nFCE line. */
+
+		nfconf = readl(info-&gt;regs + S3C2410_NFCONF);
+		nfconf &amp;= ~info-&gt;sel_bit;
+		nfconf |= info-&gt;save_nfconf &amp; info-&gt;sel_bit;
+		writel(nfconf, info-&gt;regs + S3C2410_NFCONF);
 
 		if (allow_clk_stop(info))
 			clk_disable(info-&gt;clk);

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
]