Skip to content

Commit 2a8d45e

Browse files
P33MP33M
P33M
authored and
P33M
committed
dwc_otg: Don't issue traffic to LS devices in FS mode
Issuing low-speed packets when the root port is in full-speed mode causes the root port to stop responding. Explicitly fail when enqueuing URBs to a LS endpoint on a FS bus.
1 parent 1457dc8 commit 2a8d45e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/usb/host/dwc_otg/dwc_otg_hcd.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * hcd,
501501
dwc_otg_transaction_type_e tr_type;
502502
dwc_otg_qtd_t *qtd;
503503
gintmsk_data_t intr_mask = {.d32 = 0 };
504+
hprt0_data_t hprt0 = { .d32 = 0 };
504505

505506
#ifdef DEBUG /* integrity checks (Broadcom) */
506507
if (NULL == hcd->core_if) {
@@ -515,6 +516,16 @@ int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * hcd,
515516
return -DWC_E_NO_DEVICE;
516517
}
517518

519+
/* Some core configurations cannot support LS traffic on a FS root port */
520+
if ((hcd->fops->speed(hcd, dwc_otg_urb->priv) == USB_SPEED_LOW) &&
521+
(hcd->core_if->hwcfg2.b.fs_phy_type == 1) &&
522+
(hcd->core_if->hwcfg2.b.hs_phy_type == 1)) {
523+
hprt0.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0);
524+
if (hprt0.b.prtspd == DWC_HPRT0_PRTSPD_FULL_SPEED) {
525+
return -DWC_E_NO_DEVICE;
526+
}
527+
}
528+
518529
qtd = dwc_otg_hcd_qtd_create(dwc_otg_urb, atomic_alloc);
519530
if (qtd == NULL) {
520531
DWC_ERROR("DWC OTG HCD URB Enqueue failed creating QTD\n");

0 commit comments

Comments
 (0)