Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6507442rdb; Thu, 14 Dec 2023 23:47:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlV3eoOcS2aDzPIEQvjaS7f3JTq7ODG4DXcgFsi7Nceb643y4ZPnQJVxZaeJcWSHC5SoFU X-Received: by 2002:a05:6808:2390:b0:3b9:e80b:708e with SMTP id bp16-20020a056808239000b003b9e80b708emr14843055oib.82.1702626445199; Thu, 14 Dec 2023 23:47:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702626445; cv=none; d=google.com; s=arc-20160816; b=pL/5Nx2snvmqVd7NAIFcqxNU9ZCal1kw7IDixwhp3QPs8wR6ZNz9WVxz8WN9hWr0KN DgcbXf4Ld7bFzKPbVGX6+70TM5wEjxldyHtVeGmw2lS7gCaj5T9KEYQnPAWseBPhPyZK aGXC7XdTRrkYRzYSOlIcOhlCJymjSmhgNXjs8n7VHK/lzpxXkGjrYHLGAZ9WTj+3ohIq lcvPE3ZigOzkGIQscnpaBReKKUnNDzztGPJSW4Czp0IXHriAeG11FGlaqgVFQ18k2yXE CA1dw+eMuLsIMuO/Epg1laclbrQ1Lg/SDhQmQjyULhnccdCkBXlpnHWsChF9FJ6+do2o ayiw== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-547-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a28-20020a62d41c000000b006cebc804fb3si12591876pfh.381.2023.12.14.23.47.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 23:47:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-547-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 423BAB22C0B for ; Fri, 15 Dec 2023 07:44:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCD6D1CF95; Fri, 15 Dec 2023 07:41:16 +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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 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); -- 2.42.0