提交 ee4ecb8a 编写于 作者: O Oliver Neukum 提交者: Greg Kroah-Hartman

USB: work around for EHCI with quirky periodic schedules

a quirky chipset needs periodic schedules to run for a minimum
time before they can be disabled again. This enforces the requirement
with a time stamp and a calculated delay
Signed-off-by: NOliver Neukum <oliver@neukum.org>
Cc: stable <stable@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 8d6499e5
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/ktime.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/usb.h> #include <linux/usb.h>
...@@ -676,6 +677,7 @@ static int ehci_run (struct usb_hcd *hcd) ...@@ -676,6 +677,7 @@ static int ehci_run (struct usb_hcd *hcd)
ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
msleep(5); msleep(5);
up_write(&ehci_cf_port_reset_rwsem); up_write(&ehci_cf_port_reset_rwsem);
ehci->last_periodic_enable = ktime_get_real();
temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase));
ehci_info (ehci, ehci_info (ehci,
......
...@@ -111,6 +111,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd) ...@@ -111,6 +111,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
switch (pdev->vendor) { switch (pdev->vendor) {
case PCI_VENDOR_ID_INTEL: case PCI_VENDOR_ID_INTEL:
ehci->need_io_watchdog = 0; ehci->need_io_watchdog = 0;
if (pdev->device == 0x27cc) {
ehci->broken_periodic = 1;
ehci_info(ehci, "using broken periodic workaround\n");
}
break; break;
case PCI_VENDOR_ID_TDI: case PCI_VENDOR_ID_TDI:
if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
......
...@@ -475,6 +475,8 @@ static int enable_periodic (struct ehci_hcd *ehci) ...@@ -475,6 +475,8 @@ static int enable_periodic (struct ehci_hcd *ehci)
/* make sure ehci_work scans these */ /* make sure ehci_work scans these */
ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index) ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index)
% (ehci->periodic_size << 3); % (ehci->periodic_size << 3);
if (unlikely(ehci->broken_periodic))
ehci->last_periodic_enable = ktime_get_real();
return 0; return 0;
} }
...@@ -486,6 +488,16 @@ static int disable_periodic (struct ehci_hcd *ehci) ...@@ -486,6 +488,16 @@ static int disable_periodic (struct ehci_hcd *ehci)
if (--ehci->periodic_sched) if (--ehci->periodic_sched)
return 0; return 0;
if (unlikely(ehci->broken_periodic)) {
/* delay experimentally determined */
ktime_t safe = ktime_add_us(ehci->last_periodic_enable, 1000);
ktime_t now = ktime_get_real();
s64 delay = ktime_us_delta(safe, now);
if (unlikely(delay > 0))
udelay(delay);
}
/* did setting PSE not take effect yet? /* did setting PSE not take effect yet?
* takes effect only at frame boundaries... * takes effect only at frame boundaries...
*/ */
......
...@@ -118,6 +118,7 @@ struct ehci_hcd { /* one per controller */ ...@@ -118,6 +118,7 @@ struct ehci_hcd { /* one per controller */
unsigned stamp; unsigned stamp;
unsigned random_frame; unsigned random_frame;
unsigned long next_statechange; unsigned long next_statechange;
ktime_t last_periodic_enable;
u32 command; u32 command;
/* SILICON QUIRKS */ /* SILICON QUIRKS */
...@@ -127,6 +128,7 @@ struct ehci_hcd { /* one per controller */ ...@@ -127,6 +128,7 @@ struct ehci_hcd { /* one per controller */
unsigned big_endian_desc:1; unsigned big_endian_desc:1;
unsigned has_amcc_usb23:1; unsigned has_amcc_usb23:1;
unsigned need_io_watchdog:1; unsigned need_io_watchdog:1;
unsigned broken_periodic:1;
/* required for usb32 quirk */ /* required for usb32 quirk */
#define OHCI_CTRL_HCFS (3 << 6) #define OHCI_CTRL_HCFS (3 << 6)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册