Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5870184rdb; Thu, 14 Dec 2023 01:49:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiP9wfX1tA2phkxCBJ2ThFrqY5U9MYOBBW6pxALEx9DckPe454g4jGUtY9f8CtpyTwG1xv X-Received: by 2002:a05:6e02:310f:b0:35f:7f8e:6241 with SMTP id bg15-20020a056e02310f00b0035f7f8e6241mr952276ilb.58.1702547367553; Thu, 14 Dec 2023 01:49:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702547367; cv=none; d=google.com; s=arc-20160816; b=dPzal/Js33ppTGc27pc6JJ5hmq5YDrfXPe9BVy0Qddxp9ZqvKUytsYAzGgnzIIJnv+ IwNunms2AMooQL6VBRmHO99xhIQav7SwRYq4dsTtS/ukP/puztaQrVbCqEt6breTmS/U oJirD5SvnHvX2wSz7T9JjvkYjxM2h/YBl1eaUISR4ZgPynbT8zG8HqTtEreNDWE1IzxG rbYogUvGIzGc3uJjWjAeiutV9gpFQ+c7Yb6Fe3E0K6W5BIOqANi6BDnZtC6cx33eVGiW g5x5JXKeIXa2AInYxBZ7RqtEer2vcu1LIV4+CEsE+vqProoFUai1ZUY2uEIev12uHrJZ jzYQ== 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=g1/PSi7VGkjdeLX+7/20eelyP/TKgqeOerVb/AB4m5E=; fh=/GuWXIFJTb2Z3LVYajHwooJWphp6NrpriHhj5GHcik0=; b=Jq3n7I0Lt/oTnQVAOv+u3Duqeon+8+xglTma47SJOQ48igSb6HQHklWMZll629YlTd aHibMy7G9ZRtDVLaXqEm7p3S/GR9h1zm6Bh7dz8amyugkFm3Rx9Bl7p6ZVa4jn2WHydX S0Tr61dRY/8z3n+iswIqJV3jnnrBVSBWP07IR/V3ZKR3h2TZHZoLms7aVU7Y0WM/w1Zw l4YizvNDRSv/ebDXDc4O4Yab/7TL5CUqw9mNnw3Wfr1sCAYNYUxjtz6K8CUe6GGMplPs QfusiFQcc7+4QN23P+hMwWTvW6Z/ySc9ocoyTf4p9y3vFqE+2qvEtpC4qbpXfTML/IA3 aLfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Q+6Kucqe; 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 q207-20020a632ad8000000b005ca5b61cac5si1195897pgq.121.2023.12.14.01.49.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 01:49:27 -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=Q+6Kucqe; 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 7C7EF8028D6D; Thu, 14 Dec 2023 01:49:26 -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 S1443422AbjLNJtL (ORCPT + 99 others); Thu, 14 Dec 2023 04:49:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443561AbjLNJtD (ORCPT ); Thu, 14 Dec 2023 04:49:03 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DDAA118; Thu, 14 Dec 2023 01:49:04 -0800 (PST) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BE8k2hR017630; Thu, 14 Dec 2023 09:48:50 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=g1/PSi7VGkjdeLX+7/20eelyP/TKgqeOerVb/AB4m5E=; b=Q+ 6Kucqe6Hyr1jN9o+GdfITFsebJQfe4JJcWN/rbWE930l+NT+nsBWplPb6pljGKHW bS1Aw3AZKsfxkg6y1yFucFRLNMDOLlfXENFeN7mAa8FTt1ZlTN30lYKVofCYAMVc O8Yb+4czgyFpEk9/KptwgLOuA19NM8W5ndqTjnFCEQj2Qg/BP5+B4pYmqwd0ky12 z/xxplvMLZr+0Fli5lPXC3HMwwNPtmmzkVArdnxmNdR+ku1rptOYhz8dQ2iKlVSL t2vUzhMjadeCajCwlUJQed+E9pUc6f3oSOtjuhCQhii+WZTID1Vf3fHbqa+Vxr9O W1Q6XiEmixoNxhzoOWGA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uytn68jwu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 09:48:50 +0000 (GMT) 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 3BE9mn8e016536 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 09:48:49 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:45 -0800 From: Luo Jie To: , , , , , , , , , , , , CC: , , , Subject: [PATCH v7 05/14] net: phy: at803x: Add qca8084_config_init function Date: Thu, 14 Dec 2023 17:48:04 +0800 Message-ID: <20231214094813.24690-6-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-GUID: QRAe3tA68AcDDTlUQBoC24ioP5h0tAK_ X-Proofpoint-ORIG-GUID: QRAe3tA68AcDDTlUQBoC24ioP5h0tAK_ 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_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 phishscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 bulkscore=0 impostorscore=0 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312140065 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 01:49:26 -0800 (PST) Configure MSE detect threshold and ADC clock edge invert. Signed-off-by: Luo Jie --- drivers/net/phy/at803x.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 143f0d2e36a6..ba5d069ad351 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -280,6 +280,15 @@ #define QCA8081_PHY_SERDES_MMD1_FIFO_CTRL 0x9072 #define QCA8081_PHY_FIFO_RSTN BIT(11) +/* QCA8084 ADC clock edge */ +#define QCA8084_ADC_CLK_SEL 0x8b80 +#define QCA8084_ADC_CLK_SEL_ACLK GENMASK(7, 4) +#define QCA8084_ADC_CLK_SEL_ACLK_FALL 0xf +#define QCA8084_ADC_CLK_SEL_ACLK_RISE 0x0 + +#define QCA8084_MSE_THRESHOLD 0x800a +#define QCA8084_MSE_THRESHOLD_2P5G_VAL 0x51c6 + MODULE_DESCRIPTION("Qualcomm Atheros AR803x and QCA808X PHY driver"); MODULE_AUTHOR("Matus Ujhelyi"); MODULE_LICENSE("GPL"); @@ -2085,6 +2094,26 @@ static void qca808x_link_change_notify(struct phy_device *phydev) QCA8081_PHY_FIFO_RSTN, phydev->link ? QCA8081_PHY_FIFO_RSTN : 0); } +static int qca8084_config_init(struct phy_device *phydev) +{ + int ret; + + /* Invert ADC clock edge */ + ret = at803x_debug_reg_mask(phydev, QCA8084_ADC_CLK_SEL, + QCA8084_ADC_CLK_SEL_ACLK, + FIELD_PREP(QCA8084_ADC_CLK_SEL_ACLK, + QCA8084_ADC_CLK_SEL_ACLK_FALL)); + if (ret < 0) + return ret; + + /* Adjust MSE threshold value to avoid link issue with + * some link partner. + */ + return phy_write_mmd(phydev, MDIO_MMD_PMAPMD, + QCA8084_MSE_THRESHOLD, + QCA8084_MSE_THRESHOLD_2P5G_VAL); +} + static struct phy_driver at803x_driver[] = { { /* Qualcomm Atheros AR8035 */ @@ -2281,6 +2310,7 @@ static struct phy_driver at803x_driver[] = { .soft_reset = qca808x_soft_reset, .cable_test_start = qca808x_cable_test_start, .cable_test_get_status = qca808x_cable_test_get_status, + .config_init = qca8084_config_init, }, }; module_phy_driver(at803x_driver); -- 2.42.0