hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/usb/host/ehci-hcd.c
....@@ -560,7 +560,7 @@
560560 ehci->command = temp;
561561
562562 /* Accept arbitrarily long scatter-gather lists */
563
- if (!(hcd->driver->flags & HCD_LOCAL_MEM))
563
+ if (!hcd->localmem_pool)
564564 hcd->self.sg_tablesize = ~0;
565565
566566 /* Prepare for unlinking active QHs */
....@@ -712,7 +712,8 @@
712712 static irqreturn_t ehci_irq (struct usb_hcd *hcd)
713713 {
714714 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
715
- u32 status, masked_status, pcd_status = 0, cmd;
715
+ u32 status, current_status, masked_status, pcd_status = 0;
716
+ u32 cmd;
716717 int bh;
717718 unsigned long flags;
718719
....@@ -724,37 +725,48 @@
724725 */
725726 spin_lock_irqsave(&ehci->lock, flags);
726727
727
- status = ehci_readl(ehci, &ehci->regs->status);
728
+ status = 0;
729
+ current_status = ehci_readl(ehci, &ehci->regs->status);
730
+restart:
728731
729732 /* e.g. cardbus physical eject */
730
- if (status == ~(u32) 0) {
733
+ if (current_status == ~(u32) 0) {
731734 ehci_dbg (ehci, "device removed\n");
732735 goto dead;
733736 }
737
+ status |= current_status;
734738
735739 /*
736740 * We don't use STS_FLR, but some controllers don't like it to
737741 * remain on, so mask it out along with the other status bits.
738742 */
739
- masked_status = status & (INTR_MASK | STS_FLR);
743
+ masked_status = current_status & (INTR_MASK | STS_FLR);
740744
741745 /* Shared IRQ? */
742746 if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) {
747
+ if (masked_status)
748
+ ehci_writel(ehci, masked_status, &ehci->regs->status);
743749 spin_unlock_irqrestore(&ehci->lock, flags);
744750 return IRQ_NONE;
745751 }
746752
747753 /* clear (just) interrupts */
748754 ehci_writel(ehci, masked_status, &ehci->regs->status);
755
+
756
+ /* For edge interrupts, don't race with an interrupt bit being raised */
757
+ current_status = ehci_readl(ehci, &ehci->regs->status);
758
+ if (current_status & INTR_MASK)
759
+ goto restart;
760
+
749761 cmd = ehci_readl(ehci, &ehci->regs->command);
750762 bh = 0;
751763
752764 /* normal [4.15.1.2] or error [4.15.1.1] completion */
753765 if (likely ((status & (STS_INT|STS_ERR)) != 0)) {
754766 if (likely ((status & STS_ERR) == 0))
755
- COUNT (ehci->stats.normal);
767
+ INCR(ehci->stats.normal);
756768 else
757
- COUNT (ehci->stats.error);
769
+ INCR(ehci->stats.error);
758770 bh = 1;
759771 }
760772
....@@ -778,7 +790,7 @@
778790 if (cmd & CMD_IAAD)
779791 ehci_dbg(ehci, "IAA with IAAD still set?\n");
780792 if (ehci->iaa_in_progress)
781
- COUNT(ehci->stats.iaa);
793
+ INCR(ehci->stats.iaa);
782794 end_iaa_cycle(ehci);
783795 }
784796
....@@ -1004,7 +1016,7 @@
10041016 start_unlink_async(ehci, qh);
10051017 else
10061018 start_unlink_intr(ehci, qh);
1007
- /* FALL THROUGH */
1019
+ fallthrough;
10081020 case QH_STATE_COMPLETING: /* already in unlinking */
10091021 case QH_STATE_UNLINK: /* wait for hw to finish? */
10101022 case QH_STATE_UNLINK_WAIT:
....@@ -1021,7 +1033,7 @@
10211033 qh_destroy(ehci, qh);
10221034 break;
10231035 }
1024
- /* fall through */
1036
+ fallthrough;
10251037 default:
10261038 /* caller was supposed to have unlinked any requests;
10271039 * that's not our job. just leak this memory.
....@@ -1215,7 +1227,7 @@
12151227 * generic hardware linkage
12161228 */
12171229 .irq = ehci_irq,
1218
- .flags = HCD_MEMORY | HCD_USB2 | HCD_BH,
1230
+ .flags = HCD_MEMORY | HCD_DMA | HCD_USB2 | HCD_BH,
12191231
12201232 /*
12211233 * basic lifecycle operations
....@@ -1306,11 +1318,6 @@
13061318 #ifdef CONFIG_SPARC_LEON
13071319 #include "ehci-grlib.c"
13081320 #define PLATFORM_DRIVER ehci_grlib_driver
1309
-#endif
1310
-
1311
-#ifdef CONFIG_USB_EHCI_MV
1312
-#include "ehci-mv.c"
1313
-#define PLATFORM_DRIVER ehci_mv_driver
13141321 #endif
13151322
13161323 static int __init ehci_hcd_init(void)