> -----Original Message----- > From: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> > Sent: Wednesday, January 10, 2024 9:47 PM > To: linux-wireless@xxxxxxxxxxxxxxx > Cc: Ping-Ke Shih <pkshih@xxxxxxxxxxx>; Larry Finger <Larry.Finger@xxxxxxxxxxxx> > Subject: [PATCH v2] wifi: rtlwifi: rtl_usb: Use sync register writes > > Currently rtl_usb performs register writes using the async > usb_submit_urb() function. This appears to work fine for the RTL8192CU, > but the RTL8192DU (soon to be supported by rtlwifi) has a problem: > it transmits everything at the 1M rate in the 2.4 GHz band. (The 5 GHz > band is still untested.) > > With this patch, rtl_usb performs the register writes using the > synchronous usb_control_msg() function, and the RTL8192DU works > normally. The RTL8192CU still works. > > The vendor drivers use the async writes in only one function, > rtl8192du_trigger_gpio_0 / rtl8192cu_trigger_gpio_0, which probably > doesn't even run in real life. They use sync writes everywhere else. > > Also, remove "sync" and "async" from the names of the members of > struct rtl_io to avoid confusion: > > write{8,16,32}_async -> write{8,16,32} > read{8,16,32}_sync -> read{8,16,32} > > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> Acked-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx> > --- > v2: > - Rename the members of struct rtl_io. > --- > drivers/net/wireless/realtek/rtlwifi/pci.c | 12 +- > drivers/net/wireless/realtek/rtlwifi/usb.c | 163 ++++++-------------- > drivers/net/wireless/realtek/rtlwifi/wifi.h | 30 ++-- > 3 files changed, 66 insertions(+), 139 deletions(-) > [...] > @@ -114,18 +51,15 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request, > } while (++vendorreq_times < MAX_USBCTRL_VENDORREQ_TIMES); > > if (status < 0 && count++ < 4) > - pr_err("reg 0x%x, usbctrl_vendorreq TimeOut! status:0x%x value=0x%x\n", > - value, status, *(u32 *)pdata); > - return status; > + pr_err("reg 0x%x, usbctrl_vendorreq TimeOut! status:0x%x value=0x%x reqtype=0x%x\n", nit: Since you touch this, would you like to use dev_err() instead? > + value, status, *(u32 *)pdata, reqtype); > } > [...]