From: peter.chen@freescale.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 2/3] USB: ehci-mxc: Use new phy structure code for mxc host use
Date: Tue, 6 Dec 2011 18:43:13 +0800 [thread overview]
Message-ID: <1323168194-24191-3-git-send-email-peter.chen@freescale.com> (raw)
In-Reply-To: <1323168194-24191-1-git-send-email-peter.chen@freescale.com>
This patch just shows how mxc hci host uses general phy framework
We can use multi-phy with different phy's pointer.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
drivers/usb/host/ehci-mxc.c | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index 55978fc..8daaa7a 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -21,6 +21,7 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/usb/otg.h>
+#include <linux/usb/phy.h>
#include <linux/usb/ulpi.h>
#include <linux/slab.h>
@@ -34,6 +35,7 @@
struct ehci_mxc_priv {
struct clk *usbclk, *ahbclk, *phy1clk;
struct usb_hcd *hcd;
+ struct usb_transceiver *xceiv;
};
/* called during probe() after chip reset completes */
@@ -120,6 +122,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
int irq, ret;
unsigned int flags;
struct ehci_mxc_priv *priv;
+ struct usb_transceiver *xceiv = NULL;
struct device *dev = &pdev->dev;
struct ehci_hcd *ehci;
@@ -218,19 +221,26 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
msleep(10);
/* Initialize the transceiver */
- if (pdata->otg) {
- pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET;
- ret = otg_init(pdata->otg);
+ xceiv = usb_get_transceiver(dev_name(&pdev->dev));
+ if (!xceiv) {
+ dev_err(dev, "can't find transceiver\n");
+ ret = -ENODEV;
+ goto err_add;
+ } else {
+ if (xceiv->interface == USB_XCEIV_ULPI)
+ xceiv->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET;
+ ret = xceiv->init(xceiv);
if (ret) {
dev_err(dev, "unable to init transceiver, probably missing\n");
ret = -ENODEV;
goto err_add;
}
- ret = otg_set_vbus(pdata->otg, 1);
+ ret = xceiv->set_vbus(xceiv, 1);
if (ret) {
dev_err(dev, "unable to enable vbus on transceiver\n");
goto err_add;
}
+ priv->xceiv = xceiv;
}
priv->hcd = hcd;
@@ -240,16 +250,16 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
if (ret)
goto err_add;
- if (pdata->otg) {
+ if (xceiv) {
/*
* efikamx and efikasb have some hardware bug which is
* preventing usb to work unless CHRGVBUS is set.
* It's in violation of USB specs
*/
if (machine_is_mx51_efikamx() || machine_is_mx51_efikasb()) {
- flags = otg_io_read(pdata->otg, ULPI_OTG_CTRL);
+ flags = xceiv_io_read(xceiv, ULPI_OTG_CTRL);
flags |= ULPI_OTG_CTRL_CHRGVBUS;
- ret = otg_io_write(pdata->otg, flags, ULPI_OTG_CTRL);
+ ret = xceiv_io_write(xceiv, flags, ULPI_OTG_CTRL);
if (ret) {
dev_err(dev, "unable to set CHRVBUS\n");
goto err_add;
@@ -296,8 +306,8 @@ static int __exit ehci_mxc_drv_remove(struct platform_device *pdev)
if (pdata && pdata->exit)
pdata->exit(pdev);
- if (pdata->otg)
- otg_shutdown(pdata->otg);
+ if (priv->xceiv)
+ usb_put_transceiver(priv->xceiv);
usb_remove_hcd(hcd);
iounmap(hcd->regs);
--
1.6.3.3
next prev parent reply other threads:[~2011-12-06 10:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-06 10:43 [RFC PATCH 0/3] Use Generic USB PHY Layer at i.MX Platform Peter Chen
2011-12-06 10:43 ` [RFC PATCH 1/3] USB: Add Generic USB PHY Layer code Peter Chen
2011-12-06 10:43 ` Peter Chen [this message]
2011-12-06 10:43 ` [RFC PATCH 3/3] ARM: mx51: Create two usb phy platform drivers 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=1323168194-24191-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).