RE: [PATCH rtw-next v5] wifi: rtw88: usb: do not log transfers lost to a mode switch
Ping-Ke Shih <[email protected]>
| Newsgroups | org.kernel.vger.linux-wireless |
|---|---|
| Message-ID | <[email protected]> |
Mehmet Fide <[email protected]> wrote: > From: Mehmet Fide <[email protected]> > > An RTL8822BU or RTL8822CU is asked to come back as a USB 3 device by > rtw_usb_switch_mode_new(). The chip powers off its MAC and leaves the bus > while the last control transfers of that sequence are still in flight, so > they complete with -EPROTO and the driver reports them as errors: > > rtw_8822bu 1-1:1.0: Firmware version 27.2.0, H2C version 13 > rtw_8822bu 1-1:1.0: write register 0xc4 failed with -71 > usb 1-1: USB disconnect, device number 2 > usbcore: registered new interface driver rtw_8822bu > rtw_8822bu 1-1:1.0: Firmware version 27.2.0, H2C version 13 > > Register 0xc4 is REG_PAD_CTRL2 and the access losing the race is the > rtw_write32_set() that ends the switch sequence, a few milliseconds before > the disconnect. Which transfer gets caught varies from boot to boot: 0xc4 > is in the "always on" section, so every write to it is followed by a second > one from rtw_usb_reg_sec(), and sometimes that is the one that fails: > > rtw_8822bu 1-1:1.0: rtw_usb_reg_sec: reg 0x4e0, usb write 1 fail, > status: -71 > > Nothing is wrong here. The device re-enumerates, probes again and registers > normally, which is why rtw_usb_probe() already treats a non-zero return > from rtw_usb_switch_mode() as "Not a fail". On a USB 2 only port the > switch can never succeed, so the message returns on every boot and > everyone using such a port has to work out that it is harmless. > > Mark the window in which the chip is expected to leave the bus and skip the > error reports for transfers that fall into it. The mark is a rtw_flags bit > set in rtw_usb_switch_mode(), so it covers both the new and the old switch > sequence, and it is cleared again right after them: the transfers that lose > the race are issued from inside the sequences, and anything that fails > later must be reported again. > > Tested with an RTL8822BU (0x7392:0xb822) on a USB 2 root port of a TI AM62, > where the message appears exactly once per boot. With the patch both lines > are gone while the disconnect, the re-enumeration and the second firmware > load are unchanged. > > Signed-off-by: Mehmet Fide <[email protected]> Acked-by: Ping-Ke Shih <[email protected]>