From nobody Tue Oct 7 16:36:38 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 DD8C11D5CD1; Tue, 8 Jul 2025 16:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751990939; cv=none; b=ncd8lUIhIirRM2Y576p73pxk8154TnnxeEIJX5wOPRHK1hNHtQZxpj+OBhJGHGJRsk/lQluXLkoUBDJjgBtbUMr+E8MSHApZJWBd8/d776Flb2usqy1AQZ6Iv5g9hDtwK7VNSw3sO8/vXl3lwHgjiTLzQqDrTxGTF+XBhdTP9Ns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751990939; c=relaxed/simple; bh=nrgLWfVt4wM5C0iLRI369JH4fwXe2URvBmZYKaQKPFA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=YBkdh8/FyiYkXvnFIDv2Mh/WHCFHbDoExuW659G3pKtSXmrmr+1IeWW9hL1CZanqP8GL0hdmYvJU/XYk1SA4xQD8kCTUsHplEtce54W2EDMr0wIiNLavOeyhEvSt9HFdG/ZKe0tV8J1/F1n6+QKSHwdQX1mKlRgayNwPqS4+GUE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=IdNfk+Y8; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="IdNfk+Y8" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 568AAXwQ029138; Tue, 8 Jul 2025 16:08:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Z5loTR2ktold+chD/k6krm4Esz9jXCWiEOA8i7K/4i4=; b=IdNfk+Y8s2svjHMc UtGdCYPlJkB9OgHA2l5J6o2ZkcimQG8KhTN8OZzSjrHXQrdw99vjNxk4YhAwbV+D yac0QdaIGfdvxdfbqPuHg4H4gI5MvspXT1MguXEps4oGr9+CJuYQNMbmk54fK5GU Fnw/yNK/gOKSnCkzLoOu0HvFGAagyQt0e7ClVTC6wemCQlENMXWU9Vc1Rhd2rNFu HDwGwjZ9GuSBoaMH9VwUbuREPHXSTAqil+5ZYcljV9QV1RHfKAflByhxI6MCaINh tlPBu+9wizlovFclIkBA6rw6XXHSe7BO1rHzBLOls4X8JtZqJp1D6ZFWSFKK1DwZ C//yCg== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47pu2b7r66-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Jul 2025 16:08:46 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 568G8jAL016684 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 8 Jul 2025 16:08:45 GMT Received: from nsssdc-sh01-lnx.ap.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Tue, 8 Jul 2025 09:08:42 -0700 From: Luo Jie Date: Wed, 9 Jul 2025 00:07:56 +0800 Subject: [PATCH net-next 1/3] net: phy: qcom: Add PHY counter support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250709-qcom_phy_counter-v1-1-93a54a029c46@quicinc.com> References: <20250709-qcom_phy_counter-v1-0-93a54a029c46@quicinc.com> In-Reply-To: <20250709-qcom_phy_counter-v1-0-93a54a029c46@quicinc.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , , Luo Jie X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751990919; l=4430; i=quic_luoj@quicinc.com; s=20250209; h=from:subject:message-id; bh=nrgLWfVt4wM5C0iLRI369JH4fwXe2URvBmZYKaQKPFA=; b=6CEh6k1fLgeU2fP/zBkszsMV/qQ3DJvfrLZBHQwbbHWc+Hw2/Qruk8d6LSMXUil1x2+CKHF4M xGWMk9A+SJpBi2AqKoEHlvZRD4rgJgRxe0UxvW4UxJvDZALW1FkXKxJ X-Developer-Key: i=quic_luoj@quicinc.com; a=ed25519; pk=pzwy8bU5tJZ5UKGTv28n+QOuktaWuriznGmriA9Qkfc= X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzA4MDEzNiBTYWx0ZWRfX0M//0lu4RoYH mdu11v+wPiDldWvxgyUyQMiUibf/TU6aeub7N50bwUup5y4LxV/EjR09mik4XrKZmY2voIsujht 2xaNIIRYzuPnYrYbZE1rs+sDyxoZ8sseT1lRGmWhiZuYZbW0QZbqqhVQ5liAl2brvHoehrWnDcp ExjYCMOWw+BZMBpjp4amLGWAlxYvApsYydE1BWRm2wBf1PBNmloV+bnpOVnDafCZEf43oX0j7Q5 Ass4eGgRL4BHgGXrKi3cSMxay3dvu7bKmG15XscL3sbMSuscj2uBv2H2YFholZRizwfMzHGxEgI hjJHdk1qhusqcHv2nPGh6UPZvxRgIFBeAwVxMjOASy1Gvrn9SfggcUrtcAJ/bF16Xf3qgXGK4SW FYM0wrsj82Tx+Ir5WIhmqbBZRKPzblV4CG7k8cdX+DCnyMnMllWUg45ryAO2YhJsyzW/m1dV X-Proofpoint-ORIG-GUID: gKGtL5XB25PbQ7qZfOZC1hEJBwr7O1u4 X-Proofpoint-GUID: gKGtL5XB25PbQ7qZfOZC1hEJBwr7O1u4 X-Authority-Analysis: v=2.4 cv=erTfzppX c=1 sm=1 tr=0 ts=686d428e cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=COk6AnOGAAAA:8 a=pGLkceISAAAA:8 a=qZhSqy8QcDR0uRVn7pwA:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-08_04,2025-07-07_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 impostorscore=0 spamscore=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507080136 Add PHY counter functionality to the shared library. The implementation is identical for the current QCA807X and QCA808X PHYs. Signed-off-by: Luo Jie --- drivers/net/phy/qcom/qcom-phy-lib.c | 82 +++++++++++++++++++++++++++++++++= ++++ drivers/net/phy/qcom/qcom.h | 16 ++++++++ 2 files changed, 98 insertions(+) diff --git a/drivers/net/phy/qcom/qcom-phy-lib.c b/drivers/net/phy/qcom/qco= m-phy-lib.c index d28815ef56bb..6447e590539b 100644 --- a/drivers/net/phy/qcom/qcom-phy-lib.c +++ b/drivers/net/phy/qcom/qcom-phy-lib.c @@ -14,6 +14,40 @@ MODULE_AUTHOR("Matus Ujhelyi"); MODULE_AUTHOR("Christian Marangi "); MODULE_LICENSE("GPL"); =20 +struct qcom_phy_hw_stat { + const char *string; + int devad; + u16 cnt_31_16_reg; + u16 cnt_15_0_reg; +}; + +static const struct qcom_phy_hw_stat qcom_phy_hw_stats[] =3D { + { + .string =3D "phy_rx_good_frame", + .devad =3D MDIO_MMD_AN, + .cnt_31_16_reg =3D QCA808X_MMD7_CNT_RX_GOOD_CRC_31_16, + .cnt_15_0_reg =3D QCA808X_MMD7_CNT_RX_GOOD_CRC_15_0, + }, + { + .string =3D "phy_rx_bad_frame", + .devad =3D MDIO_MMD_AN, + .cnt_31_16_reg =3D 0xffff, + .cnt_15_0_reg =3D QCA808X_MMD7_CNT_RX_BAD_CRC, + }, + { + .string =3D "phy_tx_good_frame", + .devad =3D MDIO_MMD_AN, + .cnt_31_16_reg =3D QCA808X_MMD7_CNT_TX_GOOD_CRC_31_16, + .cnt_15_0_reg =3D QCA808X_MMD7_CNT_TX_GOOD_CRC_15_0, + }, + { + .string =3D "phy_tx_bad_frame", + .devad =3D MDIO_MMD_AN, + .cnt_31_16_reg =3D 0xffff, + .cnt_15_0_reg =3D QCA808X_MMD7_CNT_TX_BAD_CRC, + }, +}; + int at803x_debug_reg_read(struct phy_device *phydev, u16 reg) { int ret; @@ -674,3 +708,51 @@ int qca808x_led_reg_blink_set(struct phy_device *phyde= v, u16 reg, return 0; } EXPORT_SYMBOL_GPL(qca808x_led_reg_blink_set); + +/* Enable CRC checking for both received and transmitted frames to support + * accurate counter recording. + */ +int qcom_phy_counter_crc_check_en(struct phy_device *phydev) +{ + return phy_set_bits_mmd(phydev, MDIO_MMD_AN, QCA808X_MMD7_CNT_CTRL, + QCA808X_MMD7_CNT_CTRL_CRC_CHECK_EN); +} +EXPORT_SYMBOL_GPL(qcom_phy_counter_crc_check_en); + +int qcom_phy_get_sset_count(struct phy_device *phydev) +{ + return ARRAY_SIZE(qcom_phy_hw_stats); +} +EXPORT_SYMBOL_GPL(qcom_phy_get_sset_count); + +void qcom_phy_get_strings(struct phy_device *phydev, u8 *data) +{ + unsigned int i; + + for (i =3D 0; i < ARRAY_SIZE(qcom_phy_hw_stats); i++) + ethtool_puts(&data, qcom_phy_hw_stats[i].string); +} +EXPORT_SYMBOL_GPL(qcom_phy_get_strings); + +void qcom_phy_get_stats(struct phy_device *phydev, struct ethtool_stats *s= tats, + u64 *data) +{ + struct qcom_phy_hw_stat stat; + unsigned int i; + int ret, cnt; + + for (i =3D 0; i < ARRAY_SIZE(qcom_phy_hw_stats); i++) { + stat =3D qcom_phy_hw_stats[i]; + data[i] =3D U64_MAX; + + ret =3D phy_read_mmd(phydev, stat.devad, stat.cnt_15_0_reg); + if (ret >=3D 0) { + cnt =3D ret; + + ret =3D phy_read_mmd(phydev, stat.devad, stat.cnt_31_16_reg); + if (ret >=3D 0) + data[i] =3D cnt | ret << 16; + } + } +} +EXPORT_SYMBOL_GPL(qcom_phy_get_stats); diff --git a/drivers/net/phy/qcom/qcom.h b/drivers/net/phy/qcom/qcom.h index 4bb541728846..ee2eb11d8d7e 100644 --- a/drivers/net/phy/qcom/qcom.h +++ b/drivers/net/phy/qcom/qcom.h @@ -192,6 +192,17 @@ #define AT803X_MIN_DOWNSHIFT 2 #define AT803X_MAX_DOWNSHIFT 9 =20 +#define QCA808X_MMD7_CNT_CTRL 0x8029 +#define QCA808X_MMD7_CNT_CTRL_READ_CLEAR_EN BIT(1) +#define QCA808X_MMD7_CNT_CTRL_CRC_CHECK_EN BIT(0) + +#define QCA808X_MMD7_CNT_RX_GOOD_CRC_31_16 0x802a +#define QCA808X_MMD7_CNT_RX_GOOD_CRC_15_0 0x802b +#define QCA808X_MMD7_CNT_RX_BAD_CRC 0x802c +#define QCA808X_MMD7_CNT_TX_GOOD_CRC_31_16 0x802d +#define QCA808X_MMD7_CNT_TX_GOOD_CRC_15_0 0x802e +#define QCA808X_MMD7_CNT_TX_BAD_CRC 0x802f + enum stat_access_type { PHY, MMD @@ -241,3 +252,8 @@ int qca808x_led_reg_brightness_set(struct phy_device *p= hydev, int qca808x_led_reg_blink_set(struct phy_device *phydev, u16 reg, unsigned long *delay_on, unsigned long *delay_off); +int qcom_phy_counter_crc_check_en(struct phy_device *phydev); +int qcom_phy_get_sset_count(struct phy_device *phydev); +void qcom_phy_get_strings(struct phy_device *phydev, u8 *data); +void qcom_phy_get_stats(struct phy_device *phydev, struct ethtool_stats *s= tats, + u64 *data); --=20 2.34.1 From nobody Tue Oct 7 16:36:38 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 64DDB22FDE8; Tue, 8 Jul 2025 16:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751990941; cv=none; b=U6jAMZC+M3SmjRZ4zvuG8lNz3eU74gyjBTEOxvthyqbxoHxFxvuA2FnNruOBH/YpwC/0EqA8pYS00GiW7z1Z7SuVgzoFbIVajyf4s6yAbeHkCdXjKkxckQuJ5R1piGBNcDpyW/wbLFKG/+So8nLnOfrXvUBktkpkDGGlhyyrRLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751990941; c=relaxed/simple; bh=E1XNJwW3BrTwevuvMGtePENPxfdIEg4WnI7LQeUBvm4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=tvW5TaEyN85SjgPVw8dctcuPTjls4K2IuWtIpKvk0T67f2EP8aMJ/N0VXwJqpACy31FR977hgLE0z7gHVDho7Bv7SKwtZx3NGFZKhQz8kV5gzBNH1heM85sE4rYvrVDv9f63xuf5SRd84P9U/gNfVytUnZx0PNbLkvQrxFZT3iA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=lZuDGWr7; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="lZuDGWr7" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 568EbfuO006230; Tue, 8 Jul 2025 16:08:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= DC1D6igSqBK1ID/1bd8ZrzQBsN/iFbBWMyoa4ABgCLc=; b=lZuDGWr731X/3msk Y7Fp9WilTMto/9T+kDQPeA/ZG4ya/nUsG7GTvrW5QPkHjpMCitFTO2rzjwdsWThb kbZ56sW9tXCC4rbVZG6g7NBzs1NZP+AljjzYDcl4Ie+nESNefXNHideKX5K7el2Y Ffxel2I5kXa3mUn0kHFoU+hLy5LJKrbv31AI8WK2umw73XXmg8k4idsSL19y7xWC 6Pb4MEC+HbZlx9j9us417jWgh5FzvzQET4gZg4peOxvTvcnYOxVp3PZZQEMFxDjN 942g+D4JL8LZTNIpJDWzn/hU7KinYMaDHZOB9IUaKTg0+J9xkM0cYj1WtvxG7yyV WhX2jg== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47pu2b7r71-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Jul 2025 16:08:48 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 568G8lUF010182 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 8 Jul 2025 16:08:47 GMT Received: from nsssdc-sh01-lnx.ap.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Tue, 8 Jul 2025 09:08:45 -0700 From: Luo Jie Date: Wed, 9 Jul 2025 00:07:57 +0800 Subject: [PATCH net-next 2/3] net: phy: qcom: qca808x: Support PHY counter Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250709-qcom_phy_counter-v1-2-93a54a029c46@quicinc.com> References: <20250709-qcom_phy_counter-v1-0-93a54a029c46@quicinc.com> In-Reply-To: <20250709-qcom_phy_counter-v1-0-93a54a029c46@quicinc.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , , Luo Jie X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751990919; l=1285; i=quic_luoj@quicinc.com; s=20250209; h=from:subject:message-id; bh=E1XNJwW3BrTwevuvMGtePENPxfdIEg4WnI7LQeUBvm4=; b=wvOMJML3Fr+Tmx5TZbM8XRMZ+9eBeLFqRNhZa29hgCKPH0FGhWjeffTsZzEoxTLmYrY3Hm79j NqZD4uKL9yTAKI2RjaxpiPY4v3ND1cu5LeGAe5WJYP/j32ej3+BCPiA X-Developer-Key: i=quic_luoj@quicinc.com; a=ed25519; pk=pzwy8bU5tJZ5UKGTv28n+QOuktaWuriznGmriA9Qkfc= X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzA4MDEzNiBTYWx0ZWRfX4dxhcu+4lGwW 5jfQV8i6eUBiEczA8JMoOlwtkC6kv2x1mRgwAPZ7NzUCQUYJ5AaVXBJWQHRhhxBn/+LLwrvIYDp +cJyjFjm+Old3Fr5D2K0H88hlHfVajrfujd6lJxZ6DSLxmiGAFWPbjEfn3R988UV9BRtV1fDPaS j9kQx5Fd1FPmk5df93MSOl6U+vpFYlSApXFTaKhfzdmCSu2uYJTR0qBdOSqVtj6lRmq/z0kFFsC ckYwSFU+lSj/XUkQaXn8SD7mD3S9k05JAJD5yo/4AfMFo/i9alDiBCw0QLwyrhMcHBcs28bwYq4 D0MUEwTnUWpKz3W5uJlHc5owtbrr5+VDfxDrmTEKsxwJBGcdhMm3U6KGRkjvntpEL3XN8Re42Jj n+ilFe5rvHZKX3uCnqyzFXtP3qEsLXVWox5DVMSoG+qOYgLHzMmhW54SAuOAsPnK8gLd/jsJ X-Proofpoint-ORIG-GUID: czHBwM4UwTvMFz6NRKw_YCk7OHY1_kQr X-Proofpoint-GUID: czHBwM4UwTvMFz6NRKw_YCk7OHY1_kQr X-Authority-Analysis: v=2.4 cv=erTfzppX c=1 sm=1 tr=0 ts=686d4290 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=COk6AnOGAAAA:8 a=VwXRJrvAj_jGHEK00D4A:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-08_04,2025-07-07_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 impostorscore=0 spamscore=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507080136 Enable CRC checking for received and transmitted frames within the config_init() function to support counter recording, and incorporate PHY counter operations. Signed-off-by: Luo Jie --- drivers/net/phy/qcom/qca808x.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/phy/qcom/qca808x.c b/drivers/net/phy/qcom/qca808x.c index 71498c518f0f..06967ce54036 100644 --- a/drivers/net/phy/qcom/qca808x.c +++ b/drivers/net/phy/qcom/qca808x.c @@ -243,6 +243,10 @@ static int qca808x_config_init(struct phy_device *phyd= ev) =20 qca808x_fill_possible_interfaces(phydev); =20 + ret =3D qcom_phy_counter_crc_check_en(phydev); + if (ret) + return ret; + /* Configure adc threshold as 100mv for the link 10M */ return at803x_debug_reg_mask(phydev, QCA808X_PHY_DEBUG_ADC_THRESHOLD, QCA808X_ADC_THRESHOLD_MASK, @@ -651,6 +655,9 @@ static struct phy_driver qca808x_driver[] =3D { .led_hw_control_set =3D qca808x_led_hw_control_set, .led_hw_control_get =3D qca808x_led_hw_control_get, .led_polarity_set =3D qca808x_led_polarity_set, + .get_sset_count =3D qcom_phy_get_sset_count, + .get_strings =3D qcom_phy_get_strings, + .get_stats =3D qcom_phy_get_stats, }, }; =20 module_phy_driver(qca808x_driver); --=20 2.34.1 From nobody Tue Oct 7 16:36:38 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 8D9DA2E5B3A; Tue, 8 Jul 2025 16:09:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751990944; cv=none; b=t0+X0H2ZJoT56QyzCVRyNMDXBeeYc8bvkxOCnQ5mcBGvUlto/aIXskEGrEzoPTfQbzXqK3OSfgV6bgKk3/WEvdrWgyBk59ROCI/fS580LfRmNfaV7KEzShec2yte1a/n1C1tZXoNBYWll3VLcQ0PCn1lmeuhuAbftk+q2Cza1Xk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751990944; c=relaxed/simple; bh=ZyaCKaQXI0uLhbZ/KKtzrJ/do4HoeAgRPraqtt4s6QY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ikC/iniynOaV220ACpuuej+uK6tFH1/+LixXMdLVS4aTBHjrHcb5AvfcaVciLJ+9yHjnxOeKqSc5JmSAD8W8s78dRgRVflyUNvBhRUQOlG7oMDQ8SvysbTRpSxH4HceURCvzIXnToLatlizRg8auGYKQ8G0O07PxrfgIPArq9pI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=C7Hq8Ffm; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="C7Hq8Ffm" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 568AAFBU008271; Tue, 8 Jul 2025 16:08:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 7ZVj0+/oodglGDIZOrIveVBem+sp+h3oPXacN8rq34Q=; b=C7Hq8FfmrclS7ZHC u3O/2Ye5XWMpAd/2yRdtVinFs4iH97c39ecKaD/0wXgizuDrZxSbSle1GtsioYE3 IEvPzdYFYUKzdjsf9XbC96jaRfSS0v2DT1b4qyYKAeiyKSvYcSZc55Losq1S4vim PujDzbAHf2X0wd8Q5YWmlIr4R2EQoUw9IeFZ+4EQlHo8hed1VcGZDHLZ2doZ0mCR Iio7kBrssNAyd1MsFPFyBIBwxgLlGCwFLi9oZTyRzNbbvP3bzTSFly2LEqGE9S3d Ttt7R4ISb3Lv937cMcOsYTkK0OSZYgx6s/BqHj6ptknkXO8ytvvESN+LIl3zapGp 7BvcYA== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47pucmywh9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Jul 2025 16:08:51 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 568G8o4J016775 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 8 Jul 2025 16:08:50 GMT Received: from nsssdc-sh01-lnx.ap.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Tue, 8 Jul 2025 09:08:47 -0700 From: Luo Jie Date: Wed, 9 Jul 2025 00:07:58 +0800 Subject: [PATCH net-next 3/3] net: phy: qcom: qca807x: Support PHY counter Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250709-qcom_phy_counter-v1-3-93a54a029c46@quicinc.com> References: <20250709-qcom_phy_counter-v1-0-93a54a029c46@quicinc.com> In-Reply-To: <20250709-qcom_phy_counter-v1-0-93a54a029c46@quicinc.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , , Luo Jie X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751990919; l=1670; i=quic_luoj@quicinc.com; s=20250209; h=from:subject:message-id; bh=ZyaCKaQXI0uLhbZ/KKtzrJ/do4HoeAgRPraqtt4s6QY=; b=t3w9y1dCUgg5eeC4/2crzPz/R52eDMP16ISxFSl9SVOC4O0prBFP3ouMTYkCmU7yvyM0E494P G/6QgEF5eQHBo9Vd1wc0CuZROANzIjo10NZ+nRZjSZ7krAqAgamkyJC X-Developer-Key: i=quic_luoj@quicinc.com; a=ed25519; pk=pzwy8bU5tJZ5UKGTv28n+QOuktaWuriznGmriA9Qkfc= X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=GdQXnRXL c=1 sm=1 tr=0 ts=686d4293 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=COk6AnOGAAAA:8 a=gK5dAuqeCtZj7zEIbdkA:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: LAOH6BJQrgGdi_sUYhw2ABYeB5I16xrz X-Proofpoint-ORIG-GUID: LAOH6BJQrgGdi_sUYhw2ABYeB5I16xrz X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzA4MDEzNiBTYWx0ZWRfX8MbFRl3w7aIB h/YL90g3EipBJK3qzYf3fAv0d6V0T00rcyygYmAMhKpHZ+ztdhL6cb88aBdgO0lm5WUZPVcrWW1 UQGPJiuMyRU16bYfp/O8sZz51CwRo9o2YAhoTwgGplm5cJSjJk6ViQ07LvAUcyEOb2e4vv3aBMV GOetfBft1+0jcOKBUbdJXTazAxkjGMVsfspiaHvSxAIctHnarx54ZkXkURunXvj/1iflzVsOkQn c5OTOAAO3zSuDvzL5Atm3MfXK2c5rKxX3NSd/zL1QFTomdFuoqKEOwpS/TEibwa7M0/GWRvkbWx QsJFmTBEndhOivnMmFuTuw6VFW5hN8Y+0LlNQTzya6zXHsCGbbelGpKhI8iVPNJQepWUl0/O+kY hOA1lfrg2HJ1P/WCvfP16bSlrrkhLLSgOR9WK2iSbUhH17nAi5fInKXuBVIrVXCEw45ou1Px X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-08_04,2025-07-07_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 clxscore=1015 spamscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 malwarescore=0 mlxscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507080136 Within the QCA807X PHY operation's config_init() function, enable CRC checking for received and transmitted frames to support counter recording, and add PHY counter operations Signed-off-by: Luo Jie --- drivers/net/phy/qcom/qca807x.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/phy/qcom/qca807x.c b/drivers/net/phy/qcom/qca807x.c index 6d10ef7e9a8a..51101d009dce 100644 --- a/drivers/net/phy/qcom/qca807x.c +++ b/drivers/net/phy/qcom/qca807x.c @@ -768,6 +768,10 @@ static int qca807x_config_init(struct phy_device *phyd= ev) return ret; } =20 + ret =3D qcom_phy_counter_crc_check_en(phydev); + if (ret) + return ret; + control_dac =3D phy_read_mmd(phydev, MDIO_MMD_AN, QCA807X_MMD7_1000BASE_T_POWER_SAVE_PER_CABLE_LENGTH); control_dac &=3D ~QCA807X_CONTROL_DAC_MASK; @@ -800,6 +804,9 @@ static struct phy_driver qca807x_drivers[] =3D { .suspend =3D genphy_suspend, .cable_test_start =3D qca807x_cable_test_start, .cable_test_get_status =3D qca808x_cable_test_get_status, + .get_sset_count =3D qcom_phy_get_sset_count, + .get_strings =3D qcom_phy_get_strings, + .get_stats =3D qcom_phy_get_stats, }, { PHY_ID_MATCH_EXACT(PHY_ID_QCA8075), @@ -823,6 +830,9 @@ static struct phy_driver qca807x_drivers[] =3D { .led_hw_is_supported =3D qca807x_led_hw_is_supported, .led_hw_control_set =3D qca807x_led_hw_control_set, .led_hw_control_get =3D qca807x_led_hw_control_get, + .get_sset_count =3D qcom_phy_get_sset_count, + .get_strings =3D qcom_phy_get_strings, + .get_stats =3D qcom_phy_get_stats, }, }; module_phy_driver(qca807x_drivers); --=20 2.34.1