樹莓派CM4 usb dwc2驅動報:dwc2_hc_chhltd_intr_dma: Channel 7 - ChHltd set, but reason is unknown
阿新 • • 發佈:2021-12-10
問題描述:
在CM4的USB2.0外接USB口上接了一個realtek的usb2eth網絡卡,型號如下:
ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter
usb2eth網絡卡不能穩定工作,dmesg裡能看到kernel裡dwc2驅動一直報warning。
Dec 10 15:11:23 raspberrypi kernel: [ 8505.396473] dwc2 fe980000.usb: dwc2_hc_chhltd_intr_dma: Channel 7 - ChHltd set, but reason isunknown Dec 10 15:11:23 raspberrypi kernel: [ 8505.396490] dwc2 fe980000.usb: hcint 0x00000002, intsts 0x04400009 Dec 10 15:11:24 raspberrypi kernel: [ 8506.367465] dwc2 fe980000.usb: dwc2_hc_chhltd_intr_dma: Channel 1 - ChHltd set, but reason is unknown Dec 10 15:11:24 raspberrypi kernel: [ 8506.367472] dwc2 fe980000.usb: hcint 0x00000002, intsts 0x04400001 Dec 10 15:11:30 raspberrypi kernel: [ 8512.359278] dwc2 fe980000.usb: dwc2_hc_chhltd_intr_dma: Channel 5 - ChHltd set, but reason is unknown Dec 10 15:11:30 raspberrypi kernel: [ 8512.359285] dwc2 fe980000.usb: hcint 0x00000002, intsts 0x04400001 Dec 10 15:11:30 raspberrypi kernel: [ 8512.359415] dwc2 fe980000.usb: dwc2_hc_chhltd_intr_dma: Channel 7- ChHltd set, but reason is unknown Dec 10 15:11:30 raspberrypi kernel: [ 8512.359420] dwc2 fe980000.usb: hcint 0x00000002, intsts 0x04400001 Dec 10 15:11:30 raspberrypi kernel: [ 8512.359650] dwc2 fe980000.usb: dwc2_hc_chhltd_intr_dma: Channel 6 - ChHltd set, but reason is unknown Dec 10 15:11:30 raspberrypi kernel: [ 8512.359654] dwc2 fe980000.usb: hcint 0x00000002, intsts 0x04400001 Dec 10 15:11:30 raspberrypi kernel: [ 8512.359682] dwc2 fe980000.usb: dwc2_hc_chhltd_intr_dma: Channel 3 - ChHltd set, but reason is unknown Dec 10 15:11:30 raspberrypi kernel: [ 8512.359686] dwc2 fe980000.usb: hcint 0x00000002, intsts 0x04400001 Dec 10 15:11:30 raspberrypi kernel: [ 8512.359774] dwc2 fe980000.usb: dwc2_hc_chhltd_intr_dma: Channel 2 - ChHltd set, but reason is unknown Dec 10 15:11:30 raspberrypi kernel: [ 8512.359778] dwc2 fe980000.usb: hcint 0x00000002, intsts 0x04400001 Dec 10 15:11:30 raspberrypi kernel: [ 8512.361090] dwc2 fe980000.usb: dwc2_hc_chhltd_intr_dma: Channel 1 - ChHltd set, but reason is unknown Dec 10 15:11:30 raspberrypi kernel: [ 8512.361095] dwc2 fe980000.usb: hcint 0x00000002, intsts 0x04400001
解決辦法:
diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c index d5f4ec1..4989ec7 100644 --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c @@ -1180,7 +1180,10 @@ static void dwc2_update_urb_state_abn(struct dwc2_hsotg *hsotg, if (urb->actual_length + xfer_length > urb->length) { dev_warn(hsotg->dev, "%s(): trimming xfer length\n", __func__); - xfer_length = urb->length - urb->actual_length; + if (urb->length & 0x3) + xfer_length = 0; + else + xfer_length = urb->length - urb->actual_length; } urb->actual_length += xfer_length; @@ -2065,8 +2068,6 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum) hcint, hcintmsk, hcint & hcintmsk); } - dwc2_writel(hsotg, hcint, HCINT(chnum)); - /* * If we got an interrupt after someone called * dwc2_hcd_endpoint_disable() we don't want to crash below @@ -2079,6 +2080,8 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum) chan->hcint = hcint; hcint &= hcintmsk; + dwc2_writel(hsotg, hcint, HCINT(chnum)); + /* * If the channel was halted due to a dequeue, the qtd list might * be empty or at least the first entry will not be the active qtd.
注意:
這個補丁只清除未遮蔽中斷,以避免觸發未知通道停止中斷。然而,如果通道停止中斷意外發生,我們需要檢查dwc2_update_urb_state_abn()中的urb->length是否為4位元組對齊,這可以幫助避免上述警告。
本文來自部落格園,作者:王樓小子,轉載請註明原文連結:https://www.cnblogs.com/wanglouxiaozi/p/15673185.html