Skip to content

Commit

Permalink
usb: host: ohci-at91: suspend/resume ports after/before OHCI accesses
Browse files Browse the repository at this point in the history
commit 00de6a5 upstream.

On SAMA7G5 suspending ports will cut the access to OHCI registers and
any subsequent access to them will lead to CPU being blocked trying to
access that memory. Same thing happens on resume: if OHCI memory is
accessed before resuming ports the CPU will block on that access. The
OCHI memory is accessed on suspend/resume though
ohci_suspend()/ohci_resume().

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210721132905.1970713-1-claudiu.beznea@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
claudiubeznea authored and gregkh committed Aug 12, 2021
1 parent 74cd646 commit f6f2d87
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/usb/host/ohci-at91.c
Expand Up @@ -611,8 +611,6 @@ ohci_hcd_at91_drv_suspend(struct device *dev)
if (ohci_at91->wakeup)
enable_irq_wake(hcd->irq);

ohci_at91_port_suspend(ohci_at91->sfr_regmap, 1);

ret = ohci_suspend(hcd, ohci_at91->wakeup);
if (ret) {
if (ohci_at91->wakeup)
Expand All @@ -632,7 +630,10 @@ ohci_hcd_at91_drv_suspend(struct device *dev)
/* flush the writes */
(void) ohci_readl (ohci, &ohci->regs->control);
msleep(1);
ohci_at91_port_suspend(ohci_at91->sfr_regmap, 1);
at91_stop_clock(ohci_at91);
} else {
ohci_at91_port_suspend(ohci_at91->sfr_regmap, 1);
}

return ret;
Expand All @@ -644,15 +645,15 @@ ohci_hcd_at91_drv_resume(struct device *dev)
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);

ohci_at91_port_suspend(ohci_at91->sfr_regmap, 0);

if (ohci_at91->wakeup)
disable_irq_wake(hcd->irq);
else
at91_start_clock(ohci_at91);

ohci_resume(hcd, false);

ohci_at91_port_suspend(ohci_at91->sfr_regmap, 0);

return 0;
}

Expand Down

0 comments on commit f6f2d87

Please sign in to comment.