dwc_otg驱动 "BUG: sleeping function called from invalid context at mm/page_alloc.c"

时间:2023-11-13 20:05:56

方案商的开发板上otg功能只能做device,硬件看过后说没有5v供电,加上后能够识别U盘了,但是内核报了错

[ 3.264000] usb 2-1: new high-speed USB device number 2 using dwc_otg
[ 3.280000] BUG: sleeping function called from invalid context at mm/page_alloc.c:2444
[ 3.284000] in_atomic(): 1, irqs_disabled(): 128, pid: 29, name: khubd
[ 3.300000] [<c00154dc>] (unwind_backtrace+0x0/0x12c) from [<c00efb34>] (__alloc_pages_nodemask+0x208/0x91c)
[ 3.336000] [<c00efb34>] (__alloc_pages_nodemask+0x208/0x91c) from [<c001892c>] (__dma_alloc+0xa0/0x378)
[ 3.352000] [<c001892c>] (__dma_alloc+0xa0/0x378) from [<c0018f08>] (dma_alloc_coherent+0x68/0x70)
[ 3.376000] [<c0018f08>] (dma_alloc_coherent+0x68/0x70) from [<c038c8d8>] (__DWC_DMA_ALLOC+0x10/0x38)
[ 3.400000] [<c038c8d8>] (__DWC_DMA_ALLOC+0x10/0x38) from [<c0389658>] (dwc_otg_hcd_qh_init_ddma+0x38/0x278)
[ 3.416000] [<c0389658>] (dwc_otg_hcd_qh_init_ddma+0x38/0x278) from [<c03885cc>] (dwc_otg_hcd_qh_create+0x74/0xc8)
[ 3.432000] [<c03885cc>] (dwc_otg_hcd_qh_create+0x74/0xc8) from [<c0389034>] (dwc_otg_hcd_qtd_add+0x88/0xa0)
[ 3.464000] [<c0389034>] (dwc_otg_hcd_qtd_add+0x88/0xa0) from [<c0382d68>] (dwc_otg_hcd_urb_enqueue+0x88/0x1e4)
[ 3.480000] [<c0382d68>] (dwc_otg_hcd_urb_enqueue+0x88/0x1e4) from [<c03845f0>] (dwc_otg_urb_enqueue+0x198/0x2d0)
[ 3.496000] [<c03845f0>] (dwc_otg_urb_enqueue+0x198/0x2d0) from [<c03552bc>] (usb_hcd_submit_urb+0xa4/0x77c)
[ 3.528000] [<c03552bc>] (usb_hcd_submit_urb+0xa4/0x77c) from [<c0356f7c>] (usb_start_wait_urb+0x4c/0x138)
[ 3.544000] [<c0356f7c>] (usb_start_wait_urb+0x4c/0x138) from [<c0357114>] (usb_control_msg+0xac/0xe4)
[ 3.560000] [<c0357114>] (usb_control_msg+0xac/0xe4) from [<c034fbd4>] (hub_port_init+0x4d8/0x86c)
[ 3.596000] [<c034fbd4>] (hub_port_init+0x4d8/0x86c) from [<c035232c>] (hub_thread+0x6b8/0x1454)
[ 3.612000] [<c035232c>] (hub_thread+0x6b8/0x1454) from [<c00649d0>] (kthread+0x90/0x94)
[ 3.628000] [<c00649d0>] (kthread+0x90/0x94) from [<c000f86c>] (kernel_thread_exit+0x0/0x8)

追进去

  dwc_otg_set_param_dma_desc_enable函数里有以下代码

#if defined(CONFIG_ARCH_CPU_SLSI)

    val = ;

#if defined(CONFIG_USB_VIDEO_CLASS)

    val = ;

#endif

#endif

强制打开了dma_desc_enable,看起来host模式时应该不需要打开,果然注释之后错误消失

    //val = 1;

不明白这段代码和uvc有什么关系,其实我就是用这个来插usb camera的,这个地方反而导致操作uvc驱动的时候报错;

uvc报错:

Failed to resubmit video URB (-1)

解决,记录一下