From patchwork Tue Mar 25 08:19:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 26973 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7E1B320062 for ; Tue, 25 Mar 2014 08:21:38 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id lh14sf283976vcb.10 for ; Tue, 25 Mar 2014 01:21:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=MPQFlqt0fxkCVwlWYrDTxVxgAtc+PIj9omQEPi7+8zA=; b=aiMV4mu2gCgXFw2rtglKjJDpBbXAswuuafGYIkgEYVE1GPabNqwBW6NI7l1WrbFnQR Onqe4Lbdcbem4bwm2YjY3bjEScdUD8nrGxdrs6u589rllewFWyguFBcBZzxvlxyqAYNa f7JMxSG+8nXpL3XsbTdnKGNKGT94XHv8w0gzJniLcgRB81DgoxhYm5I1N1ksauAS4sK4 eQJJ3pEEpMPRaTbsyVn2ar+J7yWUEMmnD26OUbtLfzce5nC9k1LESkXrP2H9Qbwg4usp dt40XCdi6tNfvpQdllu1bwplmrnHiO/xi9XVfqqcxOU/C56BrdlF2JXpGcNKunyiZ5/w O0QQ== X-Gm-Message-State: ALoCoQkqz0YEAvwLIPZ1kwkjbkLIqvZfXrwGoSj2eTJK8gZ2JGpcUgZbfaWul6bXrNrPQiGxs/42 X-Received: by 10.236.142.212 with SMTP id i60mr13026518yhj.39.1395735698209; Tue, 25 Mar 2014 01:21:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.12 with SMTP id t12ls143861qge.1.gmail; Tue, 25 Mar 2014 01:21:38 -0700 (PDT) X-Received: by 10.58.55.170 with SMTP id t10mr36933vep.29.1395735698113; Tue, 25 Mar 2014 01:21:38 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id r7si65293vcn.79.2014.03.25.01.21.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:21:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ij19so124740vcb.38 for ; Tue, 25 Mar 2014 01:21:38 -0700 (PDT) X-Received: by 10.220.92.135 with SMTP id r7mr54432424vcm.11.1395735698041; Tue, 25 Mar 2014 01:21:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp285308vck; Tue, 25 Mar 2014 01:21:36 -0700 (PDT) X-Received: by 10.180.97.72 with SMTP id dy8mr19870260wib.5.1395735696469; Tue, 25 Mar 2014 01:21:36 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id my12si12196967wic.69.2014.03.25.01.21.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Mar 2014 01:21:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMbk-0007xh-86; Tue, 25 Mar 2014 08:21:16 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMbe-0002CI-BB; Tue, 25 Mar 2014 08:21:10 +0000 Received: from mail-wg0-f43.google.com ([74.125.82.43]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMbC-00025Z-CB for linux-mtd@lists.infradead.org; Tue, 25 Mar 2014 08:20:52 +0000 Received: by mail-wg0-f43.google.com with SMTP id x13so75424wgg.26 for ; Tue, 25 Mar 2014 01:20:19 -0700 (PDT) X-Received: by 10.180.79.73 with SMTP id h9mr20380724wix.3.1395735619564; Tue, 25 Mar 2014 01:20:19 -0700 (PDT) Received: from lee--X1.home (host109-148-113-193.range109-148.btcentralplus.com. [109.148.113.193]) by mx.google.com with ESMTPSA id k4sm5567676wib.19.2014.03.25.01.20.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:20:18 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 01/47] mtd: nand: export useful functions from core driver Date: Tue, 25 Mar 2014 08:19:18 +0000 Message-Id: <1395735604-26706-2-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> References: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140325_042042_728871_BD57717D X-CRM114-Status: GOOD ( 13.37 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.43 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: angus.clark@st.com, kernel@stlinux.com, lee.jones@linaro.org, linux-mtd@lists.infradead.org, pekon@ti.com, computersforpeace@gmail.com, dwmw2@infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 These functions are utilised by the STM BCH NAND Controller driver. Signed-off-by: Lee Jones --- drivers/mtd/nand/nand_base.c | 18 +++++++++++------- include/linux/mtd/nand.h | 6 ++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index bd39f7b..070505d 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -90,7 +90,7 @@ static struct nand_ecclayout nand_oob_128 = { .length = 78} } }; -static int nand_get_device(struct mtd_info *mtd, int new_state); +int nand_get_device(struct mtd_info *mtd, int new_state); static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops); @@ -128,7 +128,7 @@ static int check_offs_len(struct mtd_info *mtd, * * Release chip lock and wake up anyone waiting on the device. */ -static void nand_release_device(struct mtd_info *mtd) +void nand_release_device(struct mtd_info *mtd) { struct nand_chip *chip = mtd->priv; @@ -139,6 +139,7 @@ static void nand_release_device(struct mtd_info *mtd) wake_up(&chip->controller->wq); spin_unlock(&chip->controller->lock); } +EXPORT_SYMBOL_GPL(nand_release_device); /** * nand_read_byte - [DEFAULT] read one byte from the chip @@ -736,8 +737,7 @@ static void panic_nand_get_device(struct nand_chip *chip, * * Get the device and lock it for exclusive access */ -static int -nand_get_device(struct mtd_info *mtd, int new_state) +int nand_get_device(struct mtd_info *mtd, int new_state) { struct nand_chip *chip = mtd->priv; spinlock_t *lock = &chip->controller->lock; @@ -769,6 +769,7 @@ retry: remove_wait_queue(wq, &wait); goto retry; } +EXPORT_SYMBOL_GPL(nand_get_device); /** * panic_nand_wait - [GENERIC] wait until the command is done @@ -2665,7 +2666,7 @@ erase_exit: * * Sync is actually a wait for chip ready function. */ -static void nand_sync(struct mtd_info *mtd) +void nand_sync(struct mtd_info *mtd) { pr_debug("%s: called\n", __func__); @@ -2674,6 +2675,7 @@ static void nand_sync(struct mtd_info *mtd) /* Release it and go back */ nand_release_device(mtd); } +EXPORT_SYMBOL_GPL(nand_sync); /** * nand_block_isbad - [MTD Interface] Check if block at offset is bad @@ -2757,16 +2759,17 @@ static int nand_onfi_get_features(struct mtd_info *mtd, struct nand_chip *chip, * nand_suspend - [MTD Interface] Suspend the NAND flash * @mtd: MTD device structure */ -static int nand_suspend(struct mtd_info *mtd) +int nand_suspend(struct mtd_info *mtd) { return nand_get_device(mtd, FL_PM_SUSPENDED); } +EXPORT_SYMBOL(nand_suspend); /** * nand_resume - [MTD Interface] Resume the NAND flash * @mtd: MTD device structure */ -static void nand_resume(struct mtd_info *mtd) +void nand_resume(struct mtd_info *mtd) { struct nand_chip *chip = mtd->priv; @@ -2776,6 +2779,7 @@ static void nand_resume(struct mtd_info *mtd) pr_err("%s called for a chip which is not in suspended state\n", __func__); } +EXPORT_SYMBOL(nand_resume); /* Set default functions */ static void nand_set_defaults(struct nand_chip *chip, int busw) diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 9e6c8f9..f7b6a53 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -698,6 +698,12 @@ extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, int allowbbt); extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, uint8_t *buf); +extern void nand_sync(struct mtd_info *mtd); +extern int nand_suspend(struct mtd_info *mtd); +extern void nand_resume(struct mtd_info *mtd); + +extern int nand_get_device(struct mtd_info *mtd, int new_state); +extern void nand_release_device(struct mtd_info *mtd); /** * struct platform_nand_chip - chip level device structure