Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1007102rdb; Fri, 17 Nov 2023 22:28:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2BHfaDmJq3BRkEUr6B5Q/k0lioplKny4PJDcAUhISRSSry1MuIWeKAT4ve0l2GarGDsOq X-Received: by 2002:a05:6358:882c:b0:168:d0a3:202f with SMTP id hv44-20020a056358882c00b00168d0a3202fmr1592410rwb.15.1700288934785; Fri, 17 Nov 2023 22:28:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700288934; cv=none; d=google.com; s=arc-20160816; b=aC1Lby2puKGsgJJJZ3WsinZU4J/qmB8CeEnMlVYsWg2yO4v1hcVmj4rMVDTl585dQ7 IJ/SL8HOGxdZJHviplhFeex/P9NPXSWPPIv37yDsGwLzyEvb6qTYNCDbsEd75zJvT6Yg uEr6PVCH6xGLDR5kcr6qAsvfNd0DxuY/l+Xelnc7Zfg7kYjkEctm5FqK3oZqtfymc/Eo JINaACDqG32A6AzZVjeis8ebBSeGNDBgdCkpl5egO8qGsRhn+quvCqcGNw/ExflI18ue bh30M6lCuUa7AVuc4HDe8+a6zyp75JlHj/EQ/lWQPXLGzw4Xs/mjqYUiX7TE3BVLfMCV jV6g== 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=xoUh7MWwDswQU0Qbcu6kSaukCEbi0jZ75coOg98MRMg=; fh=CzJZH1Mq0+1gFor3WuKjwLRRL9rPD0zvQs0go/fRLgA=; b=pH7h/Sws0PhAP88c49LgBpn35xisDzR57T3PIDCXnCgtr8mgLlrOQ26yQlpZ1CKd/6 Z9fpw/dnW8C/dj9d0xVWUN136lF/AESMZtZOQMTA3lJGyM8LSrIR0bGxcleeF5HFto19 2lKijt1wNdHSe2TbXKCMcPxjE5TxDYHYU1yHQEjGiK1bFGd9ldcTFzmGffSJ16L4tRzE dt3Y77sXnxNxPEpHDt/nLXpqv+kWdW8DWuSVZWIQoPS8iLhQbxWjm4wi3SRyT0D3w+zm ssM3wYSzxX07OXGX+CvTz4FGauptXMnqnP8e6eRqTxxMb3EN+YzJGtuo9QuD6/31bMWi Nb0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IWkR7wxQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l184-20020a6325c1000000b005b8f60baea9si3616406pgl.801.2023.11.17.22.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 22:28:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IWkR7wxQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 6CAC682B6F5E; Fri, 17 Nov 2023 22:28:52 -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 S232972AbjKRG2p (ORCPT + 99 others); Sat, 18 Nov 2023 01:28:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232925AbjKRG2j (ORCPT ); Sat, 18 Nov 2023 01:28:39 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C2ECD5C; Fri, 17 Nov 2023 22:28:35 -0800 (PST) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AI5xVLM019281; Sat, 18 Nov 2023 06:28:25 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=xoUh7MWwDswQU0Qbcu6kSaukCEbi0jZ75coOg98MRMg=; b=IWkR7wxQNF3xF/1TAV2J/lWHvc4BWLEpC38PnuSPPIagj6iWOUCdKqEDi+s6ISzdiRFP qQLPM2UlL29yJMB0BZ7VOIxIUFINkyvDNs3EIuCDq9Vv3RLbtqyQxdzgOYUR/nJrD97k a6bDjYkvpVbFndA1K4U66OTky+IeRuZZkRGnJUAiMdoCJYpX4IBfW1jI062N/LCp3dNI 7IxivIvph565VhG0XX6tOhoW0MuodtE10kxTpsEHFgztaQOCpyqKkqelLPmavlGwla0T 0Q74UtsABnMOftsbj/P6NUFg3Iw89GP5ORFWneEq/SgGPQLe5SB3lBW6h94EyvretN3X BQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uem80g8s2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 18 Nov 2023 06:28:25 +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 3AI6SOSN001344 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 18 Nov 2023 06:28:24 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; Fri, 17 Nov 2023 22:28:21 -0800 From: Luo Jie To: , , , , , , , , , , CC: , , , Subject: [PATCH v5 5/6] net: phy: at803x: Add qca8084_config_init function Date: Sat, 18 Nov 2023 14:27:53 +0800 Message-ID: <20231118062754.2453-6-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231118062754.2453-1-quic_luoj@quicinc.com> References: <20231118062754.2453-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: 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: -Gic8IksuMB6moj_hsRoU1j51Q3Qc3CP X-Proofpoint-ORIG-GUID: -Gic8IksuMB6moj_hsRoU1j51Q3Qc3CP 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-18_04,2023-11-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 adultscore=0 priorityscore=1501 phishscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311180045 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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]); Fri, 17 Nov 2023 22:28:52 -0800 (PST) Configure MSE detect threshold and ADC clock edge invert. Signed-off-by: Luo Jie --- drivers/net/phy/at803x.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index f56202f5944d..06a068ca5539 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"); @@ -2083,6 +2092,23 @@ 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 */ @@ -2280,6 +2306,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