Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338673
b: refs/heads/master
c: ff84f0e
h: refs/heads/master
i:
  338671: 870510e
v: v3
  • Loading branch information
Peter Chen authored and Greg Kroah-Hartman committed Nov 16, 2012
1 parent b2cd64a commit b73c399
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba2d8ce9db0a61505362bb17b8899df3d3326146
refs/heads/master: ff84f0e9f70cde6de1ba7c7f6156c8c3c98af383
38 changes: 3 additions & 35 deletions trunk/drivers/usb/otg/mxs-phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/workqueue.h>

#define DRIVER_NAME "mxs_phy"

Expand All @@ -35,16 +34,9 @@
#define BM_USBPHY_CTRL_ENUTMILEVEL2 BIT(14)
#define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1)

/*
* Amount of delay in miliseconds to safely enable ENHOSTDISCONDETECT bit
* so that connection and reset processing can be completed for the root hub.
*/
#define MXY_PHY_ENHOSTDISCONDETECT_DELAY 250

struct mxs_phy {
struct usb_phy phy;
struct clk *clk;
struct delayed_work enhostdiscondetect_work;
};

#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy)
Expand All @@ -70,7 +62,6 @@ static int mxs_phy_init(struct usb_phy *phy)

clk_prepare_enable(mxs_phy->clk);
mxs_phy_hw_init(mxs_phy);
INIT_DELAYED_WORK(&mxs_phy->enhostdiscondetect_work, NULL);

return 0;
}
Expand All @@ -85,34 +76,13 @@ static void mxs_phy_shutdown(struct usb_phy *phy)
clk_disable_unprepare(mxs_phy->clk);
}

static void mxs_phy_enhostdiscondetect_delay(struct work_struct *ws)
{
struct mxs_phy *mxs_phy = container_of(ws, struct mxs_phy,
enhostdiscondetect_work.work);

/* Enable HOSTDISCONDETECT after delay. */
dev_dbg(mxs_phy->phy.dev, "Setting ENHOSTDISCONDETECT\n");
writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
mxs_phy->phy.io_priv + HW_USBPHY_CTRL_SET);
}

static int mxs_phy_on_connect(struct usb_phy *phy, int port)
{
struct mxs_phy *mxs_phy = to_mxs_phy(phy);

dev_dbg(phy->dev, "Connect on port %d\n", port);

mxs_phy_hw_init(mxs_phy);

/*
* Delay enabling ENHOSTDISCONDETECT so that connection and
* reset processing can be completed for the root hub.
*/
dev_dbg(phy->dev, "Delaying setting ENHOSTDISCONDETECT\n");
PREPARE_DELAYED_WORK(&mxs_phy->enhostdiscondetect_work,
mxs_phy_enhostdiscondetect_delay);
schedule_delayed_work(&mxs_phy->enhostdiscondetect_work,
msecs_to_jiffies(MXY_PHY_ENHOSTDISCONDETECT_DELAY));
mxs_phy_hw_init(to_mxs_phy(phy));
writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
phy->io_priv + HW_USBPHY_CTRL_SET);

return 0;
}
Expand All @@ -121,8 +91,6 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int port)
{
dev_dbg(phy->dev, "Disconnect on port %d\n", port);

/* No need to delay before clearing ENHOSTDISCONDETECT. */
dev_dbg(phy->dev, "Clearing ENHOSTDISCONDETECT\n");
writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
phy->io_priv + HW_USBPHY_CTRL_CLR);

Expand Down

0 comments on commit b73c399

Please sign in to comment.