Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp699064rdb; Fri, 22 Dec 2023 02:16:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6ew7ruUbMB+4eLQk3Dbsf2i7L4w38CDbk1I48FvtnfI5p018XPJK4yT1+1nUv9KAOxboQ X-Received: by 2002:a17:902:788c:b0:1d3:b35e:7b0e with SMTP id q12-20020a170902788c00b001d3b35e7b0emr900583pll.57.1703240167510; Fri, 22 Dec 2023 02:16:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703240167; cv=none; d=google.com; s=arc-20160816; b=p/Wnolb2OXPWFramuu9T7xwYbsh9rFZ30vT6IIsP9gPSdDp92imqMgDa8n+Gfgabi2 tiRyQ6B43a1g+bJbUZSZjsh1U4OkdF5KKEteEV9GYh+pZyMHwEAPV3Eg53p3lMyHrXkV EBuZagCS+Aspz4HR4qXRmOECjUXVK9Z8uw2FtM+3ErMoFAy59hX/HkF5ANYsOAB/Jn8p YVa/Pw1weGUzcb46cGgHv6opb38jfYgO9j+ARddicbLR0Kf86Zvajf1fcdKmu4gs2Bfu S44J2BUDdPMUYlTcKjHAV32g6unetGN9+kaQ6EKrLMCMq0Xy14KXW+V3Tl/D0baxo+50 ZIkA== 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=NtxhvT5EXVJY6bH7E7j4niDLoEOAgIXN8np9XwZ7Rvw=; fh=KsoNWtazjfstHns8t6UZ1pulwZL69aEO39vRs0LPvyo=; b=SsL6zuYLUG+InNLTIMqBCLVriM6pQyC+lb+w+UMSYsHc1+W+EVO8Hj920tK2GpgB45 ICue0oZzjZDtV3Fqr/gsmY4jOSlKqM0J02pvbmD7t6058GBXDmZqkYyVHMMOH06CzNnC hIsZu3FBdQKV2GYzV8WkraG0sUOXqF4/YV+H39mcL4dy6wU4dNTIC1qxVyzotVom10IJ 7odIAIsj0/6oaSOfhvJVlIAvHhg/QOzk4dACnTjGZRfZsvDuMM7XoMagw14A6uKP0PxY 0SY3ZJ4Tma/4HTJEjzV9MvGocQmA5HgxxHifUyXyjE0Q3ucxJexUj+BgXbyPxkwNNa7j QSiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QXm6nuib; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1232-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1232-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. [147.75.48.161]) by mx.google.com with ESMTPS id d10-20020a170902ceca00b001cfee4c128asi3002531plg.356.2023.12.22.02.16.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 02:16:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1232-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QXm6nuib; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1232-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1232-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 1B353B2516D for ; Fri, 22 Dec 2023 10:15:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE7751803C; Fri, 22 Dec 2023 10:14:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QXm6nuib"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="x8nD63/m" 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 BA92A171B8 for ; Fri, 22 Dec 2023 10:14:51 +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=1703240087; 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=NtxhvT5EXVJY6bH7E7j4niDLoEOAgIXN8np9XwZ7Rvw=; b=QXm6nuibkcdGid7tzeEMmnjpgPHH04Xy2EptZauFGdPfOsfHynAjN1GkIPeGoEbe1n3lRg Pd2xvQxx9oirnjyLpvLWSlKiKzhlfCQH6dkAKrweQMCauxp8MG4Xs0fiMkW7SJME66PxFt yaz2PqymZLvVttS4xhqPn3bx1KvvRXBOJw/WPEXhneWwOXjJu3CicLf0HU5qwlV+C/YmGy /+P1TdEWIEVOQAAEDma/B9EFIO8lqZbH+qMzkmZ7OEViuT9xHbogXi6+wJcucL/boAcDp4 M4rLW5EQcSzd8ALehqCOVs5DpTRwNTdNUfZHDQgCy8d1sN+xco/NrlxDTVE8NQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703240087; 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=NtxhvT5EXVJY6bH7E7j4niDLoEOAgIXN8np9XwZ7Rvw=; b=x8nD63/mMbnGVizxcOqI7V311XvwNVKbRaUtHfJq0TuiYlxf5eHqv/3qzPSd+8xKNYC2VP ZPa0mj3ZWDXmSvBQ== To: linux-wireless@vger.kernel.org Cc: Jes Sorensen , Kalle Valo , Ping-Ke Shih , Bitterblue Smith , Sebastian Andrzej Siewior Subject: [PATCH v3 05/21] wifi: rtl8xxxu: support setting mac address register for both interfaces Date: Fri, 22 Dec 2023 11:14:26 +0100 Message-Id: <20231222101442.626837-6-martin.kaistra@linutronix.de> In-Reply-To: <20231222101442.626837-1-martin.kaistra@linutronix.de> References: <20231222101442.626837-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 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: Martin Kaistra Reviewed-by: Ping-Ke Shih --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 305d6dd585dfa..c2ea8e92cd637 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -3580,15 +3580,25 @@ void rtl8723a_phy_lc_calibrate(struct rtl8xxxu_priv *priv) 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; 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++) - rtl8xxxu_write8(priv, reg + i, priv->mac_addr[i]); + rtl8xxxu_write8(priv, reg + i, priv->vifs[port_num]->addr[i]); return 0; } @@ -4243,8 +4253,6 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw) rtl8xxxu_write32(priv, REG_HIMR, 0xffffffff); } - rtl8xxxu_set_mac(priv); - /* * Configure initial WMAC settings */ @@ -6619,7 +6627,7 @@ static int rtl8xxxu_add_interface(struct ieee80211_hw *hw, rtl8xxxu_set_linktype(priv, vif->type, 0); ether_addr_copy(priv->mac_addr, vif->addr); - rtl8xxxu_set_mac(priv); + rtl8xxxu_set_mac(priv, 0); return ret; } -- 2.39.2