From patchwork Mon Dec 13 12:12:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 75319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from canuck.infradead.org (canuck.infradead.org [134.117.69.58]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1B8BE1007D1 for ; Mon, 13 Dec 2010 23:21:12 +1100 (EST) Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PS7HU-0001Lk-Sp; Mon, 13 Dec 2010 12:13:28 +0000 Received: from smtp.nokia.com ([147.243.128.26] helo=mgw-da02.nokia.com) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1PS7H8-0001JD-Lp for linux-mtd@lists.infradead.org; Mon, 13 Dec 2010 12:13:07 +0000 Received: from nokia.com (localhost [127.0.0.1]) by mgw-da02.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id oBDCCfxe026906; Mon, 13 Dec 2010 14:12:41 +0200 Received: from ahunter-work.research.nokia.com ([esdhcp03791.research.nokia.com [172.21.37.91]]) by mgw-da02.nokia.com with RELAY id oBDCC84U026038 ; Mon, 13 Dec 2010 14:12:11 +0200 From: Adrian Hunter To: David Woodhouse Date: Mon, 13 Dec 2010 14:12:08 +0200 Message-Id: <20101213121208.20650.32767.sendpatchset@ahunter-work.research.nokia.com> In-Reply-To: <20101213121144.20650.27903.sendpatchset@ahunter-work.research.nokia.com> References: <20101213121144.20650.27903.sendpatchset@ahunter-work.research.nokia.com> Subject: [PATCH 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip X-Nokia-AV: Clean X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20101213_071306_894705_00E03B25 X-CRM114-Status: GOOD ( 13.12 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 TVD_RCVD_SPACE_BRACKET TVD_RCVD_SPACE_BRACKET -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Tony Lindgren , Kyungmin Park , linux-mtd Mailing List , Artem.Bityutskiy.dedekind1@gmail.com, Adrian Hunter 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: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From 16b760999cb79f9cf71728c9253f1399717be63a Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Fri, 19 Feb 2010 15:39:52 +0100 Subject: [PATCH 2/7] mtd: OneNAND: add enable / disable methods to onenand_chip Add enable / disable methods called from get_device() / release_device(). These can be used, for example, to allow the driver to prevent the voltage regulator from being put to sleep while OneNAND is in use. Signed-off-by: Adrian Hunter --- drivers/mtd/onenand/onenand_base.c | 4 ++++ include/linux/mtd/onenand.h | 2 ++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index c38bf9c..bde274f 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -948,6 +948,8 @@ static int onenand_get_device(struct mtd_info *mtd, int new_state) if (this->state == FL_READY) { this->state = new_state; spin_unlock(&this->chip_lock); + if (this->enable) + this->enable(mtd); break; } if (new_state == FL_PM_SUSPENDED) { @@ -974,6 +976,8 @@ static void onenand_release_device(struct mtd_info *mtd) { struct onenand_chip *this = mtd->priv; + if (this->state != FL_PM_SUSPENDED && this->disable) + this->disable(mtd); /* Release the chip */ spin_lock(&this->chip_lock); this->state = FL_READY; diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index 6da3fe3..ae418e4 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h @@ -118,6 +118,8 @@ struct onenand_chip { int (*chip_probe)(struct mtd_info *mtd); int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); int (*scan_bbt)(struct mtd_info *mtd); + int (*enable)(struct mtd_info *mtd); + int (*disable)(struct mtd_info *mtd); struct completion complete; int irq;