aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2012-11-08 20:44:44 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-15 20:44:51 -0500
commitac96511bb5cf92bad97ffc2249f75e45eb70301d (patch)
tree4558028534ad7aa6c508c9485c3435c1cdb8c60c
parentb76baa8154335a906be85f2b32d6bd1876900133 (diff)
usb: phy: change phy notify connect/disconnect API
The old parameter "port" is useless for phy notify, as one usb phy is only for one usb port. New parameter "speed" stands for the device's speed which is on the port, this "speed" parameter is needed at some platforms which will do some phy operations according to device's speed. Signed-off-by: Peter Chen <peter.chen@freescale.com> Tested-by: Mike Thompson <mpthompson@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/core/hub.c4
-rw-r--r--drivers/usb/otg/mxs-phy.c22
-rw-r--r--include/linux/usb/phy.h15
3 files changed, 25 insertions, 16 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 8391538d688b..a815fd2cc5e7 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4039,7 +4039,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
4039 goto fail; 4039 goto fail;
4040 4040
4041 if (hcd->phy && !hdev->parent) 4041 if (hcd->phy && !hdev->parent)
4042 usb_phy_notify_connect(hcd->phy, port1); 4042 usb_phy_notify_connect(hcd->phy, udev->speed);
4043 4043
4044 /* 4044 /*
4045 * Some superspeed devices have finished the link training process 4045 * Some superspeed devices have finished the link training process
@@ -4238,7 +4238,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
4238 if (udev) { 4238 if (udev) {
4239 if (hcd->phy && !hdev->parent && 4239 if (hcd->phy && !hdev->parent &&
4240 !(portstatus & USB_PORT_STAT_CONNECTION)) 4240 !(portstatus & USB_PORT_STAT_CONNECTION))
4241 usb_phy_notify_disconnect(hcd->phy, port1); 4241 usb_phy_notify_disconnect(hcd->phy, udev->speed);
4242 usb_disconnect(&hub->ports[port1 - 1]->child); 4242 usb_disconnect(&hub->ports[port1 - 1]->child);
4243 } 4243 }
4244 clear_bit(port1, hub->change_bits); 4244 clear_bit(port1, hub->change_bits);
diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
index 5b09f3339ded..9a3caeecc508 100644
--- a/drivers/usb/otg/mxs-phy.c
+++ b/drivers/usb/otg/mxs-phy.c
@@ -76,22 +76,28 @@ static void mxs_phy_shutdown(struct usb_phy *phy)
76 clk_disable_unprepare(mxs_phy->clk); 76 clk_disable_unprepare(mxs_phy->clk);
77} 77}
78 78
79static int mxs_phy_on_connect(struct usb_phy *phy, int port) 79static int mxs_phy_on_connect(struct usb_phy *phy,
80 enum usb_device_speed speed)
80{ 81{
81 dev_dbg(phy->dev, "Connect on port %d\n", port); 82 dev_dbg(phy->dev, "%s speed device has connected\n",
83 (speed == USB_SPEED_HIGH) ? "high" : "non-high");
82 84
83 writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, 85 if (speed == USB_SPEED_HIGH)
84 phy->io_priv + HW_USBPHY_CTRL_SET); 86 writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
87 phy->io_priv + HW_USBPHY_CTRL_SET);
85 88
86 return 0; 89 return 0;
87} 90}
88 91
89static int mxs_phy_on_disconnect(struct usb_phy *phy, int port) 92static int mxs_phy_on_disconnect(struct usb_phy *phy,
93 enum usb_device_speed speed)
90{ 94{
91 dev_dbg(phy->dev, "Disconnect on port %d\n", port); 95 dev_dbg(phy->dev, "%s speed device has disconnected\n",
96 (speed == USB_SPEED_HIGH) ? "high" : "non-high");
92 97
93 writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, 98 if (speed == USB_SPEED_HIGH)
94 phy->io_priv + HW_USBPHY_CTRL_CLR); 99 writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
100 phy->io_priv + HW_USBPHY_CTRL_CLR);
95 101
96 return 0; 102 return 0;
97} 103}
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 06b5bae35b29..a29ae1eb9346 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -10,6 +10,7 @@
10#define __LINUX_USB_PHY_H 10#define __LINUX_USB_PHY_H
11 11
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/usb.h>
13 14
14enum usb_phy_events { 15enum usb_phy_events {
15 USB_EVENT_NONE, /* no events or cable disconnected */ 16 USB_EVENT_NONE, /* no events or cable disconnected */
@@ -99,8 +100,10 @@ struct usb_phy {
99 int suspend); 100 int suspend);
100 101
101 /* notify phy connect status change */ 102 /* notify phy connect status change */
102 int (*notify_connect)(struct usb_phy *x, int port); 103 int (*notify_connect)(struct usb_phy *x,
103 int (*notify_disconnect)(struct usb_phy *x, int port); 104 enum usb_device_speed speed);
105 int (*notify_disconnect)(struct usb_phy *x,
106 enum usb_device_speed speed);
104}; 107};
105 108
106 109
@@ -189,19 +192,19 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
189} 192}
190 193
191static inline int 194static inline int
192usb_phy_notify_connect(struct usb_phy *x, int port) 195usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
193{ 196{
194 if (x->notify_connect) 197 if (x->notify_connect)
195 return x->notify_connect(x, port); 198 return x->notify_connect(x, speed);
196 else 199 else
197 return 0; 200 return 0;
198} 201}
199 202
200static inline int 203static inline int
201usb_phy_notify_disconnect(struct usb_phy *x, int port) 204usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed)
202{ 205{
203 if (x->notify_disconnect) 206 if (x->notify_disconnect)
204 return x->notify_disconnect(x, port); 207 return x->notify_disconnect(x, speed);
205 else 208 else
206 return 0; 209 return 0;
207} 210}