From patchwork Tue Mar 25 08:19:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 27014 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A6BC720062 for ; Tue, 25 Mar 2014 08:49:25 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i7sf617314oag.0 for ; Tue, 25 Mar 2014 01:49:25 -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=QHC8bElmv1rsQs2vtEhN4n+0nyn2O2SvjLTTY6yY9sk=; b=QISW9OFKUyp7/t+Sk0EEzBcv6KiHNbxL0gvRFvdrMyA20/Gsnb+v0JbOF2nG1oWNP5 3ySCZRni5hFj31pJLu4jfRpLbG2WiPYLjTitU6E1+cBcyk1GndHIg44sI1F/dlJ/u86N 2B5No/GzMRbqiHFNovgaVChbNGgldmjgkqAI1YATvYZZ+bcgbRpP7OtFOlhrR3Nu8aCt sjRmj+Ah/xEuSptslFG1O94tMlTbEHK1tjndaPaEbw/F5SgHYMrVZZnnU33i54CZRAoi 1ilHuWgYKLHiOf/jW22DCgjP0EyV/IuWNBjWe1J3hWVeLB0bUot6P8xjV3+ppNI3hL0A F6OA== X-Gm-Message-State: ALoCoQn6tM4Ip+CShRCvXLmA0G+SrvHUcH08vBhz4VrrhMsWD9GY34SVpa5d60t1oMS4Z58sd+4O X-Received: by 10.182.236.74 with SMTP id us10mr14589082obc.36.1395737365267; Tue, 25 Mar 2014 01:49:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.16 with SMTP id g16ls152075qgd.25.gmail; Tue, 25 Mar 2014 01:49:25 -0700 (PDT) X-Received: by 10.59.9.38 with SMTP id dp6mr5669366ved.24.1395737365100; Tue, 25 Mar 2014 01:49:25 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id bj3si3541443vcb.172.2014.03.25.01.49.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:49:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id jw12so161990veb.13 for ; Tue, 25 Mar 2014 01:49:25 -0700 (PDT) X-Received: by 10.58.229.4 with SMTP id sm4mr55589141vec.10.1395737365019; Tue, 25 Mar 2014 01:49:25 -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 i9csp286801vck; Tue, 25 Mar 2014 01:49:23 -0700 (PDT) X-Received: by 10.180.219.66 with SMTP id pm2mr21412251wic.60.1395737363351; Tue, 25 Mar 2014 01:49:23 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [85.118.1.10]) by mx.google.com with ESMTPS id fu20si1425207wic.112.2014.03.25.01.49.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Mar 2014 01:49:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 85.118.1.10 as permitted sender) client-ip=85.118.1.10; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSN0d-0004ww-3U; Tue, 25 Mar 2014 08:47:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSN0A-00045p-BN; Tue, 25 Mar 2014 08:46:30 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMtq-00036r-QG for linux-arm-kernel@merlin.infradead.org; Tue, 25 Mar 2014 08:39:58 +0000 Received: from mail-wg0-f50.google.com ([74.125.82.50]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMbR-0007FV-Ty for linux-arm-kernel@lists.infradead.org; Tue, 25 Mar 2014 08:20:58 +0000 Received: by mail-wg0-f50.google.com with SMTP id x13so75456wgg.33 for ; Tue, 25 Mar 2014 01:20:38 -0700 (PDT) X-Received: by 10.180.19.138 with SMTP id f10mr20227960wie.11.1395735638526; Tue, 25 Mar 2014 01:20:38 -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.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:20:37 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 11/47] mtd: nand: stm_nand_bch: add Power Management Date: Tue, 25 Mar 2014 08:19:28 +0000 Message-Id: <1395735604-26706-12-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_082057_995462_76BE83B7 X-CRM114-Status: GOOD ( 10.87 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (-2.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.50 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-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-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.128.182 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 Populate the standard PM call-backs for; suspend, resume and restore. Signed-off-by: Lee Jones q --- drivers/mtd/nand/stm_nand_bch.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index 8ab8e7b..e1ebf92 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -415,12 +415,51 @@ static int stm_nand_bch_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +static int stm_nand_bch_suspend(struct device *dev) +{ + struct nandi_controller *nandi = dev_get_drvdata(dev); + + nandi_clk_disable(nandi); + + return 0; +} +static int stm_nand_bch_resume(struct device *dev) +{ + struct nandi_controller *nandi = dev_get_drvdata(dev); + + nandi_clk_enable(nandi); + + return 0; +} + +static int stm_nand_bch_restore(struct device *dev) +{ + struct nandi_controller *nandi = dev_get_drvdata(dev); + struct stm_plat_nand_bch_data *pdata = dev->platform_data; + struct stm_nand_bank_data *bank = pdata->bank; + + nandi_init_controller(nandi, bank->csn); + + return 0; +} + +static const struct dev_pm_ops stm_nand_bch_pm_ops = { + .suspend = stm_nand_bch_suspend, + .resume = stm_nand_bch_resume, + .restore = stm_nand_bch_restore, +}; +#else +static const struct dev_pm_ops stm_nand_bch_pm_ops; +#endif + static struct platform_driver stm_nand_bch_driver = { .probe = stm_nand_bch_probe , .remove = stm_nand_bch_remove, .driver = { .name = "stm-nand-bch", .owner = THIS_MODULE, + .pm = &stm_nand_bch_pm_ops, }, }; module_platform_driver(stm_nand_bch_driver);