From: richard.zhao@freescale.com (Richard Zhao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] USB: mxs-phy: add basic otg support
Date: Mon, 17 Sep 2012 17:05:03 +0800 [thread overview]
Message-ID: <1347872703-15167-1-git-send-email-richard.zhao@freescale.com> (raw)
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
Changes from v2:
- assign host/gadget in mxs_phy_set_host/mxs_phy_set_peripheral
drivers/usb/otg/mxs-phy.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
index 88db976..3255112 100644
--- a/drivers/usb/otg/mxs-phy.c
+++ b/drivers/usb/otg/mxs-phy.c
@@ -129,12 +129,28 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int port)
return 0;
}
+static int mxs_phy_set_host(struct usb_otg *otg, struct usb_bus *host)
+{
+ otg->host = host;
+
+ return 0;
+}
+
+static int mxs_phy_set_peripheral(struct usb_otg *otg,
+ struct usb_gadget *gadget)
+{
+ otg->gadget = gadget;
+
+ return 0;
+}
+
static int mxs_phy_probe(struct platform_device *pdev)
{
struct resource *res;
void __iomem *base;
struct clk *clk;
struct mxs_phy *mxs_phy;
+ struct usb_otg *otg;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -171,6 +187,15 @@ static int mxs_phy_probe(struct platform_device *pdev)
mxs_phy->clk = clk;
+ otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), GFP_KERNEL);
+ if (!otg)
+ return -ENOMEM;
+ otg->phy = &mxs_phy->phy;
+ otg->set_host = mxs_phy_set_host;
+ otg->set_peripheral = mxs_phy_set_peripheral;
+
+ mxs_phy->phy.otg = otg;
+
platform_set_drvdata(pdev, &mxs_phy->phy);
return 0;
--
1.7.9.5
next reply other threads:[~2012-09-17 9:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 9:05 Richard Zhao [this message]
2012-09-17 10:06 ` [PATCH v3] USB: mxs-phy: add basic otg support Alexander Shishkin
2012-09-19 1:11 ` Richard Zhao
2012-09-19 7:27 ` Marc Kleine-Budde
2012-09-17 10:08 ` Chen Peter-B29397
2012-09-17 10:18 ` Alexander Shishkin
2012-09-17 23:39 ` Chen Peter-B29397
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=1347872703-15167-1-git-send-email-richard.zhao@freescale.com \
--to=richard.zhao@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).