From patchwork Fri Dec 15 07:39:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Luo X-Patchwork-Id: 179067 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9105119dys; Thu, 14 Dec 2023 23:44:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEK9NCXZ1uk3+oVFlDa2vK03DAZb+w0edaM68ZDv2MHcPvL4DVS3+2Pdmk0TlkOVYbp4Ajg X-Received: by 2002:a17:903:44a:b0:1d3:5f7f:c882 with SMTP id iw10-20020a170903044a00b001d35f7fc882mr2186916plb.30.1702626290779; Thu, 14 Dec 2023 23:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702626290; cv=none; d=google.com; s=arc-20160816; b=ZhohZYkp2tPuD6xRpSWWtzahLApAojG6pjLBput4cArWJEgwzR5/9uT2PKPqqTfEg7 32u7HZZ3HlD9IV495605yEqU7UMPYAlkX78Iv/CBE4XB1o60PmlOpejd8yWRXh2MZlqI RWPh58EGO/VJWTmEh6sOyXfVY9Q7G9eHLGhGQX/Xv9frWutPG0oR6nBWWxsWIQW4apvu 0vorhBjJ4JmP+RfZKZWQh/+dEu2/V7SaQfrczPjSZ9/K4OY9oLUhEkAysn36+pH9kXCq yLZkj3ttbCnC1POEyqzBKDMnBWpON0njAP3g5cNqodBKvucqvyqBhIVGXBblo4h0mBjr smjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=oMKb/bC0IiOLVdW8TS1QSiGeJrouun61X6rrwSQSgZ4=; fh=/GuWXIFJTb2Z3LVYajHwooJWphp6NrpriHhj5GHcik0=; b=GHWfBUR5K7O/+8xBtVkAgxHKdOLlDsw+F9aif803qFabNzY1fd77yA9/o16s7EuUbo /bhZ3GddB6fmgt2YFONm8hRUkm9EUJZz+opJ+BPRn4fcpJ85GpyakGKqWKLyRkUzIpzS CAPTifTsSc7YiFaJ4GCdiqR7IfRLsttvo2Hwp2F7dVUMleUKkQ9iglCGeSYKhqVJeVjJ 4CZOnw3YTXZQzj/Z3lDNxAIbdY/EVs9ve0Whq7jcEQwGe2OZKlup0WsDj/7doMfFuspJ okdxGCu4HojNhfqneMeFWSj6SoHgEpZEm/evYKoO2c2B4nTA08DVzGbOwP7rAkXyLDZj fERw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ooL6fgF0; spf=pass (google.com: domain of linux-kernel+bounces-547-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-547-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c9-20020a170902d48900b001d3766085a1si1663867plg.564.2023.12.14.23.44.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 23:44:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-547-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ooL6fgF0; spf=pass (google.com: domain of linux-kernel+bounces-547-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-547-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 86DE2287282 for ; Fri, 15 Dec 2023 07:44:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C617924B53; Fri, 15 Dec 2023 07:41:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ooL6fgF0" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 511341798E; Fri, 15 Dec 2023 07:41:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com 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 3BF6eU7G031895; Fri, 15 Dec 2023 07:40:49 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=oMKb/bC0IiOLVdW8TS1QSiGeJrouun61X6rrwSQSgZ4=; b=oo L6fgF0qfUjgDjqzgkTZiyvwqLau7xBsCPMATE4WzZg1OkXB0cnAEG3lEmzSwloCY VzVmORS7Nh9zYnIk1JaKj7RF35YB9lsYHQrTnj1uf+eji7t2d3LSE0I4bVrW35ao QguPwcS5CD5dXKYXtNQSnsbI7q2ukuiPFbYiHT8IefEb3E39DOM1E4c4I+miynDL TRpqGqYOdeZzq+j5JtUc03NYrwEEU03oR3WcmotWnBVPJPN7Jpqj6qlKNKCuziro U17IsZpScdf9VxD/4blhSXYulGL3Efsbl4r77NIylLfL2ZkMd8WKVp4Rz0jl9oDr amw9Val2gdSfSdTZqVYQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v0hdf86y4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 07:40:49 +0000 (GMT) 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 3BF7empG024027 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 07:40:48 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 23:40:44 -0800 From: Luo Jie To: , , , , , , , , , , , , CC: , , , Subject: [PATCH v8 05/14] net: phy: at803x: Add qca8084_config_init function Date: Fri, 15 Dec 2023 15:39:55 +0800 Message-ID: <20231215074005.26976-6-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231215074005.26976-1-quic_luoj@quicinc.com> References: <20231215074005.26976-1-quic_luoj@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: OA6-BsvObgkzBd2ukXcdNmdf4x11vkBj X-Proofpoint-GUID: OA6-BsvObgkzBd2ukXcdNmdf4x11vkBj 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 malwarescore=0 mlxlogscore=999 impostorscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312150047 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785333065507702522 X-GMAIL-MSGID: 1785333065507702522 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 1030896dd546..252fae4329cc 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"); @@ -2163,6 +2172,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 */ @@ -2358,6 +2387,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);