1 From 7f444692cde83c1455682c2d0d2c9a666422b867 Mon Sep 17 00:00:00 2001
2 From: Martin Kaistra <martin.kaistra@linutronix.de>
3 Date: Fri, 22 Dec 2023 11:14:24 +0100
4 Subject: [PATCH 03/21] wifi: rtl8xxxu: support setting linktype for both
7 To prepare for concurrent mode, enhance the set_linktype function to be
8 able to set the linktype in the MSR register for both hardware ports.
10 Until the users of set_linktype can handle multiple interfaces, use
13 Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
14 Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
15 Signed-off-by: Kalle Valo <kvalo@kernel.org>
16 Link: https://msgid.link/20231222101442.626837-4-martin.kaistra@linutronix.de
18 .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 37 +++++++++++--------
19 1 file changed, 22 insertions(+), 15 deletions(-)
21 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
22 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
23 @@ -1633,33 +1633,41 @@ rtl8xxxu_gen1_set_tx_power(struct rtl8xx
26 static void rtl8xxxu_set_linktype(struct rtl8xxxu_priv *priv,
27 - enum nl80211_iftype linktype)
28 + enum nl80211_iftype linktype, int port_num)
32 - val8 = rtl8xxxu_read8(priv, REG_MSR);
33 - val8 &= ~MSR_LINKTYPE_MASK;
37 case NL80211_IFTYPE_UNSPECIFIED:
38 - val8 |= MSR_LINKTYPE_NONE;
39 + type = MSR_LINKTYPE_NONE;
41 case NL80211_IFTYPE_ADHOC:
42 - val8 |= MSR_LINKTYPE_ADHOC;
43 + type = MSR_LINKTYPE_ADHOC;
45 case NL80211_IFTYPE_STATION:
46 - val8 |= MSR_LINKTYPE_STATION;
47 + type = MSR_LINKTYPE_STATION;
49 case NL80211_IFTYPE_AP:
50 - val8 |= MSR_LINKTYPE_AP;
51 + type = MSR_LINKTYPE_AP;
60 + val8 = rtl8xxxu_read8(priv, REG_MSR) & 0x0c;
64 + val8 = rtl8xxxu_read8(priv, REG_MSR) & 0x03;
71 rtl8xxxu_write8(priv, REG_MSR, val8);
77 @@ -4236,7 +4244,6 @@ static int rtl8xxxu_init_device(struct i
80 rtl8xxxu_set_mac(priv);
81 - rtl8xxxu_set_linktype(priv, NL80211_IFTYPE_STATION);
84 * Configure initial WMAC settings
85 @@ -4964,7 +4971,7 @@ rtl8xxxu_bss_info_changed(struct ieee802
86 if (changed & BSS_CHANGED_ASSOC) {
87 dev_dbg(dev, "Changed ASSOC: %i!\n", vif->cfg.assoc);
89 - rtl8xxxu_set_linktype(priv, vif->type);
90 + rtl8xxxu_set_linktype(priv, vif->type, 0);
94 @@ -6610,7 +6617,7 @@ static int rtl8xxxu_add_interface(struct
98 - rtl8xxxu_set_linktype(priv, vif->type);
99 + rtl8xxxu_set_linktype(priv, vif->type, 0);
100 ether_addr_copy(priv->mac_addr, vif->addr);
101 rtl8xxxu_set_mac(priv);