From patchwork Fri Dec 15 07:39:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Luo X-Patchwork-Id: 179076 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9106793dys; Thu, 14 Dec 2023 23:49:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrjR7h6AM5va88aPUIdDl8NahPI4u7Oza250AhgTipkhSPo6yfTo+rY2E7P34P1GXdRYR6 X-Received: by 2002:a17:902:e885:b0:1d0:bb65:685c with SMTP id w5-20020a170902e88500b001d0bb65685cmr6736129plg.31.1702626579700; Thu, 14 Dec 2023 23:49:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702626579; cv=none; d=google.com; s=arc-20160816; b=MynoTb8XybiyU/iCubGEu/g2hi6uA1R1K1FBJjLFsRkQnhl1DLsecj3baMedzFgkQT NmRfGW9sSpXYsUzJVPKslYz8l/FQHkP05kgyRGRtpKB7e99hrT2p8PrwaAaO+JsFVoWN w6E6gHz4z/FqRvWmf9aZawGfLXSxZrou3CHQ2JckWunCWmWxRm/nGKPPzZ7DVpUyzPJT TFKmgbz+oiWx4l27vAIQZcrrcFLM4d6/DIUZFBaNp9L9ThKu55H4v/43BptrKPXzBbyb Is9bvmHOqWjvdhP8Sjlf6dG8LtZ+t72L4XN2+cv5HDtfKsApqbeFtS1uPvghb//+5lYx +ukQ== 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=dJ5kQvuoEbVrG4WmjFAM8eSccltqgqQY4QEeEFSI+gk=; fh=/GuWXIFJTb2Z3LVYajHwooJWphp6NrpriHhj5GHcik0=; b=ZwTDR5SWJg8BHalECkWM57OZ9do22bCsKxVeLvJ5FRNhM9JzQRLo+p1I4nJfO+5x9P tIY/ifp8iOqpqWTfd2ppPdWLDN7Q6pM307QmgYRv7D++KWWKAOin8PklLny1ItKV+37n jmBfSGphsyR0Tum1m9l5lNDjh9DlRupt2sb5/a2WSrDZPog9QanIg8KSat4B7UidavX9 G7kBvsc30VNX4niiJM7TDNNl20gyY4vMVblHcgLqbqbyYcw5zwV66oRBk+bkePB2dWW2 11BXl6mpodpcImWH8+hjsgG2eyK0IW2S0HfAv/h1Jak5dfVN+/u5/8HcuVtGB59WHbSR wHOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=HlI6XGqb; spf=pass (google.com: domain of linux-kernel+bounces-548-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-548-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z13-20020a170903018d00b001cfd4eb4deasi12944201plg.357.2023.12.14.23.49.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 23:49:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-548-ouuuleilei=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=HlI6XGqb; spf=pass (google.com: domain of linux-kernel+bounces-548-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-548-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0E340B22C97 for ; Fri, 15 Dec 2023 07:44:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E1626250E0; 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="HlI6XGqb" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 714681947C; 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 (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BF4o2O0022299; Fri, 15 Dec 2023 07:40:58 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=dJ5kQvuoEbVrG4WmjFAM8eSccltqgqQY4QEeEFSI+gk=; b=Hl I6XGqb3okTHmJAtVktLZ/3egBSh309JPdCBGLNWklZlBe6SvWdoX32SpYE3Ulnq5 QBXoDTKOdPc6o4SiOyxl4WxPE4pWMaZb5qPzjq3wHAYnj0HgPt7g2ksmfVQjDvfj 1106D0VZINS4K8f5IlttrXqeXD1adMr1qJAE2XYAUI7OCL1F/JPX/BWT159rDxU8 yTR7owizsmZqDbxiVvJ54slzsLpSRXqbakmejYc5W663wVfl/UzifM4RFaeLW2Ra aQkLYj2qZQW8+ySVAmlsPZqIp5McAmmDqHcMm1nG6koR/FnkRZ8yIxRyYuJ7EBj4 fkT/udd3GkHlc9zUJ73g== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v07c6286b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 07:40:58 +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 3BF7ev71021940 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 07:40:57 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:53 -0800 From: Luo Jie To: , , , , , , , , , , , , CC: , , , Subject: [PATCH v8 07/14] net: phy: at803x: add the possible_interfaces Date: Fri, 15 Dec 2023 15:39:57 +0800 Message-ID: <20231215074005.26976-8-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-GUID: 9Z0uW0s37wvLdjGJ4fJsZZfAowzMiEOz X-Proofpoint-ORIG-GUID: 9Z0uW0s37wvLdjGJ4fJsZZfAowzMiEOz 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_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=954 mlxscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 phishscore=0 adultscore=0 impostorscore=0 lowpriorityscore=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: 1785333368611115367 X-GMAIL-MSGID: 1785333368611115367 When qca808x works on the interface mode sgmii or 2500base-x, the interface mode can be switched according to the PHY link speed. Signed-off-by: Luo Jie --- drivers/net/phy/at803x.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index bb382089ab77..cd1bdb61d122 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -2179,10 +2179,22 @@ static void qca808x_link_change_notify(struct phy_device *phydev) QCA8081_PHY_FIFO_RSTN, phydev->link ? QCA8081_PHY_FIFO_RSTN : 0); } +static void qca808x_fill_possible_interfaces(struct phy_device *phydev) +{ + unsigned long *possible = phydev->possible_interfaces; + + if (phydev->interface != PHY_INTERFACE_MODE_10G_QXGMII) { + __set_bit(PHY_INTERFACE_MODE_2500BASEX, possible); + __set_bit(PHY_INTERFACE_MODE_SGMII, possible); + } +} + static int qca8084_config_init(struct phy_device *phydev) { int ret; + qca808x_fill_possible_interfaces(phydev); + /* Invert ADC clock edge */ ret = at803x_debug_reg_mask(phydev, QCA8084_ADC_CLK_SEL, QCA8084_ADC_CLK_SEL_ACLK,