diff options
Diffstat (limited to 'drivers/usb/host/xhci-hub.c')
-rw-r--r-- | drivers/usb/host/xhci-hub.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 208b805b80eb..a1a7a9795536 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -64,15 +64,15 @@ static void xhci_hub_descriptor(struct xhci_hcd *xhci, | |||
64 | static unsigned int xhci_port_speed(unsigned int port_status) | 64 | static unsigned int xhci_port_speed(unsigned int port_status) |
65 | { | 65 | { |
66 | if (DEV_LOWSPEED(port_status)) | 66 | if (DEV_LOWSPEED(port_status)) |
67 | return 1 << USB_PORT_FEAT_LOWSPEED; | 67 | return USB_PORT_STAT_LOW_SPEED; |
68 | if (DEV_HIGHSPEED(port_status)) | 68 | if (DEV_HIGHSPEED(port_status)) |
69 | return 1 << USB_PORT_FEAT_HIGHSPEED; | 69 | return USB_PORT_STAT_HIGH_SPEED; |
70 | if (DEV_SUPERSPEED(port_status)) | 70 | if (DEV_SUPERSPEED(port_status)) |
71 | return 1 << USB_PORT_FEAT_SUPERSPEED; | 71 | return USB_PORT_STAT_SUPER_SPEED; |
72 | /* | 72 | /* |
73 | * FIXME: Yes, we should check for full speed, but the core uses that as | 73 | * FIXME: Yes, we should check for full speed, but the core uses that as |
74 | * a default in portspeed() in usb/core/hub.c (which is the only place | 74 | * a default in portspeed() in usb/core/hub.c (which is the only place |
75 | * USB_PORT_FEAT_*SPEED is used). | 75 | * USB_PORT_STAT_*_SPEED is used). |
76 | */ | 76 | */ |
77 | return 0; | 77 | return 0; |
78 | } | 78 | } |
@@ -205,27 +205,27 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
205 | 205 | ||
206 | /* wPortChange bits */ | 206 | /* wPortChange bits */ |
207 | if (temp & PORT_CSC) | 207 | if (temp & PORT_CSC) |
208 | status |= 1 << USB_PORT_FEAT_C_CONNECTION; | 208 | status |= USB_PORT_STAT_C_CONNECTION << 16; |
209 | if (temp & PORT_PEC) | 209 | if (temp & PORT_PEC) |
210 | status |= 1 << USB_PORT_FEAT_C_ENABLE; | 210 | status |= USB_PORT_STAT_C_ENABLE << 16; |
211 | if ((temp & PORT_OCC)) | 211 | if ((temp & PORT_OCC)) |
212 | status |= 1 << USB_PORT_FEAT_C_OVER_CURRENT; | 212 | status |= USB_PORT_STAT_C_OVERCURRENT << 16; |
213 | /* | 213 | /* |
214 | * FIXME ignoring suspend, reset, and USB 2.1/3.0 specific | 214 | * FIXME ignoring suspend, reset, and USB 2.1/3.0 specific |
215 | * changes | 215 | * changes |
216 | */ | 216 | */ |
217 | if (temp & PORT_CONNECT) { | 217 | if (temp & PORT_CONNECT) { |
218 | status |= 1 << USB_PORT_FEAT_CONNECTION; | 218 | status |= USB_PORT_STAT_CONNECTION; |
219 | status |= xhci_port_speed(temp); | 219 | status |= xhci_port_speed(temp); |
220 | } | 220 | } |
221 | if (temp & PORT_PE) | 221 | if (temp & PORT_PE) |
222 | status |= 1 << USB_PORT_FEAT_ENABLE; | 222 | status |= USB_PORT_STAT_ENABLE; |
223 | if (temp & PORT_OC) | 223 | if (temp & PORT_OC) |
224 | status |= 1 << USB_PORT_FEAT_OVER_CURRENT; | 224 | status |= USB_PORT_STAT_OVERCURRENT; |
225 | if (temp & PORT_RESET) | 225 | if (temp & PORT_RESET) |
226 | status |= 1 << USB_PORT_FEAT_RESET; | 226 | status |= USB_PORT_STAT_RESET; |
227 | if (temp & PORT_POWER) | 227 | if (temp & PORT_POWER) |
228 | status |= 1 << USB_PORT_FEAT_POWER; | 228 | status |= USB_PORT_STAT_POWER; |
229 | xhci_dbg(xhci, "Get port status returned 0x%x\n", status); | 229 | xhci_dbg(xhci, "Get port status returned 0x%x\n", status); |
230 | put_unaligned(cpu_to_le32(status), (__le32 *) buf); | 230 | put_unaligned(cpu_to_le32(status), (__le32 *) buf); |
231 | break; | 231 | break; |
@@ -298,7 +298,6 @@ error: | |||
298 | * Returns 0 if the status hasn't changed, or the number of bytes in buf. | 298 | * Returns 0 if the status hasn't changed, or the number of bytes in buf. |
299 | * Ports are 0-indexed from the HCD point of view, | 299 | * Ports are 0-indexed from the HCD point of view, |
300 | * and 1-indexed from the USB core pointer of view. | 300 | * and 1-indexed from the USB core pointer of view. |
301 | * xHCI instances can have up to 127 ports, so FIXME if you see more than 15. | ||
302 | * | 301 | * |
303 | * Note that the status change bits will be cleared as soon as a port status | 302 | * Note that the status change bits will be cleared as soon as a port status |
304 | * change event is generated, so we use the saved status from that event. | 303 | * change event is generated, so we use the saved status from that event. |
@@ -315,14 +314,9 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
315 | ports = HCS_MAX_PORTS(xhci->hcs_params1); | 314 | ports = HCS_MAX_PORTS(xhci->hcs_params1); |
316 | 315 | ||
317 | /* Initial status is no changes */ | 316 | /* Initial status is no changes */ |
318 | buf[0] = 0; | 317 | retval = (ports + 8) / 8; |
318 | memset(buf, 0, retval); | ||
319 | status = 0; | 319 | status = 0; |
320 | if (ports > 7) { | ||
321 | buf[1] = 0; | ||
322 | retval = 2; | ||
323 | } else { | ||
324 | retval = 1; | ||
325 | } | ||
326 | 320 | ||
327 | spin_lock_irqsave(&xhci->lock, flags); | 321 | spin_lock_irqsave(&xhci->lock, flags); |
328 | /* For each port, did anything change? If so, set that bit in buf. */ | 322 | /* For each port, did anything change? If so, set that bit in buf. */ |
@@ -331,10 +325,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
331 | NUM_PORT_REGS*i; | 325 | NUM_PORT_REGS*i; |
332 | temp = xhci_readl(xhci, addr); | 326 | temp = xhci_readl(xhci, addr); |
333 | if (temp & (PORT_CSC | PORT_PEC | PORT_OCC)) { | 327 | if (temp & (PORT_CSC | PORT_PEC | PORT_OCC)) { |
334 | if (i < 7) | 328 | buf[(i + 1) / 8] |= 1 << (i + 1) % 8; |
335 | buf[0] |= 1 << (i + 1); | ||
336 | else | ||
337 | buf[1] |= 1 << (i - 7); | ||
338 | status = 1; | 329 | status = 1; |
339 | } | 330 | } |
340 | } | 331 | } |