Skip to content

Commit

Permalink
malta uhci quirks: make allowance for slow 4k(e)c
Browse files Browse the repository at this point in the history
This works around an unexpected IRQ torvalds#255 seen during initial USB host
mass storage device initialization and access.
* wait up to 50us for HCRESET to clear, a slow 4kc needs a longer time.
* leave FSBR enabled so that a slow 4kec/24kec will not be overwhelmed.

Signed-off-by: <weixing.shil@windriver.com> Weixing Shi
Signed-off-by: <bruce.ashfield@windriver.com> Bruce Ashfield
  • Loading branch information
Weixing Shi authored and zeddii committed Sep 21, 2023
1 parent d09eb27 commit 79afea1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 12 additions & 2 deletions drivers/usb/host/pci-quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,9 @@ EXPORT_SYMBOL_GPL(usb_amd_pt_check_port);
*/
void uhci_reset_hc(struct pci_dev *pdev, unsigned long base)
{
#ifdef CONFIG_MIPS_MALTA
int timeout = 10;
#endif
/* Turn off PIRQ enable and SMI enable. (This also turns off the
* BIOS's USB Legacy Support.) Turn off all the R/WC bits too.
*/
Expand All @@ -650,9 +653,16 @@ void uhci_reset_hc(struct pci_dev *pdev, unsigned long base)
outw(UHCI_USBCMD_HCRESET, base + UHCI_USBCMD);
mb();
udelay(5);
if (inw(base + UHCI_USBCMD) & UHCI_USBCMD_HCRESET)
dev_warn(&pdev->dev, "HCRESET not completed yet!\n");

#ifdef CONFIG_MIPS_MALTA
while (inw(base + UHCI_USBCMD) & UHCI_USBCMD_HCRESET) {
if (--timeout < 0) {
dev_warn(&pdev->dev, "HCRESET timed out!\n");
break;
}
udelay(5);
}
#endif
/* Just to be safe, disable interrupt requests and
* make sure the controller is stopped.
*/
Expand Down
4 changes: 3 additions & 1 deletion drivers/usb/host/uhci-q.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ static void uhci_fsbr_off(struct uhci_hcd *uhci)
static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb)
{
struct urb_priv *urbp = urb->hcpriv;

#ifdef CONFIG_MIPS_MALTA
return;
#endif
urbp->fsbr = 1;
}

Expand Down

0 comments on commit 79afea1

Please sign in to comment.