From patchwork Mon Nov 18 04:08:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Lai X-Patchwork-Id: 13878075 X-Patchwork-Delegate: kuba@kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 064FE13C816; Mon, 18 Nov 2024 04:09:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731902958; cv=none; b=UBwzmOaAO67BlE2Ut4rwi9Ir9K+weCkhMuJzuSp8iB48YMdfiW756NJeYI01gFDisKW+v2wnA4uZ6v/wikSTlUAGzy9MyxDtTBLMBbl1n+LFHprt9tTjYRdcEdE4G68Kv65gpoBK6BQ5zCkcz0UHk2vaxvQPD8Y8rtliuRqNrHE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731902958; c=relaxed/simple; bh=QfVWlreJZg/l0pgy+fenk87ylKvpPC5vFMVGj7hj1Pk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hHGwWv9EOgxUPhnVfzlQ9KdK9tkNlCRA5JMzSz+v+jNVW422UhgdSbWedRO0qL6vh7NQ7UPSVIQ0nT9pdTKXMf43oM14qlz3o2UtlS9+5F0/4sKgyjZbW0NnIlaN/IMimIfKpFcrzC+IvsyzB+xO7+4bCFQx30fZ/QvazMEnptA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b=tr0M0H1o; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b="tr0M0H1o" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AI490rY4108245, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1731902940; bh=QfVWlreJZg/l0pgy+fenk87ylKvpPC5vFMVGj7hj1Pk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=tr0M0H1oAXupwZgiVVIEgnb6IAbrPa8jt9X1+GheCDpUBH++RDlZswAZj1WpIH/w4 qCVI82bLNbyVxAba7N9nPipkIADM+xA6UkPqQND8V570FsqWTFwcQYM/dCSTcTvJXx EqOqgVJ8iXAujV33lhIoYqYayypWEgev5g/ehqVdEEMGCJ+gnG0FJEdzmAA7zbz/xS OsR0looYb2OkGSUtNS/VzxNbpOY6Thr3IGVSLt5icPUfMICaexB2xXNk0qLp89eezF VKPOwB0aLybwOXn/8lt5ZasBMXvMBtS9vHqKmQyjzu69fvwe01ccgJ+yvg7YSUWgMN 1vDJw3UIv4TLQ== Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/3.06/5.92) with ESMTPS id 4AI490rY4108245 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 12:09:00 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 18 Nov 2024 12:09:01 +0800 Received: from RTDOMAIN (172.21.210.74) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 18 Nov 2024 12:09:00 +0800 From: Justin Lai To: CC: , , , , , , , , , Justin Lai Subject: [PATCH net v3 1/4] rtase: Refactor the rtase_check_mac_version_valid() function Date: Mon, 18 Nov 2024 12:08:25 +0800 Message-ID: <20241118040828.454861-2-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241118040828.454861-1-justinlai0215@realtek.com> References: <20241118040828.454861-1-justinlai0215@realtek.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-Patchwork-Delegate: kuba@kernel.org 1. Sets tp->hw_ver. 2. Changes the return type from bool to int. 3. Modify the error message for an invalid hardware version id. Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this module") Signed-off-by: Justin Lai --- drivers/net/ethernet/realtek/rtase/rtase.h | 2 ++ .../net/ethernet/realtek/rtase/rtase_main.c | 22 +++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/realtek/rtase/rtase.h b/drivers/net/ethernet/realtek/rtase/rtase.h index 583c33930f88..547c71937b01 100644 --- a/drivers/net/ethernet/realtek/rtase/rtase.h +++ b/drivers/net/ethernet/realtek/rtase/rtase.h @@ -327,6 +327,8 @@ struct rtase_private { u16 int_nums; u16 tx_int_mit; u16 rx_int_mit; + + u32 hw_ver; }; #define RTASE_LSO_64K 64000 diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c index f8777b7663d3..0c19c5645d53 100644 --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c @@ -1972,20 +1972,21 @@ static void rtase_init_software_variable(struct pci_dev *pdev, tp->dev->max_mtu = RTASE_MAX_JUMBO_SIZE; } -static bool rtase_check_mac_version_valid(struct rtase_private *tp) +static int rtase_check_mac_version_valid(struct rtase_private *tp) { - u32 hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK; - bool known_ver = false; + int ret = -ENODEV; - switch (hw_ver) { + tp->hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK; + + switch (tp->hw_ver) { case 0x00800000: case 0x04000000: case 0x04800000: - known_ver = true; + ret = 0; break; } - return known_ver; + return ret; } static int rtase_init_board(struct pci_dev *pdev, struct net_device **dev_out, @@ -2105,9 +2106,12 @@ static int rtase_init_one(struct pci_dev *pdev, tp->pdev = pdev; /* identify chip attached to board */ - if (!rtase_check_mac_version_valid(tp)) - return dev_err_probe(&pdev->dev, -ENODEV, - "unknown chip version, contact rtase maintainers (see MAINTAINERS file)\n"); + ret = rtase_check_mac_version_valid(tp); + if (ret != 0) { + dev_err(&pdev->dev, + "unknown chip version: 0x%08x, contact rtase maintainers (see MAINTAINERS file)\n", + tp->hw_ver); + } rtase_init_software_variable(pdev, tp); rtase_init_hardware(tp); From patchwork Mon Nov 18 04:08:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Lai X-Patchwork-Id: 13878076 X-Patchwork-Delegate: kuba@kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55E9F12DD95; Mon, 18 Nov 2024 04:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731902984; cv=none; b=Za1B2q2mtNECalNUC8wta7eO81dv760/DnuQGoWxqyZKIJupYlJfhV10YohRGLoSZaXk2cHvMy+53uB70vYKqOPPctNrcpmn/styTCffOPKqo/fSN8PsYlxMLPv3NjaB8D7hOCdpLIutBRSUUrBUtPp4+L8K3ifB1fh56GJPJwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731902984; c=relaxed/simple; bh=CykH9i7P9pZRTLcdwSphEWfFe4k6k8acMq71zcZ+/tU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CQ4/E9BDcevH1zJhpO3COdBUDh5l0sINjmQMVK1NPG006RbjuO10ENLecrwkcuWuXAU537FnczsFiebLNP2ymYQoJS/XedMbFSKcA30ffNSswXt+lB5nd0AThW6jZJRVjWnf5t0Ydo/6fv4KsASOre4TexFfj4i5Rq50MK/veVk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b=m4HYMhv4; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b="m4HYMhv4" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AI49QMo8108266, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1731902966; bh=CykH9i7P9pZRTLcdwSphEWfFe4k6k8acMq71zcZ+/tU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=m4HYMhv4V1E1wYKsOd5TrToIUYTHBtBD4o4r/MmcO5iN6xaCITZGWL7gFM/zLrb4a VGlkkByIg+Ca+DWNb7QcFIfMXlJduOlCqLRTx6qtCeJZf2nvEosMFr50usznlnJKtI OB9uYIvx/RkEJ6yw4BMWeCVFbzpsFocadrdZjO+1OeShx0toZQyw1oc5x6gIvAQorW 6f0Lf1IcqxmGywOp41HL9iMgGbAoWVjgK4K3jcETwDOdUXPhwqyp5hl+c8B+36irOo EB5ut3fmSul4OLpccOacro/KlErycqirmeY4kCCh03Kre8ibXhQPAcpIDairWhYPs1 fJ0gfGYYAPo7Q== Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/3.06/5.92) with ESMTPS id 4AI49QMo8108266 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 12:09:26 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 18 Nov 2024 12:09:27 +0800 Received: from RTDOMAIN (172.21.210.74) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 18 Nov 2024 12:09:26 +0800 From: Justin Lai To: CC: , , , , , , , , , Justin Lai Subject: [PATCH net v3 2/4] rtase: Correct the speed for RTL907XD-V1 Date: Mon, 18 Nov 2024 12:08:26 +0800 Message-ID: <20241118040828.454861-3-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241118040828.454861-1-justinlai0215@realtek.com> References: <20241118040828.454861-1-justinlai0215@realtek.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: RTEXH36506.realtek.com.tw (172.21.6.27) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-Patchwork-Delegate: kuba@kernel.org Correct the speed for RTL907XD-V1. Fixes: dd7f17c40fd1 ("rtase: Implement ethtool function") Signed-off-by: Justin Lai --- drivers/net/ethernet/realtek/rtase/rtase_main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c index 0c19c5645d53..5b8012987ea6 100644 --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c @@ -1714,10 +1714,21 @@ static int rtase_get_settings(struct net_device *dev, struct ethtool_link_ksettings *cmd) { u32 supported = SUPPORTED_MII | SUPPORTED_Pause | SUPPORTED_Asym_Pause; + const struct rtase_private *tp = netdev_priv(dev); ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, supported); - cmd->base.speed = SPEED_5000; + + switch (tp->hw_ver) { + case 0x00800000: + case 0x04000000: + cmd->base.speed = SPEED_5000; + break; + case 0x04800000: + cmd->base.speed = SPEED_10000; + break; + } + cmd->base.duplex = DUPLEX_FULL; cmd->base.port = PORT_MII; cmd->base.autoneg = AUTONEG_DISABLE; From patchwork Mon Nov 18 04:08:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Lai X-Patchwork-Id: 13878077 X-Patchwork-Delegate: kuba@kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C1B86E2BE; Mon, 18 Nov 2024 04:10:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731903023; cv=none; b=iGMLQORElTe0kmk/C0tywOM3Dpqf66+362iRFi/yR7DCppxAaji+h7vIf+WI/U0353X+iqn8F0SSRoISy1TiVMmJ23pS5EB+j4kEexJ5KK41hIiypT7sw/NKjNqleWw4dz5p/G990cRQOzPn6Kfn0aOHWWnqWe/7rZE9b/+XZtM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731903023; c=relaxed/simple; bh=CUZXK3npAiC71j5t/rX7zvVV7NzMRI88NuO+GHcvZJA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FA9h3Gb9xAoiJo/NkZFO8mC9Pzf+D/IkIYf+pSgT9SUqxmjGu/F2JobV9fSdZIfbhmCz5z8QpKQNRsfl5zQQXfSFt1j8+P4sGEuf/doBCTLys0uTzECEiwJzF4HBSWsc6qH6t9saNA/bXzN9C82/Hb0qwcoFLkR6qDpEhuTScpY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b=pC2J3n+z; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b="pC2J3n+z" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AI4A7nM4108783, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1731903007; bh=CUZXK3npAiC71j5t/rX7zvVV7NzMRI88NuO+GHcvZJA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=pC2J3n+zBDDX+z06tcNVQ3rqXzhTXpIy6Q9b8aYNcFYldyk+h27VA3RxeUZNowpDO HuAdPL5vzD+4gMU7tc/DrdtDbRtyTJ20s6BmLi+ORL4R2lNNsjlZhu8wna2g3XW0Nn EQ1T3YiVjVcVUPuhKRGxL6eP+t2alZK0J2ic5GbQ/sUvvhgpC4qfatEKOMqhfiE8F/ D4Cy/2okh/8apjsC5eGC87TRYJ4nGJWNKaRaLe4iGa7RI87SwkimCk3/EIV5mxSsUh 7VoNF1zR8zvCrg6EX9VgqfwzO3ZYJ0seLc4UrgkVHZZq9vmQVXkGnPxaGizD2ZXI+D 7IsLeB3VCf9PQ== Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/3.06/5.92) with ESMTPS id 4AI4A7nM4108783 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 12:10:07 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 18 Nov 2024 12:10:06 +0800 Received: from RTDOMAIN (172.21.210.74) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 18 Nov 2024 12:10:05 +0800 From: Justin Lai To: CC: , , , , , , , , , Justin Lai Subject: [PATCH net v3 3/4] rtase: Corrects error handling of the rtase_check_mac_version_valid() Date: Mon, 18 Nov 2024 12:08:27 +0800 Message-ID: <20241118040828.454861-4-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241118040828.454861-1-justinlai0215@realtek.com> References: <20241118040828.454861-1-justinlai0215@realtek.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-Patchwork-Delegate: kuba@kernel.org Corrects error handling of the rtase_check_mac_version_valid(). Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this module") Signed-off-by: Justin Lai --- drivers/net/ethernet/realtek/rtase/rtase_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c index 5b8012987ea6..26331a2b7b2d 100644 --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c @@ -2122,6 +2122,7 @@ static int rtase_init_one(struct pci_dev *pdev, dev_err(&pdev->dev, "unknown chip version: 0x%08x, contact rtase maintainers (see MAINTAINERS file)\n", tp->hw_ver); + goto err_out_release_board; } rtase_init_software_variable(pdev, tp); @@ -2196,6 +2197,7 @@ static int rtase_init_one(struct pci_dev *pdev, netif_napi_del(&ivec->napi); } +err_out_release_board: rtase_release_board(pdev, dev, ioaddr); return ret; From patchwork Mon Nov 18 04:08:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Lai X-Patchwork-Id: 13878078 X-Patchwork-Delegate: kuba@kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3AB817C98; Mon, 18 Nov 2024 04:10:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731903045; cv=none; b=FKF8hv6NaayFskU8QQne5UZ5D5bPWp1rG21/mGUW9nxBa5cfnJcP7WcpcPppslBMkQSPsvxEHbVfIvaHwWPcZOpnIO/880qPphyaW5Oifc3FVXkZMCpL3TncwPeG26AlmkSs7zNeBY9dQd7srizbQQ2nd/q2mFvRVNjxZBGM3kc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731903045; c=relaxed/simple; bh=ow1vGg4eO+2OEbxNFP6nOJmj1FB88Ng9OVoBewOdaRY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JIDH5XN2Jl/USp5hiQ3naNDadge5eHeVj6bOmI93tOYd0iABrXCUToWeYumxS+jB7tzY9JSBsl05alv/VJ2Dawtaw/y0TZbF/bi5ZhjJYt7WJb6RHukhewiFLswSMTPi2DdWjIwel7PBeQTaaIOEmx3rLO8bgRkY6wrZlySWWic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b=H4E0+XAk; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=realtek.com header.i=@realtek.com header.b="H4E0+XAk" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AI4AS8w8108806, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1731903028; bh=ow1vGg4eO+2OEbxNFP6nOJmj1FB88Ng9OVoBewOdaRY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=H4E0+XAkkFu5/Skl/CXhtETYuUPBjwTEnZfAPjRxGvh2KRcldtILrVJrZOJvshvcJ U2T8LDB0ZgxtwGi7cmwEDnm64xpy6BG67C6Kntu63aIxLrmxIVIdwf+slo2uHQZ1+q 7uEnTc3xbt/uRnrORsdhNbv9Z4ADzatvpcRHyWScHVDhXHG6EP4VNNDz9HiXc20z1m KIKV+4sTmKDE3TWQoEdiT6kZm/CJ0ky3UKVvN+ekUl0qk2IKRkHqX/myri9qCCnIMo A6qmfgi+DvRL4besCHQd98RX4kdbp4DLzKkW0/7WvPIizc6z1uKp1OMe6q++8VnV3j e2ctgsPM/mSTg== Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/3.06/5.92) with ESMTPS id 4AI4AS8w8108806 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2024 12:10:28 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 18 Nov 2024 12:10:28 +0800 Received: from RTDOMAIN (172.21.210.74) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 18 Nov 2024 12:10:28 +0800 From: Justin Lai To: CC: , , , , , , , , , Justin Lai Subject: [PATCH net v3 4/4] rtase: Add defines for hardware version id Date: Mon, 18 Nov 2024 12:08:28 +0800 Message-ID: <20241118040828.454861-5-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241118040828.454861-1-justinlai0215@realtek.com> References: <20241118040828.454861-1-justinlai0215@realtek.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-Patchwork-Delegate: kuba@kernel.org Add defines for hardware version id. Signed-off-by: Justin Lai --- drivers/net/ethernet/realtek/rtase/rtase.h | 5 ++++- drivers/net/ethernet/realtek/rtase/rtase_main.c | 12 ++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/realtek/rtase/rtase.h b/drivers/net/ethernet/realtek/rtase/rtase.h index 547c71937b01..4a4434869b10 100644 --- a/drivers/net/ethernet/realtek/rtase/rtase.h +++ b/drivers/net/ethernet/realtek/rtase/rtase.h @@ -9,7 +9,10 @@ #ifndef RTASE_H #define RTASE_H -#define RTASE_HW_VER_MASK 0x7C800000 +#define RTASE_HW_VER_MASK 0x7C800000 +#define RTASE_HW_VER_906X_7XA 0x00800000 +#define RTASE_HW_VER_906X_7XC 0x04000000 +#define RTASE_HW_VER_907XD_V1 0x04800000 #define RTASE_RX_DMA_BURST_256 4 #define RTASE_TX_DMA_BURST_UNLIMITED 7 diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c index 26331a2b7b2d..1bfe5ef40c52 100644 --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c @@ -1720,11 +1720,11 @@ static int rtase_get_settings(struct net_device *dev, supported); switch (tp->hw_ver) { - case 0x00800000: - case 0x04000000: + case RTASE_HW_VER_906X_7XA: + case RTASE_HW_VER_906X_7XC: cmd->base.speed = SPEED_5000; break; - case 0x04800000: + case RTASE_HW_VER_907XD_V1: cmd->base.speed = SPEED_10000; break; } @@ -1990,9 +1990,9 @@ static int rtase_check_mac_version_valid(struct rtase_private *tp) tp->hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK; switch (tp->hw_ver) { - case 0x00800000: - case 0x04000000: - case 0x04800000: + case RTASE_HW_VER_906X_7XA: + case RTASE_HW_VER_906X_7XC: + case RTASE_HW_VER_907XD_V1: ret = 0; break; }