Received: by 2002:a05:7412:a9a3:b0:f9:327e:43ab with SMTP id o35csp139598rdh; Mon, 18 Dec 2023 06:39:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGELIfL04FIZ7YTHehDp1BVmLdYLl8kNOWNhbJhvSv0HKUAe2bNALO0tcTVeSbwvRUG+d8L X-Received: by 2002:a17:902:fc8f:b0:1d3:a865:b16f with SMTP id mf15-20020a170902fc8f00b001d3a865b16fmr1457880plb.7.1702910375083; Mon, 18 Dec 2023 06:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702910375; cv=none; d=google.com; s=arc-20160816; b=PiL1Rb9EAIiB+eNy1oqRUnY6A+JMPOCjjruwKv0TEPt1DE7pWfyOiSXZaCjFvPk3na qQkWaH1f3o57FCs3eLM78iGviJwkLoXQJKzMyY0GitsoZD1UuliuWf6ex7WcDm6hq0n4 +ull+nJLdOihvK/Kb0qCUp9Pt75I7IgMYq1ajFTAXx5P9STo7Dob0nqyKfDTah1yr6ej iMhs/HEIFeDbd/Osk3bBUc2rEq5hzjvT9i02DxcTnVBbH0k72p/yarxLE8vYIjHD5t4t LCx3P2p6PSoGgAvBxS5yMfr74T6h6WPtf9WXrSJLjKjL/fL4Q1/4yGjF2frXdVbFdO7K WhKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:dkim-signature:dkim-signature:from; bh=mi4ELzo3FZhzcl+T/tLoCV1R4ur75BKpb4KlDpGL0C8=; fh=KsoNWtazjfstHns8t6UZ1pulwZL69aEO39vRs0LPvyo=; b=M7JbiVS3nkOaSXtbfaAuzy6x14RH7GBDcrVC5frnK8FzNaDGAYSXRStzujXm3lytIh YwIhnXyq+CxiiSqxxHgwb7l4Dbd8TLyOyQq1yM7XuolpFKmMpx05UBIZmonV00JrfBfd 68ndAaMrA88PXnup3HcNq1qFUIYuXU4YXaGtguqj7ex/UMJT3qNRhZ62kGh1HWNQ3Nlh 9UdmcIOxSfBwKL2h3cuavtk3c8iqeSEBCJN6+gJs7WZvAn3zFWCMMosgfwe+KJJI+thz gRHiaJF/99G9HqllXun7ybj7VpkUQ0h+XaQnqsYYbm4wNdGUSkfO0ZcMPXpmLj+XCG8p 6vIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3BuJlAqC; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-wireless+bounces-914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ix10-20020a170902f80a00b001d3be63dde9si1613361plb.457.2023.12.18.06.39.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 06:39:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3BuJlAqC; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-wireless+bounces-914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B1A70B22BBD for ; Mon, 18 Dec 2023 14:37:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 259EC3786A; Mon, 18 Dec 2023 14:37:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3BuJlAqC"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="umPYKHnq" X-Original-To: linux-wireless@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CCD03786B for ; Mon, 18 Dec 2023 14:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Martin Kaistra DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1702910227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mi4ELzo3FZhzcl+T/tLoCV1R4ur75BKpb4KlDpGL0C8=; b=3BuJlAqCPWbDWOBt/QriNe32VHuu7wLM0qexdFgKIm4b/a8oBYPq4Qg8+U42T76E1N35fo A90qzE3ZRzmDNb4fQdPLTxehbVZcBTWdOm/vmrmpgWrBaOC1T5QTEYAZrWKUsYyXuN+9WC DO0t8Ql+9WBvFmVq1w4UTBshlLdEjhkVt9xvSCOnYmkwVF1QzFZunz7GHU/WdtjI9yCT91 jXkZBBYMNHKOZJZpiirobc6APHuo98qQuXFqxl8w2dKKo3iM6kW7Iux/08i2w31C+1LAdM GfTCbe1U2IOJF5iG20FhDtmc1nt+rvTJtu546HBHc5PYp9qbf2GUSUD7Ip+zUg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1702910227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mi4ELzo3FZhzcl+T/tLoCV1R4ur75BKpb4KlDpGL0C8=; b=umPYKHnq2m/oV6XobESfFSBEGLND2wqTWAjkeAd9LmExlCFj2GRsj/+Nw+ZeqNXcwWl76I loICFmKs9lrDq4AQ== To: linux-wireless@vger.kernel.org Cc: Jes Sorensen , Kalle Valo , Ping-Ke Shih , Bitterblue Smith , Sebastian Andrzej Siewior Subject: [PATCH 03/20] wifi: rtl8xxxu: support setting linktype for both interfaces Date: Mon, 18 Dec 2023 15:36:28 +0100 Message-Id: <20231218143645.433356-4-martin.kaistra@linutronix.de> In-Reply-To: <20231218143645.433356-1-martin.kaistra@linutronix.de> References: <20231218143645.433356-1-martin.kaistra@linutronix.de> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To prepare for concurrent mode, enhance the set_linktype function to be able to set the linktype in the MSR register for both hardware ports. Until the users of set_linktype can handle multiple interfaces, use port_num = 0. Signed-off-by: Martin Kaistra --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 5b7c20970a973..305d6dd585dfa 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -1633,33 +1633,41 @@ rtl8xxxu_gen1_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40) } static void rtl8xxxu_set_linktype(struct rtl8xxxu_priv *priv, - enum nl80211_iftype linktype) + enum nl80211_iftype linktype, int port_num) { - u8 val8; - - val8 = rtl8xxxu_read8(priv, REG_MSR); - val8 &= ~MSR_LINKTYPE_MASK; + u8 val8, type; switch (linktype) { case NL80211_IFTYPE_UNSPECIFIED: - val8 |= MSR_LINKTYPE_NONE; + type = MSR_LINKTYPE_NONE; break; case NL80211_IFTYPE_ADHOC: - val8 |= MSR_LINKTYPE_ADHOC; + type = MSR_LINKTYPE_ADHOC; break; case NL80211_IFTYPE_STATION: - val8 |= MSR_LINKTYPE_STATION; + type = MSR_LINKTYPE_STATION; break; case NL80211_IFTYPE_AP: - val8 |= MSR_LINKTYPE_AP; + type = MSR_LINKTYPE_AP; break; default: - goto out; + return; + } + + switch (port_num) { + case 0: + val8 = rtl8xxxu_read8(priv, REG_MSR) & 0x0c; + val8 |= type; + break; + case 1: + val8 = rtl8xxxu_read8(priv, REG_MSR) & 0x03; + val8 |= type << 2; + break; + default: + return; } rtl8xxxu_write8(priv, REG_MSR, val8); -out: - return; } static void @@ -4236,7 +4244,6 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw) } rtl8xxxu_set_mac(priv); - rtl8xxxu_set_linktype(priv, NL80211_IFTYPE_STATION); /* * Configure initial WMAC settings @@ -4964,7 +4971,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (changed & BSS_CHANGED_ASSOC) { dev_dbg(dev, "Changed ASSOC: %i!\n", vif->cfg.assoc); - rtl8xxxu_set_linktype(priv, vif->type); + rtl8xxxu_set_linktype(priv, vif->type, 0); if (vif->cfg.assoc) { u32 ramask; @@ -6610,7 +6617,7 @@ static int rtl8xxxu_add_interface(struct ieee80211_hw *hw, ret = -EOPNOTSUPP; } - rtl8xxxu_set_linktype(priv, vif->type); + rtl8xxxu_set_linktype(priv, vif->type, 0); ether_addr_copy(priv->mac_addr, vif->addr); rtl8xxxu_set_mac(priv); -- 2.39.2