From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miquel Raynal Subject: [PATCH v3 04/10] usb: ehci-orion: add S2RAM support Date: Mon, 21 Jan 2019 12:23:30 +0100 Message-ID: <20190121112336.23489-5-miquel.raynal@bootlin.com> References: <20190121112336.23489-1-miquel.raynal@bootlin.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190121112336.23489-1-miquel.raynal@bootlin.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Gregory Clement , Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Kishon Vijay Abraham I , Rob Herring , Mark Rutland , Greg Kroah-Hartman , Mathias Nyman , Alan Stern Cc: devicetree@vger.kernel.org, Antoine Tenart , linux-usb@vger.kernel.org, Maxime Chevallier , Nadav Haklai , Thomas Petazzoni , Miquel Raynal , linux-arm-kernel@lists.infradead.org List-Id: devicetree@vger.kernel.org Add suspend/resume callbacks to reset the host controller properly during S2RAM operation. Signed-off-by: Miquel Raynal --- drivers/usb/host/ehci-orion.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 3109f082949e..dab22aa57c0b 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c @@ -182,6 +182,30 @@ static int ehci_orion_drv_reset(struct usb_hcd *hcd) return ret; } +static int __maybe_unused ehci_orion_drv_suspend(struct device *dev) +{ + struct usb_hcd *hcd = dev_get_drvdata(dev); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); + + ehci_prepare_ports_for_controller_suspend(ehci, + device_may_wakeup(dev)); + + return ehci_suspend(hcd, false); +} + +static int __maybe_unused ehci_orion_drv_resume(struct device *dev) +{ + struct usb_hcd *hcd = dev_get_drvdata(dev); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); + + ehci_prepare_ports_for_controller_resume(ehci); + + return ehci_resume(hcd, false); +} + +static SIMPLE_DEV_PM_OPS(ehci_orion_pm_ops, ehci_orion_drv_suspend, + ehci_orion_drv_resume); + static const struct ehci_driver_overrides orion_overrides __initconst = { .extra_priv_size = sizeof(struct orion_ehci_hcd), .reset = ehci_orion_drv_reset, @@ -334,6 +358,7 @@ static struct platform_driver ehci_orion_driver = { .driver = { .name = "orion-ehci", .of_match_table = ehci_orion_dt_ids, + .pm = &ehci_orion_pm_ops, }, }; -- 2.19.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Subject: [v3,04/10] usb: ehci-orion: add S2RAM support From: Miquel Raynal Message-Id: <20190121112336.23489-5-miquel.raynal@bootlin.com> Date: Mon, 21 Jan 2019 12:23:30 +0100 To: Gregory Clement , Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Kishon Vijay Abraham I , Rob Herring , Mark Rutland , Greg Kroah-Hartman , Mathias Nyman , Alan Stern Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, Thomas Petazzoni , Antoine Tenart , Maxime Chevallier , Nadav Haklai , Miquel Raynal List-ID: QWRkIHN1c3BlbmQvcmVzdW1lIGNhbGxiYWNrcyB0byByZXNldCB0aGUgaG9zdCBjb250cm9sbGVy IHByb3Blcmx5CmR1cmluZyBTMlJBTSBvcGVyYXRpb24uCgpTaWduZWQtb2ZmLWJ5OiBNaXF1ZWwg UmF5bmFsIDxtaXF1ZWwucmF5bmFsQGJvb3RsaW4uY29tPgotLS0KIGRyaXZlcnMvdXNiL2hvc3Qv ZWhjaS1vcmlvbi5jIHwgMjUgKysrKysrKysrKysrKysrKysrKysrKysrKwogMSBmaWxlIGNoYW5n ZWQsIDI1IGluc2VydGlvbnMoKykKCmRpZmYgLS1naXQgYS9kcml2ZXJzL3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3RhdGlj IFNJTVBMRV9ERVZfUE1fT1BTKGVoY2lfb3Jpb25fcG1fb3BzLCBlaGNpX29yaW9uX2Rydl9zdXNw ZW5kLAorCQkJIGVoY2lfb3Jpb25fZHJ2X3Jlc3VtZSk7CisKIHN0YXRpYyBjb25zdCBzdHJ1Y3Qg ZWhjaV9kcml2ZXJfb3ZlcnJpZGVzIG9yaW9uX292ZXJyaWRlcyBfX2luaXRjb25zdCA9IHsKIAku ZXh0cmFfcHJpdl9zaXplID0Jc2l6ZW9mKHN0cnVjdCBvcmlvbl9laGNpX2hjZCksCiAJLnJlc2V0 ID0gZWhjaV9vcmlvbl9kcnZfcmVzZXQsCkBAIC0zMzQsNiArMzU4LDcgQEAgc3RhdGljIHN0cnVj dCBwbGF0Zm9ybV9kcml2ZXIgZWhjaV9vcmlvbl9kcml2ZXIgPSB7CiAJLmRyaXZlciA9IHsKIAkJ Lm5hbWUJPSAib3Jpb24tZWhjaSIsCiAJCS5vZl9tYXRjaF90YWJsZSA9IGVoY2lfb3Jpb25fZHRf aWRzLAorCQkucG0gPSAmZWhjaV9vcmlvbl9wbV9vcHMsCiAJfSwKIH07CiAK From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D220C7112F for ; Mon, 21 Jan 2019 11:26:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3D3D120663 for ; Mon, 21 Jan 2019 11:26:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y2spxLqS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D3D120663 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=bP8ELQXpzMyIwfBB3MLQoK4G6FV4t2l0qul12u56h2Q=; b=Y2spxLqSWmUj1A 4xkJdHyn08GOCLlY4y/mJ+VxRrCChG0KJhOj8ik5VhyZr0QOHO+Cxy/J9dfqukpIWpTzya5zlNmaM eboqmnMV3dY/+2p3l3UEsyPvfQxpRp8hewUDyZNQ/4LFr9ckxhY5rtb2oiGVNpajfiPmZu/HqCkMx W0WD1QcPgQS6e/eNPOtDvfbsvkfxaddpc7qzWL1MU5h/MHkvQb8D0c1TpTUM0h2Jfm0qWSYLAXDpL jaTq9KswUQqWxQwtYFXRpPw41V8nihD0yD/6YqUFUQXYu6iI1v/KfgtrgJFBa0eS7gGump0jtijDg NbUCzutiF3zjmCtry5uw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1glXii-00050I-Ek; Mon, 21 Jan 2019 11:26:24 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1glXg4-0001Gs-Km for linux-arm-kernel@lists.infradead.org; Mon, 21 Jan 2019 11:23:42 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 55C6F20A32; Mon, 21 Jan 2019 12:23:39 +0100 (CET) Received: from localhost.localdomain (aaubervilliers-681-1-37-87.w90-88.abo.wanadoo.fr [90.88.156.87]) by mail.bootlin.com (Postfix) with ESMTPSA id E17D3206A7; Mon, 21 Jan 2019 12:23:38 +0100 (CET) From: Miquel Raynal To: Gregory Clement , Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Kishon Vijay Abraham I , Rob Herring , Mark Rutland , Greg Kroah-Hartman , Mathias Nyman , Alan Stern Subject: [PATCH v3 04/10] usb: ehci-orion: add S2RAM support Date: Mon, 21 Jan 2019 12:23:30 +0100 Message-Id: <20190121112336.23489-5-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190121112336.23489-1-miquel.raynal@bootlin.com> References: <20190121112336.23489-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190121_032340_811002_FE481BE1 X-CRM114-Status: GOOD ( 13.39 ) 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: devicetree@vger.kernel.org, Antoine Tenart , linux-usb@vger.kernel.org, Maxime Chevallier , Nadav Haklai , Thomas Petazzoni , Miquel Raynal , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add suspend/resume callbacks to reset the host controller properly during S2RAM operation. Signed-off-by: Miquel Raynal --- drivers/usb/host/ehci-orion.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 3109f082949e..dab22aa57c0b 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c @@ -182,6 +182,30 @@ static int ehci_orion_drv_reset(struct usb_hcd *hcd) return ret; } +static int __maybe_unused ehci_orion_drv_suspend(struct device *dev) +{ + struct usb_hcd *hcd = dev_get_drvdata(dev); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); + + ehci_prepare_ports_for_controller_suspend(ehci, + device_may_wakeup(dev)); + + return ehci_suspend(hcd, false); +} + +static int __maybe_unused ehci_orion_drv_resume(struct device *dev) +{ + struct usb_hcd *hcd = dev_get_drvdata(dev); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); + + ehci_prepare_ports_for_controller_resume(ehci); + + return ehci_resume(hcd, false); +} + +static SIMPLE_DEV_PM_OPS(ehci_orion_pm_ops, ehci_orion_drv_suspend, + ehci_orion_drv_resume); + static const struct ehci_driver_overrides orion_overrides __initconst = { .extra_priv_size = sizeof(struct orion_ehci_hcd), .reset = ehci_orion_drv_reset, @@ -334,6 +358,7 @@ static struct platform_driver ehci_orion_driver = { .driver = { .name = "orion-ehci", .of_match_table = ehci_orion_dt_ids, + .pm = &ehci_orion_pm_ops, }, }; -- 2.19.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel