From: peter.chen@freescale.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/4] usb: mxs-phy: add set_suspend API
Date: Tue, 15 Jan 2013 14:08:36 +0800 [thread overview]
Message-ID: <1358230117-19443-3-git-send-email-peter.chen@freescale.com> (raw)
In-Reply-To: <1358230117-19443-1-git-send-email-peter.chen@freescale.com>
It needs to call set_suspend during USB suspend/resume
Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
drivers/usb/otg/mxs-phy.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
index 49727dd..cad16e5 100644
--- a/drivers/usb/otg/mxs-phy.c
+++ b/drivers/usb/otg/mxs-phy.c
@@ -84,6 +84,25 @@ static void mxs_phy_shutdown(struct usb_phy *phy)
clk_disable_unprepare(mxs_phy->clk);
}
+static int mxs_phy_suspend(struct usb_phy *x, int suspend)
+{
+ struct mxs_phy *mxs_phy = to_mxs_phy(x);
+
+ if (suspend) {
+ writel_relaxed(0xffffffff, x->io_priv + HW_USBPHY_PWD);
+ writel_relaxed(BM_USBPHY_CTRL_CLKGATE,
+ x->io_priv + HW_USBPHY_CTRL_SET);
+ clk_disable_unprepare(mxs_phy->clk);
+ } else {
+ clk_prepare_enable(mxs_phy->clk);
+ writel_relaxed(BM_USBPHY_CTRL_CLKGATE,
+ x->io_priv + HW_USBPHY_CTRL_CLR);
+ writel_relaxed(0, x->io_priv + HW_USBPHY_PWD);
+ }
+
+ return 0;
+}
+
static int mxs_phy_on_connect(struct usb_phy *phy,
enum usb_device_speed speed)
{
@@ -146,6 +165,7 @@ static int mxs_phy_probe(struct platform_device *pdev)
mxs_phy->phy.label = DRIVER_NAME;
mxs_phy->phy.init = mxs_phy_init;
mxs_phy->phy.shutdown = mxs_phy_shutdown;
+ mxs_phy->phy.set_suspend = mxs_phy_suspend;
mxs_phy->phy.notify_connect = mxs_phy_on_connect;
mxs_phy->phy.notify_disconnect = mxs_phy_on_disconnect;
--
1.7.0.4
next prev parent reply other threads:[~2013-01-15 6:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-15 6:08 [PATCH v2 1/4] ARM i.MX6: use reserved bit for mxs phy clock gate Peter Chen
2013-01-15 6:08 ` [PATCH v2 2/4] usb: mxs-phy: change clock usage for i.mx6q Peter Chen
2013-01-15 6:08 ` Peter Chen [this message]
2013-01-15 6:08 ` [PATCH v2 4/4] usb: chipidea: imx: Add system suspend/resume API Peter Chen
2013-01-15 11:33 ` [PATCH v2 1/4] ARM i.MX6: use reserved bit for mxs phy clock gate Shawn Guo
2013-01-16 1:18 ` Peter Chen
2013-01-16 1:48 ` Shawn Guo
2013-01-16 2:10 ` Peter Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358230117-19443-3-git-send-email-peter.chen@freescale.com \
--to=peter.chen@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).