From patchwork Thu May 1 09:56:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 29455 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f71.google.com (mail-qg0-f71.google.com [209.85.192.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 247CF203F3 for ; Thu, 1 May 2014 09:57:33 +0000 (UTC) Received: by mail-qg0-f71.google.com with SMTP id j5sf6245422qga.2 for ; Thu, 01 May 2014 02:57:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=8YuUCI+2Kwuj0Va+YC0kxYYJRPeqnG3nwX0Kt73oC2U=; b=VjBwZKLvUnFGnpxjfk/tEvK9mcsIxxMzSc0fzgT5WHOc5iT/JNYPRr5/5Rwa5p7eeO Zcr/hurEWzYMjE2hn5ULQXDD4GYoKkywEFZxkwPm1Z/hr4HGJoRc8w2oogsUY6chMgXV QdGqF5lb8REYfsoYgt+WV1AG1Rags6NGLjKvArPged0Wvv/GYpUGcZLPa98p4sIFNXvN 0tKxQQAIoHxYEZOaIkX+KupgkAF75MCmF326dDVr/SjcvOdDB6LvLVuOYMnDUb7Tuq9S 1AKwD9kzrg/3l+DqxTG2BlGuqJQ04FLEFN6Od7AjFnBPJ0OJFEKj9GYvfoKn/yJ4Ce5c d9SA== X-Gm-Message-State: ALoCoQlcirt1xN9zJEi0MfIoD7Nz56/kn552BNNx/d1glZqr9tvDupp4o7cyAGKHo0DqMrped+D8 X-Received: by 10.236.112.4 with SMTP id x4mr791268yhg.56.1398938252936; Thu, 01 May 2014 02:57:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.43.35 with SMTP id d32ls970751qga.87.gmail; Thu, 01 May 2014 02:57:32 -0700 (PDT) X-Received: by 10.58.207.74 with SMTP id lu10mr8131808vec.15.1398938252832; Thu, 01 May 2014 02:57:32 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id af10si5963587vec.185.2014.05.01.02.57.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:32 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jy13so3673144veb.3 for ; Thu, 01 May 2014 02:57:32 -0700 (PDT) X-Received: by 10.53.1.69 with SMTP id be5mr6753501vdd.27.1398938252765; Thu, 01 May 2014 02:57:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp12907vcb; Thu, 1 May 2014 02:57:32 -0700 (PDT) X-Received: by 10.180.198.46 with SMTP id iz14mr1528010wic.46.1398938251755; Thu, 01 May 2014 02:57:31 -0700 (PDT) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by mx.google.com with ESMTPS id ce2si565358wib.112.2014.05.01.02.57.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:31 -0700 (PDT) Received-SPF: none (google.com: lee.jones@linaro.org does not designate permitted sender hosts) client-ip=209.85.212.176; Received: by mail-wi0-f176.google.com with SMTP id f8so406742wiw.15 for ; Thu, 01 May 2014 02:57:31 -0700 (PDT) X-Received: by 10.180.211.116 with SMTP id nb20mr1497311wic.5.1398938251266; Thu, 01 May 2014 02:57:31 -0700 (PDT) Received: from lee--X1.home (host109-148-238-223.range109-148.btcentralplus.com. [109.148.238.223]) by mx.google.com with ESMTPSA id bj5sm2696494wib.3.2014.05.01.02.57.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:29 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org Cc: computersforpeace@gmail.com, linux-mtd@lists.infradead.org, kernel@stlinux.com, Lee Jones Subject: [PATCH 12/47] mtd: nand: stm_nand_bch: add Power Management Date: Thu, 1 May 2014 10:56:19 +0100 Message-Id: <1398938214-17847-13-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398938214-17847-1-git-send-email-lee.jones@linaro.org> References: <1398938214-17847-1-git-send-email-lee.jones@linaro.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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Populate the standard PM call-backs for; suspend, resume and restore. Signed-off-by: Lee Jones --- 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 0c6aad2..8a63c4a 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -568,12 +568,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);