Skip to content

Commit ae0186d

Browse files
P33Mpopcornmix
authored andcommitted
usb: dwc3: core: add support for setting NAK enhancement bits for FS/HS
If a device frequently NAKs, it can exhaust the scheduled handshakes in a frame. It will then not get polled by the controller until the next frame interval. This is most noticeable on FS devices as the controller schedules a small set of transactions only once per full-speed frame. Setting the ENH_PER_NAK_FS/LS bits in the GUCTL1 register increases the number of transactions that can be scheduled to Async (Control/Bulk) endpoints in the respective frame time. In the FS case, this only applies to FS devices directly connected to root ports. Signed-off-by: Jonathan Bell <[email protected]>
1 parent 4e7c8dd commit ae0186d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

drivers/usb/dwc3/core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,12 @@ static int dwc3_core_init(struct dwc3 *dwc)
14641464
if (dwc->dis_tx_ipgap_linecheck_quirk)
14651465
reg |= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS;
14661466

1467+
if (dwc->enh_nak_fs_quirk)
1468+
reg |= DWC3_GUCTL1_NAK_PER_ENH_FS;
1469+
1470+
if (dwc->enh_nak_hs_quirk)
1471+
reg |= DWC3_GUCTL1_NAK_PER_ENH_HS;
1472+
14671473
if (dwc->parkmode_disable_ss_quirk)
14681474
reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS;
14691475

@@ -1824,6 +1830,10 @@ static void dwc3_get_properties(struct dwc3 *dwc)
18241830
"snps,resume-hs-terminations");
18251831
dwc->ulpi_ext_vbus_drv = device_property_read_bool(dev,
18261832
"snps,ulpi-ext-vbus-drv");
1833+
dwc->enh_nak_fs_quirk = device_property_read_bool(dev,
1834+
"snps,enhanced-nak-fs-quirk");
1835+
dwc->enh_nak_hs_quirk = device_property_read_bool(dev,
1836+
"snps,enhanced-nak-hs-quirk");
18271837
dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev,
18281838
"snps,parkmode-disable-ss-quirk");
18291839
dwc->parkmode_disable_hs_quirk = device_property_read_bool(dev,

drivers/usb/dwc3/core.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@
282282
#define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28)
283283
#define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26)
284284
#define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24)
285+
#define DWC3_GUCTL1_NAK_PER_ENH_FS BIT(19)
286+
#define DWC3_GUCTL1_NAK_PER_ENH_HS BIT(18)
285287
#define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17)
286288
#define DWC3_GUCTL1_PARKMODE_DISABLE_HS BIT(16)
287289
#define DWC3_GUCTL1_PARKMODE_DISABLE_FSLS BIT(15)
@@ -1138,6 +1140,8 @@ struct dwc3_scratchpad_array {
11381140
* generation after resume from suspend.
11391141
* @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin
11401142
* VBUS with an external supply.
1143+
* @enh_nak_fs_quirk: Set to schedule more handshakes to Async FS endpoints.
1144+
* @enh_nak_hs_quirk: Set to schedule more handshakes to Async HS endpoints.
11411145
* @parkmode_disable_ss_quirk: If set, disable park mode feature for all
11421146
* Superspeed instances.
11431147
* @parkmode_disable_hs_quirk: If set, disable park mode feature for all
@@ -1378,6 +1382,8 @@ struct dwc3 {
13781382
unsigned dis_tx_ipgap_linecheck_quirk:1;
13791383
unsigned resume_hs_terminations:1;
13801384
unsigned ulpi_ext_vbus_drv:1;
1385+
unsigned enh_nak_fs_quirk:1;
1386+
unsigned enh_nak_hs_quirk:1;
13811387
unsigned parkmode_disable_ss_quirk:1;
13821388
unsigned parkmode_disable_hs_quirk:1;
13831389
unsigned parkmode_disable_fsls_quirk:1;

0 commit comments

Comments
 (0)