Commit 00add60c authored by Martin Kaistra's avatar Martin Kaistra Committed by Kalle Valo

wifi: rtl8xxxu: support setting mac address register for both interfaces

To prepare for concurrent mode, enhance rtl8xxxu_set_mac() to write the
mac address of the respective interface to REG_MACID or REG_MACID1.

Remove the call to rtl8xxxu_set_mac() from the init function as we set
it in rtl8xxxu_add_interface() later anyway.

Until rtl8xxxu_add_interface() can handle both interfaces, call
rtl8xxxu_set_mac() with port_num = 0.
Signed-off-by: default avatarMartin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231222101442.626837-6-martin.kaistra@linutronix.de
parent a047e46a
...@@ -3580,15 +3580,25 @@ void rtl8723a_phy_lc_calibrate(struct rtl8xxxu_priv *priv) ...@@ -3580,15 +3580,25 @@ void rtl8723a_phy_lc_calibrate(struct rtl8xxxu_priv *priv)
rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00);
} }
static int rtl8xxxu_set_mac(struct rtl8xxxu_priv *priv) static int rtl8xxxu_set_mac(struct rtl8xxxu_priv *priv, int port_num)
{ {
int i; int i;
u16 reg; u16 reg;
reg = REG_MACID; switch (port_num) {
case 0:
reg = REG_MACID;
break;
case 1:
reg = REG_MACID1;
break;
default:
WARN_ONCE("%s: invalid port_num\n", __func__);
return -EINVAL;
}
for (i = 0; i < ETH_ALEN; i++) for (i = 0; i < ETH_ALEN; i++)
rtl8xxxu_write8(priv, reg + i, priv->mac_addr[i]); rtl8xxxu_write8(priv, reg + i, priv->vifs[port_num]->addr[i]);
return 0; return 0;
} }
...@@ -4243,8 +4253,6 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw) ...@@ -4243,8 +4253,6 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
rtl8xxxu_write32(priv, REG_HIMR, 0xffffffff); rtl8xxxu_write32(priv, REG_HIMR, 0xffffffff);
} }
rtl8xxxu_set_mac(priv);
/* /*
* Configure initial WMAC settings * Configure initial WMAC settings
*/ */
...@@ -6619,7 +6627,7 @@ static int rtl8xxxu_add_interface(struct ieee80211_hw *hw, ...@@ -6619,7 +6627,7 @@ static int rtl8xxxu_add_interface(struct ieee80211_hw *hw,
rtl8xxxu_set_linktype(priv, vif->type, 0); rtl8xxxu_set_linktype(priv, vif->type, 0);
ether_addr_copy(priv->mac_addr, vif->addr); ether_addr_copy(priv->mac_addr, vif->addr);
rtl8xxxu_set_mac(priv); rtl8xxxu_set_mac(priv, 0);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment