> -----Original Message----- > From: Fiona Klute <fiona.klute@xxxxxx> > Sent: Wednesday, February 28, 2024 7:55 AM > To: linux-wireless@xxxxxxxxxxxxxxx; Ping-Ke Shih <pkshih@xxxxxxxxxxx> > Cc: Fiona Klute <fiona.klute@xxxxxx>; kvalo@xxxxxxxxxx; ulf.hansson@xxxxxxxxxx; linux-mmc@xxxxxxxxxxxxxxx; > pavel@xxxxxx; megi@xxxxxx > Subject: [PATCH v2 5/9] wifi: rtw88: Add rtw8703b.c > > This is the main source for the new rtw88_8703b chip driver. > > Acked-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx> > Tested-by: Pavel Machek <pavel@xxxxxx> > Signed-off-by: Fiona Klute <fiona.klute@xxxxxx> > --- > drivers/net/wireless/realtek/rtw88/rtw8703b.c | 2112 +++++++++++++++++ > 1 file changed, 2112 insertions(+) > create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8703b.c > > diff --git a/drivers/net/wireless/realtek/rtw88/rtw8703b.c > b/drivers/net/wireless/realtek/rtw88/rtw8703b.c > new file mode 100644 > index 00000000000..83b1da60eb4 > --- /dev/null > +++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c > @@ -0,0 +1,2112 @@ > +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause > +/* Copyright Fiona Klute <fiona.klute@xxxxxx> */ > + > +#include <linux/of_net.h> > +#include "main.h" > +#include "coex.h" > +#include "debug.h" > +#include "mac.h" > +#include "phy.h" > +#include "reg.h" > +#include "rx.h" > +#include "rtw8703b.h" > +#include "rtw8703b_tables.h" > +#include "rtw8723x.h" > + > +#define GET_RX_DESC_BW(rxdesc) \ > + (le32_get_bits(*((__le32 *)(rxdesc) + 0x04), GENMASK(31, 24))) Can we move this to rx.h GET_RX_DESC_xxx()? > + > +#define BIT_MASK_TXQ_INIT (BIT(7)) > +#define WLAN_RL_VAL 0x3030 > +/* disable BAR */ > +#define WLAN_BAR_VAL 0x0201ffff > +#define WLAN_PIFS_VAL 0 > +#define WLAN_RX_PKT_LIMIT 0x18 > +#define WLAN_SLOT_TIME 0x09 > +#define WLAN_SPEC_SIFS 0x100a > +#define WLAN_MAX_AGG_NR 0x1f > +#define WLAN_AMPDU_MAX_TIME 0x70 > + > +/* unit is 32us */ > +#define TBTT_PROHIBIT_SETUP_TIME 0x04 > +#define TBTT_PROHIBIT_HOLD_TIME 0x80 > +#define TBTT_PROHIBIT_HOLD_TIME_STOP_BCN 0x64 > + > +/* raw pkt_stat->drv_info_sz is in unit of 8-bytes */ > +#define RX_DRV_INFO_SZ_UNIT_8703B 8 > + > +#define TRANS_SEQ_END \ > + {0xFFFF, \ > + RTW_PWR_CUT_ALL_MSK, \ > + RTW_PWR_INTF_ALL_MSK, \ > + 0, \ > + RTW_PWR_CMD_END, 0, 0} Move this macro to main.h along with RTW_PWR_CUT_ALL_MSK. > + > +static void rtw8703b_cfg_notch(struct rtw_dev *rtwdev, u8 channel, bool notch) > +{ > + if (!notch) { > + rtw_write32_mask(rtwdev, REG_OFDM0_RXDSP, BIT_MASK_RXDSP, 0x1f); > + rtw_write32_mask(rtwdev, REG_OFDM0_RXDSP, BIT_EN_RXDSP, 0x0); > + rtw_write32(rtwdev, REG_OFDM1_CSI1, 0x00000000); > + rtw_write32(rtwdev, REG_OFDM1_CSI2, 0x00000000); > + rtw_write32(rtwdev, REG_OFDM1_CSI3, 0x00000000); > + rtw_write32(rtwdev, REG_OFDM1_CSI4, 0x00000000); > + rtw_write32_mask(rtwdev, REG_OFDM1_CFOTRK, BIT_EN_CFOTRK, 0x0); > + return; > + } > + > + switch (channel) { > + case 5: > + fallthrough; no need fallthrough unless you do something by case 5. > + case 13: > + rtw_write32_mask(rtwdev, REG_OFDM0_RXDSP, BIT_MASK_RXDSP, 0xb); > + rtw_write32_mask(rtwdev, REG_OFDM0_RXDSP, BIT_EN_RXDSP, 0x1); > + rtw_write32(rtwdev, REG_OFDM1_CSI1, 0x06000000); > + rtw_write32(rtwdev, REG_OFDM1_CSI2, 0x00000000); > + rtw_write32(rtwdev, REG_OFDM1_CSI3, 0x00000000); > + rtw_write32(rtwdev, REG_OFDM1_CSI4, 0x00000000); > + rtw_write32_mask(rtwdev, REG_OFDM1_CFOTRK, BIT_EN_CFOTRK, 0x1); > + break; [...]