Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 565227c0 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Greg Kroah-Hartman
Browse files

usb: Remove broken optimisation in OHCI IRQ handler



The OHCI IRQ handler has an optimisation that avoids reading some
chip registers when the controller reports that the interrupt was
triggered *only* because completed requests were written into the
controller's "done list" and handed to the host.

This mechanism can't be used on some controllers.  Among others, it
fails for the SA1111 and the AMCC 440EP PowerPC processor.

This patch removes the optimisation and makes the code clearer.

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 08cbc706
Loading
Loading
Loading
Loading
+13 −10
Original line number Original line Diff line number Diff line
@@ -732,24 +732,27 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd)
	struct ohci_regs __iomem *regs = ohci->regs;
	struct ohci_regs __iomem *regs = ohci->regs;
	int			ints;
	int			ints;


	/* we can eliminate a (slow) ohci_readl()
	/* Read interrupt status (and flush pending writes).  We ignore the
	 * if _only_ WDH caused this irq
	 * optimization of checking the LSB of hcca->done_head; it doesn't
	 * work on all systems (edge triggering for OHCI can be a factor).
	 */
	 */
	if ((ohci->hcca->done_head != 0)
	ints = ohci_readl(ohci, &regs->intrstatus);
			&& ! (hc32_to_cpup (ohci, &ohci->hcca->done_head)
				& 0x01)) {
		ints =  OHCI_INTR_WDH;


	/* cardbus/... hardware gone before remove() */
	/* Check for an all 1's result which is a typical consequence
	} else if ((ints = ohci_readl (ohci, &regs->intrstatus)) == ~(u32)0) {
	 * of dead, unclocked, or unplugged (CardBus...) devices
	 */
	if (ints == ~(u32)0) {
		disable (ohci);
		disable (ohci);
		ohci_dbg (ohci, "device removed!\n");
		ohci_dbg (ohci, "device removed!\n");
		return IRQ_HANDLED;
		return IRQ_HANDLED;
	}

	/* We only care about interrupts that are enabled */
	ints &= ohci_readl(ohci, &regs->intrenable);


	/* interrupt for some other device? */
	/* interrupt for some other device? */
	} else if ((ints &= ohci_readl (ohci, &regs->intrenable)) == 0) {
	if (ints == 0)
		return IRQ_NOTMINE;
		return IRQ_NOTMINE;
	}


	if (ints & OHCI_INTR_UE) {
	if (ints & OHCI_INTR_UE) {
		// e.g. due to PCI Master/Target Abort
		// e.g. due to PCI Master/Target Abort