From patchwork Thu Jun 29 03:48:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Luo X-Patchwork-Id: 114139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9378370vqr; Wed, 28 Jun 2023 21:01:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ylYOx/EJrKiOq17uNCw8OqG8/69H/w++pG/SWa4I1YBBrDnhIjVeul9nhBW3NW6PD8WtF X-Received: by 2002:a05:6808:1d6:b0:3a1:f026:6b40 with SMTP id x22-20020a05680801d600b003a1f0266b40mr7944093oic.23.1688011297031; Wed, 28 Jun 2023 21:01:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688011296; cv=none; d=google.com; s=arc-20160816; b=w2D3Z4zOqIyDxmpr+HHOsqycRuZTubWC6tPlnMTelU+ZM43lunuA9bRj2Fgd/63HP8 9UThZuu5oqwlybvDNzKiC/CZnxQx0ti1vWiR1FnzrqC2UzxuW4bLgEJ1yDYewCiLGC4o 2REkZDp3ejdNKJOIEVRpt4mWJh7JSouK9kOJHFNCcCZBtDhxDdIZWw3MU1FM/UHrB9rz NCmf2Kt/INIIJlctxXx1TB0eG+vQpncktd2ivwTDDvMiTaIHL3qAfDOVT56pNJtmC8uC iCQHuB9ah/Vj7L8qNeM8a69JMGA5ej/qsLAsIxoJiDFRGYai+SxxwdYKw57yvR+WPFhB Rosg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=uRKaP7DatgDduxvtLtj6NGLqcnXa/rZDM8YgpRlxzwo=; fh=mS4olsDpwKWMVea3JlmDCyrKluY9hAHtbr7sWBM0SJ8=; b=uXoW2r36wMFt8Zg8b/REwU5koiz858qX/X0NohIqFo9lT/jdDLudRx+LalZVMi9uzv DJoZNcrp+GgNxni3JIdyg7DtajoGCrhIw36YgT3+VxVLfaMBurt/lvGVTJ3aTAquQUbn gwIgVjzvY7RFfD+aqCL5SveIAadmOQX/68v0KdVSKIOc2sv28H9Vxeyll6a/U/b+7nzQ D1XjH3cbCLuVA5zbYtd7djBrLk0+yElYNUzv0DTQMmCp+JUtMeQqMHlf3BOJxx5Qnk4X gn2/XZsXONPU86F3YMk798kdhvZCZaWzxxlM/cBiawL5gogLF5efb4EN2kiCEiQ52YED DhWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mGH+JMS5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k25-20020a635a59000000b0054ff8291781si10107280pgm.349.2023.06.28.21.01.23; Wed, 28 Jun 2023 21:01:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mGH+JMS5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231901AbjF2Dti (ORCPT + 99 others); Wed, 28 Jun 2023 23:49:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231789AbjF2Dt0 (ORCPT ); Wed, 28 Jun 2023 23:49:26 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B0F71BD3; Wed, 28 Jun 2023 20:49:24 -0700 (PDT) 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 35T3japp019917; Thu, 29 Jun 2023 03:49:10 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-type; s=qcppdkim1; bh=uRKaP7DatgDduxvtLtj6NGLqcnXa/rZDM8YgpRlxzwo=; b=mGH+JMS5Qev5RQ78hYu8zsuVnjl3SjOYbA2V52MNsYWNP92BUkYoEnguE6cnW5F+eHL/ 7yPF5laxs1qbKSQadAPLxPpsxp2a/uLBIJK+szvEMvxOdx7/N3SYLok6p/VOPqhkKNVB MYmnMoR8Js02hOsd5qAUGG5dSkNlbPtnTw/C/sjc3q7dGDXaBmXX8DJpKFadeYCd7PSk 4+K2EEIkhFTEqGx7QPomx84MElA/6yYgfxaMCjUUloygU1vX79Iys8KdMlXqbyKUALeZ LxGblZU88FGpclnVMHfJ+qzN/JVuTk5NfZPEYdvrER9yy9/E0QVm3EWWhcbwo7QNnwSr bA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rgas2ttne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Jun 2023 03:49:10 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35T3n9L1023229 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Jun 2023 03:49:09 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.986.42; Wed, 28 Jun 2023 20:49:06 -0700 From: Luo Jie To: , , , , , , CC: , , , Luo Jie Subject: [PATCH 1/3] net: phy: at803x: support qca8081 1G chip type Date: Thu, 29 Jun 2023 11:48:44 +0800 Message-ID: <20230629034846.30600-2-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230629034846.30600-1-quic_luoj@quicinc.com> References: <20230629034846.30600-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: vDnzgmAVvZMddROhTb9saxmgzf949VJl X-Proofpoint-GUID: vDnzgmAVvZMddROhTb9saxmgzf949VJl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_14,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 impostorscore=0 priorityscore=1501 adultscore=0 spamscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306290032 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770008133743551923?= X-GMAIL-MSGID: =?utf-8?q?1770008133743551923?= The qca8081 1G chip version does not support 2.5 capability, which is distinguished from qca8081 2.5G chip according to the bit0 of register mmd7.0x901d. The fast retrain and master slave seed configs are only needed when the 2.5G capability is supported. Signed-off-by: Luo Jie --- drivers/net/phy/at803x.c | 58 ++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index c1f307d90518..3339ca372b24 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -272,6 +272,10 @@ #define QCA808X_CDT_STATUS_STAT_OPEN 2 #define QCA808X_CDT_STATUS_STAT_SHORT 3 +/* QCA808X 1G chip type */ +#define QCA808X_PHY_MMD7_CHIP_TYPE 0x901d +#define QCA808X_PHY_CHIP_TYPE_1G BIT(0) + MODULE_DESCRIPTION("Qualcomm Atheros AR803x and QCA808X PHY driver"); MODULE_AUTHOR("Matus Ujhelyi"); MODULE_LICENSE("GPL"); @@ -898,12 +902,22 @@ static int at803x_get_features(struct phy_device *phydev) return err; if (phydev->drv->phy_id == QCA8081_PHY_ID) { - err = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_NG_EXTABLE); + err = phy_read_mmd(phydev, MDIO_MMD_AN, QCA808X_PHY_MMD7_CHIP_TYPE); if (err < 0) return err; - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported, - err & MDIO_PMA_NG_EXTABLE_2_5GBT); + /* QCA808X does not support 2.5G capability if the chip type is 1G according + * to the register MMD7.QCA808X_PHY_MMD7_CHIP_TYPE. + */ + + if (!(QCA808X_PHY_CHIP_TYPE_1G & err)) { + err = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_NG_EXTABLE); + if (err < 0) + return err; + + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported, + err & MDIO_PMA_NG_EXTABLE_2_5GBT); + } } if (phydev->drv->phy_id != ATH8031_PHY_ID) @@ -1770,20 +1784,22 @@ static int qca808x_config_init(struct phy_device *phydev) if (ret) return ret; - /* Config the fast retrain for the link 2500M */ - ret = qca808x_phy_fast_retrain_config(phydev); - if (ret) - return ret; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported)) { + /* Config the fast retrain for the link 2500M */ + ret = qca808x_phy_fast_retrain_config(phydev); + if (ret) + return ret; - /* Configure lower ramdom seed to make phy linked as slave mode */ - ret = qca808x_phy_ms_random_seed_set(phydev); - if (ret) - return ret; + /* Configure lower ramdom seed to make phy linked as slave mode */ + ret = qca808x_phy_ms_random_seed_set(phydev); + if (ret) + return ret; - /* Enable seed */ - ret = qca808x_phy_ms_seed_enable(phydev, true); - if (ret) - return ret; + /* Enable seed */ + ret = qca808x_phy_ms_seed_enable(phydev, true); + if (ret) + return ret; + } /* Configure adc threshold as 100mv for the link 10M */ return at803x_debug_reg_mask(phydev, QCA808X_PHY_DEBUG_ADC_THRESHOLD, @@ -1822,11 +1838,13 @@ static int qca808x_read_status(struct phy_device *phydev) * value is configured as the same value, the link can't be up and no link change * occurs. */ - if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) { - qca808x_phy_ms_seed_enable(phydev, false); - } else { - qca808x_phy_ms_random_seed_set(phydev); - qca808x_phy_ms_seed_enable(phydev, true); + if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported)) { + if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) { + qca808x_phy_ms_seed_enable(phydev, false); + } else { + qca808x_phy_ms_random_seed_set(phydev); + qca808x_phy_ms_seed_enable(phydev, true); + } } } From patchwork Thu Jun 29 03:48:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Luo X-Patchwork-Id: 114140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9378418vqr; Wed, 28 Jun 2023 21:01:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6rc+2SBVln38+Dfgjuiljcib2ySCrUbgoSE8/kvnI2YbjfuSHC68OWz/Yhv/dVPWv45UmV X-Received: by 2002:a17:90b:e8d:b0:262:e598:6046 with SMTP id fv13-20020a17090b0e8d00b00262e5986046mr12607140pjb.28.1688011303714; Wed, 28 Jun 2023 21:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688011303; cv=none; d=google.com; s=arc-20160816; b=BYut2M0QGJtrRgXZ3n/mAInzSQQUbuI5y3MUX3dRXaoubYe9KT6NLlyEiIiNJ1Wtdq tcvCAzBO3c5azBUFi0BR5ckB+CU/DdZhC3Bi9S/1ZU/CAmn5mwzeH39SYsWmcT5WzPTQ Weg0eBTriJNjy6f1pL5HWvF2OdMKum9O/RgHk4L0p5PFEFGkstbv14rOQ/24J1jF83bz fEl4yBvcczvIaRWmafp+MvJCljTXTxkj5hvIQQDYozenA159dzOn7i8eBe+Gss0yFdQ8 Tptpa26PXitKNupOOgKVBwrdV+ECacb4HuZtMuoIsNnyIWot4ADmLGKqWKMvM71297KN JwIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=eJDuWULCHpBChnFjsBNFxg7emBlrA7VNawfhBgMo0Dk=; fh=mS4olsDpwKWMVea3JlmDCyrKluY9hAHtbr7sWBM0SJ8=; b=ws9Lr5Sp0s4I7oabHHlBiNJIpIhgoZucs7aqqixuOX1xEsB2z21tHia8BAky7glrpl bs0nJuYz8bWqg34VR46aXxqa5MWJxpWyXoywWrjK7CxWZqPI6R0GnIufXYjSi9kOcTlk ntmkq9/0PnrnWDXR/FC052JkJjdggCapWtGrhqdRQ9mwiK+7SyrGstHBGdmYZq5gw9i8 b98jgbJmRnUL+ikz+8/KZTOJR5ZzVV2IJGKZJ2TMcqvk7crCg4dU8InrGZd94eTjsp8r y/JUEhp1PNS3ZkG2SFRdQbzVst3h8Uz0TWiFssTn98bRyx7/uQrzdFgEesMQ1qaBEDeC iX3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="b/WwfTBz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u13-20020a170903124d00b001ae7f85061bsi10732098plh.609.2023.06.28.21.01.30; Wed, 28 Jun 2023 21:01:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="b/WwfTBz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231709AbjF2Dtc (ORCPT + 99 others); Wed, 28 Jun 2023 23:49:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231886AbjF2DtZ (ORCPT ); Wed, 28 Jun 2023 23:49:25 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7107D273B; Wed, 28 Jun 2023 20:49:24 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35T395SX018207; Thu, 29 Jun 2023 03:49:13 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-type; s=qcppdkim1; bh=eJDuWULCHpBChnFjsBNFxg7emBlrA7VNawfhBgMo0Dk=; b=b/WwfTBzD5QW+nD/zp1ck0ddUrs6JbZUdcEyUFpMElQKL6CsygAK/qAK3zXXmAT6lpFJ fNykuwFD+ay8BTMaT9M9Tgo8QuVApGMrlUXozFZ0yUp5GSK6gU7NEozuQwjpAo2bWCHO kBr+LmIQXMqDPbWS1nhPvBwL6ZYjLoCJAcbFu2M6ClNL5HfbE4k3Pwn4jpzuVWLI/ORe kcEHPiRl5/xYntFvwIwLVW3nbEPUi0aXqMly/m8EIeU0GzdzkFvh+hwtFwN/g5XIBvFx Kp1ChegCrdzEffKr8yrhlL94cyB/2C8f9krAU6YyVvoQTlgQIZDwF5kqYnlXDR+z96b4 NA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rgnxr9dr1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Jun 2023 03:49:13 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35T3nCYv014961 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Jun 2023 03:49:12 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.986.42; Wed, 28 Jun 2023 20:49:09 -0700 From: Luo Jie To: , , , , , , CC: , , , Luo Jie Subject: [PATCH 2/3] net: phy: at803x: remove 1000BaseX mode of qca8081 Date: Thu, 29 Jun 2023 11:48:45 +0800 Message-ID: <20230629034846.30600-3-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230629034846.30600-1-quic_luoj@quicinc.com> References: <20230629034846.30600-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: 5klEJROxc8ZWh_AhZW026jTagmWaTp2Y X-Proofpoint-GUID: 5klEJROxc8ZWh_AhZW026jTagmWaTp2Y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_14,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 impostorscore=0 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxlogscore=783 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306290032 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770008140744070102?= X-GMAIL-MSGID: =?utf-8?q?1770008140744070102?= QCA808x does not support the link mode 1000BaseX. Signed-off-by: Luo Jie Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 3339ca372b24..29aab7eaaa90 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -920,7 +920,7 @@ static int at803x_get_features(struct phy_device *phydev) } } - if (phydev->drv->phy_id != ATH8031_PHY_ID) + if (phydev->drv->phy_id != ATH8031_PHY_ID && phydev->drv->phy_id != QCA8081_PHY_ID) return 0; /* AR8031/AR8033 have different status registers @@ -933,6 +933,8 @@ static int at803x_get_features(struct phy_device *phydev) * * Remove this mode from the supported link modes * when not operating in 1000BaseX mode. + * + * QCA808x does not support 1000BaseX mode. */ if (!priv->is_1000basex) linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT, From patchwork Thu Jun 29 03:48:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Luo X-Patchwork-Id: 114147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9383442vqr; Wed, 28 Jun 2023 21:14:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/a7bmr+5RZAR4m3P9WIvZebEf2GQZ4eVL556aty6Ibi70HtIKOZ+iURHbygXbTJ/88J54 X-Received: by 2002:a17:902:ab95:b0:1af:ffda:855a with SMTP id f21-20020a170902ab9500b001afffda855amr10520844plr.9.1688012083931; Wed, 28 Jun 2023 21:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688012083; cv=none; d=google.com; s=arc-20160816; b=mUS9hnjHH6ftO12wOYBPze2oWSNdegIOSZ10sBdM1FIgob0lJkgAUqlzYBZdb5Dz45 6MiXCxBuXu1EIgUUboVsZZIQRRvDOz65q9IY1L+5kkkW38Oa7KD+ebHBBrkS+Y+mpmuT bvXPpaC4/YrIlKAfU3PM2e1Hb+P3gR8A4eBqAv/aDsRFCZ5VYivsqmbYDVZF27MBcaSB kQacJNqZ+jKI2qMD3OLpk6j8o6xjdnW04gBOv7YgW4KHPaP8k9OOmZ3fHXP2GHQsszrE DGUm9+4hcPFvLtoe/BIaUgeuHK/pHMmTgK5n92ZXSAmWFK22k6Aam4hTbeKi3BbbZMYD j0gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UsZZNOMcEsr6zHnCwEOy39/yVjTTEJoQuHl0GKi18Co=; fh=mS4olsDpwKWMVea3JlmDCyrKluY9hAHtbr7sWBM0SJ8=; b=IB+dXnzikZSd5DKCl6db2l9vkdehkgHDEU7SiRyDtRJ/gW3revxALzFzuC3+uWllqd bcYUy1TPT4Rhd+aeEdU/OSfSnx6eAijX0BPU/+tSRllXm43B0DrhurHvqpZQdWTQiDPj DUxaBua1AABcsRqVJYRaHslM6ss7+C6OeVseDJBoC/z3+WZ+jzu7h+kX/yzok34BgVn1 zdHOWX2ZYTWKYoqyRnOim8KMAWRdLFxeEyn/WnrzIJpAnhSz96uzCAPr7WjqbZYCY6yD MSP8HpcvOivgWG9bj0v6ja5E9CA3UkbkKWo3e0S29LsYyNT6xgjUKBs6pOOiAvpZeQmn t9yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ScFU1tXy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a170902c40400b001b569049666si11118514plk.617.2023.06.28.21.14.29; Wed, 28 Jun 2023 21:14:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ScFU1tXy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231967AbjF2Dtr (ORCPT + 99 others); Wed, 28 Jun 2023 23:49:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231908AbjF2Dt1 (ORCPT ); Wed, 28 Jun 2023 23:49:27 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86184273B; Wed, 28 Jun 2023 20:49:26 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35T3buJU008598; Thu, 29 Jun 2023 03:49: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-type; s=qcppdkim1; bh=UsZZNOMcEsr6zHnCwEOy39/yVjTTEJoQuHl0GKi18Co=; b=ScFU1tXyLOrXZHKP3/qBvOfztYw94gTcasrHcObtYwPDUxy39RfkzlNLjsl2aGlve5dG ArAVItQA+PkGuutv5w0Qkv8EkUHeG6OVR3nb1FhElrEPq5p60UzCFnR1c+80Lgy08jHr MPGkN3lAzBBMwSdlrbu9Dq3Z2XLAnpZtSAszqe01o+Tub6fi9pOUh3fcPnH7oJPck3yP ym6wSFJyS2DPFoCJYaktg/9NF1+EqPxx82Or4+AspMxpURgdYCGmhZIU7Vr99wcDIV3x 7X3kkCqVzu48FlK/4atZRreJFf+kzdPf98K1d91Ur55OZYyzNbKlJ1ZJ7eQbPz3+nzu8 LA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rh0aag602-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Jun 2023 03:49:15 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35T3nEMS021687 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Jun 2023 03:49:14 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.986.42; Wed, 28 Jun 2023 20:49:12 -0700 From: Luo Jie To: , , , , , , CC: , , , Luo Jie Subject: [PATCH 3/3] net: phy: at803x: add qca8081 fifo reset on the link down Date: Thu, 29 Jun 2023 11:48:46 +0800 Message-ID: <20230629034846.30600-4-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230629034846.30600-1-quic_luoj@quicinc.com> References: <20230629034846.30600-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-GUID: 7BYEfI2D6UCswZP0I9C8Et4V0Lu7pKVx X-Proofpoint-ORIG-GUID: 7BYEfI2D6UCswZP0I9C8Et4V0Lu7pKVx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_14,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 phishscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306290032 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770008958868721490?= X-GMAIL-MSGID: =?utf-8?q?1770008958868721490?= The qca8081 fifo needs to be reset on link down and released on the link up in case of any abnormal issue such as the packet blocked on the PHY. Signed-off-by: Luo Jie --- drivers/net/phy/at803x.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 29aab7eaaa90..5dc707eaf18c 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -276,6 +276,9 @@ #define QCA808X_PHY_MMD7_CHIP_TYPE 0x901d #define QCA808X_PHY_CHIP_TYPE_1G BIT(0) +#define QCA8081_PHY_SERDES_MMD1_FIFO_CTRL 0x9072 +#define QCA8081_PHY_FIFO_RSTN BIT(11) + MODULE_DESCRIPTION("Qualcomm Atheros AR803x and QCA808X PHY driver"); MODULE_AUTHOR("Matus Ujhelyi"); MODULE_LICENSE("GPL"); @@ -1808,6 +1811,16 @@ static int qca808x_config_init(struct phy_device *phydev) QCA808X_ADC_THRESHOLD_MASK, QCA808X_ADC_THRESHOLD_100MV); } +static int qca808x_fifo_reset(struct phy_device *phydev) +{ + /* Reset serdes fifo on link down, Release serdes fifo on link up, + * the serdes address is phy address added by 1. + */ + return mdiobus_c45_modify_changed(phydev->mdio.bus, phydev->mdio.addr + 1, + MDIO_MMD_PMAPMD, QCA8081_PHY_SERDES_MMD1_FIFO_CTRL, + QCA8081_PHY_FIFO_RSTN, phydev->link ? QCA8081_PHY_FIFO_RSTN : 0); +} + static int qca808x_read_status(struct phy_device *phydev) { int ret; @@ -1827,6 +1840,10 @@ static int qca808x_read_status(struct phy_device *phydev) if (ret < 0) return ret; + ret = qca808x_fifo_reset(phydev); + if (ret < 0) + return ret; + if (phydev->link) { if (phydev->speed == SPEED_2500) phydev->interface = PHY_INTERFACE_MODE_2500BASEX;