Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2618057rdb; Wed, 15 Nov 2023 06:09:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDsBwsVTk0yn47hboBN9OEGS+yyOLJcJ7hmJqdbpJm21Z+NPtmnmsRN0qfifsBiaZGXItL X-Received: by 2002:a05:6808:130b:b0:3b2:e95d:8b2 with SMTP id y11-20020a056808130b00b003b2e95d08b2mr17797882oiv.12.1700057363473; Wed, 15 Nov 2023 06:09:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700057363; cv=none; d=google.com; s=arc-20160816; b=NlZgN+0+LNlpnVf9UTgwuki8m8nOLyJY0XVhNth0SLKsLJy1DK5KqoIdL8E9FrKm5o WnHgv+iQhqbnkJUHKYrFECosA7f/g9SvjnqxjcovsPj6XBab2PlfN2LMzR1nx2EoFeLa AYfI1FNxg8aFesgj6xZZyto3+TmnT40zurdAxM30W9b7gt1EwvrJ1n7QZbJSy5wSy2ER Xrr1q5+2BPTovN4cSmHM2JYdtujdvFoxWvv7ZMlnupUYxRG5lr6myOoM08rSxUBtgIK+ 6R2H2MXpwmiIAaItF/7OG7k9sHasnUom1zx6PIZh2KZzVhprmn+NzBzqtWZVAQdYs8QQ +EsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CLpJvxEOJWPI/XnaXTlnX9ueptBWpRe+/Nh9WcXUebo=; fh=CzJZH1Mq0+1gFor3WuKjwLRRL9rPD0zvQs0go/fRLgA=; b=i8fh+Hirm5eDXauu89OEagPPFRSI+tA/OTDfQd1SH/QnmlFpAnoCD77Z5VJY+2OG0B WY+KmYluf6zx+pu9VFFUAgh44U+Bxykv510TX6Oh/KC7mUTUjdSm8w0yMRnLYSIMFFNx H8aRYE3w6AtCA9d/v4KKz0UkBJqvzOSb/G4OtbIEEaueOYiEF0VYpeDtwDiyi4UWiT9a Lxak3IwHFgw0+iWverW3lk7DxYIIY5t0Yc2rUx9MkDMuxQL0maW8E2owYPuAlZ0UX0FW HLkd09cphUYcLQYYI9aI1Yh0u/PfX2NBeuAKdYs+M0hz8uuRB/FIrcj72UWb9pmbF4XM 35yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=pzgMqZRH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a17-20020a056808121100b003ae5ee7fa17si3873196oil.61.2023.11.15.06.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 06:09:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=pzgMqZRH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9E42681A3355; Wed, 15 Nov 2023 06:09:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344127AbjKOOJM (ORCPT + 99 others); Wed, 15 Nov 2023 09:09:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344133AbjKOOJI (ORCPT ); Wed, 15 Nov 2023 09:09:08 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A00F0E1; Wed, 15 Nov 2023 06:09:04 -0800 (PST) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AFCl9sr010182; Wed, 15 Nov 2023 14:08:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=CLpJvxEOJWPI/XnaXTlnX9ueptBWpRe+/Nh9WcXUebo=; b=pzgMqZRHdTH4zesatPOn1DDfwgH9HPRT0f1Xuvcwx1CqhIKQ0cHk7CVgRsBJM4xsF/z6 g9InLKJtUgYDX28Hg3QHsOG1y8XIy9xQ20Q8IK2M92WlvnYGnjFKQbuGQiq3AU5DDXa+ RX2l81E/DbzpuGAuIWJjQBYSVdTD8BC0hBv/Q+q5pMAo24oR1kg1X38WFAZwP9BTzvI4 vrQ6cODMwhv0Zx2c9Pwdltny7PqgWQPhRblKHZB/5u6DVer1hUFcX90733DNAiEeYcv9 iUe8qqmMO4eN1J00yPN7IJbz9AMWr3v4XxSPif6lTebl3c7LjpoT+mBJySDVOYYEwFgL CA== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ucmbahfhk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 14:08:54 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AFE8ruu006542 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 14:08:53 GMT Received: from akronite-sh-dev02.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Wed, 15 Nov 2023 06:08:50 -0800 From: Luo Jie To: , , , , , , , , , , CC: , , , Subject: [PATCH v3 4/6] net: phy: at803x: add the function phydev_id_is_qca808x Date: Wed, 15 Nov 2023 22:06:28 +0800 Message-ID: <20231115140630.10858-5-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231115140630.10858-1-quic_luoj@quicinc.com> References: <20231115140630.10858-1-quic_luoj@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: sh-CiTriMk7_fEjN6zzPUIsH1Ys5wuH2 X-Proofpoint-ORIG-GUID: sh-CiTriMk7_fEjN6zzPUIsH1Ys5wuH2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_12,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 adultscore=0 mlxlogscore=965 impostorscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150109 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 06:09:18 -0800 (PST) The function phydev_id_is_qca808x is applicable to the PHY qca8081 and qca8084. Signed-off-by: Luo Jie --- drivers/net/phy/at803x.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 471d5c13d76d..f56202f5944d 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1165,6 +1165,12 @@ static void at803x_link_change_notify(struct phy_device *phydev) } } +static inline bool phydev_id_is_qca808x(struct phy_device *phydev) +{ + return phydev_id_compare(phydev, QCA8081_PHY_ID) || + phydev_id_compare(phydev, QCA8084_PHY_ID); +} + static int at803x_read_specific_status(struct phy_device *phydev) { int ss; @@ -1184,8 +1190,8 @@ static int at803x_read_specific_status(struct phy_device *phydev) if (sfc < 0) return sfc; - /* qca8081 takes the different bits for speed value from at803x */ - if (phydev->drv->phy_id == QCA8081_PHY_ID) + /* qca808x takes the different bits for speed value from at803x */ + if (phydev_id_is_qca808x(phydev)) speed = FIELD_GET(QCA808X_SS_SPEED_MASK, ss); else speed = FIELD_GET(AT803X_SS_SPEED_MASK, ss); @@ -1316,7 +1322,7 @@ static int at803x_config_aneg(struct phy_device *phydev) */ ret = 0; - if (phydev->drv->phy_id == QCA8081_PHY_ID) { + if (phydev_id_is_qca808x(phydev)) { int phy_ctrl = 0; /* The reg MII_BMCR also needs to be configured for force mode, the @@ -1470,8 +1476,8 @@ static int at803x_cdt_start(struct phy_device *phydev, int pair) { u16 cdt; - /* qca8081 takes the different bit 15 to enable CDT test */ - if (phydev->drv->phy_id == QCA8081_PHY_ID) + /* qca808x takes the different bit 15 to enable CDT test */ + if (phydev_id_is_qca808x(phydev)) cdt = QCA808X_CDT_ENABLE_TEST | QCA808X_CDT_LENGTH_UNIT | QCA808X_CDT_INTER_CHECK_DIS; @@ -1487,7 +1493,7 @@ static int at803x_cdt_wait_for_completion(struct phy_device *phydev) int val, ret; u16 cdt_en; - if (phydev->drv->phy_id == QCA8081_PHY_ID) + if (phydev_id_is_qca808x(phydev)) cdt_en = QCA808X_CDT_ENABLE_TEST; else cdt_en = AT803X_CDT_ENABLE_TEST; -- 2.42.0