Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338676
b: refs/heads/master
c: ac96511
h: refs/heads/master
v: v3
  • Loading branch information
Peter Chen authored and Greg Kroah-Hartman committed Nov 16, 2012
1 parent ab47b92 commit fb6772f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 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: b76baa8154335a906be85f2b32d6bd1876900133
refs/heads/master: ac96511bb5cf92bad97ffc2249f75e45eb70301d
4 changes: 2 additions & 2 deletions trunk/drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -4039,7 +4039,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
goto fail;

if (hcd->phy && !hdev->parent)
usb_phy_notify_connect(hcd->phy, port1);
usb_phy_notify_connect(hcd->phy, udev->speed);

/*
* Some superspeed devices have finished the link training process
Expand Down Expand Up @@ -4238,7 +4238,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
if (udev) {
if (hcd->phy && !hdev->parent &&
!(portstatus & USB_PORT_STAT_CONNECTION))
usb_phy_notify_disconnect(hcd->phy, port1);
usb_phy_notify_disconnect(hcd->phy, udev->speed);
usb_disconnect(&hub->ports[port1 - 1]->child);
}
clear_bit(port1, hub->change_bits);
Expand Down
22 changes: 14 additions & 8 deletions trunk/drivers/usb/otg/mxs-phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,28 @@ static void mxs_phy_shutdown(struct usb_phy *phy)
clk_disable_unprepare(mxs_phy->clk);
}

static int mxs_phy_on_connect(struct usb_phy *phy, int port)
static int mxs_phy_on_connect(struct usb_phy *phy,
enum usb_device_speed speed)
{
dev_dbg(phy->dev, "Connect on port %d\n", port);
dev_dbg(phy->dev, "%s speed device has connected\n",
(speed == USB_SPEED_HIGH) ? "high" : "non-high");

writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
phy->io_priv + HW_USBPHY_CTRL_SET);
if (speed == USB_SPEED_HIGH)
writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
phy->io_priv + HW_USBPHY_CTRL_SET);

return 0;
}

static int mxs_phy_on_disconnect(struct usb_phy *phy, int port)
static int mxs_phy_on_disconnect(struct usb_phy *phy,
enum usb_device_speed speed)
{
dev_dbg(phy->dev, "Disconnect on port %d\n", port);
dev_dbg(phy->dev, "%s speed device has disconnected\n",
(speed == USB_SPEED_HIGH) ? "high" : "non-high");

writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
phy->io_priv + HW_USBPHY_CTRL_CLR);
if (speed == USB_SPEED_HIGH)
writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
phy->io_priv + HW_USBPHY_CTRL_CLR);

return 0;
}
Expand Down
15 changes: 9 additions & 6 deletions trunk/include/linux/usb/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define __LINUX_USB_PHY_H

#include <linux/notifier.h>
#include <linux/usb.h>

enum usb_phy_events {
USB_EVENT_NONE, /* no events or cable disconnected */
Expand Down Expand Up @@ -99,8 +100,10 @@ struct usb_phy {
int suspend);

/* notify phy connect status change */
int (*notify_connect)(struct usb_phy *x, int port);
int (*notify_disconnect)(struct usb_phy *x, int port);
int (*notify_connect)(struct usb_phy *x,
enum usb_device_speed speed);
int (*notify_disconnect)(struct usb_phy *x,
enum usb_device_speed speed);
};


Expand Down Expand Up @@ -189,19 +192,19 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
}

static inline int
usb_phy_notify_connect(struct usb_phy *x, int port)
usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
{
if (x->notify_connect)
return x->notify_connect(x, port);
return x->notify_connect(x, speed);
else
return 0;
}

static inline int
usb_phy_notify_disconnect(struct usb_phy *x, int port)
usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed)
{
if (x->notify_disconnect)
return x->notify_disconnect(x, port);
return x->notify_disconnect(x, speed);
else
return 0;
}
Expand Down

0 comments on commit fb6772f

Please sign in to comment.