Search Linux Wireless

Re: [PATCH 06/10] rtw88: Add common USB chip support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 18, 2022 at 10:23:14AM +0200, Sascha Hauer wrote:
> Add the common bits and pieces to add USB support to the RTW88 driver.
> This is based on https://github.com/ulli-kroll/rtw88-usb.git which
> itself is first written by Neo Jou.
> 
> Signed-off-by: neo_jou <neo_jou@xxxxxxxxxxx>
> Signed-off-by: Hans Ulli Kroll <linux@xxxxxxxxxxxxx>
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> ---
>  drivers/net/wireless/realtek/rtw88/Kconfig  |    3 +
>  drivers/net/wireless/realtek/rtw88/Makefile |    2 +
>  drivers/net/wireless/realtek/rtw88/mac.c    |    3 +
>  drivers/net/wireless/realtek/rtw88/main.c   |    5 +
>  drivers/net/wireless/realtek/rtw88/main.h   |    4 +
>  drivers/net/wireless/realtek/rtw88/reg.h    |    1 +
>  drivers/net/wireless/realtek/rtw88/tx.h     |   31 +
>  drivers/net/wireless/realtek/rtw88/usb.c    | 1051 +++++++++++++++++++
>  drivers/net/wireless/realtek/rtw88/usb.h    |  109 ++
>  9 files changed, 1209 insertions(+)
>  create mode 100644 drivers/net/wireless/realtek/rtw88/usb.c
>  create mode 100644 drivers/net/wireless/realtek/rtw88/usb.h
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/Kconfig b/drivers/net/wireless/realtek/rtw88/Kconfig
> index e3d7cb6c12902..1624c5db69bac 100644
> --- a/drivers/net/wireless/realtek/rtw88/Kconfig
> +++ b/drivers/net/wireless/realtek/rtw88/Kconfig
> @@ -16,6 +16,9 @@ config RTW88_CORE
>  config RTW88_PCI
>  	tristate
>  
> +config RTW88_USB
> +	tristate
> +
>  config RTW88_8822B
>  	tristate
>  
> diff --git a/drivers/net/wireless/realtek/rtw88/Makefile b/drivers/net/wireless/realtek/rtw88/Makefile
> index 834c66ec0af9e..9e095f8181483 100644
> --- a/drivers/net/wireless/realtek/rtw88/Makefile
> +++ b/drivers/net/wireless/realtek/rtw88/Makefile
> @@ -45,4 +45,6 @@ obj-$(CONFIG_RTW88_8821CE)	+= rtw88_8821ce.o
>  rtw88_8821ce-objs		:= rtw8821ce.o
>  
>  obj-$(CONFIG_RTW88_PCI)		+= rtw88_pci.o
> +obj-$(CONFIG_RTW88_USB)		+= rtw88_usb.o
>  rtw88_pci-objs			:= pci.o
> +rtw88_usb-objs			:= usb.o
> diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
> index d1678aed9d9cb..19728c705eaa9 100644
> --- a/drivers/net/wireless/realtek/rtw88/mac.c
> +++ b/drivers/net/wireless/realtek/rtw88/mac.c
> @@ -1032,6 +1032,9 @@ static int txdma_queue_mapping(struct rtw_dev *rtwdev)
>  	if (rtw_chip_wcpu_11ac(rtwdev))
>  		rtw_write32(rtwdev, REG_H2CQ_CSR, BIT_H2CQ_FULL);
>  
> +	if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_USB)
> +		rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_ARBBW_EN);
> +
>  	return 0;
>  }
>  
> diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
> index 5afb8bef9696a..162fa432ce0d1 100644
> --- a/drivers/net/wireless/realtek/rtw88/main.c
> +++ b/drivers/net/wireless/realtek/rtw88/main.c
> @@ -1715,6 +1715,10 @@ static int rtw_chip_parameter_setup(struct rtw_dev *rtwdev)
>  		rtwdev->hci.rpwm_addr = 0x03d9;
>  		rtwdev->hci.cpwm_addr = 0x03da;
>  		break;
> +	case RTW_HCI_TYPE_USB:
> +		rtwdev->hci.rpwm_addr = 0xfe58;
> +		rtwdev->hci.cpwm_addr = 0xfe57;
> +		break;
>  	default:
>  		rtw_err(rtwdev, "unsupported hci type\n");
>  		return -EINVAL;
> @@ -2105,6 +2109,7 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)
>  	hw->wiphy->available_antennas_rx = hal->antenna_rx;
>  
>  	hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
> +			    WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
>  			    WIPHY_FLAG_TDLS_EXTERNAL_SETUP;

This change should be in a separate patch. I don't have an idea though
what it's good for anyway. Is this change desired for the PCI variants
as well or only for USB? Do we want to have this change at all?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux