Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5870161rdb; Thu, 14 Dec 2023 01:49:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGrWEh1GQYrbkmJMUfD8+W79k+MWI9Gan1DGfQeQRl9NJRO613aEiM4PqWhW8ZiMZwNPJh X-Received: by 2002:a05:6870:c084:b0:203:d6:7430 with SMTP id c4-20020a056870c08400b0020300d67430mr4854827oad.13.1702547362988; Thu, 14 Dec 2023 01:49:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702547362; cv=none; d=google.com; s=arc-20160816; b=QBxLiUWrDs8sWQzsdkPjDAX0wuvFF++sH2GIR6bkdsbnI/6PpU1hSIV16dcI4pAzpD uMerkpdtzVFW2+ObGwFhLYtJ3xFRvdsVWekP5h3tfJzRaE9UlQFmV9W6nytxhwYzw3xS uLQeLcMSIiMCjurqvhVk3CDoHQjgRv0f25DTZC97z43uWPK3h9OOQbTJqhhS32Y7VldW 94oWdUqt7spSihS8BmV5eTdZdChdw7HjXgjxdaEd3+41ZxQ4WjE40pWAh47DG/7+MNPK /7Jz4QAZDkn0gDyDF/U8cHdFbmaM9tla+fQduHNCclNvcQdUY7nR/HBGmGY44fmF4MSU 15EA== 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=0bVysHhmiIwOWR5neHsBpe+iBusVLfMfldDRhFy7W/U=; fh=/GuWXIFJTb2Z3LVYajHwooJWphp6NrpriHhj5GHcik0=; b=geteUF5UpZUIs+Ix0IbT11qqRPbDfXT9b68tuKgJg5AG3i4wHeiHGkE4dgF3Wk5PnW Os61INzWgWJynL1TReJVhU21rzCcAr8cRn7o2l3qWFQIUyPBYgQtpHmLTxQoSzSWAbEh ZxG3JM66taVdkczLXosB7YeDS75OSfE7eHUMqTET7FqSI7WNgzi6tfyCx/4YimfgRJd3 xev0tQBFL2528w6S2t3cRbRt5kRFKaJYM+hvJsO2vJfRFExelBQwmROzrwZAMnZQZixm a/cBnX+3Sf37607t9FRI9xd94y/QFsm40fNFVagNAzaIa78K+dFz8QS8PjVlLKrEeCZp s1PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=TMTAO+3R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id j7-20020a654287000000b005c663eae38dsi10793929pgp.370.2023.12.14.01.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 01:49:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=TMTAO+3R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id C00008325D29; Thu, 14 Dec 2023 01:49:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229666AbjLNJs5 (ORCPT + 99 others); Thu, 14 Dec 2023 04:48:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443537AbjLNJsx (ORCPT ); Thu, 14 Dec 2023 04:48:53 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6CCE115; Thu, 14 Dec 2023 01:48:59 -0800 (PST) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BE9MNtf021355; Thu, 14 Dec 2023 09:48:46 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=0bVysHhmiIwOWR5neHsBpe+iBusVLfMfldDRhFy7W/U=; b=TM TAO+3R5ieHFgpyIiLyw7VEToa4jK6LoQ1BDDP3ArMFqnkeAa7uUUDiqhR5DGB88A F3drXwBMUxFM+3utW5pH4mzSa3NoJQ007UVsi3MsFOZPL52ZsBLqIm3NykhgbUJu RNTwlMfTKk2pzDc7owTJxjbHimtLY79+ZTYB7QGsEng1ITEoFnEnvv/ga6Z+VYDK PUig9PZRV24AxfPiZvza03jAqnxquprY/cTlHkXhY9tr3SJE7qAfnXGIZDhVwlsS 4Gw12ZA3Bao6kpS/mEgSOAg8ajjJ9P3B3r26UHnN5tCEoJU2pEI7WhnThZwQNviU n8ri4zV7W8EwYUw+DFoQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uyp0p92uq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 09:48:46 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BE9mjmj006323 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 09:48:45 GMT Received: from akronite-sh-dev02.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 14 Dec 2023 01:48:40 -0800 From: Luo Jie To: , , , , , , , , , , , , CC: , , , Subject: [PATCH v7 04/14] net: phy: at803x: add the function phydev_id_is_qca808x Date: Thu, 14 Dec 2023 17:48:03 +0800 Message-ID: <20231214094813.24690-5-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231214094813.24690-1-quic_luoj@quicinc.com> References: <20231214094813.24690-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 nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: BGPm8VSDTEI6Fp5UWSGCowun_Q7j8vPW X-Proofpoint-GUID: BGPm8VSDTEI6Fp5UWSGCowun_Q7j8vPW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 phishscore=0 impostorscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312140065 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Thu, 14 Dec 2023 01:49: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 8dfdf2ff56a5..143f0d2e36a6 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 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