* Re: usb: gadget: dwc2: RK3308: Transmission to EP OUT stalls at larger packet size
From: Minas Harutyunyan @ 2024-02-05 16:05 UTC (permalink / raw)
To: Pavel Hofman; +Cc: linux-usb@vger.kernel.org
In-Reply-To: <4c198e2b-72fe-f21c-77a0-7c011ace3c6d@ivitera.com>
Hi Pavel,
On 2/5/24 19:52, Pavel Hofman wrote:
>
>
> Dne 05. 02. 24 v 15:35 Pavel Hofman napsal(a):
>>
>>>
>> It really looks like some DMA performance issue. Stream 980 bytes/
>> 250us (bInterval=2) is bitperfect, no dropped packets. While 24
>> bytes/125us (bInterval=1) gets stuck. IIUC the DMA is not capable of
>> copying packets every 125us. Please is there any chance to tweak the
>> performance to handle the 125us packets reliably?
>>
>
> I tried increasing f_uac2 req_number/UAC2_DEF_REQ_NUM from 2 to 8 and
> streaming seems to run stable at 125us microframes now (in both
> directions simultaneously). Please is there any other gadget tweak which
> could potentially reduce the risk of dropped packets? Something like
> using plain DMA instead of desc DMA (no idea :-) )...
>
> Thanks a lot for your expert opinion.
Yes, it's mandatory to increase f_uac2_req_number, at least 4. Obviously
2 is not enough for descriptor list and main cause of BNA interrupt.
Another suggestion to change DMA mode from DDMA to BDMA as I suggested
in previous email.
Thanks,
Minas
^ permalink raw reply
* Re: usb: gadget: dwc2: RK3308: Transmission to EP OUT stalls at larger packet size
From: Pavel Hofman @ 2024-02-05 15:52 UTC (permalink / raw)
To: Minas Harutyunyan; +Cc: linux-usb@vger.kernel.org
In-Reply-To: <758d6e5d-d5b4-2bcc-bd51-fb7b49356532@ivitera.com>
Dne 05. 02. 24 v 15:35 Pavel Hofman napsal(a):
>
> Dne 05. 02. 24 v 14:43 Pavel Hofman napsal(a):
>> Hi Minas,
>>
>> I am having issues with dwc2 gadget on RK3308 (Rock Pi S). Kernel 6.6.2.
>>
>> When lightly loading EP OUT with UAC2, EP OUT works OK. When
>> increasing the packet size (960 bytes in the iso packet), the data
>> delivery stops completely. Method u_audio.c:u_audio_iso_complete stops
>> being called, it's like as if the incoming stream reception got stuck.
>>
>> Only the function f_uac2 is used on the gadget.
>>
>> Debug log from gadget.c + u_audio.c (logging all calls of
>> u_audio_iso_complete including !req->status) is attached. Starts of
>> playback on the host are marked with this logs in the dump:
>>
>> g_audio gadget.0: start capture with rate 192000
>>
>>
>>
>> root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat hw_params
>> op_mode : 0
>> arch : 2
>> dma_desc_enable : 1
>> enable_dynamic_fifo : 1
>> en_multiple_tx_fifo : 1
>> rx_fifo_size : 1024
>> host_nperio_tx_fifo_size : 0
>> dev_nperio_tx_fifo_size : 16
>> host_perio_tx_fifo_size : 0
>> nperio_tx_q_depth : 4
>> host_perio_tx_q_depth : 4
>> dev_token_q_depth : 8
>> max_transfer_size : 524287
>> max_packet_count : 1023
>> host_channels : 9
>> hs_phy_type : 1
>> fs_phy_type : 0
>> i2c_enable : 0
>> num_dev_ep : 9
>> num_dev_perio_in_ep : 0
>> total_fifo_size : 972
>> power_optimized : 1
>> utmi_phy_data_width : 1
>> snpsid : 0x4f54310a
>> dev_ep_dirs : 0x6664
>>
>>
>> root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat params
>> otg_caps.hnp_support : 0
>> otg_caps.srp_support : 0
>> otg_caps.otg_rev : 0
>> dma_desc_enable : 0
>> dma_desc_fs_enable : 0
>> speed : 0
>> enable_dynamic_fifo : 1
>> en_multiple_tx_fifo : 1
>> host_rx_fifo_size : 525
>> host_nperio_tx_fifo_size : 128
>> host_perio_tx_fifo_size : 256
>> max_transfer_size : 524287
>> max_packet_count : 1023
>> host_channels : 0
>> phy_type : 1
>> phy_utmi_width : 16
>> phy_ulpi_ddr : 0
>> phy_ulpi_ext_vbus : 0
>> i2c_enable : 0
>> ipg_isoc_en : 0
>> ulpi_fs_ls : 0
>> host_support_fs_ls_low_power : 0
>> host_ls_low_power_phy_clk : 0
>> activate_stm_fs_transceiver : 0
>> activate_stm_id_vb_detection : 0
>> ts_dline : 0
>> reload_ctl : 1
>> ahbcfg : 0xe
>> uframe_sched : 1
>> external_id_pin_ctl : 0
>> power_down : 0
>> lpm : 0
>> lpm_clock_gating : 0
>> besl : 0
>> hird_threshold_en : 0
>> hird_threshold : 4
>> service_interval : 0
>> host_dma : 0
>> g_dma : 1
>> g_dma_desc : 1
>> g_rx_fifo_size : 310
>> g_np_tx_fifo_size : 16
>> g_tx_fifo_size[0] : 0
>> g_tx_fifo_size[1] : 256
>> g_tx_fifo_size[2] : 128
>> g_tx_fifo_size[3] : 128
>> g_tx_fifo_size[4] : 64
>> g_tx_fifo_size[5] : 32
>> g_tx_fifo_size[6] : 16
>> g_tx_fifo_size[7] : 0
>> g_tx_fifo_size[8] : 0
>> g_tx_fifo_size[9] : 0
>> g_tx_fifo_size[10] : 0
>> g_tx_fifo_size[11] : 0
>> g_tx_fifo_size[12] : 0
>> g_tx_fifo_size[13] : 0
>> g_tx_fifo_size[14] : 0
>> g_tx_fifo_size[15] : 0
>>
>>
>> root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat regdump
>> GOTGCTL = 0x000d0000
>> GOTGINT = 0x00000000
>> GAHBCFG = 0x0000002f
>> GUSBCFG = 0x4000140f
>> GRSTCTL = 0x40000000
>> GINTSTS = 0x0438c0ba
>> GINTMSK = 0xd88c3c44
>> GRXSTSR = 0x51643c02
>> GRXFSIZ = 0x00000136
>> GNPTXFSIZ = 0x00100136
>> GNPTXSTS = 0x00080010
>> GI2CCTL = 0x00000000
>> GPVNDCTL = 0x00000000
>> GGPIO = 0x00000000
>> GUID = 0x32000001
>> GSNPSID = 0x4f54310a
>> GHWCFG1 = 0x00006664
>> GHWCFG2 = 0x228e2450
>> GHWCFG3 = 0x03cc90e8
>> GHWCFG4 = 0xdbf04030
>> GLPMCFG = 0x00000000
>> GPWRDN = 0x00600010
>> GDFIFOCFG = 0x03b603cc
>> ADPCTL = 0x00000000
>> HPTXFSIZ = 0x00000000
>> DPTXFSIZN(1) = 0x01000146
>> DPTXFSIZN(2) = 0x00800246
>> DPTXFSIZN(3) = 0x008002c6
>> DPTXFSIZN(4) = 0x00400346
>> DPTXFSIZN(5) = 0x00200386
>> DPTXFSIZN(6) = 0x001003a6
>> DPTXFSIZN(7) = 0x00200386
>> DPTXFSIZN(8) = 0x001003a6
>> DPTXFSIZN(9) = 0x01000146
>> DPTXFSIZN(10) = 0x00800246
>> DPTXFSIZN(11) = 0x008002c6
>> DPTXFSIZN(12) = 0x00400346
>> DPTXFSIZN(13) = 0x00200386
>> DPTXFSIZN(14) = 0x001003a6
>> DPTXFSIZN(15) = 0x00200386
>> DCFG = 0x008402f0
>> DCTL = 0x00000000
>> DSTS = 0x001ef900
>> DIEPMSK = 0x0000220f
>> DOEPMSK = 0x0000023f
>> DAINT = 0x02140000
>> DAINTMSK = 0x0005000b
>> DTKNQR1 = 0x00000000
>> DTKNQR2 = 0x00000000
>> DTKNQR3 = 0x0c100020
>> DTKNQR4 = 0x00000000
>> DVBUSDIS = 0x00000b8f
>> DVBUSPULSE = 0x000002c6
>> DIEPCTL(0) = 0x00028000
>> DIEPCTL(1) = 0x018c8006
>> DIEPCTL(2) = 0x00000400
>> DIEPCTL(3) = 0x01448004
>> DIEPCTL(4) = 0x00000400
>> DIEPCTL(5) = 0x004603e8
>> DIEPCTL(6) = 0x00000400
>> DIEPCTL(7) = 0x00000400
>> DIEPCTL(8) = 0x00000400
>> DIEPCTL(9) = 0x00000400
>> DIEPCTL(10) = 0x00000400
>> DIEPCTL(11) = 0x00000400
>> DIEPCTL(12) = 0x00000400
>> DIEPCTL(13) = 0x00000400
>> DIEPCTL(14) = 0x00000400
>> DIEPCTL(15) = 0x00000400
>> DOEPCTL(0) = 0x80028000
>> DOEPCTL(1) = 0x00000400
>> DOEPCTL(2) = 0x800483e8
>> DOEPCTL(3) = 0x00000400
>> DOEPCTL(4) = 0x00000400
>> DOEPCTL(5) = 0x00000400
>> DOEPCTL(6) = 0x00000400
>> DOEPCTL(7) = 0x00000400
>> DOEPCTL(8) = 0x00000400
>> DOEPCTL(9) = 0x00000400
>> DOEPCTL(10) = 0x00000400
>> DOEPCTL(11) = 0x00000400
>> DOEPCTL(12) = 0x00000400
>> DOEPCTL(13) = 0x00000400
>> DOEPCTL(14) = 0x00000400
>> DOEPCTL(15) = 0x00000400
>> DIEPINT(0) = 0x00000090
>> DIEPINT(1) = 0x00000090
>> DIEPINT(2) = 0x000002a0
>> DIEPINT(3) = 0x00000090
>> DIEPINT(4) = 0x000002a0
>> DIEPINT(5) = 0x000000c0
>> DIEPINT(6) = 0x000002a0
>> DIEPINT(7) = 0x00000080
>> DIEPINT(8) = 0x00000080
>> DIEPINT(9) = 0x00000080
>> DIEPINT(10) = 0x000002a0
>> DIEPINT(11) = 0x000002a0
>> DIEPINT(12) = 0x000002a0
>> DIEPINT(13) = 0x000002a0
>> DIEPINT(14) = 0x000002a0
>> DIEPINT(15) = 0x000002a0
>> DOEPINT(0) = 0x00002000
>> DOEPINT(1) = 0x00000000
>> DOEPINT(2) = 0x00002010
>> DOEPINT(3) = 0x00000000
>> DOEPINT(4) = 0x00000020
>> DOEPINT(5) = 0x00000000
>> DOEPINT(6) = 0x00000000
>> DOEPINT(7) = 0x00000000
>> DOEPINT(8) = 0x00000000
>> DOEPINT(9) = 0x00000220
>> DOEPINT(10) = 0x00000000
>> DOEPINT(11) = 0x00000000
>> DOEPINT(12) = 0x00000000
>> DOEPINT(13) = 0x00000000
>> DOEPINT(14) = 0x00000000
>> DOEPINT(15) = 0x00000000
>> DIEPTSIZ(0) = 0x00080052
>> DIEPTSIZ(1) = 0x00000000
>> DIEPTSIZ(2) = 0x00000000
>> DIEPTSIZ(3) = 0x11d81ef7
>> DIEPTSIZ(4) = 0x00000000
>> DIEPTSIZ(5) = 0x00000000
>> DIEPTSIZ(6) = 0x00000000
>> DIEPTSIZ(7) = 0x00000000
>> DIEPTSIZ(8) = 0x00000000
>> DIEPTSIZ(9) = 0x00000000
>> DIEPTSIZ(10) = 0x00000000
>> DIEPTSIZ(11) = 0x00000000
>> DIEPTSIZ(12) = 0x00000000
>> DIEPTSIZ(13) = 0x00000000
>> DIEPTSIZ(14) = 0x00000000
>> DIEPTSIZ(15) = 0x00000000
>> DOEPTSIZ(0) = 0x2000005e
>> DOEPTSIZ(1) = 0x00000000
>> DOEPTSIZ(2) = 0x1f27b8c0
>> DOEPTSIZ(3) = 0x00000000
>> DOEPTSIZ(4) = 0x00000000
>> DOEPTSIZ(5) = 0x00000000
>> DOEPTSIZ(6) = 0x00000000
>> DOEPTSIZ(7) = 0x00000000
>> DOEPTSIZ(8) = 0x00000000
>> DOEPTSIZ(9) = 0x00000000
>> DOEPTSIZ(10) = 0x00000000
>> DOEPTSIZ(11) = 0x00000000
>> DOEPTSIZ(12) = 0x00000000
>> DOEPTSIZ(13) = 0x00000000
>> DOEPTSIZ(14) = 0x00000000
>> DOEPTSIZ(15) = 0x00000000
>> DIEPDMA(0) = 0x0e693000
>> DIEPDMA(1) = 0x86711010
>> DIEPDMA(2) = 0x92b8b5a4
>> DIEPDMA(3) = 0x1ba02008
>> DIEPDMA(4) = 0x92b8b5a4
>> DIEPDMA(5) = 0x2fae0710
>> DIEPDMA(6) = 0x92b8b5a4
>> DIEPDMA(7) = 0x43c7ba7f
>> DIEPDMA(8) = 0x0cc64000
>> DIEPDMA(9) = 0x57447266
>> DIEPDMA(10) = 0x92b8b5a4
>> DIEPDMA(11) = 0x92b8b5a4
>> DIEPDMA(12) = 0x92b8b5a4
>> DIEPDMA(13) = 0x92b8b5a4
>> DIEPDMA(14) = 0x92b8b5a4
>> DIEPDMA(15) = 0x92b8b5a4
>> DOEPDMA(0) = 0x1ba01000
>> DOEPDMA(1) = 0xa8800c26
>> DOEPDMA(2) = 0x1ba01008
>> DOEPDMA(3) = 0xa8800c26
>> DOEPDMA(4) = 0x6db46af8
>> DOEPDMA(5) = 0xa8800c26
>> DOEPDMA(6) = 0x1291dfd8
>> DOEPDMA(7) = 0xa8800c26
>> DOEPDMA(8) = 0x82d9ef90
>> DOEPDMA(9) = 0x0309d816
>> DOEPDMA(10) = 0xa8800c26
>> DOEPDMA(11) = 0xa8800c26
>> DOEPDMA(12) = 0xa8800c26
>> DOEPDMA(13) = 0xa8800c26
>> DOEPDMA(14) = 0xa8800c26
>> DOEPDMA(15) = 0xa8800c26
>> DTXFSTS(0) = 0x00000010
>> DTXFSTS(1) = 0x00000010
>> DTXFSTS(2) = 0x00000010
>> DTXFSTS(3) = 0x00000020
>> DTXFSTS(4) = 0x00000010
>> DTXFSTS(5) = 0x00000100
>> DTXFSTS(6) = 0x00000010
>> DTXFSTS(7) = 0x00000010
>> DTXFSTS(8) = 0x00000010
>> DTXFSTS(9) = 0x00000010
>> DTXFSTS(10) = 0x00000010
>> DTXFSTS(11) = 0x00000010hofman
>> DTXFSTS(12) = 0x00000010
>> DTXFSTS(13) = 0x00000010
>> DTXFSTS(14) = 0x00000010
>> DTXFSTS(15) = 0x00000010
>> PCGCTL = 0x00000000
>> HCFG = 0x008402f0
>> HFIR = 0x00000b8f
>> HFNUM = 0x0b1803df
>> HPTXSTS = 0x00080100
>> HAINT = 0x00000002
>> HAINTMSK = 0x00000007
>> HFLBADDR = 0x00000000
>> HPRT0 = 0x00000000
>> HCCHAR(0) = 0x018c8006
>> HCCHAR(1) = 0x00000400
>> HCCHAR(2) = 0x800483e8
>> HCCHAR(3) = 0x00000400
>> HCCHAR(4) = 0x00000400
>> HCCHAR(5) = 0x00000400
>> HCCHAR(6) = 0x00000400
>> HCCHAR(7) = 0x00000400
>> HCCHAR(8) = 0x00000400
>> HCCHAR(9) = 0x00000400
>> HCCHAR(10) = 0x00000400
>> HCCHAR(11) = 0x00000400
>> HCCHAR(12) = 0x00000400
>> HCCHAR(13) = 0x00000400
>> HCCHAR(14) = 0x00000400
>> HCCHAR(15) = 0x00000400
>> HCSPLT(0) = 0x00000000
>> HCSPLT(1) = 0x00000000
>> HCSPLT(2) = 0x00000000
>> HCSPLT(3) = 0x00000000
>> HCSPLT(4) = 0x00000000
>> HCSPLT(5) = 0x00000000
>> HCSPLT(6) = 0x00000000
>> HCSPLT(7) = 0x00000000
>> HCSPLT(8) = 0x00000000
>> HCSPLT(9) = 0x00000000
>> HCSPLT(10) = 0x00000000
>> HCSPLT(11) = 0x00000000
>> HCSPLT(12) = 0x00000000
>> HCSPLT(13) = 0x00000000
>> HCSPLT(14) = 0x00000000
>> HCSPLT(15) = 0x00000000
>> HCINT(0) = 0x00000010
>> HCINT(1) = 0x00000000
>> HCINT(2) = 0x00002010
>> HCINT(3) = 0x00000000
>> HCINT(4) = 0x00000020
>> HCINT(5) = 0x00000000
>> HCINT(6) = 0x00000000
>> HCINT(7) = 0x00000000
>> HCINT(8) = 0x00000000
>> HCINT(9) = 0x00000220
>> HCINT(10) = 0x00000000
>> HCINT(11) = 0x00000000
>> HCINT(12) = 0x00000000
>> HCINT(13) = 0x00000000
>> HCINT(14) = 0x00000000
>> HCINT(15) = 0x00000000
>> HCINTMSK(0) = 0x0000020f
>> HCINTMSK(1) = 0x00000000
>> HCINTMSK(2) = 0x00000000
>> HCINTMSK(3) = 0x00000000
>> HCINTMSK(4) = 0x00000000
>> HCINTMSK(5) = 0x00000000
>> HCINTMSK(6) = 0x00000000
>> HCINTMSK(7) = 0x00000000
>> HCINTMSK(8) = 0x00000000
>> HCINTMSK(9) = 0x00000000
>> HCINTMSK(10) = 0x00000000
>> HCINTMSK(11) = 0x00000000
>> HCINTMSK(12) = 0x00000000
>> HCINTMSK(13) = 0x00000000
>> HCINTMSK(14) = 0x00000000
>> HCINTMSK(15) = 0x00000000
>> HCTSIZ(0) = 0x00000000
>> HCTSIZ(1) = 0x00000000
>> HCTSIZ(2) = 0x1f27b8c0
>> HCTSIZ(3) = 0x00000000
>> HCTSIZ(4) = 0x00000000
>> HCTSIZ(5) = 0x00000000
>> HCTSIZ(6) = 0x00000000
>> HCTSIZ(7) = 0x00000000
>> HCTSIZ(8) = 0x00000000
>> HCTSIZ(9) = 0x00000000
>> HCTSIZ(10) = 0x00000000
>> HCTSIZ(11) = 0x00000000
>> HCTSIZ(12) = 0x00000000
>> HCTSIZ(13) = 0x00000000
>> HCTSIZ(14) = 0x00000000
>> HCTSIZ(15) = 0x00000000
>> HCDMA(0) = 0x1ba01000
>> HCDMA(1) = 0xa8800c26
>> HCDMA(2) = 0x1ba01008
>> HCDMA(3) = 0xa8800c26
>> HCDMA(4) = 0x6db46af8
>> HCDMA(5) = 0xa8800c26
>> HCDMA(6) = 0x1291dfd8
>> HCDMA(7) = 0xa8800c26
>> HCDMA(8) = 0x82d9ef90
>> HCDMA(9) = 0x0309d816
>> HCDMA(10) = 0xa8800c26
>> HCDMA(11) = 0xa8800c26
>> HCDMA(12) = 0xa8800c26
>> HCDMA(13) = 0xa8800c26
>> HCDMA(14) = 0xa8800c26
>> HCDMA(15) = 0xa8800c26
>> HCDMAB(0) = 0x069e9ff0
>> HCDMAB(1) = 0xa8800c26
>> HCDMAB(2) = 0x05eaf3c0
>> HCDMAB(3) = 0xa8800c26
>> HCDMAB(4) = 0x1f0d193f
>> HCDMAB(5) = 0xa8800c26
>> HCDMAB(6) = 0x7f72548c
>> HCDMAB(7) = 0xa8800c26
>> HCDMAB(8) = 0x7795e924
>> HCDMAB(9) = 0xc36c019a
>> HCDMAB(10) = 0xa8800c26
>> HCDMAB(11) = 0xa8800c26
>> HCDMAB(12) = 0xa8800c26
>> HCDMAB(13) = 0xa8800c26
>> HCDMAB(14) = 0xa8800c26
>> HCDMAB(15) = 0xa8800c26
>>
> It really looks like some DMA performance issue. Stream 980 bytes/ 250us
> (bInterval=2) is bitperfect, no dropped packets. While 24 bytes/125us
> (bInterval=1) gets stuck. IIUC the DMA is not capable of copying packets
> every 125us. Please is there any chance to tweak the performance to
> handle the 125us packets reliably?
>
I tried increasing f_uac2 req_number/UAC2_DEF_REQ_NUM from 2 to 8 and
streaming seems to run stable at 125us microframes now (in both
directions simultaneously). Please is there any other gadget tweak which
could potentially reduce the risk of dropped packets? Something like
using plain DMA instead of desc DMA (no idea :-) )...
Thanks a lot for your expert opinion.
^ permalink raw reply
* Re: usb: gadget: dwc2: RK3308: Transmission to EP OUT stalls at larger packet size
From: Minas Harutyunyan @ 2024-02-05 15:40 UTC (permalink / raw)
To: Pavel Hofman; +Cc: linux-usb@vger.kernel.org
In-Reply-To: <758d6e5d-d5b4-2bcc-bd51-fb7b49356532@ivitera.com>
Hi Pavel,
On 2/5/24 18:35, Pavel Hofman wrote:
>
>>
> It really looks like some DMA performance issue. Stream 980 bytes/ 250us
> (bInterval=2) is bitperfect, no dropped packets. While 24 bytes/125us
> (bInterval=1) gets stuck. IIUC the DMA is not capable of copying packets
> every 125us. Please is there any chance to tweak the performance to
> handle the 125us packets reliably?
>
> Thanks a lot!
Quick analysis.
1. In dmesg seen BNA (buffer not available) interrupt which mean driver
not prepare DMA descriptor on time.
2. For a try please disable debug printing from g_audio:
[ 2080.107701] u_audio_iso_complete: iso_complete status(-61) 0/1000
3. Please try run device in Buffer DMA instead of Descriptor DMA:
p->g_dma_desc = hw->dma_desc_enable;
replace to:
p->g_dma_desc = 0;
Thanks,
Minas
^ permalink raw reply
* Re: Linux warning `usb: port power management may be unreliable` on Dell XPS 13 9360
From: Mathias Nyman @ 2024-02-05 15:15 UTC (permalink / raw)
To: Paul Menzel, Greg Kroah-Hartman; +Cc: linux-usb, LKML, Hans de Goede
In-Reply-To: <b97d07bf-da27-4576-bed6-fd63e3e0b569@molgen.mpg.de>
On 4.2.2024 10.45, Paul Menzel wrote:
> Dear Linux folks,
>
>
> On the Dell XPS 13 9360, Linux warns:
>
> usb: port power management may be unreliable
Is this a new issue, regression?
Was the firmware recently updated?
>
> $ lsusb -t
> /: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p, 480M
> |__ Port 003: Dev 002, If 0, Class=Wireless, Driver=[none], 12M
> |__ Port 003: Dev 002, If 1, Class=Wireless, Driver=[none], 12M
> |__ Port 004: Dev 003, If 0, Class=Human Interface Device, Driver=usbhid, 12M
> |__ Port 005: Dev 004, If 0, Class=Video, Driver=uvcvideo, 480M
> |__ Port 005: Dev 004, If 1, Class=Video, Driver=uvcvideo, 480M
> /: Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/6p, 5000M
>
> Enabling dynamic debug with `usbcore.dyndbg=+p` – `dyndbg="file port.c +p"` did not work¹ – the additional messages are:
>
> [ 1.149417] usb usb2-port1: peered to usb1-port1
> [ 1.150123] usb usb2-port2: peered to usb1-port2
> [ 1.150916] usb usb2-port3: peered to usb1-port6
> [ 1.151621] usb: failed to peer usb2-port4 and usb1-port6 by location (usb2-port4:none) (usb1-port6:usb2-port3)
> [ 1.151634] usb usb2-port4: failed to peer to usb1-port6 (-16)
> [ 1.151642] usb: port power management may be unreliable
> [ 1.152314] usb: failed to peer usb2-port5 and usb1-port6 by location (usb2-port5:none) (usb1-port6:usb2-port3)
> [ 1.152325] usb usb2-port5: failed to peer to usb1-port6 (-16)
> [ 1.153020] usb: failed to peer usb2-port6 and usb1-port6 by location (usb2-port6:none) (usb1-port6:usb2-port3)
> [ 1.153031] usb usb2-port6: failed to peer to usb1-port6 (-16)
> [ 1.153079] usb usb2: port-1 no _DSM function 5
> [ 1.153096] usb usb2: port-2 no _DSM function 5
> [ 1.153111] usb usb2: port-3 no _DSM function 5
> [ 1.153124] usb usb2: port-4 no _DSM function 5
> [ 1.153137] usb usb2: port-5 no _DSM function 5
> [ 1.153151] usb usb2: port-6 no _DSM function 5
> [ 1.166521] usb usb1-port3: status 0101 change 0001
> [ 1.166555] usb usb1-port4: status 0101 change 0001
> [ 1.166584] usb usb1-port5: status 0101 change 0001
> [ 1.270442] usb usb1-port3: status 0101, change 0000, 12 Mb/s
> [ 1.362751] usb usb2: bus auto-suspend, wakeup 1
These are all related to reading values from firmware ACPI tables.
The "failed to peer portx-porty.." messages are because driver can't match which
HS USB 2 and SS USB3 ports are in the same physical connector based on info
read from firmware ACPI _PLD entries
_DSM function 5 is related to port link power management.
Both cases mostly impact power management, but might affects something
else. Haven't looked at it in detail.
ACPI table dump could show more info, especially the DSDT table
>
> So the problematic ports do not show up in `lsusb`, do they?
>
> Please find the output of `dmesg` attached.
dmesg shows that "usb2" is the SuperSpeed USB 3 roothub.
It's suspended as no SuperSpeed devices are connected to it.
Do USB 3 devices work normally on this machine?
Thanks
Mathias
^ permalink raw reply
* [usb:usb-testing] BUILD SUCCESS ed5551279c9100aff6adf337d809057a7532b6f7
From: kernel test robot @ 2024-02-05 14:35 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
branch HEAD: ed5551279c9100aff6adf337d809057a7532b6f7 Merge 6.8-rc3 into usb-next
elapsed time: 1447m
configs tested: 237
configs skipped: 4
The following configs have been built successfully.
More configs may be tested in the coming days.
tested configs:
alpha allnoconfig gcc
alpha allyesconfig gcc
alpha defconfig gcc
arc alldefconfig gcc
arc allmodconfig gcc
arc allnoconfig gcc
arc allyesconfig gcc
arc axs103_defconfig gcc
arc axs103_smp_defconfig gcc
arc defconfig gcc
arc hsdk_defconfig gcc
arc randconfig-001-20240205 gcc
arc randconfig-002-20240205 gcc
arc tb10x_defconfig gcc
arc vdk_hs38_defconfig gcc
arm allmodconfig gcc
arm allnoconfig clang
arm allyesconfig gcc
arm at91_dt_defconfig clang
arm defconfig clang
arm ep93xx_defconfig clang
arm imx_v6_v7_defconfig clang
arm mmp2_defconfig gcc
arm moxart_defconfig gcc
arm multi_v4t_defconfig clang
arm mv78xx0_defconfig clang
arm randconfig-001-20240205 clang
arm randconfig-002-20240205 gcc
arm randconfig-003-20240205 clang
arm randconfig-004-20240205 clang
arm s5pv210_defconfig gcc
arm spear6xx_defconfig clang
arm stm32_defconfig gcc
arm64 allmodconfig clang
arm64 allnoconfig gcc
arm64 defconfig gcc
arm64 randconfig-001-20240205 gcc
arm64 randconfig-002-20240205 gcc
arm64 randconfig-003-20240205 gcc
arm64 randconfig-004-20240205 gcc
csky allmodconfig gcc
csky allnoconfig gcc
csky allyesconfig gcc
csky defconfig gcc
csky randconfig-001-20240205 gcc
csky randconfig-002-20240205 gcc
hexagon allmodconfig clang
hexagon allnoconfig clang
hexagon allyesconfig clang
hexagon defconfig clang
hexagon randconfig-001-20240205 clang
hexagon randconfig-002-20240205 clang
i386 allmodconfig gcc
i386 allnoconfig gcc
i386 allyesconfig gcc
i386 buildonly-randconfig-001-20240205 clang
i386 buildonly-randconfig-002-20240205 clang
i386 buildonly-randconfig-003-20240205 clang
i386 buildonly-randconfig-004-20240205 clang
i386 buildonly-randconfig-005-20240205 clang
i386 buildonly-randconfig-006-20240205 clang
i386 defconfig clang
i386 randconfig-001-20240205 clang
i386 randconfig-002-20240205 clang
i386 randconfig-003-20240205 clang
i386 randconfig-004-20240205 gcc
i386 randconfig-005-20240205 clang
i386 randconfig-006-20240205 gcc
i386 randconfig-011-20240205 gcc
i386 randconfig-012-20240205 clang
i386 randconfig-013-20240205 gcc
i386 randconfig-014-20240205 gcc
i386 randconfig-015-20240205 clang
i386 randconfig-016-20240205 gcc
loongarch allmodconfig gcc
loongarch allnoconfig gcc
loongarch allyesconfig gcc
loongarch defconfig gcc
loongarch randconfig-001-20240205 gcc
loongarch randconfig-002-20240205 gcc
m68k allmodconfig gcc
m68k allnoconfig gcc
m68k allyesconfig gcc
m68k amiga_defconfig gcc
m68k atari_defconfig gcc
m68k defconfig gcc
m68k m5249evb_defconfig gcc
microblaze allmodconfig gcc
microblaze allnoconfig gcc
microblaze allyesconfig gcc
microblaze defconfig gcc
mips allmodconfig gcc
mips allnoconfig gcc
mips allyesconfig gcc
mips cobalt_defconfig gcc
mips gcw0_defconfig clang
mips loongson3_defconfig gcc
mips rm200_defconfig gcc
nios2 3c120_defconfig gcc
nios2 allmodconfig gcc
nios2 allnoconfig gcc
nios2 allyesconfig gcc
nios2 defconfig gcc
nios2 randconfig-001-20240205 gcc
nios2 randconfig-002-20240205 gcc
openrisc alldefconfig gcc
openrisc allmodconfig gcc
openrisc allnoconfig gcc
openrisc allyesconfig gcc
openrisc defconfig gcc
parisc allmodconfig gcc
parisc allnoconfig gcc
parisc allyesconfig gcc
parisc defconfig gcc
parisc randconfig-001-20240205 gcc
parisc randconfig-002-20240205 gcc
parisc64 defconfig gcc
powerpc allmodconfig gcc
powerpc allnoconfig gcc
powerpc allyesconfig clang
powerpc fsp2_defconfig gcc
powerpc holly_defconfig clang
powerpc icon_defconfig gcc
powerpc iss476-smp_defconfig gcc
powerpc maple_defconfig clang
powerpc microwatt_defconfig gcc
powerpc ppa8548_defconfig gcc
powerpc randconfig-001-20240205 clang
powerpc randconfig-002-20240205 clang
powerpc randconfig-003-20240205 gcc
powerpc socrates_defconfig gcc
powerpc64 randconfig-001-20240205 clang
powerpc64 randconfig-002-20240205 clang
powerpc64 randconfig-003-20240205 clang
riscv allmodconfig clang
riscv allnoconfig gcc
riscv allyesconfig clang
riscv defconfig clang
riscv randconfig-001-20240205 clang
riscv randconfig-002-20240205 gcc
s390 allmodconfig clang
s390 allnoconfig clang
s390 allyesconfig gcc
s390 defconfig clang
s390 randconfig-001-20240205 clang
s390 randconfig-002-20240205 gcc
sh allmodconfig gcc
sh allnoconfig gcc
sh allyesconfig gcc
sh defconfig gcc
sh dreamcast_defconfig gcc
sh landisk_defconfig gcc
sh polaris_defconfig gcc
sh randconfig-001-20240205 gcc
sh randconfig-002-20240205 gcc
sh se7206_defconfig gcc
sh se7705_defconfig gcc
sh se7750_defconfig gcc
sh sh2007_defconfig gcc
sh sh7710voipgw_defconfig gcc
sh urquell_defconfig gcc
sparc allmodconfig gcc
sparc allnoconfig gcc
sparc allyesconfig gcc
sparc defconfig gcc
sparc64 allmodconfig gcc
sparc64 allyesconfig gcc
sparc64 defconfig gcc
sparc64 randconfig-001-20240205 gcc
sparc64 randconfig-002-20240205 gcc
um allmodconfig clang
um allnoconfig clang
um allyesconfig gcc
um defconfig clang
um randconfig-001-20240205 clang
um randconfig-002-20240205 gcc
um x86_64_defconfig clang
x86_64 allnoconfig clang
x86_64 allyesconfig clang
x86_64 buildonly-randconfig-001-20240204 clang
x86_64 buildonly-randconfig-001-20240205 clang
x86_64 buildonly-randconfig-002-20240204 clang
x86_64 buildonly-randconfig-002-20240205 clang
x86_64 buildonly-randconfig-003-20240204 gcc
x86_64 buildonly-randconfig-003-20240205 gcc
x86_64 buildonly-randconfig-004-20240204 gcc
x86_64 buildonly-randconfig-004-20240205 gcc
x86_64 buildonly-randconfig-005-20240204 clang
x86_64 buildonly-randconfig-005-20240205 gcc
x86_64 buildonly-randconfig-006-20240204 gcc
x86_64 buildonly-randconfig-006-20240205 gcc
x86_64 defconfig gcc
x86_64 randconfig-001-20240204 gcc
x86_64 randconfig-001-20240205 gcc
x86_64 randconfig-002-20240204 gcc
x86_64 randconfig-002-20240205 gcc
x86_64 randconfig-003-20240204 clang
x86_64 randconfig-003-20240205 clang
x86_64 randconfig-004-20240204 clang
x86_64 randconfig-004-20240205 gcc
x86_64 randconfig-005-20240204 gcc
x86_64 randconfig-005-20240205 gcc
x86_64 randconfig-006-20240204 gcc
x86_64 randconfig-006-20240205 gcc
x86_64 randconfig-011-20240204 gcc
x86_64 randconfig-011-20240205 gcc
x86_64 randconfig-012-20240204 gcc
x86_64 randconfig-012-20240205 gcc
x86_64 randconfig-013-20240204 gcc
x86_64 randconfig-013-20240205 clang
x86_64 randconfig-014-20240204 gcc
x86_64 randconfig-014-20240205 clang
x86_64 randconfig-015-20240204 clang
x86_64 randconfig-015-20240205 gcc
x86_64 randconfig-016-20240204 clang
x86_64 randconfig-016-20240205 clang
x86_64 randconfig-071-20240204 gcc
x86_64 randconfig-071-20240205 clang
x86_64 randconfig-072-20240204 gcc
x86_64 randconfig-072-20240205 gcc
x86_64 randconfig-073-20240204 gcc
x86_64 randconfig-073-20240205 clang
x86_64 randconfig-074-20240204 clang
x86_64 randconfig-074-20240205 clang
x86_64 randconfig-075-20240204 clang
x86_64 randconfig-075-20240205 gcc
x86_64 randconfig-076-20240204 gcc
x86_64 randconfig-076-20240205 clang
x86_64 rhel-8.3-bpf gcc
x86_64 rhel-8.3-func gcc
x86_64 rhel-8.3-rust clang
x86_64 rhel-8.3 gcc
xtensa allnoconfig gcc
xtensa allyesconfig gcc
xtensa cadence_csp_defconfig gcc
xtensa randconfig-001-20240205 gcc
xtensa randconfig-002-20240205 gcc
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: usb: gadget: dwc2: RK3308: Transmission to EP OUT stalls at larger packet size
From: Pavel Hofman @ 2024-02-05 14:35 UTC (permalink / raw)
To: Minas Harutyunyan; +Cc: linux-usb@vger.kernel.org
In-Reply-To: <91811ad2-991e-bd34-b3ec-2b92229bdd8b@ivitera.com>
Dne 05. 02. 24 v 14:43 Pavel Hofman napsal(a):
> Hi Minas,
>
> I am having issues with dwc2 gadget on RK3308 (Rock Pi S). Kernel 6.6.2.
>
> When lightly loading EP OUT with UAC2, EP OUT works OK. When increasing
> the packet size (960 bytes in the iso packet), the data delivery stops
> completely. Method u_audio.c:u_audio_iso_complete stops being called,
> it's like as if the incoming stream reception got stuck.
>
> Only the function f_uac2 is used on the gadget.
>
> Debug log from gadget.c + u_audio.c (logging all calls of
> u_audio_iso_complete including !req->status) is attached. Starts of
> playback on the host are marked with this logs in the dump:
>
> g_audio gadget.0: start capture with rate 192000
>
>
> Other debug files are below.
>
> The SoC is quite weak (A35, 1GHz), it may be that it's not capable of
> full HS iso bandwidth. But maybe it's just some suboptimal configuration
> of DMA/DWC2.
>
> Of course I am ready to provide any other debug info.
>
> Thank you very much for any help.
>
> With regards,
>
> Pavel.
>
>
> This is EPs overview from the host + packetsize:
>
> Playback:
> Status: Running
> Interface = 1
> Altset = 1
> Packet Size = 1000
> Momentary freq = 192000 Hz (0x18.0000)
> Feedback Format = 16.16
> Interface 1
> Altset 1
> Format: S32_LE
> Channels: 10
> Endpoint: 0x02 (2 OUT) (ASYNC)
> Rates: 192000
> Data packet interval: 125 us
> Bits: 32
> Channel map: FL FR FC LFE RL RR FLC FRC RC SL
> Sync Endpoint: 0x83 (3 IN)
> Sync EP Interface: 1
> Sync EP Altset: 1
> Implicit Feedback Mode: No
>
> Capture:
> Status: Stop
> Interface 2
> Altset 1
> Format: S32_LE
> Channels: 10
> Endpoint: 0x85 (5 IN) (ASYNC)
> Rates: 192000
> Data packet interval: 125 us
> Bits: 32
> Channel map: FL FR FC LFE RL RR FLC FRC RC SL
>
>
>
>
> root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat ep2out
> Endpoint index 2, named ep2out, dir out:
> DIEPCTL=0x00000400, DOEPCTL=0x800483e8
> DIEPDMA=0x92b8b5a4, DOEPDMA=0x1ba01008
> DIEPINT=0x000002a0, DOEPINT=0x00002010
> DIEPTSIZ=0x00000000, DOEPTSIZ=0x1f27b8c0
>
> mps 1000
> total_data=0
> request list (00000000f7fd142e,00000000900d6fbc):
> req 0000000074dc3bc0: 1000 bytes @0000000074c79a73, 0 done, res -115
> req 00000000980b129b: 1000 bytes @000000006ef8394b, 0 done, res -115
>
>
> RXFIFO is large enough for one full HS iso packet (we calculated it in
> the past to be around 304 bytes minimum). FIFOs fit the 972 bytes of
> total_fifo_size:
>
> root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat fifo
> Non-periodic FIFOs:
> RXFIFO: Size 310
> NPTXFIFO: Size 16, Start 0x00000136
>
> Periodic TXFIFOs:
> DPTXFIFO 1: Size 256, Start 0x00000146
> DPTXFIFO 2: Size 128, Start 0x00000246
> DPTXFIFO 3: Size 128, Start 0x000002c6
> DPTXFIFO 4: Size 64, Start 0x00000346
> DPTXFIFO 5: Size 32, Start 0x00000386
> DPTXFIFO 6: Size 16, Start 0x000003a6
>
>
> root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat hw_params
> op_mode : 0
> arch : 2
> dma_desc_enable : 1
> enable_dynamic_fifo : 1
> en_multiple_tx_fifo : 1
> rx_fifo_size : 1024
> host_nperio_tx_fifo_size : 0
> dev_nperio_tx_fifo_size : 16
> host_perio_tx_fifo_size : 0
> nperio_tx_q_depth : 4
> host_perio_tx_q_depth : 4
> dev_token_q_depth : 8
> max_transfer_size : 524287
> max_packet_count : 1023
> host_channels : 9
> hs_phy_type : 1
> fs_phy_type : 0
> i2c_enable : 0
> num_dev_ep : 9
> num_dev_perio_in_ep : 0
> total_fifo_size : 972
> power_optimized : 1
> utmi_phy_data_width : 1
> snpsid : 0x4f54310a
> dev_ep_dirs : 0x6664
>
>
> root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat params
> otg_caps.hnp_support : 0
> otg_caps.srp_support : 0
> otg_caps.otg_rev : 0
> dma_desc_enable : 0
> dma_desc_fs_enable : 0
> speed : 0
> enable_dynamic_fifo : 1
> en_multiple_tx_fifo : 1
> host_rx_fifo_size : 525
> host_nperio_tx_fifo_size : 128
> host_perio_tx_fifo_size : 256
> max_transfer_size : 524287
> max_packet_count : 1023
> host_channels : 0
> phy_type : 1
> phy_utmi_width : 16
> phy_ulpi_ddr : 0
> phy_ulpi_ext_vbus : 0
> i2c_enable : 0
> ipg_isoc_en : 0
> ulpi_fs_ls : 0
> host_support_fs_ls_low_power : 0
> host_ls_low_power_phy_clk : 0
> activate_stm_fs_transceiver : 0
> activate_stm_id_vb_detection : 0
> ts_dline : 0
> reload_ctl : 1
> ahbcfg : 0xe
> uframe_sched : 1
> external_id_pin_ctl : 0
> power_down : 0
> lpm : 0
> lpm_clock_gating : 0
> besl : 0
> hird_threshold_en : 0
> hird_threshold : 4
> service_interval : 0
> host_dma : 0
> g_dma : 1
> g_dma_desc : 1
> g_rx_fifo_size : 310
> g_np_tx_fifo_size : 16
> g_tx_fifo_size[0] : 0
> g_tx_fifo_size[1] : 256
> g_tx_fifo_size[2] : 128
> g_tx_fifo_size[3] : 128
> g_tx_fifo_size[4] : 64
> g_tx_fifo_size[5] : 32
> g_tx_fifo_size[6] : 16
> g_tx_fifo_size[7] : 0
> g_tx_fifo_size[8] : 0
> g_tx_fifo_size[9] : 0
> g_tx_fifo_size[10] : 0
> g_tx_fifo_size[11] : 0
> g_tx_fifo_size[12] : 0
> g_tx_fifo_size[13] : 0
> g_tx_fifo_size[14] : 0
> g_tx_fifo_size[15] : 0
>
>
> root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat regdump
> GOTGCTL = 0x000d0000
> GOTGINT = 0x00000000
> GAHBCFG = 0x0000002f
> GUSBCFG = 0x4000140f
> GRSTCTL = 0x40000000
> GINTSTS = 0x0438c0ba
> GINTMSK = 0xd88c3c44
> GRXSTSR = 0x51643c02
> GRXFSIZ = 0x00000136
> GNPTXFSIZ = 0x00100136
> GNPTXSTS = 0x00080010
> GI2CCTL = 0x00000000
> GPVNDCTL = 0x00000000
> GGPIO = 0x00000000
> GUID = 0x32000001
> GSNPSID = 0x4f54310a
> GHWCFG1 = 0x00006664
> GHWCFG2 = 0x228e2450
> GHWCFG3 = 0x03cc90e8
> GHWCFG4 = 0xdbf04030
> GLPMCFG = 0x00000000
> GPWRDN = 0x00600010
> GDFIFOCFG = 0x03b603cc
> ADPCTL = 0x00000000
> HPTXFSIZ = 0x00000000
> DPTXFSIZN(1) = 0x01000146
> DPTXFSIZN(2) = 0x00800246
> DPTXFSIZN(3) = 0x008002c6
> DPTXFSIZN(4) = 0x00400346
> DPTXFSIZN(5) = 0x00200386
> DPTXFSIZN(6) = 0x001003a6
> DPTXFSIZN(7) = 0x00200386
> DPTXFSIZN(8) = 0x001003a6
> DPTXFSIZN(9) = 0x01000146
> DPTXFSIZN(10) = 0x00800246
> DPTXFSIZN(11) = 0x008002c6
> DPTXFSIZN(12) = 0x00400346
> DPTXFSIZN(13) = 0x00200386
> DPTXFSIZN(14) = 0x001003a6
> DPTXFSIZN(15) = 0x00200386
> DCFG = 0x008402f0
> DCTL = 0x00000000
> DSTS = 0x001ef900
> DIEPMSK = 0x0000220f
> DOEPMSK = 0x0000023f
> DAINT = 0x02140000
> DAINTMSK = 0x0005000b
> DTKNQR1 = 0x00000000
> DTKNQR2 = 0x00000000
> DTKNQR3 = 0x0c100020
> DTKNQR4 = 0x00000000
> DVBUSDIS = 0x00000b8f
> DVBUSPULSE = 0x000002c6
> DIEPCTL(0) = 0x00028000
> DIEPCTL(1) = 0x018c8006
> DIEPCTL(2) = 0x00000400
> DIEPCTL(3) = 0x01448004
> DIEPCTL(4) = 0x00000400
> DIEPCTL(5) = 0x004603e8
> DIEPCTL(6) = 0x00000400
> DIEPCTL(7) = 0x00000400
> DIEPCTL(8) = 0x00000400
> DIEPCTL(9) = 0x00000400
> DIEPCTL(10) = 0x00000400
> DIEPCTL(11) = 0x00000400
> DIEPCTL(12) = 0x00000400
> DIEPCTL(13) = 0x00000400
> DIEPCTL(14) = 0x00000400
> DIEPCTL(15) = 0x00000400
> DOEPCTL(0) = 0x80028000
> DOEPCTL(1) = 0x00000400
> DOEPCTL(2) = 0x800483e8
> DOEPCTL(3) = 0x00000400
> DOEPCTL(4) = 0x00000400
> DOEPCTL(5) = 0x00000400
> DOEPCTL(6) = 0x00000400
> DOEPCTL(7) = 0x00000400
> DOEPCTL(8) = 0x00000400
> DOEPCTL(9) = 0x00000400
> DOEPCTL(10) = 0x00000400
> DOEPCTL(11) = 0x00000400
> DOEPCTL(12) = 0x00000400
> DOEPCTL(13) = 0x00000400
> DOEPCTL(14) = 0x00000400
> DOEPCTL(15) = 0x00000400
> DIEPINT(0) = 0x00000090
> DIEPINT(1) = 0x00000090
> DIEPINT(2) = 0x000002a0
> DIEPINT(3) = 0x00000090
> DIEPINT(4) = 0x000002a0
> DIEPINT(5) = 0x000000c0
> DIEPINT(6) = 0x000002a0
> DIEPINT(7) = 0x00000080
> DIEPINT(8) = 0x00000080
> DIEPINT(9) = 0x00000080
> DIEPINT(10) = 0x000002a0
> DIEPINT(11) = 0x000002a0
> DIEPINT(12) = 0x000002a0
> DIEPINT(13) = 0x000002a0
> DIEPINT(14) = 0x000002a0
> DIEPINT(15) = 0x000002a0
> DOEPINT(0) = 0x00002000
> DOEPINT(1) = 0x00000000
> DOEPINT(2) = 0x00002010
> DOEPINT(3) = 0x00000000
> DOEPINT(4) = 0x00000020
> DOEPINT(5) = 0x00000000
> DOEPINT(6) = 0x00000000
> DOEPINT(7) = 0x00000000
> DOEPINT(8) = 0x00000000
> DOEPINT(9) = 0x00000220
> DOEPINT(10) = 0x00000000
> DOEPINT(11) = 0x00000000
> DOEPINT(12) = 0x00000000
> DOEPINT(13) = 0x00000000
> DOEPINT(14) = 0x00000000
> DOEPINT(15) = 0x00000000
> DIEPTSIZ(0) = 0x00080052
> DIEPTSIZ(1) = 0x00000000
> DIEPTSIZ(2) = 0x00000000
> DIEPTSIZ(3) = 0x11d81ef7
> DIEPTSIZ(4) = 0x00000000
> DIEPTSIZ(5) = 0x00000000
> DIEPTSIZ(6) = 0x00000000
> DIEPTSIZ(7) = 0x00000000
> DIEPTSIZ(8) = 0x00000000
> DIEPTSIZ(9) = 0x00000000
> DIEPTSIZ(10) = 0x00000000
> DIEPTSIZ(11) = 0x00000000
> DIEPTSIZ(12) = 0x00000000
> DIEPTSIZ(13) = 0x00000000
> DIEPTSIZ(14) = 0x00000000
> DIEPTSIZ(15) = 0x00000000
> DOEPTSIZ(0) = 0x2000005e
> DOEPTSIZ(1) = 0x00000000
> DOEPTSIZ(2) = 0x1f27b8c0
> DOEPTSIZ(3) = 0x00000000
> DOEPTSIZ(4) = 0x00000000
> DOEPTSIZ(5) = 0x00000000
> DOEPTSIZ(6) = 0x00000000
> DOEPTSIZ(7) = 0x00000000
> DOEPTSIZ(8) = 0x00000000
> DOEPTSIZ(9) = 0x00000000
> DOEPTSIZ(10) = 0x00000000
> DOEPTSIZ(11) = 0x00000000
> DOEPTSIZ(12) = 0x00000000
> DOEPTSIZ(13) = 0x00000000
> DOEPTSIZ(14) = 0x00000000
> DOEPTSIZ(15) = 0x00000000
> DIEPDMA(0) = 0x0e693000
> DIEPDMA(1) = 0x86711010
> DIEPDMA(2) = 0x92b8b5a4
> DIEPDMA(3) = 0x1ba02008
> DIEPDMA(4) = 0x92b8b5a4
> DIEPDMA(5) = 0x2fae0710
> DIEPDMA(6) = 0x92b8b5a4
> DIEPDMA(7) = 0x43c7ba7f
> DIEPDMA(8) = 0x0cc64000
> DIEPDMA(9) = 0x57447266
> DIEPDMA(10) = 0x92b8b5a4
> DIEPDMA(11) = 0x92b8b5a4
> DIEPDMA(12) = 0x92b8b5a4
> DIEPDMA(13) = 0x92b8b5a4
> DIEPDMA(14) = 0x92b8b5a4
> DIEPDMA(15) = 0x92b8b5a4
> DOEPDMA(0) = 0x1ba01000
> DOEPDMA(1) = 0xa8800c26
> DOEPDMA(2) = 0x1ba01008
> DOEPDMA(3) = 0xa8800c26
> DOEPDMA(4) = 0x6db46af8
> DOEPDMA(5) = 0xa8800c26
> DOEPDMA(6) = 0x1291dfd8
> DOEPDMA(7) = 0xa8800c26
> DOEPDMA(8) = 0x82d9ef90
> DOEPDMA(9) = 0x0309d816
> DOEPDMA(10) = 0xa8800c26
> DOEPDMA(11) = 0xa8800c26
> DOEPDMA(12) = 0xa8800c26
> DOEPDMA(13) = 0xa8800c26
> DOEPDMA(14) = 0xa8800c26
> DOEPDMA(15) = 0xa8800c26
> DTXFSTS(0) = 0x00000010
> DTXFSTS(1) = 0x00000010
> DTXFSTS(2) = 0x00000010
> DTXFSTS(3) = 0x00000020
> DTXFSTS(4) = 0x00000010
> DTXFSTS(5) = 0x00000100
> DTXFSTS(6) = 0x00000010
> DTXFSTS(7) = 0x00000010
> DTXFSTS(8) = 0x00000010
> DTXFSTS(9) = 0x00000010
> DTXFSTS(10) = 0x00000010
> DTXFSTS(11) = 0x00000010hofman
> DTXFSTS(12) = 0x00000010
> DTXFSTS(13) = 0x00000010
> DTXFSTS(14) = 0x00000010
> DTXFSTS(15) = 0x00000010
> PCGCTL = 0x00000000
> HCFG = 0x008402f0
> HFIR = 0x00000b8f
> HFNUM = 0x0b1803df
> HPTXSTS = 0x00080100
> HAINT = 0x00000002
> HAINTMSK = 0x00000007
> HFLBADDR = 0x00000000
> HPRT0 = 0x00000000
> HCCHAR(0) = 0x018c8006
> HCCHAR(1) = 0x00000400
> HCCHAR(2) = 0x800483e8
> HCCHAR(3) = 0x00000400
> HCCHAR(4) = 0x00000400
> HCCHAR(5) = 0x00000400
> HCCHAR(6) = 0x00000400
> HCCHAR(7) = 0x00000400
> HCCHAR(8) = 0x00000400
> HCCHAR(9) = 0x00000400
> HCCHAR(10) = 0x00000400
> HCCHAR(11) = 0x00000400
> HCCHAR(12) = 0x00000400
> HCCHAR(13) = 0x00000400
> HCCHAR(14) = 0x00000400
> HCCHAR(15) = 0x00000400
> HCSPLT(0) = 0x00000000
> HCSPLT(1) = 0x00000000
> HCSPLT(2) = 0x00000000
> HCSPLT(3) = 0x00000000
> HCSPLT(4) = 0x00000000
> HCSPLT(5) = 0x00000000
> HCSPLT(6) = 0x00000000
> HCSPLT(7) = 0x00000000
> HCSPLT(8) = 0x00000000
> HCSPLT(9) = 0x00000000
> HCSPLT(10) = 0x00000000
> HCSPLT(11) = 0x00000000
> HCSPLT(12) = 0x00000000
> HCSPLT(13) = 0x00000000
> HCSPLT(14) = 0x00000000
> HCSPLT(15) = 0x00000000
> HCINT(0) = 0x00000010
> HCINT(1) = 0x00000000
> HCINT(2) = 0x00002010
> HCINT(3) = 0x00000000
> HCINT(4) = 0x00000020
> HCINT(5) = 0x00000000
> HCINT(6) = 0x00000000
> HCINT(7) = 0x00000000
> HCINT(8) = 0x00000000
> HCINT(9) = 0x00000220
> HCINT(10) = 0x00000000
> HCINT(11) = 0x00000000
> HCINT(12) = 0x00000000
> HCINT(13) = 0x00000000
> HCINT(14) = 0x00000000
> HCINT(15) = 0x00000000
> HCINTMSK(0) = 0x0000020f
> HCINTMSK(1) = 0x00000000
> HCINTMSK(2) = 0x00000000
> HCINTMSK(3) = 0x00000000
> HCINTMSK(4) = 0x00000000
> HCINTMSK(5) = 0x00000000
> HCINTMSK(6) = 0x00000000
> HCINTMSK(7) = 0x00000000
> HCINTMSK(8) = 0x00000000
> HCINTMSK(9) = 0x00000000
> HCINTMSK(10) = 0x00000000
> HCINTMSK(11) = 0x00000000
> HCINTMSK(12) = 0x00000000
> HCINTMSK(13) = 0x00000000
> HCINTMSK(14) = 0x00000000
> HCINTMSK(15) = 0x00000000
> HCTSIZ(0) = 0x00000000
> HCTSIZ(1) = 0x00000000
> HCTSIZ(2) = 0x1f27b8c0
> HCTSIZ(3) = 0x00000000
> HCTSIZ(4) = 0x00000000
> HCTSIZ(5) = 0x00000000
> HCTSIZ(6) = 0x00000000
> HCTSIZ(7) = 0x00000000
> HCTSIZ(8) = 0x00000000
> HCTSIZ(9) = 0x00000000
> HCTSIZ(10) = 0x00000000
> HCTSIZ(11) = 0x00000000
> HCTSIZ(12) = 0x00000000
> HCTSIZ(13) = 0x00000000
> HCTSIZ(14) = 0x00000000
> HCTSIZ(15) = 0x00000000
> HCDMA(0) = 0x1ba01000
> HCDMA(1) = 0xa8800c26
> HCDMA(2) = 0x1ba01008
> HCDMA(3) = 0xa8800c26
> HCDMA(4) = 0x6db46af8
> HCDMA(5) = 0xa8800c26
> HCDMA(6) = 0x1291dfd8
> HCDMA(7) = 0xa8800c26
> HCDMA(8) = 0x82d9ef90
> HCDMA(9) = 0x0309d816
> HCDMA(10) = 0xa8800c26
> HCDMA(11) = 0xa8800c26
> HCDMA(12) = 0xa8800c26
> HCDMA(13) = 0xa8800c26
> HCDMA(14) = 0xa8800c26
> HCDMA(15) = 0xa8800c26
> HCDMAB(0) = 0x069e9ff0
> HCDMAB(1) = 0xa8800c26
> HCDMAB(2) = 0x05eaf3c0
> HCDMAB(3) = 0xa8800c26
> HCDMAB(4) = 0x1f0d193f
> HCDMAB(5) = 0xa8800c26
> HCDMAB(6) = 0x7f72548c
> HCDMAB(7) = 0xa8800c26
> HCDMAB(8) = 0x7795e924
> HCDMAB(9) = 0xc36c019a
> HCDMAB(10) = 0xa8800c26
> HCDMAB(11) = 0xa8800c26
> HCDMAB(12) = 0xa8800c26
> HCDMAB(13) = 0xa8800c26
> HCDMAB(14) = 0xa8800c26
> HCDMAB(15) = 0xa8800c26
>
It really looks like some DMA performance issue. Stream 980 bytes/ 250us
(bInterval=2) is bitperfect, no dropped packets. While 24 bytes/125us
(bInterval=1) gets stuck. IIUC the DMA is not capable of copying packets
every 125us. Please is there any chance to tweak the performance to
handle the 125us packets reliably?
Thanks a lot!
^ permalink raw reply
* [PATCH v2 5/5] usb: dwc3-am62: add workaround for Errata i2409
From: Roger Quadros @ 2024-02-05 14:12 UTC (permalink / raw)
To: Thinh.Nguyen
Cc: gregkh, r-gunasekaran, b-liu, afd, nm, srk, linux-usb,
linux-kernel, Roger Quadros, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
In-Reply-To: <20240205141221.56076-1-rogerq@kernel.org>
All AM62 devices have Errata i2409 [1] due to which
USB2 PHY may lock up due to short suspend.
Workaround involves setting bit 5 and 4 PLL_REG12
in PHY2 register space after USB controller is brought
out of LPSC reset but before controller initialization.
Handle this workaround.
[1] - https://www.ti.com/lit/er/sprz487d/sprz487d.pdf
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
Notes:
Changelog:
v2:
- don't add phy read/write helpers or add phy to private data
v1: https://lore.kernel.org/all/20240201121220.5523-5-rogerq@kernel.org/
drivers/usb/dwc3/dwc3-am62.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c
index af1ce934e7fb..5ae5c3087b0f 100644
--- a/drivers/usb/dwc3/dwc3-am62.c
+++ b/drivers/usb/dwc3/dwc3-am62.c
@@ -101,6 +101,11 @@
#define PHY_CORE_VOLTAGE_MASK BIT(31)
#define PHY_PLL_REFCLK_MASK GENMASK(3, 0)
+/* USB PHY2 register offsets */
+#define USB_PHY_PLL_REG12 0x130
+#define USB_PHY_PLL_LDO_REF_EN BIT(5)
+#define USB_PHY_PLL_LDO_REF_EN_EN BIT(4)
+
#define DWC3_AM62_AUTOSUSPEND_DELAY 100
struct dwc3_am62 {
@@ -184,8 +189,9 @@ static int dwc3_ti_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct device_node *node = pdev->dev.of_node;
struct dwc3_am62 *am62;
- int i, ret;
unsigned long rate;
+ void __iomem *phy;
+ int i, ret;
u32 reg;
am62 = devm_kzalloc(dev, sizeof(*am62), GFP_KERNEL);
@@ -201,6 +207,12 @@ static int dwc3_ti_probe(struct platform_device *pdev)
return PTR_ERR(am62->usbss);
}
+ phy = devm_platform_ioremap_resource(pdev, 1);
+ if (IS_ERR(phy)) {
+ dev_err(dev, "can't map PHY IOMEM resource. Won't apply i2409 fix.\n");
+ phy = NULL;
+ }
+
am62->usb2_refclk = devm_clk_get(dev, "ref");
if (IS_ERR(am62->usb2_refclk)) {
dev_err(dev, "can't get usb2_refclk\n");
@@ -227,6 +239,13 @@ static int dwc3_ti_probe(struct platform_device *pdev)
if (ret)
return ret;
+ /* Workaround Errata i2409 */
+ if (phy) {
+ reg = readl(phy + USB_PHY_PLL_REG12);
+ reg |= USB_PHY_PLL_LDO_REF_EN | USB_PHY_PLL_LDO_REF_EN_EN;
+ writel(reg, phy + USB_PHY_PLL_REG12);
+ }
+
/* VBUS divider select */
am62->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider");
reg = dwc3_ti_readl(am62, USBSS_PHY_CONFIG);
--
2.34.1
^ permalink raw reply related
* [PATCH v2 4/5] dt-bindings: usb/ti,am62-usb.yaml: Add PHY2 register space
From: Roger Quadros @ 2024-02-05 14:12 UTC (permalink / raw)
To: Thinh.Nguyen
Cc: gregkh, r-gunasekaran, b-liu, afd, nm, srk, linux-usb,
linux-kernel, Roger Quadros, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
In-Reply-To: <20240205141221.56076-1-rogerq@kernel.org>
Add PHY2 register space to DT binding documentation.
We use minItems: 1 as DT update will come later and we don't
want warnings for existing DTs.
So far this register space was not required but due to the
newly identified Errata i2409 [1] we need to poke this
register space.
[1] https://www.ti.com/lit/er/sprz487d/sprz487d.pdf
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
Notes:
Changelog:
v2: add minItems and update commit log
v1: was sent as part of different series
https://lore.kernel.org/all/20240201120332.4811-5-rogerq@kernel.org/
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
index fec5651f5602..f6e6d084d1c5 100644
--- a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
+++ b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
@@ -14,7 +14,10 @@ properties:
const: ti,am62-usb
reg:
- maxItems: 1
+ minItems: 1
+ items:
+ - description: USB CFG register space
+ - description: USB PHY2 register space
ranges: true
@@ -82,7 +85,8 @@ examples:
usbss1: usb@f910000 {
compatible = "ti,am62-usb";
- reg = <0x00 0x0f910000 0x00 0x800>;
+ reg = <0x00 0x0f910000 0x00 0x800>,
+ <0x00 0x0f918000 0x00 0x400>;
clocks = <&k3_clks 162 3>;
clock-names = "ref";
ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>;
--
2.34.1
^ permalink raw reply related
* [PATCH v2 3/5] usb: dwc3-am62: Fix PHY core voltage selection
From: Roger Quadros @ 2024-02-05 14:12 UTC (permalink / raw)
To: Thinh.Nguyen
Cc: gregkh, r-gunasekaran, b-liu, afd, nm, srk, linux-usb,
linux-kernel, Roger Quadros
In-Reply-To: <20240205141221.56076-1-rogerq@kernel.org>
TRM information is outdated and design team has confirmed
that PHY_CORE_VOLTAGE should be 0 irrespective of
VDD_CORE voltage.
Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
Notes:
Changelog:
v2: no change
v1: https://lore.kernel.org/all/20240201121220.5523-4-rogerq@kernel.org/
drivers/usb/dwc3/dwc3-am62.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c
index 600ba9cfefea..af1ce934e7fb 100644
--- a/drivers/usb/dwc3/dwc3-am62.c
+++ b/drivers/usb/dwc3/dwc3-am62.c
@@ -97,7 +97,8 @@
#define USBSS_VBUS_STAT_SESSVALID BIT(2)
#define USBSS_VBUS_STAT_VBUSVALID BIT(0)
-/* Mask for PHY PLL REFCLK */
+/* USB_PHY_CTRL register bits in CTRL_MMR */
+#define PHY_CORE_VOLTAGE_MASK BIT(31)
#define PHY_PLL_REFCLK_MASK GENMASK(3, 0)
#define DWC3_AM62_AUTOSUSPEND_DELAY 100
@@ -162,6 +163,13 @@ static int phy_syscon_pll_refclk(struct dwc3_am62 *am62)
am62->offset = args.args[0];
+ /* Core voltage. PHY_CORE_VOLTAGE bit Recommended to be 0 always */
+ ret = regmap_update_bits(am62->syscon, am62->offset, PHY_CORE_VOLTAGE_MASK, 0);
+ if (ret) {
+ dev_err(dev, "failed to set phy core voltage\n");
+ return ret;
+ }
+
ret = regmap_update_bits(am62->syscon, am62->offset, PHY_PLL_REFCLK_MASK, am62->rate_code);
if (ret) {
dev_err(dev, "failed to set phy pll reference clock rate\n");
--
2.34.1
^ permalink raw reply related
* [PATCH v2 2/5] usb: dwc3-am62: fix error on module removal
From: Roger Quadros @ 2024-02-05 14:12 UTC (permalink / raw)
To: Thinh.Nguyen
Cc: gregkh, r-gunasekaran, b-liu, afd, nm, srk, linux-usb,
linux-kernel, Roger Quadros
In-Reply-To: <20240205141221.56076-1-rogerq@kernel.org>
As runtime PM is enabled, the module can be runtime
suspended when .remove() is called.
Do a pm_runtime_get_sync() to make sure module is active
before doing any register operations.
Doing a pm_runtime_put_sync() should disable the refclk
so no need to disable it again.
Fixes the below warning at module removel.
[ 39.705310] ------------[ cut here ]------------
[ 39.710004] clk:162:3 already disabled
[ 39.713941] WARNING: CPU: 0 PID: 921 at drivers/clk/clk.c:1090 clk_core_disable+0xb0/0xb8
Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
Notes:
Changelog:
v2: no change
v1: https://lore.kernel.org/all/20240201121220.5523-3-rogerq@kernel.org/
drivers/usb/dwc3/dwc3-am62.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c
index 1bfc9e67614f..600ba9cfefea 100644
--- a/drivers/usb/dwc3/dwc3-am62.c
+++ b/drivers/usb/dwc3/dwc3-am62.c
@@ -273,6 +273,11 @@ static void dwc3_ti_remove(struct platform_device *pdev)
struct dwc3_am62 *am62 = platform_get_drvdata(pdev);
u32 reg;
+ pm_runtime_get_sync(dev);
+
+ device_wakeup_disable(dev);
+ device_set_wakeup_capable(dev, false);
+
of_platform_depopulate(dev);
/* Clear mode valid bit */
@@ -281,7 +286,6 @@ static void dwc3_ti_remove(struct platform_device *pdev)
dwc3_ti_writel(am62, USBSS_MODE_CONTROL, reg);
pm_runtime_put_sync(dev);
- clk_disable_unprepare(am62->usb2_refclk);
pm_runtime_disable(dev);
pm_runtime_set_suspended(dev);
}
--
2.34.1
^ permalink raw reply related
* [PATCH v2 1/5] usb: dwc3-am62: call of_platform_depopulate in .remove()
From: Roger Quadros @ 2024-02-05 14:12 UTC (permalink / raw)
To: Thinh.Nguyen
Cc: gregkh, r-gunasekaran, b-liu, afd, nm, srk, linux-usb,
linux-kernel, Roger Quadros
In-Reply-To: <20240205141221.56076-1-rogerq@kernel.org>
We called of_platform_populate() in .probe() so call the
cleanup function of_platform_depopulate() in .remove().
Get rid of the now unnnecessary dwc3_ti_remove_core().
Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
Notes:
Changelog:
v2: no change
v1: https://lore.kernel.org/all/20240201121220.5523-2-rogerq@kernel.org/
drivers/usb/dwc3/dwc3-am62.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c
index 90a587bc29b7..1bfc9e67614f 100644
--- a/drivers/usb/dwc3/dwc3-am62.c
+++ b/drivers/usb/dwc3/dwc3-am62.c
@@ -267,21 +267,13 @@ static int dwc3_ti_probe(struct platform_device *pdev)
return ret;
}
-static int dwc3_ti_remove_core(struct device *dev, void *c)
-{
- struct platform_device *pdev = to_platform_device(dev);
-
- platform_device_unregister(pdev);
- return 0;
-}
-
static void dwc3_ti_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct dwc3_am62 *am62 = platform_get_drvdata(pdev);
u32 reg;
- device_for_each_child(dev, NULL, dwc3_ti_remove_core);
+ of_platform_depopulate(dev);
/* Clear mode valid bit */
reg = dwc3_ti_readl(am62, USBSS_MODE_CONTROL);
--
2.34.1
^ permalink raw reply related
* [PATCH v2 0/5] usb: dwc3-am62: module removal and errata fixes
From: Roger Quadros @ 2024-02-05 14:12 UTC (permalink / raw)
To: Thinh.Nguyen
Cc: gregkh, r-gunasekaran, b-liu, afd, nm, srk, linux-usb,
linux-kernel, Roger Quadros
Hi,
This series fixes errors during module removal. It also
implements PHY core voltage selection as per TI recommendation
and workaround for Errata i2409 [1].
The workaround needs PHY2 region to be present in device node.
The device tree patch will be sent later after the DT binding doc
is merged.
[1] - https://www.ti.com/lit/er/sprz487d/sprz487d.pdf
Changelog in each file
v1: https://lore.kernel.org/all/20240201121220.5523-1-rogerq@kernel.org/
cheers,
-roger
Roger Quadros (5):
usb: dwc3-am62: call of_platform_depopulate in .remove()
usb: dwc3-am62: fix error on module removal
usb: dwc3-am62: Fix PHY core voltage selection
dt-bindings: usb/ti,am62-usb.yaml: Add PHY2 register space
usb: dwc3-am62: add workaround for Errata i2409
.../devicetree/bindings/usb/ti,am62-usb.yaml | 8 +++-
drivers/usb/dwc3/dwc3-am62.c | 47 ++++++++++++++-----
2 files changed, 41 insertions(+), 14 deletions(-)
base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
--
2.34.1
^ permalink raw reply
* Re: [PATCH 1/2] net: asix: add 0b95:1790 to AX88179A device list
From: Andrew Lunn @ 2024-02-05 14:03 UTC (permalink / raw)
To: Christian Hewitt
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Grant Grundler, linux-usb, netdev, linux-kernel
In-Reply-To: <20240205104049.48900-1-christianshewitt@gmail.com>
On Mon, Feb 05, 2024 at 10:40:48AM +0000, Christian Hewitt wrote:
> Add a generic AX88179A entry for the 0b95:1790 device id:
>
> kernel: usb 2-1: New USB device found, idVendor=0b95, idProduct=1790, bcdDevice= 2.00
> kernel: usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> kernel: usb 2-1: Product: AX88179A
> kernel: usb 2-1: Manufacturer: ASIX
> kernel: usb 2-1: SerialNumber: 00D24DC0
> kernel: asix 2-1:1.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x0000: -32
> kernel: asix: probe of 2-1:1.0 failed with error -32
> kernel: ax88179_178a 2-1:1.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x0040: -32
> kernel: ax88179_178a 2-1:1.0 eth1: register 'ax88179_178a' at usb-0000:01:00.0-1, ASIX AX88179 USB 3.0 Gigabit Ethernet, 20:7b:d2:d2:4d:c0
>
> Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
> ---
> The change is tested by a LibreELEC (distro) user who reports the NIC to be working
> fine (and logs support this) but the "Failed to read reg index 0x0000: -32" errors
> suggest ax88178_info might not be the correct choice. I'm not a serious coder so I
> need to "ask the audience" for suggestions on what more might be needed?
I would probably start by determining what ax88179_read_cmd() is
causing that print. Maybe print in addition cmd, and value. Or add a
WARN() so you get a stack trace.
It might be possible to figure it out by just looking at the code. How
many places actually pass index=0?
Andrew
^ permalink raw reply
* usb: gadget: dwc2: RK3308: Transmission to EP OUT stalls at larger packet size
From: Pavel Hofman @ 2024-02-05 13:43 UTC (permalink / raw)
To: Minas Harutyunyan; +Cc: linux-usb@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 13382 bytes --]
Hi Minas,
I am having issues with dwc2 gadget on RK3308 (Rock Pi S). Kernel 6.6.2.
When lightly loading EP OUT with UAC2, EP OUT works OK. When increasing
the packet size (960 bytes in the iso packet), the data delivery stops
completely. Method u_audio.c:u_audio_iso_complete stops being called,
it's like as if the incoming stream reception got stuck.
Only the function f_uac2 is used on the gadget.
Debug log from gadget.c + u_audio.c (logging all calls of
u_audio_iso_complete including !req->status) is attached. Starts of
playback on the host are marked with this logs in the dump:
g_audio gadget.0: start capture with rate 192000
Other debug files are below.
The SoC is quite weak (A35, 1GHz), it may be that it's not capable of
full HS iso bandwidth. But maybe it's just some suboptimal configuration
of DMA/DWC2.
Of course I am ready to provide any other debug info.
Thank you very much for any help.
With regards,
Pavel.
This is EPs overview from the host + packetsize:
Playback:
Status: Running
Interface = 1
Altset = 1
Packet Size = 1000
Momentary freq = 192000 Hz (0x18.0000)
Feedback Format = 16.16
Interface 1
Altset 1
Format: S32_LE
Channels: 10
Endpoint: 0x02 (2 OUT) (ASYNC)
Rates: 192000
Data packet interval: 125 us
Bits: 32
Channel map: FL FR FC LFE RL RR FLC FRC RC SL
Sync Endpoint: 0x83 (3 IN)
Sync EP Interface: 1
Sync EP Altset: 1
Implicit Feedback Mode: No
Capture:
Status: Stop
Interface 2
Altset 1
Format: S32_LE
Channels: 10
Endpoint: 0x85 (5 IN) (ASYNC)
Rates: 192000
Data packet interval: 125 us
Bits: 32
Channel map: FL FR FC LFE RL RR FLC FRC RC SL
root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat ep2out
Endpoint index 2, named ep2out, dir out:
DIEPCTL=0x00000400, DOEPCTL=0x800483e8
DIEPDMA=0x92b8b5a4, DOEPDMA=0x1ba01008
DIEPINT=0x000002a0, DOEPINT=0x00002010
DIEPTSIZ=0x00000000, DOEPTSIZ=0x1f27b8c0
mps 1000
total_data=0
request list (00000000f7fd142e,00000000900d6fbc):
req 0000000074dc3bc0: 1000 bytes @0000000074c79a73, 0 done, res -115
req 00000000980b129b: 1000 bytes @000000006ef8394b, 0 done, res -115
RXFIFO is large enough for one full HS iso packet (we calculated it in
the past to be around 304 bytes minimum). FIFOs fit the 972 bytes of
total_fifo_size:
root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat fifo
Non-periodic FIFOs:
RXFIFO: Size 310
NPTXFIFO: Size 16, Start 0x00000136
Periodic TXFIFOs:
DPTXFIFO 1: Size 256, Start 0x00000146
DPTXFIFO 2: Size 128, Start 0x00000246
DPTXFIFO 3: Size 128, Start 0x000002c6
DPTXFIFO 4: Size 64, Start 0x00000346
DPTXFIFO 5: Size 32, Start 0x00000386
DPTXFIFO 6: Size 16, Start 0x000003a6
root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat hw_params
op_mode : 0
arch : 2
dma_desc_enable : 1
enable_dynamic_fifo : 1
en_multiple_tx_fifo : 1
rx_fifo_size : 1024
host_nperio_tx_fifo_size : 0
dev_nperio_tx_fifo_size : 16
host_perio_tx_fifo_size : 0
nperio_tx_q_depth : 4
host_perio_tx_q_depth : 4
dev_token_q_depth : 8
max_transfer_size : 524287
max_packet_count : 1023
host_channels : 9
hs_phy_type : 1
fs_phy_type : 0
i2c_enable : 0
num_dev_ep : 9
num_dev_perio_in_ep : 0
total_fifo_size : 972
power_optimized : 1
utmi_phy_data_width : 1
snpsid : 0x4f54310a
dev_ep_dirs : 0x6664
root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat params
otg_caps.hnp_support : 0
otg_caps.srp_support : 0
otg_caps.otg_rev : 0
dma_desc_enable : 0
dma_desc_fs_enable : 0
speed : 0
enable_dynamic_fifo : 1
en_multiple_tx_fifo : 1
host_rx_fifo_size : 525
host_nperio_tx_fifo_size : 128
host_perio_tx_fifo_size : 256
max_transfer_size : 524287
max_packet_count : 1023
host_channels : 0
phy_type : 1
phy_utmi_width : 16
phy_ulpi_ddr : 0
phy_ulpi_ext_vbus : 0
i2c_enable : 0
ipg_isoc_en : 0
ulpi_fs_ls : 0
host_support_fs_ls_low_power : 0
host_ls_low_power_phy_clk : 0
activate_stm_fs_transceiver : 0
activate_stm_id_vb_detection : 0
ts_dline : 0
reload_ctl : 1
ahbcfg : 0xe
uframe_sched : 1
external_id_pin_ctl : 0
power_down : 0
lpm : 0
lpm_clock_gating : 0
besl : 0
hird_threshold_en : 0
hird_threshold : 4
service_interval : 0
host_dma : 0
g_dma : 1
g_dma_desc : 1
g_rx_fifo_size : 310
g_np_tx_fifo_size : 16
g_tx_fifo_size[0] : 0
g_tx_fifo_size[1] : 256
g_tx_fifo_size[2] : 128
g_tx_fifo_size[3] : 128
g_tx_fifo_size[4] : 64
g_tx_fifo_size[5] : 32
g_tx_fifo_size[6] : 16
g_tx_fifo_size[7] : 0
g_tx_fifo_size[8] : 0
g_tx_fifo_size[9] : 0
g_tx_fifo_size[10] : 0
g_tx_fifo_size[11] : 0
g_tx_fifo_size[12] : 0
g_tx_fifo_size[13] : 0
g_tx_fifo_size[14] : 0
g_tx_fifo_size[15] : 0
root@rock-pi-s:/sys/kernel/debug/usb/ff400000.usb# cat regdump
GOTGCTL = 0x000d0000
GOTGINT = 0x00000000
GAHBCFG = 0x0000002f
GUSBCFG = 0x4000140f
GRSTCTL = 0x40000000
GINTSTS = 0x0438c0ba
GINTMSK = 0xd88c3c44
GRXSTSR = 0x51643c02
GRXFSIZ = 0x00000136
GNPTXFSIZ = 0x00100136
GNPTXSTS = 0x00080010
GI2CCTL = 0x00000000
GPVNDCTL = 0x00000000
GGPIO = 0x00000000
GUID = 0x32000001
GSNPSID = 0x4f54310a
GHWCFG1 = 0x00006664
GHWCFG2 = 0x228e2450
GHWCFG3 = 0x03cc90e8
GHWCFG4 = 0xdbf04030
GLPMCFG = 0x00000000
GPWRDN = 0x00600010
GDFIFOCFG = 0x03b603cc
ADPCTL = 0x00000000
HPTXFSIZ = 0x00000000
DPTXFSIZN(1) = 0x01000146
DPTXFSIZN(2) = 0x00800246
DPTXFSIZN(3) = 0x008002c6
DPTXFSIZN(4) = 0x00400346
DPTXFSIZN(5) = 0x00200386
DPTXFSIZN(6) = 0x001003a6
DPTXFSIZN(7) = 0x00200386
DPTXFSIZN(8) = 0x001003a6
DPTXFSIZN(9) = 0x01000146
DPTXFSIZN(10) = 0x00800246
DPTXFSIZN(11) = 0x008002c6
DPTXFSIZN(12) = 0x00400346
DPTXFSIZN(13) = 0x00200386
DPTXFSIZN(14) = 0x001003a6
DPTXFSIZN(15) = 0x00200386
DCFG = 0x008402f0
DCTL = 0x00000000
DSTS = 0x001ef900
DIEPMSK = 0x0000220f
DOEPMSK = 0x0000023f
DAINT = 0x02140000
DAINTMSK = 0x0005000b
DTKNQR1 = 0x00000000
DTKNQR2 = 0x00000000
DTKNQR3 = 0x0c100020
DTKNQR4 = 0x00000000
DVBUSDIS = 0x00000b8f
DVBUSPULSE = 0x000002c6
DIEPCTL(0) = 0x00028000
DIEPCTL(1) = 0x018c8006
DIEPCTL(2) = 0x00000400
DIEPCTL(3) = 0x01448004
DIEPCTL(4) = 0x00000400
DIEPCTL(5) = 0x004603e8
DIEPCTL(6) = 0x00000400
DIEPCTL(7) = 0x00000400
DIEPCTL(8) = 0x00000400
DIEPCTL(9) = 0x00000400
DIEPCTL(10) = 0x00000400
DIEPCTL(11) = 0x00000400
DIEPCTL(12) = 0x00000400
DIEPCTL(13) = 0x00000400
DIEPCTL(14) = 0x00000400
DIEPCTL(15) = 0x00000400
DOEPCTL(0) = 0x80028000
DOEPCTL(1) = 0x00000400
DOEPCTL(2) = 0x800483e8
DOEPCTL(3) = 0x00000400
DOEPCTL(4) = 0x00000400
DOEPCTL(5) = 0x00000400
DOEPCTL(6) = 0x00000400
DOEPCTL(7) = 0x00000400
DOEPCTL(8) = 0x00000400
DOEPCTL(9) = 0x00000400
DOEPCTL(10) = 0x00000400
DOEPCTL(11) = 0x00000400
DOEPCTL(12) = 0x00000400
DOEPCTL(13) = 0x00000400
DOEPCTL(14) = 0x00000400
DOEPCTL(15) = 0x00000400
DIEPINT(0) = 0x00000090
DIEPINT(1) = 0x00000090
DIEPINT(2) = 0x000002a0
DIEPINT(3) = 0x00000090
DIEPINT(4) = 0x000002a0
DIEPINT(5) = 0x000000c0
DIEPINT(6) = 0x000002a0
DIEPINT(7) = 0x00000080
DIEPINT(8) = 0x00000080
DIEPINT(9) = 0x00000080
DIEPINT(10) = 0x000002a0
DIEPINT(11) = 0x000002a0
DIEPINT(12) = 0x000002a0
DIEPINT(13) = 0x000002a0
DIEPINT(14) = 0x000002a0
DIEPINT(15) = 0x000002a0
DOEPINT(0) = 0x00002000
DOEPINT(1) = 0x00000000
DOEPINT(2) = 0x00002010
DOEPINT(3) = 0x00000000
DOEPINT(4) = 0x00000020
DOEPINT(5) = 0x00000000
DOEPINT(6) = 0x00000000
DOEPINT(7) = 0x00000000
DOEPINT(8) = 0x00000000
DOEPINT(9) = 0x00000220
DOEPINT(10) = 0x00000000
DOEPINT(11) = 0x00000000
DOEPINT(12) = 0x00000000
DOEPINT(13) = 0x00000000
DOEPINT(14) = 0x00000000
DOEPINT(15) = 0x00000000
DIEPTSIZ(0) = 0x00080052
DIEPTSIZ(1) = 0x00000000
DIEPTSIZ(2) = 0x00000000
DIEPTSIZ(3) = 0x11d81ef7
DIEPTSIZ(4) = 0x00000000
DIEPTSIZ(5) = 0x00000000
DIEPTSIZ(6) = 0x00000000
DIEPTSIZ(7) = 0x00000000
DIEPTSIZ(8) = 0x00000000
DIEPTSIZ(9) = 0x00000000
DIEPTSIZ(10) = 0x00000000
DIEPTSIZ(11) = 0x00000000
DIEPTSIZ(12) = 0x00000000
DIEPTSIZ(13) = 0x00000000
DIEPTSIZ(14) = 0x00000000
DIEPTSIZ(15) = 0x00000000
DOEPTSIZ(0) = 0x2000005e
DOEPTSIZ(1) = 0x00000000
DOEPTSIZ(2) = 0x1f27b8c0
DOEPTSIZ(3) = 0x00000000
DOEPTSIZ(4) = 0x00000000
DOEPTSIZ(5) = 0x00000000
DOEPTSIZ(6) = 0x00000000
DOEPTSIZ(7) = 0x00000000
DOEPTSIZ(8) = 0x00000000
DOEPTSIZ(9) = 0x00000000
DOEPTSIZ(10) = 0x00000000
DOEPTSIZ(11) = 0x00000000
DOEPTSIZ(12) = 0x00000000
DOEPTSIZ(13) = 0x00000000
DOEPTSIZ(14) = 0x00000000
DOEPTSIZ(15) = 0x00000000
DIEPDMA(0) = 0x0e693000
DIEPDMA(1) = 0x86711010
DIEPDMA(2) = 0x92b8b5a4
DIEPDMA(3) = 0x1ba02008
DIEPDMA(4) = 0x92b8b5a4
DIEPDMA(5) = 0x2fae0710
DIEPDMA(6) = 0x92b8b5a4
DIEPDMA(7) = 0x43c7ba7f
DIEPDMA(8) = 0x0cc64000
DIEPDMA(9) = 0x57447266
DIEPDMA(10) = 0x92b8b5a4
DIEPDMA(11) = 0x92b8b5a4
DIEPDMA(12) = 0x92b8b5a4
DIEPDMA(13) = 0x92b8b5a4
DIEPDMA(14) = 0x92b8b5a4
DIEPDMA(15) = 0x92b8b5a4
DOEPDMA(0) = 0x1ba01000
DOEPDMA(1) = 0xa8800c26
DOEPDMA(2) = 0x1ba01008
DOEPDMA(3) = 0xa8800c26
DOEPDMA(4) = 0x6db46af8
DOEPDMA(5) = 0xa8800c26
DOEPDMA(6) = 0x1291dfd8
DOEPDMA(7) = 0xa8800c26
DOEPDMA(8) = 0x82d9ef90
DOEPDMA(9) = 0x0309d816
DOEPDMA(10) = 0xa8800c26
DOEPDMA(11) = 0xa8800c26
DOEPDMA(12) = 0xa8800c26
DOEPDMA(13) = 0xa8800c26
DOEPDMA(14) = 0xa8800c26
DOEPDMA(15) = 0xa8800c26
DTXFSTS(0) = 0x00000010
DTXFSTS(1) = 0x00000010
DTXFSTS(2) = 0x00000010
DTXFSTS(3) = 0x00000020
DTXFSTS(4) = 0x00000010
DTXFSTS(5) = 0x00000100
DTXFSTS(6) = 0x00000010
DTXFSTS(7) = 0x00000010
DTXFSTS(8) = 0x00000010
DTXFSTS(9) = 0x00000010
DTXFSTS(10) = 0x00000010
DTXFSTS(11) = 0x00000010
DTXFSTS(12) = 0x00000010
DTXFSTS(13) = 0x00000010
DTXFSTS(14) = 0x00000010
DTXFSTS(15) = 0x00000010
PCGCTL = 0x00000000
HCFG = 0x008402f0
HFIR = 0x00000b8f
HFNUM = 0x0b1803df
HPTXSTS = 0x00080100
HAINT = 0x00000002
HAINTMSK = 0x00000007
HFLBADDR = 0x00000000
HPRT0 = 0x00000000
HCCHAR(0) = 0x018c8006
HCCHAR(1) = 0x00000400
HCCHAR(2) = 0x800483e8
HCCHAR(3) = 0x00000400
HCCHAR(4) = 0x00000400
HCCHAR(5) = 0x00000400
HCCHAR(6) = 0x00000400
HCCHAR(7) = 0x00000400
HCCHAR(8) = 0x00000400
HCCHAR(9) = 0x00000400
HCCHAR(10) = 0x00000400
HCCHAR(11) = 0x00000400
HCCHAR(12) = 0x00000400
HCCHAR(13) = 0x00000400
HCCHAR(14) = 0x00000400
HCCHAR(15) = 0x00000400
HCSPLT(0) = 0x00000000
HCSPLT(1) = 0x00000000
HCSPLT(2) = 0x00000000
HCSPLT(3) = 0x00000000
HCSPLT(4) = 0x00000000
HCSPLT(5) = 0x00000000
HCSPLT(6) = 0x00000000
HCSPLT(7) = 0x00000000
HCSPLT(8) = 0x00000000
HCSPLT(9) = 0x00000000
HCSPLT(10) = 0x00000000
HCSPLT(11) = 0x00000000
HCSPLT(12) = 0x00000000
HCSPLT(13) = 0x00000000
HCSPLT(14) = 0x00000000
HCSPLT(15) = 0x00000000
HCINT(0) = 0x00000010
HCINT(1) = 0x00000000
HCINT(2) = 0x00002010
HCINT(3) = 0x00000000
HCINT(4) = 0x00000020
HCINT(5) = 0x00000000
HCINT(6) = 0x00000000
HCINT(7) = 0x00000000
HCINT(8) = 0x00000000
HCINT(9) = 0x00000220
HCINT(10) = 0x00000000
HCINT(11) = 0x00000000
HCINT(12) = 0x00000000
HCINT(13) = 0x00000000
HCINT(14) = 0x00000000
HCINT(15) = 0x00000000
HCINTMSK(0) = 0x0000020f
HCINTMSK(1) = 0x00000000
HCINTMSK(2) = 0x00000000
HCINTMSK(3) = 0x00000000
HCINTMSK(4) = 0x00000000
HCINTMSK(5) = 0x00000000
HCINTMSK(6) = 0x00000000
HCINTMSK(7) = 0x00000000
HCINTMSK(8) = 0x00000000
HCINTMSK(9) = 0x00000000
HCINTMSK(10) = 0x00000000
HCINTMSK(11) = 0x00000000
HCINTMSK(12) = 0x00000000
HCINTMSK(13) = 0x00000000
HCINTMSK(14) = 0x00000000
HCINTMSK(15) = 0x00000000
HCTSIZ(0) = 0x00000000
HCTSIZ(1) = 0x00000000
HCTSIZ(2) = 0x1f27b8c0
HCTSIZ(3) = 0x00000000
HCTSIZ(4) = 0x00000000
HCTSIZ(5) = 0x00000000
HCTSIZ(6) = 0x00000000
HCTSIZ(7) = 0x00000000
HCTSIZ(8) = 0x00000000
HCTSIZ(9) = 0x00000000
HCTSIZ(10) = 0x00000000
HCTSIZ(11) = 0x00000000
HCTSIZ(12) = 0x00000000
HCTSIZ(13) = 0x00000000
HCTSIZ(14) = 0x00000000
HCTSIZ(15) = 0x00000000
HCDMA(0) = 0x1ba01000
HCDMA(1) = 0xa8800c26
HCDMA(2) = 0x1ba01008
HCDMA(3) = 0xa8800c26
HCDMA(4) = 0x6db46af8
HCDMA(5) = 0xa8800c26
HCDMA(6) = 0x1291dfd8
HCDMA(7) = 0xa8800c26
HCDMA(8) = 0x82d9ef90
HCDMA(9) = 0x0309d816
HCDMA(10) = 0xa8800c26
HCDMA(11) = 0xa8800c26
HCDMA(12) = 0xa8800c26
HCDMA(13) = 0xa8800c26
HCDMA(14) = 0xa8800c26
HCDMA(15) = 0xa8800c26
HCDMAB(0) = 0x069e9ff0
HCDMAB(1) = 0xa8800c26
HCDMAB(2) = 0x05eaf3c0
HCDMAB(3) = 0xa8800c26
HCDMAB(4) = 0x1f0d193f
HCDMAB(5) = 0xa8800c26
HCDMAB(6) = 0x7f72548c
HCDMAB(7) = 0xa8800c26
HCDMAB(8) = 0x7795e924
HCDMAB(9) = 0xc36c019a
HCDMAB(10) = 0xa8800c26
HCDMAB(11) = 0xa8800c26
HCDMAB(12) = 0xa8800c26
HCDMAB(13) = 0xa8800c26
HCDMAB(14) = 0xa8800c26
HCDMAB(15) = 0xa8800c26
[-- Attachment #2: dmesg.zip --]
[-- Type: application/zip, Size: 330843 bytes --]
^ permalink raw reply
* [PATCH 2/2] net: asix: cosmetic tidying of the usb device list
From: Christian Hewitt @ 2024-02-05 10:40 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Grant Grundler, linux-usb, netdev, linux-kernel
In-Reply-To: <20240205104049.48900-1-christianshewitt@gmail.com>
Cosmetic corrections for tabs/spaces, capital letters, and formatting.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
While checking the patch for adding the ID's (cribbing the format from
the existing entries) checkpatch complained about "space prohibited
between function name and open parenthesis" and "No space is necessary
after a cast"; so this patch fixes the same issues on the existing ID's
in the same list. While here, also fix some tabs/spaces and Capitals
for consistency.
drivers/net/usb/asix_devices.c | 136 ++++++++++++++++-----------------
1 file changed, 68 insertions(+), 68 deletions(-)
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 9a7b1136cd98..56ea5a943a16 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -1424,152 +1424,152 @@ static const struct driver_info hg20f9_info = {
static const struct usb_device_id products [] = {
{
// Linksys USB200M
- USB_DEVICE (0x077b, 0x2226),
- .driver_info = (unsigned long) &ax8817x_info,
+ USB_DEVICE(0x077b, 0x2226),
+ .driver_info = (unsigned long)&ax8817x_info,
}, {
// Netgear FA120
- USB_DEVICE (0x0846, 0x1040),
- .driver_info = (unsigned long) &netgear_fa120_info,
+ USB_DEVICE(0x0846, 0x1040),
+ .driver_info = (unsigned long)&netgear_fa120_info,
}, {
// DLink DUB-E100
- USB_DEVICE (0x2001, 0x1a00),
- .driver_info = (unsigned long) &dlink_dub_e100_info,
+ USB_DEVICE(0x2001, 0x1a00),
+ .driver_info = (unsigned long)&dlink_dub_e100_info,
}, {
// Intellinet, ST Lab USB Ethernet
- USB_DEVICE (0x0b95, 0x1720),
- .driver_info = (unsigned long) &ax8817x_info,
+ USB_DEVICE(0x0b95, 0x1720),
+ .driver_info = (unsigned long)&ax8817x_info,
}, {
// Hawking UF200, TrendNet TU2-ET100
- USB_DEVICE (0x07b8, 0x420a),
- .driver_info = (unsigned long) &hawking_uf200_info,
+ USB_DEVICE(0x07b8, 0x420a),
+ .driver_info = (unsigned long)&hawking_uf200_info,
}, {
// Billionton Systems, USB2AR
- USB_DEVICE (0x08dd, 0x90ff),
- .driver_info = (unsigned long) &ax8817x_info,
+ USB_DEVICE(0x08dd, 0x90ff),
+ .driver_info = (unsigned long)&ax8817x_info,
}, {
// Billionton Systems, GUSB2AM-1G-B
USB_DEVICE(0x08dd, 0x0114),
- .driver_info = (unsigned long) &ax88178_info,
+ .driver_info = (unsigned long)&ax88178_info,
}, {
// ATEN UC210T
- USB_DEVICE (0x0557, 0x2009),
- .driver_info = (unsigned long) &ax8817x_info,
+ USB_DEVICE(0x0557, 0x2009),
+ .driver_info = (unsigned long)&ax8817x_info,
}, {
// Buffalo LUA-U2-KTX
- USB_DEVICE (0x0411, 0x003d),
- .driver_info = (unsigned long) &ax8817x_info,
+ USB_DEVICE(0x0411, 0x003d),
+ .driver_info = (unsigned long)&ax8817x_info,
}, {
// Buffalo LUA-U2-GT 10/100/1000
- USB_DEVICE (0x0411, 0x006e),
- .driver_info = (unsigned long) &ax88178_info,
+ USB_DEVICE(0x0411, 0x006e),
+ .driver_info = (unsigned long)&ax88178_info,
}, {
// Sitecom LN-029 "USB 2.0 10/100 Ethernet adapter"
- USB_DEVICE (0x6189, 0x182d),
- .driver_info = (unsigned long) &ax8817x_info,
+ USB_DEVICE(0x6189, 0x182d),
+ .driver_info = (unsigned long)&ax8817x_info,
}, {
// Sitecom LN-031 "USB 2.0 10/100/1000 Ethernet adapter"
- USB_DEVICE (0x0df6, 0x0056),
- .driver_info = (unsigned long) &ax88178_info,
+ USB_DEVICE(0x0df6, 0x0056),
+ .driver_info = (unsigned long)&ax88178_info,
}, {
// Sitecom LN-028 "USB 2.0 10/100/1000 Ethernet adapter"
- USB_DEVICE (0x0df6, 0x061c),
- .driver_info = (unsigned long) &ax88178_info,
+ USB_DEVICE(0x0df6, 0x061c),
+ .driver_info = (unsigned long)&ax88178_info,
}, {
- // corega FEther USB2-TX
- USB_DEVICE (0x07aa, 0x0017),
- .driver_info = (unsigned long) &ax8817x_info,
+ // Corega FEther USB2-TX
+ USB_DEVICE(0x07aa, 0x0017),
+ .driver_info = (unsigned long)&ax8817x_info,
}, {
// Surecom EP-1427X-2
- USB_DEVICE (0x1189, 0x0893),
- .driver_info = (unsigned long) &ax8817x_info,
+ USB_DEVICE(0x1189, 0x0893),
+ .driver_info = (unsigned long)&ax8817x_info,
}, {
- // goodway corp usb gwusb2e
- USB_DEVICE (0x1631, 0x6200),
- .driver_info = (unsigned long) &ax8817x_info,
+ // Goodway corp usb gwusb2e
+ USB_DEVICE(0x1631, 0x6200),
+ .driver_info = (unsigned long)&ax8817x_info,
}, {
// JVC MP-PRX1 Port Replicator
- USB_DEVICE (0x04f1, 0x3008),
- .driver_info = (unsigned long) &ax8817x_info,
+ USB_DEVICE(0x04f1, 0x3008),
+ .driver_info = (unsigned long)&ax8817x_info,
}, {
// Lenovo U2L100P 10/100
- USB_DEVICE (0x17ef, 0x7203),
+ USB_DEVICE(0x17ef, 0x7203),
.driver_info = (unsigned long)&ax88772b_info,
}, {
// ASIX AX88772B 10/100
- USB_DEVICE (0x0b95, 0x772b),
- .driver_info = (unsigned long) &ax88772b_info,
+ USB_DEVICE(0x0b95, 0x772b),
+ .driver_info = (unsigned long)&ax88772b_info,
}, {
// ASIX AX88772 10/100
- USB_DEVICE (0x0b95, 0x7720),
- .driver_info = (unsigned long) &ax88772_info,
+ USB_DEVICE(0x0b95, 0x7720),
+ .driver_info = (unsigned long)&ax88772_info,
}, {
// ASIX AX88178 10/100/1000
- USB_DEVICE (0x0b95, 0x1780),
- .driver_info = (unsigned long) &ax88178_info,
+ USB_DEVICE(0x0b95, 0x1780),
+ .driver_info = (unsigned long)&ax88178_info,
}, {
// ASIX AX88179A 10/100/1000
USB_DEVICE(0x0b95, 0x1790),
.driver_info = (unsigned long)&ax88178_info,
}, {
// Logitec LAN-GTJ/U2A
- USB_DEVICE (0x0789, 0x0160),
- .driver_info = (unsigned long) &ax88178_info,
+ USB_DEVICE(0x0789, 0x0160),
+ .driver_info = (unsigned long)&ax88178_info,
}, {
// Linksys USB200M Rev 2
- USB_DEVICE (0x13b1, 0x0018),
- .driver_info = (unsigned long) &ax88772_info,
+ USB_DEVICE(0x13b1, 0x0018),
+ .driver_info = (unsigned long)&ax88772_info,
}, {
// 0Q0 cable ethernet
- USB_DEVICE (0x1557, 0x7720),
- .driver_info = (unsigned long) &ax88772_info,
+ USB_DEVICE(0x1557, 0x7720),
+ .driver_info = (unsigned long)&ax88772_info,
}, {
// DLink DUB-E100 H/W Ver B1
- USB_DEVICE (0x07d1, 0x3c05),
- .driver_info = (unsigned long) &ax88772_info,
+ USB_DEVICE(0x07d1, 0x3c05),
+ .driver_info = (unsigned long)&ax88772_info,
}, {
// DLink DUB-E100 H/W Ver B1 Alternate
- USB_DEVICE (0x2001, 0x3c05),
- .driver_info = (unsigned long) &ax88772_info,
+ USB_DEVICE(0x2001, 0x3c05),
+ .driver_info = (unsigned long)&ax88772_info,
}, {
- // DLink DUB-E100 H/W Ver C1
- USB_DEVICE (0x2001, 0x1a02),
- .driver_info = (unsigned long) &ax88772_info,
+ // DLink DUB-E100 H/W Ver C1
+ USB_DEVICE(0x2001, 0x1a02),
+ .driver_info = (unsigned long)&ax88772_info,
}, {
// Linksys USB1000
- USB_DEVICE (0x1737, 0x0039),
- .driver_info = (unsigned long) &ax88178_info,
+ USB_DEVICE(0x1737, 0x0039),
+ .driver_info = (unsigned long)&ax88178_info,
}, {
// IO-DATA ETG-US2
- USB_DEVICE (0x04bb, 0x0930),
- .driver_info = (unsigned long) &ax88178_info,
+ USB_DEVICE(0x04bb, 0x0930),
+ .driver_info = (unsigned long)&ax88178_info,
}, {
// Belkin F5D5055
USB_DEVICE(0x050d, 0x5055),
- .driver_info = (unsigned long) &ax88178_info,
+ .driver_info = (unsigned long)&ax88178_info,
}, {
// Apple USB Ethernet Adapter
USB_DEVICE(0x05ac, 0x1402),
- .driver_info = (unsigned long) &ax88772_info,
+ .driver_info = (unsigned long)&ax88772_info,
}, {
// Cables-to-Go USB Ethernet Adapter
USB_DEVICE(0x0b95, 0x772a),
- .driver_info = (unsigned long) &ax88772_info,
+ .driver_info = (unsigned long)&ax88772_info,
}, {
// ABOCOM for pci
USB_DEVICE(0x14ea, 0xab11),
- .driver_info = (unsigned long) &ax88178_info,
+ .driver_info = (unsigned long)&ax88178_info,
}, {
// ASIX 88772a
USB_DEVICE(0x0db0, 0xa877),
- .driver_info = (unsigned long) &ax88772_info,
+ .driver_info = (unsigned long)&ax88772_info,
}, {
// Asus USB Ethernet Adapter
- USB_DEVICE (0x0b95, 0x7e2b),
+ USB_DEVICE(0x0b95, 0x7e2b),
.driver_info = (unsigned long)&ax88772b_info,
}, {
/* ASIX 88172a demo board */
USB_DEVICE(0x0b95, 0x172a),
- .driver_info = (unsigned long) &ax88172a_info,
+ .driver_info = (unsigned long)&ax88172a_info,
}, {
/*
* USBLINK HG20F9 "USB 2.0 LAN"
@@ -1577,11 +1577,11 @@ static const struct usb_device_id products [] = {
* doesn't (yet) conflict with any known Linksys product.
*/
USB_DEVICE(0x066b, 0x20f9),
- .driver_info = (unsigned long) &hg20f9_info,
+ .driver_info = (unsigned long)&hg20f9_info,
}, {
// Linux Automation GmbH USB 10Base-T1L
USB_DEVICE(0x33f7, 0x0004),
- .driver_info = (unsigned long) &lxausb_t1l_info,
+ .driver_info = (unsigned long)&lxausb_t1l_info,
},
{ }, // END
};
--
2.34.1
^ permalink raw reply related
* [PATCH 1/2] net: asix: add 0b95:1790 to AX88179A device list
From: Christian Hewitt @ 2024-02-05 10:40 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Grant Grundler, linux-usb, netdev, linux-kernel
Add a generic AX88179A entry for the 0b95:1790 device id:
kernel: usb 2-1: New USB device found, idVendor=0b95, idProduct=1790, bcdDevice= 2.00
kernel: usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
kernel: usb 2-1: Product: AX88179A
kernel: usb 2-1: Manufacturer: ASIX
kernel: usb 2-1: SerialNumber: 00D24DC0
kernel: asix 2-1:1.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x0000: -32
kernel: asix: probe of 2-1:1.0 failed with error -32
kernel: ax88179_178a 2-1:1.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x0040: -32
kernel: ax88179_178a 2-1:1.0 eth1: register 'ax88179_178a' at usb-0000:01:00.0-1, ASIX AX88179 USB 3.0 Gigabit Ethernet, 20:7b:d2:d2:4d:c0
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
The change is tested by a LibreELEC (distro) user who reports the NIC to be working
fine (and logs support this) but the "Failed to read reg index 0x0000: -32" errors
suggest ax88178_info might not be the correct choice. I'm not a serious coder so I
need to "ask the audience" for suggestions on what more might be needed?
drivers/net/usb/asix_devices.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index f7cff58fe044..9a7b1136cd98 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -1506,6 +1506,10 @@ static const struct usb_device_id products [] = {
// ASIX AX88178 10/100/1000
USB_DEVICE (0x0b95, 0x1780),
.driver_info = (unsigned long) &ax88178_info,
+}, {
+ // ASIX AX88179A 10/100/1000
+ USB_DEVICE(0x0b95, 0x1790),
+ .driver_info = (unsigned long)&ax88178_info,
}, {
// Logitec LAN-GTJ/U2A
USB_DEVICE (0x0789, 0x0160),
--
2.34.1
^ permalink raw reply related
* Re: [PATCH v2 2/2] usb: cdns3: fix memory double free when handle zero packet
From: Roger Quadros @ 2024-02-05 10:01 UTC (permalink / raw)
To: Frank Li
Cc: felipe.balbi, gregkh, imx, linux-kernel, linux-usb, pawell,
peter.chen
In-Reply-To: <20240202154217.661867-2-Frank.Li@nxp.com>
On 02/02/2024 17:42, Frank Li wrote:
> 829 if (request->complete) {
> 830 spin_unlock(&priv_dev->lock);
> 831 usb_gadget_giveback_request(&priv_ep->endpoint,
> 832 request);
> 833 spin_lock(&priv_dev->lock);
> 834 }
> 835
> 836 if (request->buf == priv_dev->zlp_buf)
> 837 cdns3_gadget_ep_free_request(&priv_ep->endpoint, request);
>
> Driver append an additional zero packet request when queue a packet, which
> length mod max packet size is 0. When transfer complete, run to line 831,
> usb_gadget_giveback_request() will free this requestion. 836 condition is
> true, so cdns3_gadget_ep_free_request() free this request again.
>
> Log:
>
> [ 1920.140696][ T150] BUG: KFENCE: use-after-free read in cdns3_gadget_giveback+0x134/0x2c0 [cdns3]
> [ 1920.140696][ T150]
> [ 1920.151837][ T150] Use-after-free read at 0x000000003d1cd10b (in kfence-#36):
> [ 1920.159082][ T150] cdns3_gadget_giveback+0x134/0x2c0 [cdns3]
> [ 1920.164988][ T150] cdns3_transfer_completed+0x438/0x5f8 [cdns3]
>
> Add check at line 829, skip call usb_gadget_giveback_request() if it is
> additional zero length packet request. Needn't call
> usb_gadget_giveback_request() because it is allocated in this driver.
>
> Cc: <stable@vger.kernel.org>
> Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
^ permalink raw reply
* Re: [PATCH v13 50/53] ALSA: usb-audio: Allow for rediscovery of connected USB SND devices
From: Amadeusz Sławiński @ 2024-02-05 9:01 UTC (permalink / raw)
To: Wesley Cheng, srinivas.kandagatla, mathias.nyman, perex, conor+dt,
corbet, lgirdwood, andersson, krzysztof.kozlowski+dt, gregkh,
Thinh.Nguyen, broonie, bgoswami, tiwai, robh+dt, konrad.dybcio
Cc: linux-kernel, devicetree, linux-sound, linux-usb, linux-arm-msm,
linux-doc, alsa-devel
In-Reply-To: <20240203023645.31105-51-quic_wcheng@quicinc.com>
On 2/3/2024 3:36 AM, Wesley Cheng wrote:
> In case of notifying SND platform drivers of connection events, some of
> these use cases, such as offloading, require an ASoC USB backend device to
> be initialized before the events can be handled. If the USB backend device
> has not yet been probed, this leads to missing initial USB audio device
> connection events.
>
> Expose an API that traverses the usb_chip array for connected devices, and
> to call the respective connection callback registered to the SND platform
> driver.
>
> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
> ---
> sound/usb/card.c | 19 +++++++++++++++++++
> sound/usb/card.h | 2 ++
> sound/usb/qcom/qc_audio_offload.c | 2 ++
> 3 files changed, 23 insertions(+)
>
> diff --git a/sound/usb/card.c b/sound/usb/card.c
> index 11b827b7a2a5..995b2df676ab 100644
> --- a/sound/usb/card.c
> +++ b/sound/usb/card.c
> @@ -202,6 +202,25 @@ struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx,
> }
> EXPORT_SYMBOL_GPL(snd_usb_find_suppported_substream);
>
> +/*
> + * in case the platform driver was not ready at the time of USB SND
> + * device connect, expose an API to discover all connected USB devices
> + * so it can populate any dependent resources/structures.
> + */
> +void snd_usb_rediscover_devices(void)
> +{
> + int i;
> +
> + mutex_lock(®ister_mutex);
> + for (i = 0; i < SNDRV_CARDS; i++) {
> + if (usb_chip[i])
> + if (platform_ops && platform_ops->connect_cb)
> + platform_ops->connect_cb(usb_chip[i]);
if inside if, it can just be && or maybe move callback check before
mutex lock and just return early if it is not present?
> + }
> + mutex_unlock(®ister_mutex);
> +}
> +EXPORT_SYMBOL_GPL(snd_usb_rediscover_devices);
> +
> /*
> * disconnect streams
> * called from usb_audio_disconnect()
> diff --git a/sound/usb/card.h b/sound/usb/card.h
> index 6d59995440c3..3a0d68f453a1 100644
> --- a/sound/usb/card.h
> +++ b/sound/usb/card.h
> @@ -222,11 +222,13 @@ int snd_usb_unregister_platform_ops(void);
> #if IS_ENABLED(CONFIG_SND_USB_AUDIO)
> struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx,
> struct snd_pcm_hw_params *params, int direction);
> +void snd_usb_rediscover_devices(void);
> #else
> static struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx,
> struct snd_pcm_hw_params *params, int direction)
> {
> return NULL;
> }
> +static void snd_usb_rediscover_devices(void) { }
> #endif /* IS_ENABLED(CONFIG_SND_USB_AUDIO) */
> #endif /* __USBAUDIO_CARD_H */
> diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c
> index 08af82ec22ad..9b0f98600e58 100644
> --- a/sound/usb/qcom/qc_audio_offload.c
> +++ b/sound/usb/qcom/qc_audio_offload.c
> @@ -1867,6 +1867,8 @@ static int __init qc_usb_audio_offload_init(void)
> if (ret < 0)
> goto release_qmi;
>
> + snd_usb_rediscover_devices();
> +
> return 0;
>
> release_qmi:
>
^ permalink raw reply
* Re: [PATCH v13 20/53] ASoC: Add SOC USB APIs for adding an USB backend
From: Amadeusz Sławiński @ 2024-02-05 8:20 UTC (permalink / raw)
To: Wesley Cheng, srinivas.kandagatla, mathias.nyman, perex, conor+dt,
corbet, lgirdwood, andersson, krzysztof.kozlowski+dt, gregkh,
Thinh.Nguyen, broonie, bgoswami, tiwai, robh+dt, konrad.dybcio
Cc: linux-kernel, devicetree, linux-sound, linux-usb, linux-arm-msm,
linux-doc, alsa-devel
In-Reply-To: <20240203023645.31105-21-quic_wcheng@quicinc.com>
On 2/3/2024 3:36 AM, Wesley Cheng wrote:
> Some platforms may have support for offloading USB audio devices to a
> dedicated audio DSP. Introduce a set of APIs that allow for management of
> USB sound card and PCM devices enumerated by the USB SND class driver.
> This allows for the ASoC components to be aware of what USB devices are
> available for offloading.
>
> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
> ---
...
> +
> +/**
> + * snd_soc_usb_add_port() - Add a USB backend port
> + * @dev: USB backend device
> + * @priv: private data
> + * @connection_cb: connection status callback
> + *
> + * Register a USB backend device to the SND USB SOC framework. Memory is
> + * allocated as part of the USB backend device.
> + *
> + */
> +int snd_soc_usb_add_port(struct snd_soc_usb *usb)
> +{
> +
> +
Cosmetic, but why is there white space between start of function and
body of function?
> + mutex_lock(&ctx_mutex);
> + list_add_tail(&usb->list, &usb_ctx_list);
> + mutex_unlock(&ctx_mutex);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(snd_soc_usb_add_port);
> +
^ permalink raw reply
* Re: [EXT] Re: [PATCH v5 4/8] dt-bindings: usb: ci-hdrc-usb2: add restrictions for reg, interrupts, clock and clock-names properties
From: Krzysztof Kozlowski @ 2024-02-05 7:50 UTC (permalink / raw)
To: Xu Yang, gregkh@linuxfoundation.org, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
shawnguo@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com, peter.chen@kernel.org
Cc: dl-linux-imx, Jun Li, linux-usb@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
In-Reply-To: <DU2PR04MB88221841F66A22B5A5DE47258C402@DU2PR04MB8822.eurprd04.prod.outlook.com>
On 04/02/2024 07:56, Xu Yang wrote:
>
>>
>> On 02/02/2024 10:10, Xu Yang wrote:
>>> Hi Krzysztof,
>>>
>>>>
>>>> On 31/01/2024 12:43, Xu Yang wrote:
>>>>> Change reg, interrupts, clock and clock-names as common properties and add
>>>>> restrictions on them for different compatibles.
>>>>>
>>>>> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
>>>>>
>>>>> ---
>>>>> Changes in v4:
>>>>> - new patch since v3's discussion
>>>>> - split the reg, interrupts, clock and clock-names properties into
>>>>> common part and device-specific
>>>>> Changes in v5:
>>>>> - keep common property unchanged
>>>>> - make if-then more readable
>>>>> - remove non imx part
>>>>> ---
>>>>> .../devicetree/bindings/usb/ci-hdrc-usb2.yaml | 118 ++++++++++++++++++
>>>>> 1 file changed, 118 insertions(+)
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml b/Documentation/devicetree/bindings/usb/ci-
>>>> hdrc-usb2.yaml
>>>>> index 3b56e0edb1c6..6ad3582051b8 100644
>>>>> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
>>>>> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
>>>>> @@ -412,6 +412,124 @@ allOf:
>>>>> samsung,picophy-pre-emp-curr-control: false
>>>>> samsung,picophy-dc-vol-level-adjust: false
>>>>>
>>>>> + - if:
>>>>> + properties:
>>>>> + compatible:
>>>>> + const: fsl,imx27-usb
>>>>> + then:
>>>>> + properties:
>>>>> + clocks:
>>>>> + minItems: 3
>>>>> + maxItems: 3
>>>>> + clock-names:
>>>>> + minItems: 3
>>>>> + maxItems: 3
>>>>> + items:
>>>>> + anyOf:
>>>>> + - const: ipg
>>>>> + - const: ahb
>>>>> + - const: per
>>>>
>>>> This would be just: enum: [ipg, ahb, per], but in both cases I question
>>>> why the order should be flexible? Nothing in commit msg explains it.
>>>
>>> The driver will get the clock by clock-name, then the order should not
>>> matter. However, these three clock-names should be present at the same
>>> time. I should use enum then.
>>
>> Forgot to answer to this.
>>
>> Which driver? U-boot? OpenBSD? The one in my custom Linux kernel fork
>> (open-source and published on github)? Did you check all of them?
>
> I mean below driver in linux kernel tree.
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/tree/drivers/usb/chipidea/ci_hdrc_imx.c?h=linux-6.1.y#n191
What about others? How about driver in other upstream projects? My
comment should make you think...
Best regards,
Krzysztof
^ permalink raw reply
* [PATCH v3] usb: gadget: ncm: Avoid dropping datagrams of properly parsed NTBs
From: Krishna Kurapati @ 2024-02-05 7:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, Maciej Żenczykowski, Hardik Gajjar
Cc: linux-usb, linux-kernel, quic_ppratap, quic_wcheng, quic_jackp,
Krishna Kurapati, stable
It is observed sometimes when tethering is used over NCM with Windows 11
as host, at some instances, the gadget_giveback has one byte appended at
the end of a proper NTB. When the NTB is parsed, unwrap call looks for
any leftover bytes in SKB provided by u_ether and if there are any pending
bytes, it treats them as a separate NTB and parses it. But in case the
second NTB (as per unwrap call) is faulty/corrupt, all the datagrams that
were parsed properly in the first NTB and saved in rx_list are dropped.
Adding a few custom traces showed the following:
[002] d..1 7828.532866: dwc3_gadget_giveback: ep1out:
req 000000003868811a length 1025/16384 zsI ==> 0
[002] d..1 7828.532867: ncm_unwrap_ntb: K: ncm_unwrap_ntb toprocess: 1025
[002] d..1 7828.532867: ncm_unwrap_ntb: K: ncm_unwrap_ntb nth: 1751999342
[002] d..1 7828.532868: ncm_unwrap_ntb: K: ncm_unwrap_ntb seq: 0xce67
[002] d..1 7828.532868: ncm_unwrap_ntb: K: ncm_unwrap_ntb blk_len: 0x400
[002] d..1 7828.532868: ncm_unwrap_ntb: K: ncm_unwrap_ntb ndp_len: 0x10
[002] d..1 7828.532869: ncm_unwrap_ntb: K: Parsed NTB with 1 frames
In this case, the giveback is of 1025 bytes and block length is 1024.
The rest 1 byte (which is 0x00) won't be parsed resulting in drop of
all datagrams in rx_list.
Same is case with packets of size 2048:
[002] d..1 7828.557948: dwc3_gadget_giveback: ep1out:
req 0000000011dfd96e length 2049/16384 zsI ==> 0
[002] d..1 7828.557949: ncm_unwrap_ntb: K: ncm_unwrap_ntb nth: 1751999342
[002] d..1 7828.557950: ncm_unwrap_ntb: K: ncm_unwrap_ntb blk_len: 0x800
Lecroy shows one byte coming in extra confirming that the byte is coming
in from PC:
Transfer 2959 - Bytes Transferred(1025) Timestamp((18.524 843 590)
- Transaction 8391 - Data(1025 bytes) Timestamp(18.524 843 590)
--- Packet 4063861
Data(1024 bytes)
Duration(2.117us) Idle(14.700ns) Timestamp(18.524 843 590)
--- Packet 4063863
Data(1 byte)
Duration(66.160ns) Time(282.000ns) Timestamp(18.524 845 722)
According to Windows driver, no ZLP is needed if wBlockLength is non-zero,
because the non-zero wBlockLength has already told the function side the
size of transfer to be expected. However, there are in-market NCM devices
that rely on ZLP as long as the wBlockLength is multiple of wMaxPacketSize.
To deal with such devices, it pads an extra 0 at end so the transfer is no
longer multiple of wMaxPacketSize.
Cc: <stable@vger.kernel.org>
Fixes: 9f6ce4240a2b ("usb: gadget: f_ncm.c added")
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
---
Link to v2:
https://lore.kernel.org/all/20240131150332.1326523-1-quic_kriskura@quicinc.com/
Changes in v2:
Added check to see if the padded byte is 0x00.
Changes in v3:
Removed wMaxPacketSize check from v2.
drivers/usb/gadget/function/f_ncm.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
index ca5d5f564998..e2a059cfda2c 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -1338,7 +1338,15 @@ static int ncm_unwrap_ntb(struct gether *port,
"Parsed NTB with %d frames\n", dgram_counter);
to_process -= block_len;
- if (to_process != 0) {
+
+ /*
+ * Windows NCM driver avoids USB ZLPs by adding a 1-byte
+ * zero pad as needed.
+ */
+ if (to_process == 1 &&
+ (*(unsigned char *)(ntb_ptr + block_len) == 0x00)) {
+ to_process--;
+ } else if (to_process > 0) {
ntb_ptr = (unsigned char *)(ntb_ptr + block_len);
goto parse_ntb;
}
--
2.34.1
^ permalink raw reply related
* Re: [PATCH 00/27] sparc32: sunset sun4m and sun4d
From: John Paul Adrian Glaubitz @ 2024-02-05 5:12 UTC (permalink / raw)
To: Sam Ravnborg
Cc: David S. Miller, Arnd Bergmann, Andreas Larsson, Helge Deller,
Alexander Viro, Greg Kroah-Hartman, Alan Stern, Jaroslav Kysela,
Takashi Iwai, sparclinux, linux-kernel, linux-usb, linux-fbdev,
dri-devel, linux-sound
In-Reply-To: <20240204192134.GB896678@ravnborg.org>
Hi Sam,
On Sun, 2024-02-04 at 20:21 +0100, Sam Ravnborg wrote:
> Assuming you agree with the patchset how do you want me to move forward?
> I can rebase on top of the latest -rc and collect acks if that helps.
>
> Arnd promised to pick up the patches until you got a git tree up,
> but I do not expect Arnd to pick up anything unless you have acked or
> reviewed said patch(es).
>
> If I rebase the patch-set I will likely include a few bug-fix patches that
> was prepared in the meantime.
> I can also send them as a separate series, no worries.
I met with Andreas this weekend and he got GPG signatures from at least me
and Geert which he needs for his kernel.org account. Please give him a few
more days, maybe be even 2-3 weeks to get everything up and comfortable with
the whole process.
The more patches Andreas can review and merge himself, the better. And since
your patches have been laying around for some time already, I don't think that
waiting a little longer will be a problem.
Thanks,
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply
* Re: [PATCH v2 2/2] usb: cdns3: fix memory double free when handle zero packet
From: Peter Chen @ 2024-02-05 4:52 UTC (permalink / raw)
To: Frank Li; +Cc: rogerq, felipe.balbi, gregkh, imx, linux-kernel, linux-usb,
pawell
In-Reply-To: <20240202154217.661867-2-Frank.Li@nxp.com>
On 24-02-02 10:42:17, Frank Li wrote:
> 829 if (request->complete) {
> 830 spin_unlock(&priv_dev->lock);
> 831 usb_gadget_giveback_request(&priv_ep->endpoint,
> 832 request);
> 833 spin_lock(&priv_dev->lock);
> 834 }
> 835
> 836 if (request->buf == priv_dev->zlp_buf)
> 837 cdns3_gadget_ep_free_request(&priv_ep->endpoint, request);
>
> Driver append an additional zero packet request when queue a packet, which
> length mod max packet size is 0. When transfer complete, run to line 831,
> usb_gadget_giveback_request() will free this requestion. 836 condition is
> true, so cdns3_gadget_ep_free_request() free this request again.
>
> Log:
>
> [ 1920.140696][ T150] BUG: KFENCE: use-after-free read in cdns3_gadget_giveback+0x134/0x2c0 [cdns3]
> [ 1920.140696][ T150]
> [ 1920.151837][ T150] Use-after-free read at 0x000000003d1cd10b (in kfence-#36):
> [ 1920.159082][ T150] cdns3_gadget_giveback+0x134/0x2c0 [cdns3]
> [ 1920.164988][ T150] cdns3_transfer_completed+0x438/0x5f8 [cdns3]
>
> Add check at line 829, skip call usb_gadget_giveback_request() if it is
> additional zero length packet request. Needn't call
> usb_gadget_giveback_request() because it is allocated in this driver.
>
> Cc: <stable@vger.kernel.org>
> Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
> ---
> drivers/usb/cdns3/cdns3-gadget.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index d6723d31fc6e2..fd1beb10bba72 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -828,7 +828,11 @@ void cdns3_gadget_giveback(struct cdns3_endpoint *priv_ep,
> return;
> }
>
> - if (request->complete) {
> + /*
> + * zlp request is appended by driver, needn't call usb_gadget_giveback_request() to notify
> + * gadget composite driver.
> + */
> + if (request->complete && request->buf != priv_dev->zlp_buf) {
> spin_unlock(&priv_dev->lock);
> usb_gadget_giveback_request(&priv_ep->endpoint,
> request);
> --
> 2.34.1
>
--
Thanks,
Peter Chen
^ permalink raw reply
* Re: [PATCH v2 1/2] usb: cdns3: fixed memory use after free at cdns3_gadget_ep_disable()
From: Peter Chen @ 2024-02-05 4:43 UTC (permalink / raw)
To: Frank Li; +Cc: rogerq, felipe.balbi, gregkh, imx, linux-kernel, linux-usb,
pawell
In-Reply-To: <20240202154217.661867-1-Frank.Li@nxp.com>
On 24-02-02 10:42:16, Frank Li wrote:
> ...
> cdns3_gadget_ep_free_request(&priv_ep->endpoint, &priv_req->request);
> list_del_init(&priv_req->list);
> ...
>
> 'priv_req' actually free at cdns3_gadget_ep_free_request(). But
> list_del_init() use priv_req->list after it.
>
> [ 1542.642868][ T534] BUG: KFENCE: use-after-free read in __list_del_entry_valid+0x10/0xd4
> [ 1542.642868][ T534]
> [ 1542.653162][ T534] Use-after-free read at 0x000000009ed0ba99 (in kfence-#3):
> [ 1542.660311][ T534] __list_del_entry_valid+0x10/0xd4
> [ 1542.665375][ T534] cdns3_gadget_ep_disable+0x1f8/0x388 [cdns3]
> [ 1542.671571][ T534] usb_ep_disable+0x44/0xe4
> [ 1542.675948][ T534] ffs_func_eps_disable+0x64/0xc8
> [ 1542.680839][ T534] ffs_func_set_alt+0x74/0x368
> [ 1542.685478][ T534] ffs_func_disable+0x18/0x28
>
> Move list_del_init() before cdns3_gadget_ep_free_request() to resolve this
> problem.
>
> Cc: <stable@vger.kernel.org>
> Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> Reviewed-by: Roger Quadros <rogerq@kernel.org>
Acked-by: Peter Chen <peter.chen@kernel.org>
> ---
> drivers/usb/cdns3/cdns3-gadget.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index aeca902ab6cc4..d6723d31fc6e2 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -2540,11 +2540,11 @@ static int cdns3_gadget_ep_disable(struct usb_ep *ep)
>
> while (!list_empty(&priv_ep->wa2_descmiss_req_list)) {
> priv_req = cdns3_next_priv_request(&priv_ep->wa2_descmiss_req_list);
> + list_del_init(&priv_req->list);
>
> kfree(priv_req->request.buf);
> cdns3_gadget_ep_free_request(&priv_ep->endpoint,
> &priv_req->request);
> - list_del_init(&priv_req->list);
> --priv_ep->wa2_counter;
> }
>
> --
> 2.34.1
>
--
Thanks,
Peter Chen
^ permalink raw reply
* Re: [PATCH] usb: chipidea: core: handle power lost in workqueue
From: Peter Chen @ 2024-02-05 4:40 UTC (permalink / raw)
To: Xu Yang; +Cc: gregkh, linux-usb, jun.li, linux-imx
In-Reply-To: <20240119123537.3614838-1-xu.yang_2@nxp.com>
On 24-01-19 20:35:37, Xu Yang wrote:
> When power is recycled in usb controller during system power management,
> the controller will recognize it and switch role if role has been changed
> during power lost. In current design, it will be completed in resume()
> function. However, this may bring issues since usb class devices have
> their pm operations too and these device's resume() functions are still
> not being called at this point. When usb controller recognized host role
> should be stopped, these usb class devices will be removed at this point.
> But these usb class devices can't be removed in some cases, such as scsi
> devices. Since scsi driver may sync data to U-disk, however it will block
> there because scsi drvier can only handle pm request when is in suspended
> state. Therefore, there may exist a dependency between ci_resume() and usb
> class device's resume(). To break this potential dependency, we need to
> handle power lost work in a workqueue.
>
> Fixes: 74494b33211d ("usb: chipidea: core: add controller resume support when controller is powered off")
> cc: <stable@vger.kernel.org>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
> ---
> drivers/usb/chipidea/ci.h | 2 ++
> drivers/usb/chipidea/core.c | 44 ++++++++++++++++++++-----------------
> 2 files changed, 26 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> index d9bb3d3f026e..2a38e1eb6546 100644
> --- a/drivers/usb/chipidea/ci.h
> +++ b/drivers/usb/chipidea/ci.h
> @@ -176,6 +176,7 @@ struct hw_bank {
> * @enabled_otg_timer_bits: bits of enabled otg timers
> * @next_otg_timer: next nearest enabled timer to be expired
> * @work: work for role changing
> + * @power_lost_work: work for power lost handling
> * @wq: workqueue thread
> * @qh_pool: allocation pool for queue heads
> * @td_pool: allocation pool for transfer descriptors
> @@ -226,6 +227,7 @@ struct ci_hdrc {
> enum otg_fsm_timer next_otg_timer;
> struct usb_role_switch *role_switch;
> struct work_struct work;
> + struct work_struct power_lost_work;
> struct workqueue_struct *wq;
>
> struct dma_pool *qh_pool;
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 41014f93cfdf..835bf2428dc6 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -856,6 +856,27 @@ static int ci_extcon_register(struct ci_hdrc *ci)
> return 0;
> }
>
> +static void ci_power_lost_work(struct work_struct *work)
> +{
> + struct ci_hdrc *ci = container_of(work, struct ci_hdrc, power_lost_work);
> + enum ci_role role;
> +
> + disable_irq_nosync(ci->irq);
> + pm_runtime_get_sync(ci->dev);
> + if (!ci_otg_is_fsm_mode(ci)) {
> + role = ci_get_role(ci);
> +
> + if (ci->role != role) {
> + ci_handle_id_switch(ci);
> + } else if (role == CI_ROLE_GADGET) {
> + if (ci->is_otg && hw_read_otgsc(ci, OTGSC_BSV))
> + usb_gadget_vbus_connect(&ci->gadget);
> + }
> + }
> + pm_runtime_put_sync(ci->dev);
> + enable_irq(ci->irq);
> +}
> +
> static DEFINE_IDA(ci_ida);
>
> struct platform_device *ci_hdrc_add_device(struct device *dev,
> @@ -1045,6 +1066,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>
> spin_lock_init(&ci->lock);
> mutex_init(&ci->mutex);
> + INIT_WORK(&ci->power_lost_work, ci_power_lost_work);
> +
> ci->dev = dev;
> ci->platdata = dev_get_platdata(dev);
> ci->imx28_write_fix = !!(ci->platdata->flags &
> @@ -1396,25 +1419,6 @@ static int ci_suspend(struct device *dev)
> return 0;
> }
>
> -static void ci_handle_power_lost(struct ci_hdrc *ci)
> -{
> - enum ci_role role;
> -
> - disable_irq_nosync(ci->irq);
> - if (!ci_otg_is_fsm_mode(ci)) {
> - role = ci_get_role(ci);
> -
> - if (ci->role != role) {
> - ci_handle_id_switch(ci);
> - } else if (role == CI_ROLE_GADGET) {
> - if (ci->is_otg && hw_read_otgsc(ci, OTGSC_BSV))
> - usb_gadget_vbus_connect(&ci->gadget);
> - }
> - }
> -
> - enable_irq(ci->irq);
> -}
> -
> static int ci_resume(struct device *dev)
> {
> struct ci_hdrc *ci = dev_get_drvdata(dev);
> @@ -1446,7 +1450,7 @@ static int ci_resume(struct device *dev)
> ci_role(ci)->resume(ci, power_lost);
>
> if (power_lost)
> - ci_handle_power_lost(ci);
> + queue_work(system_freezable_wq, &ci->power_lost_work);
>
> if (ci->supports_runtime_pm) {
> pm_runtime_disable(dev);
> --
> 2.34.1
>
>
--
Thanks,
Peter Chen
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox