From patchwork Sun Nov 26 06:07:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Luo X-Patchwork-Id: 169832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2317873vqx; Sat, 25 Nov 2023 22:08:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvqqEb6xAbnp8pl6xFkLKUDdHIzJABcM1Rf4udhXFFyq5pgJMwKWVub/nRIdNr44N7//KS X-Received: by 2002:a05:6808:3c99:b0:3b5:8586:b17e with SMTP id gs25-20020a0568083c9900b003b58586b17emr5128559oib.52.1700978939645; Sat, 25 Nov 2023 22:08:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700978939; cv=none; d=google.com; s=arc-20160816; b=cLbqWeldp/JQRUSlAbUpB+LRadWgr8nY2PXxXIkIR6YfcTTP60MO1faw0KBKCmOIp9 Xw7ERo+NkhXYqnAePkXJ21+Abi4h6EZbsebDs9fG5vumqJ9fpn9yi0z+5D1+XLw3k9vV NQs5itKJabD9BAmojT97IoDNnr8lpwE5gRYTxDi9udsGPTRGeonkWnDcNJKUVyJ8WA+o ruVsQjSj/GGlFacqmcvLcg9KOg/BFYbvt6FCCvw3wOIsTfnc4uEixcNtEhjT7F6bXMsh V4Z4EtcZqHMnDuKXpc9AH/mKebwoYbESq9WTcO/23apq49BWE+2wQY9Y9PKXxWtCaaTA gLBw== 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=SGKuNtLiEI9lSbymQ62ComQ7nNr0WmS8+Wf4Jy0hCRg=; fh=CzJZH1Mq0+1gFor3WuKjwLRRL9rPD0zvQs0go/fRLgA=; b=L6tNx2u9IcOcuYFOYxWlh5c5Rtn8nf9qY34SH0LL2RrQhMRWdlRgJ4uueEcjqSPKjg f0zXRWm4AQsxeHE7z/vQc0pk4aT065JtNA3VqrHNbgFewQjK+5CQhPC73BqIl6qR5+dl qUTdypNkT9myBiwOVSfT7sdVp7g8NwawOhCjcGOgcmz59AJEuGx8klecXBWb9pWJSmzx OL0qUURFJ4M4vn1gUKubNxhyQEh692BnWHp95xnuXYf3OMrZEFvGi9cpHDHzgvDdh1yy s+DrNzV42Q1EwYTZJ1g3qbWnpGLakHYWkYEZIwbH0+z3iGBkzp6fUO6SHGdrPWEkdWbl bHIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=eh1spQAw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id t32-20020a634620000000b005a9fde46fa0si7070435pga.130.2023.11.25.22.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 22:08:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=eh1spQAw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 609168042AAE; Sat, 25 Nov 2023 22:08:54 -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 S230209AbjKZGIj (ORCPT + 99 others); Sun, 26 Nov 2023 01:08:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230003AbjKZGId (ORCPT ); Sun, 26 Nov 2023 01:08:33 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11F08DE; Sat, 25 Nov 2023 22:08:40 -0800 (PST) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AQ67jjn009595; Sun, 26 Nov 2023 06:08:23 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=SGKuNtLiEI9lSbymQ62ComQ7nNr0WmS8+Wf4Jy0hCRg=; b=eh1spQAweqI37kmXNfYOFCeS7FZIj1MPnkLFl9HW6W0EkkydD4zXG2q7p5dK3xrc0Kw/ L1BpKdepRPCSBXSFZ3Ql1Gf1DANmOL9Lz9vy1jKX3mgwKn8PLADHQfogWLdhq+HyFQzT vCUzREc1VW4Uuj3E3NhJklCkmXsJ6Xr1xH/jr6gDKA9LPmrCJRCLNR0EtSY7XwPFcWri PQXjnZ+ql5PlUHAFcLyPLEhUByiyx+dLIBAocygNQVOgYn5e1CYMuH6goJpeMCD2CK5T +6OOg7uL4IbFRuSah2eg3EY8nKsr/ah0EKQ/0UH92YRNDVSQLkTDHHqIPM+xuJLkvgz/ jw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uk8h8hsk4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 26 Nov 2023 06:08:23 +0000 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 3AQ68Mlj006641 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 26 Nov 2023 06:08:22 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; Sat, 25 Nov 2023 22:08:18 -0800 From: Luo Jie To: , , , , , , , , , , CC: , , , Subject: [PATCH v6 4/6] net: phy: at803x: add the function phydev_id_is_qca808x Date: Sun, 26 Nov 2023 14:07:30 +0800 Message-ID: <20231126060732.31764-5-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231126060732.31764-1-quic_luoj@quicinc.com> References: <20231126060732.31764-1-quic_luoj@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: cTnyKzJXl3URHROzeOo-6W9ZWhq2LkVj X-Proofpoint-GUID: cTnyKzJXl3URHROzeOo-6W9ZWhq2LkVj 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-26_04,2023-11-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 bulkscore=0 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 clxscore=1015 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311260042 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]); Sat, 25 Nov 2023 22:08:54 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783605692884434621 X-GMAIL-MSGID: 1783605692884434621 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 f376d794d170..430547f304f7 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;