aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-03-18 03:37:55 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-18 03:37:55 -0400
commit577f99c1d08cf9cbdafd4e858dd13ff04d855090 (patch)
tree0f726bbda9b18d311d4c95198bbd96cb7ac01db0 /drivers/usb/host
parent26c0f03f6b77c513cb7bc37b73a06819bdbb791b (diff)
parent2f633928cbba8a5858bb39b11e7219a41b0fbef5 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/wireless/rt2x00/rt2x00dev.c net/8021q/vlan_dev.c
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-hcd.c62
-rw-r--r--drivers/usb/host/ehci-q.c2
-rw-r--r--drivers/usb/host/isp116x-hcd.c15
-rw-r--r--drivers/usb/host/isp116x.h1
4 files changed, 53 insertions, 27 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index b8ad55aff842..46ee7f4c0912 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -281,23 +281,44 @@ static void ehci_iaa_watchdog(unsigned long param)
281{ 281{
282 struct ehci_hcd *ehci = (struct ehci_hcd *) param; 282 struct ehci_hcd *ehci = (struct ehci_hcd *) param;
283 unsigned long flags; 283 unsigned long flags;
284 u32 status, cmd;
285 284
286 spin_lock_irqsave (&ehci->lock, flags); 285 spin_lock_irqsave (&ehci->lock, flags);
287 WARN_ON(!ehci->reclaim);
288 286
289 status = ehci_readl(ehci, &ehci->regs->status); 287 /* Lost IAA irqs wedge things badly; seen first with a vt8235.
290 cmd = ehci_readl(ehci, &ehci->regs->command); 288 * So we need this watchdog, but must protect it against both
291 ehci_dbg(ehci, "IAA watchdog: status %x cmd %x\n", status, cmd); 289 * (a) SMP races against real IAA firing and retriggering, and
292 290 * (b) clean HC shutdown, when IAA watchdog was pending.
293 /* lost IAA irqs wedge things badly; seen first with a vt8235 */ 291 */
294 if (ehci->reclaim) { 292 if (ehci->reclaim
295 if (status & STS_IAA) { 293 && !timer_pending(&ehci->iaa_watchdog)
296 ehci_vdbg (ehci, "lost IAA\n"); 294 && HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) {
295 u32 cmd, status;
296
297 /* If we get here, IAA is *REALLY* late. It's barely
298 * conceivable that the system is so busy that CMD_IAAD
299 * is still legitimately set, so let's be sure it's
300 * clear before we read STS_IAA. (The HC should clear
301 * CMD_IAAD when it sets STS_IAA.)
302 */
303 cmd = ehci_readl(ehci, &ehci->regs->command);
304 if (cmd & CMD_IAAD)
305 ehci_writel(ehci, cmd & ~CMD_IAAD,
306 &ehci->regs->command);
307
308 /* If IAA is set here it either legitimately triggered
309 * before we cleared IAAD above (but _way_ late, so we'll
310 * still count it as lost) ... or a silicon erratum:
311 * - VIA seems to set IAA without triggering the IRQ;
312 * - IAAD potentially cleared without setting IAA.
313 */
314 status = ehci_readl(ehci, &ehci->regs->status);
315 if ((status & STS_IAA) || !(cmd & CMD_IAAD)) {
297 COUNT (ehci->stats.lost_iaa); 316 COUNT (ehci->stats.lost_iaa);
298 ehci_writel(ehci, STS_IAA, &ehci->regs->status); 317 ehci_writel(ehci, STS_IAA, &ehci->regs->status);
299 } 318 }
300 ehci_writel(ehci, cmd & ~CMD_IAAD, &ehci->regs->command); 319
320 ehci_vdbg(ehci, "IAA watchdog: status %x cmd %x\n",
321 status, cmd);
301 end_unlink_async(ehci); 322 end_unlink_async(ehci);
302 } 323 }
303 324
@@ -631,7 +652,7 @@ static int ehci_run (struct usb_hcd *hcd)
631static irqreturn_t ehci_irq (struct usb_hcd *hcd) 652static irqreturn_t ehci_irq (struct usb_hcd *hcd)
632{ 653{
633 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 654 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
634 u32 status, pcd_status = 0; 655 u32 status, pcd_status = 0, cmd;
635 int bh; 656 int bh;
636 657
637 spin_lock (&ehci->lock); 658 spin_lock (&ehci->lock);
@@ -652,7 +673,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
652 673
653 /* clear (just) interrupts */ 674 /* clear (just) interrupts */
654 ehci_writel(ehci, status, &ehci->regs->status); 675 ehci_writel(ehci, status, &ehci->regs->status);
655 ehci_readl(ehci, &ehci->regs->command); /* unblock posted write */ 676 cmd = ehci_readl(ehci, &ehci->regs->command);
656 bh = 0; 677 bh = 0;
657 678
658#ifdef EHCI_VERBOSE_DEBUG 679#ifdef EHCI_VERBOSE_DEBUG
@@ -673,8 +694,17 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
673 694
674 /* complete the unlinking of some qh [4.15.2.3] */ 695 /* complete the unlinking of some qh [4.15.2.3] */
675 if (status & STS_IAA) { 696 if (status & STS_IAA) {
676 COUNT (ehci->stats.reclaim); 697 /* guard against (alleged) silicon errata */
677 end_unlink_async(ehci); 698 if (cmd & CMD_IAAD) {
699 ehci_writel(ehci, cmd & ~CMD_IAAD,
700 &ehci->regs->command);
701 ehci_dbg(ehci, "IAA with IAAD still set?\n");
702 }
703 if (ehci->reclaim) {
704 COUNT(ehci->stats.reclaim);
705 end_unlink_async(ehci);
706 } else
707 ehci_dbg(ehci, "IAA with nothing to reclaim?\n");
678 } 708 }
679 709
680 /* remote wakeup [4.3.1] */ 710 /* remote wakeup [4.3.1] */
@@ -781,7 +811,7 @@ static int ehci_urb_enqueue (
781static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) 811static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
782{ 812{
783 /* failfast */ 813 /* failfast */
784 if (!HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) 814 if (!HC_IS_RUNNING(ehci_to_hcd(ehci)->state) && ehci->reclaim)
785 end_unlink_async(ehci); 815 end_unlink_async(ehci);
786 816
787 /* if it's not linked then there's nothing to do */ 817 /* if it's not linked then there's nothing to do */
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 776a97f33914..2e49de820b14 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -319,10 +319,10 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
319 if (likely (last->urb != urb)) { 319 if (likely (last->urb != urb)) {
320 ehci_urb_done(ehci, last->urb, last_status); 320 ehci_urb_done(ehci, last->urb, last_status);
321 count++; 321 count++;
322 last_status = -EINPROGRESS;
322 } 323 }
323 ehci_qtd_free (ehci, last); 324 ehci_qtd_free (ehci, last);
324 last = NULL; 325 last = NULL;
325 last_status = -EINPROGRESS;
326 } 326 }
327 327
328 /* ignore urbs submitted during completions we reported */ 328 /* ignore urbs submitted during completions we reported */
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 0130fd8571e4..d7071c855758 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -911,8 +911,7 @@ static int isp116x_hub_status_data(struct usb_hcd *hcd, char *buf)
911 buf[0] = 0; 911 buf[0] = 0;
912 912
913 for (i = 0; i < ports; i++) { 913 for (i = 0; i < ports; i++) {
914 u32 status = isp116x->rhport[i] = 914 u32 status = isp116x_read_reg32(isp116x, i ? HCRHPORT2 : HCRHPORT1);
915 isp116x_read_reg32(isp116x, i ? HCRHPORT2 : HCRHPORT1);
916 915
917 if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC 916 if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC
918 | RH_PS_OCIC | RH_PS_PRSC)) { 917 | RH_PS_OCIC | RH_PS_PRSC)) {
@@ -1031,7 +1030,9 @@ static int isp116x_hub_control(struct usb_hcd *hcd,
1031 DBG("GetPortStatus\n"); 1030 DBG("GetPortStatus\n");
1032 if (!wIndex || wIndex > ports) 1031 if (!wIndex || wIndex > ports)
1033 goto error; 1032 goto error;
1034 tmp = isp116x->rhport[--wIndex]; 1033 spin_lock_irqsave(&isp116x->lock, flags);
1034 tmp = isp116x_read_reg32(isp116x, (--wIndex) ? HCRHPORT2 : HCRHPORT1);
1035 spin_unlock_irqrestore(&isp116x->lock, flags);
1035 *(__le32 *) buf = cpu_to_le32(tmp); 1036 *(__le32 *) buf = cpu_to_le32(tmp);
1036 DBG("GetPortStatus: port[%d] %08x\n", wIndex + 1, tmp); 1037 DBG("GetPortStatus: port[%d] %08x\n", wIndex + 1, tmp);
1037 break; 1038 break;
@@ -1080,8 +1081,6 @@ static int isp116x_hub_control(struct usb_hcd *hcd,
1080 spin_lock_irqsave(&isp116x->lock, flags); 1081 spin_lock_irqsave(&isp116x->lock, flags);
1081 isp116x_write_reg32(isp116x, wIndex 1082 isp116x_write_reg32(isp116x, wIndex
1082 ? HCRHPORT2 : HCRHPORT1, tmp); 1083 ? HCRHPORT2 : HCRHPORT1, tmp);
1083 isp116x->rhport[wIndex] =
1084 isp116x_read_reg32(isp116x, wIndex ? HCRHPORT2 : HCRHPORT1);
1085 spin_unlock_irqrestore(&isp116x->lock, flags); 1084 spin_unlock_irqrestore(&isp116x->lock, flags);
1086 break; 1085 break;
1087 case SetPortFeature: 1086 case SetPortFeature:
@@ -1095,24 +1094,22 @@ static int isp116x_hub_control(struct usb_hcd *hcd,
1095 spin_lock_irqsave(&isp116x->lock, flags); 1094 spin_lock_irqsave(&isp116x->lock, flags);
1096 isp116x_write_reg32(isp116x, wIndex 1095 isp116x_write_reg32(isp116x, wIndex
1097 ? HCRHPORT2 : HCRHPORT1, RH_PS_PSS); 1096 ? HCRHPORT2 : HCRHPORT1, RH_PS_PSS);
1097 spin_unlock_irqrestore(&isp116x->lock, flags);
1098 break; 1098 break;
1099 case USB_PORT_FEAT_POWER: 1099 case USB_PORT_FEAT_POWER:
1100 DBG("USB_PORT_FEAT_POWER\n"); 1100 DBG("USB_PORT_FEAT_POWER\n");
1101 spin_lock_irqsave(&isp116x->lock, flags); 1101 spin_lock_irqsave(&isp116x->lock, flags);
1102 isp116x_write_reg32(isp116x, wIndex 1102 isp116x_write_reg32(isp116x, wIndex
1103 ? HCRHPORT2 : HCRHPORT1, RH_PS_PPS); 1103 ? HCRHPORT2 : HCRHPORT1, RH_PS_PPS);
1104 spin_unlock_irqrestore(&isp116x->lock, flags);
1104 break; 1105 break;
1105 case USB_PORT_FEAT_RESET: 1106 case USB_PORT_FEAT_RESET:
1106 DBG("USB_PORT_FEAT_RESET\n"); 1107 DBG("USB_PORT_FEAT_RESET\n");
1107 root_port_reset(isp116x, wIndex); 1108 root_port_reset(isp116x, wIndex);
1108 spin_lock_irqsave(&isp116x->lock, flags);
1109 break; 1109 break;
1110 default: 1110 default:
1111 goto error; 1111 goto error;
1112 } 1112 }
1113 isp116x->rhport[wIndex] =
1114 isp116x_read_reg32(isp116x, wIndex ? HCRHPORT2 : HCRHPORT1);
1115 spin_unlock_irqrestore(&isp116x->lock, flags);
1116 break; 1113 break;
1117 1114
1118 default: 1115 default:
diff --git a/drivers/usb/host/isp116x.h b/drivers/usb/host/isp116x.h
index b91e2edd9c5c..595b90a99848 100644
--- a/drivers/usb/host/isp116x.h
+++ b/drivers/usb/host/isp116x.h
@@ -270,7 +270,6 @@ struct isp116x {
270 u32 rhdesca; 270 u32 rhdesca;
271 u32 rhdescb; 271 u32 rhdescb;
272 u32 rhstatus; 272 u32 rhstatus;
273 u32 rhport[2];
274 273
275 /* async schedule: control, bulk */ 274 /* async schedule: control, bulk */
276 struct list_head async; 275 struct list_head async;