Skip to content

Commit 8327f28

Browse files
P33Mpopcornmix
P33M
authored andcommitted
dwc_otg: add module parameter int_ep_interval_min
Add a module parameter (defaulting to ignored) that clamps the polling rate of high-speed Interrupt endpoints to a minimum microframe interval. The parameter is modifiable at runtime as it is used when activating new endpoints (such as on device connect).
1 parent 737cc54 commit 8327f28

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

drivers/usb/host/dwc_otg/dwc_otg_driver.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ uint16_t nak_holdoff = 8;
249249

250250
unsigned short fiq_fsm_mask = 0x0F;
251251

252+
unsigned short int_ep_interval_min = 0;
252253
/**
253254
* This function shows the Driver Version.
254255
*/
@@ -1398,7 +1399,10 @@ MODULE_PARM_DESC(fiq_fsm_mask, "Bitmask of transactions to perform in the FIQ.\n
13981399
"Bit 1 : Periodic split transactions\n"
13991400
"Bit 2 : High-speed multi-transfer isochronous\n"
14001401
"All other bits should be set 0.");
1401-
1402+
module_param(int_ep_interval_min, ushort, 0644);
1403+
MODULE_PARM_DESC(int_ep_interval_min, "Clamp high-speed Interrupt endpoints to a minimum polling interval.\n"
1404+
"0..1 = Use endpoint default\n"
1405+
"2..n = Minimum interval n microframes. Use powers of 2.\n");
14021406

14031407
/** @page "Module Parameters"
14041408
*

drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "dwc_otg_regs.h"
4444

4545
extern bool microframe_schedule;
46+
extern unsigned short int_ep_interval_min;
4647

4748
/**
4849
* Free each QTD in the QH's QTD-list then free the QH. QH should already be
@@ -218,21 +219,19 @@ void qh_init(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, dwc_otg_hcd_urb_t * urb)
218219
SCHEDULE_SLOP);
219220
qh->interval = urb->interval;
220221

221-
#if 0
222-
/* Increase interrupt polling rate for debugging. */
223-
if (qh->ep_type == UE_INTERRUPT) {
224-
qh->interval = 8;
225-
}
226-
#endif
227222
hprt.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0);
228-
if ((hprt.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) &&
229-
((dev_speed == USB_SPEED_LOW) ||
230-
(dev_speed == USB_SPEED_FULL))) {
231-
qh->interval *= 8;
232-
qh->sched_frame |= 0x7;
233-
qh->start_split_frame = qh->sched_frame;
223+
if (hprt.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) {
224+
if (dev_speed == USB_SPEED_LOW ||
225+
dev_speed == USB_SPEED_FULL) {
226+
qh->interval *= 8;
227+
qh->sched_frame |= 0x7;
228+
qh->start_split_frame = qh->sched_frame;
229+
} else if (int_ep_interval_min >= 2 &&
230+
qh->interval < int_ep_interval_min &&
231+
qh->ep_type == UE_INTERRUPT) {
232+
qh->interval = int_ep_interval_min;
233+
}
234234
}
235-
236235
}
237236

238237
DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD QH Initialized\n");

0 commit comments

Comments
 (0)