From patchwork Tue Nov 19 09:57:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Lai X-Patchwork-Id: 13879550 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 6B5A31B6D16; Tue, 19 Nov 2024 09:57:44 +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=1732010267; cv=none; b=dhl0ChYPKnW5/g/bsibYj7FVHpxVFncdTMyTEZJIR0le0vZCoMvL6bpi8C8t9XFYFaLHr16zt1ogdzfnqasXtE79o5KK6UfIIFoE2+1EF06dmf5G4v0j9Db8UdkjSSa1WyhWX7dLc01pmkqXoNIl3MxhLmKDQbEF63yBd+MltAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732010267; c=relaxed/simple; bh=5s86hWDe+U82KtdF5WrQaPbjjkspLRQDfBJ+/bNeLD4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jofJrTcaSO61xFXgZMvWVwrthsbLP7a49V13erLvNGwPNF99jTrlqEsUzJze3XzqXv9T4teSeGVlH/mKmjrvbiwWqgEkWahuDGReQY8S34k71Yy7V80nKyC9iURXwfN0g//PYttpoT34h4nqMircEg1BKgA9T/r/uILPQNEnx58= 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=qWOjv1wJ; 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="qWOjv1wJ" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AJ9vQAo92265168, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1732010247; bh=5s86hWDe+U82KtdF5WrQaPbjjkspLRQDfBJ+/bNeLD4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=qWOjv1wJRMoO4dkHAoi0Id+FaVGTqIzbeNH0UIG7sDMxOu8HPNGzvrqz3v+r+zSau 2a+D0q48WC86WdX9LIFJSE1KdbVEE/Hle7R/UC6IC0PyWEL+uol32UsI/PiCW6GZkG DsBLR3rbfY90UL6MZ7q2jKKXTaPdTRMU837MbkGdrIB0QQtXEMnXWE+8Pv7CwPFa+v L/UxvCwVL2dHDKnPHMHRQjQob2l7oePk0QtEuffhdNI2WNoYa+af0UxHPBN5ecT5We +Sxl+zcS7N38o8hpTgQK8OpPmbkXohlzDDmX+rgUXmIx5OtUUv8jJpwCgWKsRzoM19 MTKLTEpXx2l3w== 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 4AJ9vQAo92265168 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Nov 2024 17:57:26 +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; Tue, 19 Nov 2024 17:57: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; Tue, 19 Nov 2024 17:57:26 +0800 From: Justin Lai To: CC: , , , , , , , , , Justin Lai Subject: [PATCH net v4 1/4] rtase: Refactor the rtase_check_mac_version_valid() function Date: Tue, 19 Nov 2024 17:57:03 +0800 Message-ID: <20241119095706.480752-2-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241119095706.480752-1-justinlai0215@realtek.com> References: <20241119095706.480752-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 Different hardware requires different configurations, and this distinction was not made previously. Additionally, the error message was not clear enough. Therefore, in this patch, the following changes have been made to address these issues: 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 Tue Nov 19 09:57:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Lai X-Patchwork-Id: 13879551 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 8386A1993B4; Tue, 19 Nov 2024 09:58:37 +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=1732010320; cv=none; b=cR5g+ugmZcDZURE5zCtFH/szKk/UzYbt258sC/pOLvQbUFC0ejayf6q7TREa9B+y+ZGJ+Yc1ogpNMegHiHszcC8ElLxH/LLwLpblyVMKbSGlSHZ7j4jDRnSpdlRWbntz7+NZVvUNQQKeu9KBShW1p2kH4SIBDEguIc7xj83pyAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732010320; c=relaxed/simple; bh=h5HN7yMTNYeaiDPiA+x/V/XfsemP7gQrSc9C0y40TBM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KdYXSz8CpHu+8KfWbEkRRYy4grd4I/SvKtPDzLm36ySox9rRsl1qWrXgaTtvX2lGxOf3nvKaeIjfU006jofZmHUHzA5jOf/dddBUlioMYuay5S6K0o3IMEG2ApX0O5PaUtbhMe8EloAxY6RCmNFMTTa85N3C3gv0T1JBMo7ZaLk= 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=ZxgRsGXh; 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="ZxgRsGXh" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AJ9wJ7412265682, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1732010300; bh=h5HN7yMTNYeaiDPiA+x/V/XfsemP7gQrSc9C0y40TBM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=ZxgRsGXhEdivw+mCVAx7r7CXY2m/hCT8TvKHikP2FU0YuHfRUkMM7rwR0EGHxNfZx 32tLeQUjSwL7koeqUaZLS4heROQECjdNvRezoMgIGhOdZyjY1fQ71nKWgSAJQlO3W2 SI3E6l/8mMS5wTPB+Prl6OnCsI/EmoiNlVuqOwlZAZ8gNWJ0m4ETRMJvf/ae+E8v2y 6ujoQfa7WzymaoezwSIG2qsum29BfPG++5q4dbihF0nRgSWe9cP3a1pctJnJoz0qmx RFDBhHOGRRBFXRVTSbvReND7J2dZjMTqBoZD2fivvxiz/SbVpLM4qOtwayJdU/9qku C2fnGle9vbIHA== 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 4AJ9wJ7412265682 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Nov 2024 17:58:20 +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; Tue, 19 Nov 2024 17:58:20 +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; Tue, 19 Nov 2024 17:58:19 +0800 From: Justin Lai To: CC: , , , , , , , , , Justin Lai Subject: [PATCH net v4 2/4] rtase: Correct the speed for RTL907XD-V1 Date: Tue, 19 Nov 2024 17:57:04 +0800 Message-ID: <20241119095706.480752-3-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241119095706.480752-1-justinlai0215@realtek.com> References: <20241119095706.480752-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 Previously, the reported speed was uniformly set to SPEED_5000, but the RTL907XD-V1 actually operates at a speed of SPEED_10000. Therefore, this patch makes the necessary correction. 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 Tue Nov 19 09:57:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Lai X-Patchwork-Id: 13879554 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 AFFE71993B4; Tue, 19 Nov 2024 09:59:08 +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=1732010350; cv=none; b=I1mzRkbu5U4UaeK2+SztLEiX2bvPbk6Gqaa68nj5WDPvMXlolqrhtByAiLel2yavwjDWd3hBXBlaZg6/hVgnzjpaKWqxqr3ujA5S3sxZArF1/JcmwHo8gcMdFPsc8TYa9taZZk4uipHqoXV7OXnBp4ROsIhksCFx0XbLyRtAGaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732010350; c=relaxed/simple; bh=8bdC6Bi01ufgEL6GHDaSWYWsoDtMSp5Xfp0U+4Cg+Xw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UKoa3JHASHpD9G9jlcJPsqkC/qIpq92RSXNob8/rOomOLtTsizenJRxl0rhbXyM7bukluszkmdIJb0SKGN/Wl7Nm8Cr6o4jFVv+k7EIS+RjCUY2QGXJHiPMp3T35IrPukcJsqbo7HS2WzeK0eY/OPqE/GUy2YRKHyIoRCFQvyDE= 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=Kh6Lkyhj; 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="Kh6Lkyhj" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AJ9wqq872265740, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1732010332; bh=8bdC6Bi01ufgEL6GHDaSWYWsoDtMSp5Xfp0U+4Cg+Xw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=Kh6Lkyhj60i9QYnduMFyTG3ECwLKn4LD69iDqxbNr0YMKPBeelkZPmavI5U0AilWS xDMlf3N2l9DV8oG7wBYqfCaToB14nRybyDrVeNRQ9W1qHQRSLyFVEzSyn+omDluCH8 RWI29roDbYfBBOx9a5dyzqneP0wRnj0UjTepTZPv+IFMTOvMeBhG+q0xfPtOn+Ay7M fBkIaSsxwD2dsB5VTfmQ8gWE4fwOsbSEgS37UwaPDOb5R/74B/vhVXpWvLioC9c1TR Aw98aqiTaHb7Bh63HcI8G6xb8+eFEiI2LAKyTUfWONcjZeMTg/9lQCbch5sMhNb4vh Z21V3gK1MXQfA== 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 4AJ9wqq872265740 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Nov 2024 17:58:52 +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; Tue, 19 Nov 2024 17:58:53 +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; Tue, 19 Nov 2024 17:58:52 +0800 From: Justin Lai To: CC: , , , , , , , , , Justin Lai Subject: [PATCH net v4 3/4] rtase: Corrects error handling of the rtase_check_mac_version_valid() Date: Tue, 19 Nov 2024 17:57:05 +0800 Message-ID: <20241119095706.480752-4-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241119095706.480752-1-justinlai0215@realtek.com> References: <20241119095706.480752-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 Previously, when the hardware version ID was determined to be invalid, only an error message was printed without any further handling. Therefore, this patch makes the necessary corrections to address this. 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 Tue Nov 19 09:57:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Lai X-Patchwork-Id: 13879555 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 75CFE156887; Tue, 19 Nov 2024 09:59:34 +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=1732010377; cv=none; b=YhNpXcny6zrWmGbS0HUk/XJLCY6fLAQb1WTDbRsR+aglowiEnJYU9wDEF8Hd3x6fuiUIwMnxZ7dCVJScVphz465DLxdVWdgLcqU1COXKoKrBFplDfatNdde6TftFED+rryT+a1dRomcNG9lLYtH+TbGrnjr35yioVAv6t+Btxfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732010377; c=relaxed/simple; bh=ow1vGg4eO+2OEbxNFP6nOJmj1FB88Ng9OVoBewOdaRY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UA5bepcHGDPF591MCnZPULyCC+K7M1BCGtHF4aIA7Kd51ctn59yhoqDSQNpJFcXCPHp09oqJb4gn33PatUCOPTPYmK08JJkCgrva4GkXEm5R8gO9DsLZml9ZeUqVTI62Izpy3lBLWZHDJD85qpYJrpv8qXOMz0WQcYw5dhKyon4= 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=eUkf8HW0; 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="eUkf8HW0" X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AJ9xI4K12265836, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realtek.com; s=dkim; t=1732010358; bh=ow1vGg4eO+2OEbxNFP6nOJmj1FB88Ng9OVoBewOdaRY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=eUkf8HW0nHcv9oNB59S1G2BbDKLPoLrAzftDoxDL6sUBEqLmEqKBUnbQrdFG3eC7V NA8tSWXpmwEIVN1cK77scrQaVW4JSZyE5XaFDbNPelrcAoJ+XtYvz1AYtZ/uuJg2A4 rQ+4998iYA6FyFbQoxOBwDtt1tubhzj0EFetezPjZ6YAPq34ylKZFjIIQj5lrWsxOP AWODr6AL+0FClChd6Vp3bc+9PPixj2A5OzlNQZw0nVYj0BKUajNJZPDBfyDsV4/+YE PdUO+scllkXQW0Bh8yiiIiy6n2Meij2K7wqQda82nK3aMJps+TFBteD8+WEE1487kA t4HPEIpjDsIZg== 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 4AJ9xI4K12265836 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Nov 2024 17:59:18 +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; Tue, 19 Nov 2024 17:59:19 +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; Tue, 19 Nov 2024 17:59:18 +0800 From: Justin Lai To: CC: , , , , , , , , , Justin Lai Subject: [PATCH net v4 4/4] rtase: Add defines for hardware version id Date: Tue, 19 Nov 2024 17:57:06 +0800 Message-ID: <20241119095706.480752-5-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241119095706.480752-1-justinlai0215@realtek.com> References: <20241119095706.480752-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 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; }