From patchwork Mon Feb 20 17:22:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 9583391 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 06D396047C for ; Mon, 20 Feb 2017 17:26:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10838284E8 for ; Mon, 20 Feb 2017 17:26:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05025287C7; Mon, 20 Feb 2017 17:26:20 +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 B0847284E8 for ; Mon, 20 Feb 2017 17:26:19 +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=Qqw3vJ788klPtpODTHV9TSr1KU01XGwRtqFDYaK7jLg=; b=ZO8RmGbkEDjVxw0XnYcRvH5RJl VNDNSkidtZLhIKsFEYi2ayHcIPEt+Z8ZfCbWMS+O9fjcDEfHQLZixkP7MBfptiQvnDQApEapJ4hLh rqcPdEyFkoH9kwn8SSFprFHLp0Idf5iXGHmW9Q1j94+/WbKF1gHCu51LmrMB2t7w4mFQzjrD24BBm rJJBYMOcVpFPJbEv4evL/DvBDKRUXb/19blNlHHDiL7b72Ly8NYh/bhvRTvpA8v4DRo7y83KNeOqe 7fUVdlL+9veBQPeJ4clL8uwM7TAWIsrQvYQa1JnHdYcuHPnLaGvtwSlA8Yay/lMM9uxuqAL9flz0B hI28awPQ==; 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 1cfrj7-0006fS-T6; Mon, 20 Feb 2017 17:26:17 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cfrfc-0003CI-Ak; Mon, 20 Feb 2017 17:22:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Lq8n8iUOdg9JHvEW02Wr5mkP8YOyUZuKCQfh5mN7Ky4=; b=tC32qWMGM8z+KixCCc32VcFlp gWnrFgAwf4A10CYEc4xwDEgyld2xmJR/qGNdFtZoA1N1G88uprZgzkF6IedTokaXxMCusOAkltkSX y+A/MdWdsKnIyco3+LIFqXSPd97y4WcKyhzVcS32aagUryGuAL1uMC9V4Qlftt9IM3DQ+H62VwgqE 7k+IcZLBSLa6t7OlQxk4YZ8Z0f1iD9hC2xUZMZjEW3O/giJKJYs70RhUD1zBti+rDei4zFcdr4/i4 cbf3VEaeEDotVF3kHSsYXFPnp3XtiCoYbPyMT8SgPGzsnPT6BtfmK6Azv02vGXpkVFsGNTzioTdlE emNI0SyKA==; Received: from mail.free-electrons.com ([62.4.15.54]) by merlin.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cfrfa-0004dR-90; Mon, 20 Feb 2017 17:22:39 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 54237207D2; Mon, 20 Feb 2017 18:22:17 +0100 (CET) Received: from bbrezillon.home (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id F197F207D9; Mon, 20 Feb 2017 18:22:06 +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: [RESEND PATCH 3/3] memory: atmel-ebi: Add PM ops Date: Mon, 20 Feb 2017 18:22:02 +0100 Message-Id: <1487611322-12688-4-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487611322-12688-1-git-send-email-boris.brezillon@free-electrons.com> References: <1487611322-12688-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_122238_444434_0257397B X-CRM114-Status: GOOD ( 14.77 ) 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 Add a ->resume() hook to make sure the EBI dev configs are correctly restored when resuming the platform. Signed-off-by: Boris Brezillon --- drivers/memory/atmel-ebi.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index 06a1a136d448..15120cb37cf0 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -506,6 +506,8 @@ static int atmel_ebi_probe(struct platform_device *pdev) if (!ebi) return -ENOMEM; + platform_set_drvdata(pdev, ebi); + INIT_LIST_HEAD(&ebi->devs); ebi->caps = match->data; ebi->dev = dev; @@ -578,10 +580,28 @@ static int atmel_ebi_probe(struct platform_device *pdev) return of_platform_populate(np, NULL, NULL, dev); } +static int atmel_ebi_resume(struct device *dev) +{ + struct atmel_ebi *ebi = dev_get_drvdata(dev); + struct atmel_ebi_dev *ebid; + + list_for_each_entry(ebid, &ebi->devs, node) { + int i; + + for (i = 0; i < ebid->numcs; i++) + ebid->ebi->caps->apply_config(ebid, &ebid->configs[i]); + } + + return 0; +} + +static SIMPLE_DEV_PM_OPS(atmel_ebi_pm_ops, NULL, atmel_ebi_resume); + static struct platform_driver atmel_ebi_driver = { .driver = { .name = "atmel-ebi", .of_match_table = atmel_ebi_id_table, + .pm = &atmel_ebi_pm_ops, }, }; builtin_platform_driver_probe(atmel_ebi_driver, atmel_ebi_probe);