From patchwork Tue Dec 8 09:56:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juergen Borleis X-Patchwork-Id: 40606 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3F760B6F1C for ; Tue, 8 Dec 2009 20:58:42 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NHwoP-0007rv-Av; Tue, 08 Dec 2009 09:56:53 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1NHwoI-0007pL-09 for linux-mtd@lists.infradead.org; Tue, 08 Dec 2009 09:56:50 +0000 Received: from themisto.ext.pengutronix.de ([92.198.50.58] helo=jupiter.intranet.kreuzholzen.de) by metis.ext.pengutronix.de with esmtp (Exim 4.69) (envelope-from ) id 1NHwoD-0007mh-Va; Tue, 08 Dec 2009 10:56:44 +0100 From: Juergen Beisert Organization: Pengutronix - Linux Solutions for Science and Industry To: linux-mtd@lists.infradead.org Date: Tue, 8 Dec 2009 10:56:40 +0100 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200912081056.40210.jbe@pengutronix.de> X-SA-Exim-Connect-IP: 92.198.50.58 X-SA-Exim-Mail-From: jbe@pengutronix.de X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on metis.extern.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-16.7 required=4.5 tests=AWL, BAYES_00 shortcircuit=no autolearn=ham version=3.2.5 Subject: [PATCH] [NAND] S3C2410: Fix NFC clock enable/disable imbalance X-SA-Exim-Version: 4.2.1 (built Wed, 25 Jun 2008 17:14:11 +0000) X-SA-Exim-Scanned: Yes (on metis.ext.pengutronix.de) X-PTX-Original-Recipient: linux-mtd@lists.infradead.org X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20091208_045646_257180_5E692AA9 X-CRM114-Status: GOOD ( 19.00 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- _SUMMARY_ Cc: linux-arm-kernel@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When unmounting an mtd filesystem the s3c2410_nand_select_chip() function gets called again with "chip == -1". In this case the current code disables the NFC clock at least a second time, so it does not work anymore. Clock disabling should only happen if it was really enabled. Signed-off-by: Juergen Beisert --- drivers/mtd/nand/s3c2410.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) Index: linux-2.6.32/drivers/mtd/nand/s3c2410.c =================================================================== --- linux-2.6.32.orig/drivers/mtd/nand/s3c2410.c +++ linux-2.6.32/drivers/mtd/nand/s3c2410.c @@ -329,12 +329,16 @@ static void s3c2410_nand_select_chip(str struct s3c2410_nand_mtd *nmtd; struct nand_chip *this = mtd->priv; unsigned long cur; + int clock_enabled; nmtd = this->priv; info = nmtd->info; - if (chip != -1 && allow_clk_stop(info)) + if (chip != -1 && allow_clk_stop(info)) { clk_enable(info->clk); + clock_enabled = 1; + } else + clock_enabled = 0; cur = readl(info->sel_reg); @@ -356,7 +360,7 @@ static void s3c2410_nand_select_chip(str writel(cur, info->sel_reg); - if (chip == -1 && allow_clk_stop(info)) + if (chip == -1 && allow_clk_stop(info) && clock_enabled != 0) clk_disable(info->clk); }