aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/host/ehci-hcd.c2
-rw-r--r--drivers/usb/host/ehci-q.c17
-rw-r--r--drivers/usb/host/ehci.h5
3 files changed, 14 insertions, 10 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 369a8a5ea7bb..d9d53f289caf 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -84,7 +84,7 @@ static const char hcd_name [] = "ehci_hcd";
84#define EHCI_IAA_MSECS 10 /* arbitrary */ 84#define EHCI_IAA_MSECS 10 /* arbitrary */
85#define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */ 85#define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */
86#define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */ 86#define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */
87#define EHCI_SHRINK_JIFFIES (HZ/200) /* async qh unlink delay */ 87#define EHCI_SHRINK_FRAMES 5 /* async qh unlink delay */
88 88
89/* Initial IRQ latency: faster than hw default */ 89/* Initial IRQ latency: faster than hw default */
90static int log2_irq_thresh = 0; // 0 to 6 90static int log2_irq_thresh = 0; // 0 to 6
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index b85b54160cda..2622b6596d7c 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -1116,8 +1116,7 @@ static void scan_async (struct ehci_hcd *ehci)
1116 struct ehci_qh *qh; 1116 struct ehci_qh *qh;
1117 enum ehci_timer_action action = TIMER_IO_WATCHDOG; 1117 enum ehci_timer_action action = TIMER_IO_WATCHDOG;
1118 1118
1119 if (!++(ehci->stamp)) 1119 ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index);
1120 ehci->stamp++;
1121 timer_action_done (ehci, TIMER_ASYNC_SHRINK); 1120 timer_action_done (ehci, TIMER_ASYNC_SHRINK);
1122rescan: 1121rescan:
1123 qh = ehci->async->qh_next.qh; 1122 qh = ehci->async->qh_next.qh;
@@ -1142,18 +1141,20 @@ rescan:
1142 } 1141 }
1143 } 1142 }
1144 1143
1145 /* unlink idle entries, reducing HC PCI usage as well 1144 /* unlink idle entries, reducing DMA usage as well
1146 * as HCD schedule-scanning costs. delay for any qh 1145 * as HCD schedule-scanning costs. delay for any qh
1147 * we just scanned, there's a not-unusual case that it 1146 * we just scanned, there's a not-unusual case that it
1148 * doesn't stay idle for long. 1147 * doesn't stay idle for long.
1149 * (plus, avoids some kind of re-activation race.) 1148 * (plus, avoids some kind of re-activation race.)
1150 */ 1149 */
1151 if (list_empty (&qh->qtd_list)) { 1150 if (list_empty(&qh->qtd_list)
1152 if (qh->stamp == ehci->stamp) 1151 && qh->qh_state == QH_STATE_LINKED) {
1152 if (!ehci->reclaim
1153 && ((ehci->stamp - qh->stamp) & 0x1fff)
1154 >= (EHCI_SHRINK_FRAMES * 8))
1155 start_unlink_async(ehci, qh);
1156 else
1153 action = TIMER_ASYNC_SHRINK; 1157 action = TIMER_ASYNC_SHRINK;
1154 else if (!ehci->reclaim
1155 && qh->qh_state == QH_STATE_LINKED)
1156 start_unlink_async (ehci, qh);
1157 } 1158 }
1158 1159
1159 qh = qh->qh_next.qh; 1160 qh = qh->qh_next.qh;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 90245fd8bac4..5799298364fb 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -198,7 +198,10 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
198 break; 198 break;
199 // case TIMER_ASYNC_SHRINK: 199 // case TIMER_ASYNC_SHRINK:
200 default: 200 default:
201 t = EHCI_SHRINK_JIFFIES; 201 /* add a jiffie since we synch against the
202 * 8 KHz uframe counter.
203 */
204 t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000) + 1;
202 break; 205 break;
203 } 206 }
204 mod_timer(&ehci->watchdog, t + jiffies); 207 mod_timer(&ehci->watchdog, t + jiffies);