From patchwork Mon Feb 20 17:16:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 9583399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D733B6047C for ; Mon, 20 Feb 2017 17:33:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC718284F9 for ; Mon, 20 Feb 2017 17:33:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDEC928549; Mon, 20 Feb 2017 17:33:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 89FCB284F9 for ; Mon, 20 Feb 2017 17:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TLaoJlEdIIc342yDvE2706PXzhuJ+Bxd2po0xdAnWW0=; b=k7D1oAK4/lmH8bA1OfcQBP0YYq J3rnTlOpNCFLYOF48M6bzLHxxbamyhsbtRG4JekTHQBx/t3GfzJ44npp5nRz/JJzh2tDMHS5qSjwc 2lbsqc4fLlSnVuN4n+NbOf+I/du+rHd4XdBjll25zYAGxEJB0dieLeoNz9Zw3lLkqwOqKEydBfu3/ RYfSIkX8olyr95AjO//M4FN/o5E9jeXyWgm1Ky/eH0NlIWjwbvwF0YYf0eDb2d0KVSl6Py0mFn3Ej SqfJUuJc79ZdFhIarGO+ydAR9+L9T2iq9PFEDCnoCe3oGSXfv0D/UIWSlwy+jWVcLcFTweMZJX13o vz5PUcrw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cfrq3-0004OG-MU; Mon, 20 Feb 2017 17:33:27 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cfraC-0007Pu-Bz; Mon, 20 Feb 2017 17:17:07 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 5732B2077D; Mon, 20 Feb 2017 18:16:21 +0100 (CET) Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 0276320761; Mon, 20 Feb 2017 18:16:20 +0100 (CET) From: Boris Brezillon To: Boris Brezillon , Richard Weinberger , linux-mtd@lists.infradead.org, Sascha Hauer , Sergio Prado , Marc Gonzalez , Wenyou Yang , Josh Wu Subject: [PATCH 3/3] mtd: nand: atmel: Add PM ops Date: Mon, 20 Feb 2017 18:16:18 +0100 Message-Id: <1487610978-12423-7-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487610978-12423-1-git-send-email-boris.brezillon@free-electrons.com> References: <1487610978-12423-1-git-send-email-boris.brezillon@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170220_091704_672128_AC9C2769 X-CRM114-Status: GOOD ( 11.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Marek Vasut , Cyrille Pitchen , Brian Norris , David Woodhouse , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Provide a ->resume() hook to make sure the NAND timings are correctly restored by resetting all chips connected to the controller. Signed-off-by: Boris Brezillon --- drivers/mtd/nand/atmel/nand-controller.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c index ae46ef711d67..cd107e6edcbc 100644 --- a/drivers/mtd/nand/atmel/nand-controller.c +++ b/drivers/mtd/nand/atmel/nand-controller.c @@ -2575,6 +2575,24 @@ static int atmel_nand_controller_remove(struct platform_device *pdev) return nc->caps->ops->remove(nc); } +static int atmel_nand_controller_resume(struct device *dev) +{ + struct atmel_nand_controller *nc = dev_get_drvdata(dev); + struct atmel_nand *nand; + + list_for_each_entry(nand, &nc->chips, node) { + int i; + + for (i = 0; i < nand->numcs; i++) + nand_reset(&nand->base, i); + } + + return 0; +} + +static SIMPLE_DEV_PM_OPS(atmel_nand_controller_pm_ops, NULL, + atmel_nand_controller_resume); + static struct platform_driver atmel_nand_controller_driver = { .driver = { .name = "atmel-nand-controller",