Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3230055rdb; Thu, 16 Nov 2023 04:11:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMyTN7kcwqvYr9+VQs97EjpkWUAAShhjZHM47I3SKNdUDMnnbYo8DRafRfiwMYQsWpbThs X-Received: by 2002:a17:90b:17d2:b0:280:fecd:b170 with SMTP id me18-20020a17090b17d200b00280fecdb170mr13205201pjb.42.1700136672168; Thu, 16 Nov 2023 04:11:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700136672; cv=none; d=google.com; s=arc-20160816; b=NZ50BjuG6Xyvw4OLE5Fm6pht2YTcU5NiybmlwDeTyf3/EgybCCjcNKXtVTBN7VmIBA Rzw3jj9k8Aj6KB6mf51rm6PRkJkpYsTFE0HdDQbQhD5/rjdkGkSDGyr56c+PL3PXT+Nu sos3tAMrrW+XMAxB/KC59PknS/Dt0Ly7yuN3jh+fDt2QcrKrmsUxMC+JsYyQdeqm2kTN /CC+LdY5fTWjxgwJUPW19h85TFddNJhHLpSwjrEWr+eFZt7jKVZ+7m5uXx7pTzG5+qAJ eIf+t+BAzQ6h7qudl+qJNFhDQxLTd2RBnQFcOv+pxicS+ZxrkefbU1ZZtkv/aQe63HO4 DHTQ== 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=iv+VKLWGqdhQN4f+mpojtd0SHROmRt5LeotHAkIm1g4lynBkuzlENAagGYbIFf8pcV pOAB9BFWB6wSmgBlZ6e6+bEmvucfIWbMrrzP2KdN2QSfbFavVgoGjLPgciD/J9CIZzje OnsUO1FNlTtStMPXbyQnz2JSSW0Eis0GzqYklQRoq1J34QhEMMXnqMiXtfBYI0zmbAQO 3BXmIxkGg45JUvsSWqnMI5Njmd8so1UlR7VpQeCN1HMVn6z3WYljyDZj/uRrR8oJBwBr zhhXIH0f9ehUfnZyXg3UUUq145OlEQWTQ3uxNt/7P1hBYudTwHiTCrr5aSCN5W55ld8e bzXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=gBgpjqmz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id y12-20020a17090322cc00b001b9f55d28a2si12646200plg.205.2023.11.16.04.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 04:11:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=gBgpjqmz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 420CC80947D9; Thu, 16 Nov 2023 04:11:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345158AbjKPMKp (ORCPT + 99 others); Thu, 16 Nov 2023 07:10:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345163AbjKPLZi (ORCPT ); Thu, 16 Nov 2023 06:25:38 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88EA3D67; Thu, 16 Nov 2023 03:25:27 -0800 (PST) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AGAlHWU021666; Thu, 16 Nov 2023 11:25:16 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=gBgpjqmz10zQu+PyjVBS1ZqBYNZPEIJHgHi9meK0al3IAwZEkFCcl99+yIcIC+FiV8Im NRWMR/uhkrD9BbyHr+RmeQgDTjuDRuAwdbgzPxqXBOseyn7BGzAyRnOi7C5SFFquMe8N zc/3jVGyxGLgvtseqo2fPIL3AyJmlW0C0GNy6ToZcNqbwb1gqwgJsvkV5aCyZl5/96+i Bapzt5emjZ6Up3zSqX6alr2FjYbgPXkadI4DAVsgs64OATqN0022wW48hNyHLvweZY29 iusl0T6fFHXeRBAgSL5ShKkuIGFqm6/G/ll5HpOlfYw/YhkbBjih1odnPoWxLPKsUTBR OQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ucubsb2xe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 11:25:15 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AGBPFHq002811 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 11:25:15 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; Thu, 16 Nov 2023 03:25:12 -0800 From: Luo Jie To: , , , , , , , , , , CC: , , , Subject: [PATCH v4 4/6] net: phy: at803x: add the function phydev_id_is_qca808x Date: Thu, 16 Nov 2023 19:24:35 +0800 Message-ID: <20231116112437.10578-5-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231116112437.10578-1-quic_luoj@quicinc.com> References: <20231116112437.10578-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-ORIG-GUID: CcWnllt__O8pnDoqbGV-LanLYKv_WOn1 X-Proofpoint-GUID: CcWnllt__O8pnDoqbGV-LanLYKv_WOn1 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-16_09,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 malwarescore=0 mlxscore=0 clxscore=1015 bulkscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=964 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311160091 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Thu, 16 Nov 2023 04:11:03 -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