Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1989987rdb; Tue, 20 Feb 2024 13:22:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWQyQifkzBxNTIjSM984kT1lgoNh/b12Vc0kzdHgbC1S70j5BIPbA0Q/6ML6dcLJs6jNghQfWx+oGZZ4wL3nPv3v+tEXlMtcwxf3KGAdA== X-Google-Smtp-Source: AGHT+IF1wibKKbhuQe56TSrfZFF1Y/GonwYxVn76tN9uHhOMbUGpUgN0NSRU1nhYND6iCIsGwA4s X-Received: by 2002:a05:6a21:3994:b0:19c:a4d3:2041 with SMTP id ad20-20020a056a21399400b0019ca4d32041mr24400300pzc.42.1708464177348; Tue, 20 Feb 2024 13:22:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708464177; cv=pass; d=google.com; s=arc-20160816; b=zg3uI6M10nKHq8vwnxbmvrnN07j7Ly0DvRr5PqhQEWTkpsVE6rdAEUiTLV2q2sO609 oX4Hls7nTegbpQW2w2DoIkPAsBxH8uGZsoqzcO9SVa8wexOfGy+zrsfK1dYIiXNTIfFq zV+C2pD0phTDi8c0nmrMFde2eQKRJEU8MSeWGAfhRPPZReZizBxft1hJT673cnvQDiP9 8ZfN8MHRPdzaRi7ifDgnKNBoUk8TZBBjzYYIUecUlCfpWfvktYTcZKtZNA0KPPc9dWcz 01WE8kV6hkE9H/OTXCQBRAmAwBYC8YDCTLFOZNDXt/Ce5F04ihXop6sBQY4ROOGlQLMV GKYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=OdMEj7azN4uCGGFB9DoExghf1hCn72OYfVqg/ygKTi4=; fh=ua1hXNv+Z72KORKZmjRvKD26z2XUrsgZSTYLBVj0dtw=; b=IBmF0Z8s0vKSFBcjk1L+zXrOucXAzGlGtBGvyxsigNOVugdIFe5CiA2Wyblam1+SAB lgqA05C9YU19noe4ALEZgl0AoxxZcjFj5nDb2xxlBinzXimNJSHIbffsEjXZTd5OkZJK IqmDUjFDhmEN0lq5s6QRibzG5hdUdrKTbTl2PQiJEKfZDqUhwNLtXklN1auvGF4Shnll egqcJwq2SzyUnjSRgXxw6jFjKPv+Lp4wUwFZO8WpF7Fa47RHjdj9+lrLx1h2jQN0TZh9 P/Dz/TVZWjitaLXHqf1/ofQQvN8m8bwmgD4+1bBYomUoLNWJ7DdAT1QOTHJuj4ziccYX pr3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=F4iJGJTv; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-73722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73722-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y62-20020a638a41000000b005d8e36d9e11si6832942pgd.149.2024.02.20.13.22.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 13:22:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73722-linux.lists.archive=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=F4iJGJTv; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-73722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73722-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0D576284D27 for ; Tue, 20 Feb 2024 21:22:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02035151CFE; Tue, 20 Feb 2024 21:22:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="F4iJGJTv" 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 7C35F2DF9F; Tue, 20 Feb 2024 21:22:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708464166; cv=none; b=iCUYEhcmRpVz+unGLoZUni41JPdQU0dZ7YH7kzroH+ZIX3viOFNJg9EtTihjFH2or0WVbsnPhHqf/Ei5Vo014kqvqkiWHgDgHhmrfA5hvCGkwMjtm63c9Ajp95kQx48+2GxvHISkkkkablBwEERMaiUyG2l+xXWS8TgooAilgvw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708464166; c=relaxed/simple; bh=s931faE8/4ZR1+VSUsvD//8L/Mzovh6mhsJBinlfuEk=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=PE5WIqQNuIEuQSbICdQGqMiunpQ4n51cvS22MAy+NS0MMv4cNWXOMaTgIGs0YKCvsmOs5mltJ+0zh05OBlsgFgBeuK3Z94FAuwr5oF/ySLqfpxfLVBPox56L+sQC/RTdzJimNoORlvLcx1od099u1Myrby2MHrJeSzDvIW0+CXE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=F4iJGJTv; arc=none smtp.client-ip=205.220.168.131 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 (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41KJD5hY002449; Tue, 20 Feb 2024 21:22:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=OdMEj7azN4uCGGFB9DoExghf1hCn72OYfVqg/ygKTi4=; b=F4 iJGJTvnw88Ez4o1ZtCTy273OpTQnJWq0SO4RMCfiSWfT9NS2iStDfZoYng4YS9Zq Lrdg7/hfBdWWZ7MJtDZWBAkKBjwqDrH22Rt/Q1OLXngrcmh76hhqZWDgSWOZKptC 4NUeQZ76ydWzLo9612rcyFaYa7w7Gp5ZPRuR/5yckjX4/LDCagjHGdDRkLTgNNg/ kpFJSgd9xULSx5bznnAuz61tiGrmT+2gkXXuso10clRG4FKChfr7QRIhDE2Dtb9i CGLQo2O92rA3BRyeugCUu4EFs/ZclhM3GYu1O4T+m8EsoW63WSo9nop3rFuXdZOi GmLUafi6cndh5px8FbBg== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wd21s089c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Feb 2024 21:22:24 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41KLMNDp025986 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Feb 2024 21:22:23 GMT Received: from [10.46.19.239] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 20 Feb 2024 13:22:20 -0800 Message-ID: Date: Tue, 20 Feb 2024 13:22:19 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v5] net: stmmac: dwmac-qcom-ethqos: Add support for 2.5G SGMII To: Sneh Shah , Vinod Koul , Bhupesh Sharma , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni , Maxime Coquelin , , , , , CC: , Andrew Halaney References: <20240220050735.29507-1-quic_snehshah@quicinc.com> Content-Language: en-US From: "Abhishek Chauhan (ABC)" In-Reply-To: <20240220050735.29507-1-quic_snehshah@quicinc.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: oj5a9uhE6Yc3ERR5VRnTqQ-Be2wgTtNV X-Proofpoint-GUID: oj5a9uhE6Yc3ERR5VRnTqQ-Be2wgTtNV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-20_06,2024-02-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 impostorscore=0 mlxscore=0 suspectscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402200153 On 2/19/2024 9:07 PM, Sneh Shah wrote: > Serdes phy needs to operate at 2500 mode for 2.5G speed and 1000 > mode for 1G/100M/10M speed. > Added changes to configure serdes phy and mac based on link speed. > Changing serdes phy speed involves multiple register writes for > serdes block. To avoid redundant write operations only update serdes > phy when new speed is different. > For 2500 speed MAC PCS autoneg needs to disabled. Added changes to > disable MAC PCS autoneg if ANE parameter is not set. > > Signed-off-by: Sneh Shah Tested-by: Abhishek Chauhan # sa8775p-ride Reviewed-by: Abhishek Chauhan > --- > v5 changelog: > - Updated commit message with more details on MAC PCS autoneg disable > v4 changelog: > - Made cosmetic changes > v3 changelog: > - updated commit message > --- > v2 changelog: > - updated stmmac_pcs_ane to support autoneg disable > - Update serdes speed to 1000 for 100M and 10M also--- > --- > .../stmicro/stmmac/dwmac-qcom-ethqos.c | 26 +++++++++++++++++++ > .../net/ethernet/stmicro/stmmac/stmmac_pcs.h | 2 ++ > 2 files changed, 28 insertions(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > index 31631e3f89d0..6bbdbb7bef44 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > @@ -106,6 +106,7 @@ struct qcom_ethqos { > struct clk *link_clk; > struct phy *serdes_phy; > unsigned int speed; > + int serdes_speed; > phy_interface_t phy_mode; > > const struct ethqos_emac_por *por; > @@ -606,19 +607,39 @@ static int ethqos_configure_rgmii(struct qcom_ethqos *ethqos) > */ > static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos) > { > + struct net_device *dev = platform_get_drvdata(ethqos->pdev); > + struct stmmac_priv *priv = netdev_priv(dev); > int val; > > val = readl(ethqos->mac_base + MAC_CTRL_REG); > > switch (ethqos->speed) { > + case SPEED_2500: > + val &= ~ETHQOS_MAC_CTRL_PORT_SEL; > + rgmii_updatel(ethqos, RGMII_CONFIG2_RGMII_CLK_SEL_CFG, > + RGMII_CONFIG2_RGMII_CLK_SEL_CFG, > + RGMII_IO_MACRO_CONFIG2); > + if (ethqos->serdes_speed != SPEED_2500) > + phy_set_speed(ethqos->serdes_phy, SPEED_2500); > + ethqos->serdes_speed = SPEED_2500; > + stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 0, 0, 0); > + break; > case SPEED_1000: > val &= ~ETHQOS_MAC_CTRL_PORT_SEL; > rgmii_updatel(ethqos, RGMII_CONFIG2_RGMII_CLK_SEL_CFG, > RGMII_CONFIG2_RGMII_CLK_SEL_CFG, > RGMII_IO_MACRO_CONFIG2); > + if (ethqos->serdes_speed != SPEED_1000) > + phy_set_speed(ethqos->serdes_phy, SPEED_1000); > + ethqos->serdes_speed = SPEED_1000; > + stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0); > break; > case SPEED_100: > val |= ETHQOS_MAC_CTRL_PORT_SEL | ETHQOS_MAC_CTRL_SPEED_MODE; > + if (ethqos->serdes_speed != SPEED_1000) > + phy_set_speed(ethqos->serdes_phy, SPEED_1000); > + ethqos->serdes_speed = SPEED_1000; > + stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0); > break; > case SPEED_10: > val |= ETHQOS_MAC_CTRL_PORT_SEL; > @@ -627,6 +648,10 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos) > FIELD_PREP(RGMII_CONFIG_SGMII_CLK_DVDR, > SGMII_10M_RX_CLK_DVDR), > RGMII_IO_MACRO_CONFIG); > + if (ethqos->serdes_speed != SPEED_1000) > + phy_set_speed(ethqos->serdes_phy, ethqos->speed); > + ethqos->serdes_speed = SPEED_1000; > + stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0); > break; > } > > @@ -799,6 +824,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) > "Failed to get serdes phy\n"); > > ethqos->speed = SPEED_1000; > + ethqos->serdes_speed = SPEED_1000; > ethqos_update_link_clk(ethqos, SPEED_1000); > ethqos_set_func_clk_en(ethqos); > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h > index aefc121464b5..13a30e6df4c1 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h > @@ -110,6 +110,8 @@ static inline void dwmac_ctrl_ane(void __iomem *ioaddr, u32 reg, bool ane, > /* Enable and restart the Auto-Negotiation */ > if (ane) > value |= GMAC_AN_CTRL_ANE | GMAC_AN_CTRL_RAN; > + else > + value &= ~GMAC_AN_CTRL_ANE; > > /* In case of MAC-2-MAC connection, block is configured to operate > * according to MAC conf register.