From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68863606A322 for ; Fri, 4 Dec 2026 11:10:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=lT0ykxht; dkim=fail reason="signature verification failed" (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=dyS7ndTU; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=azv4V4B2 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=vUJphxCrqi+tX2aep9+wGq0hg0kgBtxpKxtr69JDd8A=; b=lT0ykxhtJripzN/w3zKP04k/0n aY9uOKJ9yDIY91X7bPg0p9GFRigbdl5lGGerm+JgP1UvvQY3YB2mQHbm5hIdcMhFAVO4c+4jHUiuw LpeeBFw1z2w9RpER8SgrfTyE5mSKgaLRaUZrMV6TapnBfepGbIL2Vy4436+aJgATOi/r3fDJqnm4s ECUDhgB9CoZuj8QLJj4Wrbua/dCof6H3cKwL4X2igw9++VXhCa7EgTHqaAg/axXW2qVhhadk5vnsW 3zMKMrv8BHQjhqGjWM04ZTsbgrZoPXf5r3bhuw7u4hgRSSwO12QetU7p0eMpID6Y7lr6kSeLEoD/U 2zmUVzog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZRBF-000000005Vt-3YUr; Fri, 04 Dec 2026 11:10:22 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZRBD-000000005VY-1Hkf for linux-phy@lists.infradead.org; Fri, 04 Dec 2026 11:10:20 +0000 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B45ILrQ1541026 for ; Fri, 4 Dec 2026 11:10:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=42fY1oAmz3XHHQY7zW4S2mto SW8+eoF98WXSmWBz7NQ=; b=dyS7ndTU9Lb3Nb12/gbOqdjtDMehfe7HSHQjvwsW SYVT4yWJ96LcBnnHX1kY5Mz7POChp6WvzdhuGozbtB2JmE5D1cpXB8LmnD3IaEjq zETp3dou6mSpXurzA/9mpe+B5PktqJLM5/DlU5QAL4ER//jds2E2KrX+iWgFKJRJ H8LEKr8ovNFgAoNtVjN+XWLnMvBOIubn8qF+/58v9nUWmCI8Hb1MikRVWq2a0n39 pnwhT7T+JD3XhvidIBzvqyS1DvwJ9c8k3ppr+xlIh1dsPCSg95LeUEswGhEnf3Fr +z7UDWfv/8kPwy4kZeD5Wg1LPXrHehVTIfpBn9ruyXQH3w== Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jbq8nh25x-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 04 Dec 2026 11:10:18 +0000 (GMT) Received: by mail-vs1-f72.google.com with SMTP id ada2fe7eead31-7d304016194so589408137.3 for ; Fri, 04 Dec 2026 03:10:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796382617; x=1796987417; darn=lists.infradead.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=42fY1oAmz3XHHQY7zW4S2mtoSW8+eoF98WXSmWBz7NQ=; b=azv4V4B2dT1WZZ6M0bLO5eJCaS4MlYW/Ra2E4i9B/pq/vsVqsF82doUBzJ2p6O618V oO18xxsK3xNuRTbGt3EzcBx+3YI65r2bni7y2CKqvnDMJKufa0KlwNH+RdTXSRqIG1CI JziXqlPyIbbQmaHPf8H9I383yo1LG1zfi0uXmgaob21GrIMAsmlPb9DgvpfIbRFuUIMI pkuJRPl7swstULs6lIliqUHIOtHS2L8qB/USi8R6Liy8A5E1xsrzqDJ+LEdSA9u5sgJW pfkmjSvCTOhhmtNoLBhT7hKtTC5ZSl7ZEPzuT8Fjxlpmw7rvyTnAQRdVQ9ct79jddaXS 7cIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796382617; x=1796987417; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=42fY1oAmz3XHHQY7zW4S2mtoSW8+eoF98WXSmWBz7NQ=; b=kfZaR0riqTNQe5+K+ZJJJRqouxHZAjRPOJ353g52CoiRNSJEDDmugegznqXAWbRKaP QFeU34T/U8YhaNOGT23fcKZ+E08tipcydFbwtOSHCosCy4ISgZFDRlsvwHWUdhKNAEzX cFzIIbHjuJg+ljgXnDEwO/Rk8KyUzbBDetD05NElNwaonpo4HnaJvaEk8SPsLmXy9+ge f4Bu3z21KJd1es3RIfeFf+mbm4i19YzHiBGfOUMsFSgn3a8Kwvl3+eF/FHpneVAa1/O4 EEVY+gmlDM5AERvSJ3D2bNNB4tOiIsA4nGzsTH7JGhkNnotc7+2FyiHXxpOqeoCiNYYH Na6g== X-Forwarded-Encrypted: i=1; AL+hErHL7Y3rsXVpBBJdnNThAyjgIlCa7FZBMyJvRNah4smzL8fPYsU3VEBy8I/5/Y1ZlOsNxM1uW+q/3Aw=@lists.infradead.org X-Gm-Message-State: APuU4Z/FhZ4ix3ohzc4tru7EwVqFC54HeD/G7sLhVhYjoyA8TpckRZ9f vDeJ2DTsFVLnLQH6NwDesKtABTmhGDduFuGETy9Ya1VeKSLtOWB8bzoAxtG7SA0m/WFutupncfc AARscxLN2t7bkLo9yLbliHScK2Xx6LvV0EiJYg2blmHSq93c2w/IErwMqaVa1Xp1znwbFfdMyOV ia X-Gm-Gg: AZFdTZfA0P9eCCEOCD36fDB+Mqi1Ti0enV3XhPvElRTdiSrztTWFzO1BraPfUXOOba+ WAPQJNOdk3/vHsiXNWMP0H+fQ/UXIPE7pxar7d0fMs0p4SrVbsYPnnKd4yHkugzgkSXHkGnXB9u njb5nNRp9ZBpm5jQGmpGPoDFbho/E1hjO0v0N+UCsavEEYDNLGYBIs/Dl30AOVsHZsjFgTHHjEH ru1xRAf3RwiumBf6EpJ5+zTljeVpY8n92XjmMQ8i4CWsWhaCU1axnQ9IaDtuTseuC3dsNQBUVcE v3FyGjyctB3AcZEgNEEGtsESOk+jEeHq8DIrzc71IdcnFk1DkaaPKCx4FPTKf9x7OrLC8HXniT9 qZEGs5ojYXuWXwQnTU5G/6HYozpHeyhgcDjQC6VMNp3tjs9m/duyHRNc56AKHjA== X-Received: by 2002:a05:6102:32d0:b0:7a8:10eb:96ce with SMTP id ada2fe7eead31-7daec54397cmr1101112137.4.1796382617368; Fri, 04 Dec 2026 03:10:17 -0800 (PST) X-Received: by 2002:a05:6102:32d0:b0:7a8:10eb:96ce with SMTP id ada2fe7eead31-7daec54397cmr1101084137.4.1796382616849; Fri, 04 Dec 2026 03:10:16 -0800 (PST) Received: from localhost ([130.25.105.85]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d173ab8e0bsm5000534f8f.38.2026.12.04.03.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 03:10:15 -0800 (PST) Date: Fri, 4 Dec 2026 12:10:15 +0100 From: Lorenzo Bianconi To: Mohd Ayaan Anwar Cc: Vinod Koul , Neil Armstrong , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bartosz Golaszewski , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org Subject: Re: [PATCH v2 4/5] phy: qcom: sgmii-eth: parameterize readiness register offsets Message-ID: References: <20261202-nord_ethernet_serdes-v2-0-95bb41a719c7@oss.qualcomm.com> <20261202-nord_ethernet_serdes-v2-4-95bb41a719c7@oss.qualcomm.com> X-Archived-By: MIME-Version: 1.0 In-Reply-To: <20261202-nord_ethernet_serdes-v2-4-95bb41a719c7@oss.qualcomm.com> X-Proofpoint-ORIG-GUID: ew0wlWOnmKpx5X1ySM9K-u-l5AsCzam5 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjA0MDA0NCBTYWx0ZWRfX8t9wNI+bPWDn Rcpl4HqMrLG1JhPLfbPro47OwCe0iOCFEOZX/w/GSHRgmzZxiEdFFGkaLML3M/GGuVeVxFNVT18 cJRVM694NBL4VRsB90Oxj/UrWlAPTJE= X-Authority-Analysis: v=2.4 cv=dqdOmFg4 c=1 sm=1 tr=0 ts=6b129f9a cx=c_pps a=DUEm7b3gzWu7BqY5nP7+9g==:117 a=RcFDq6c+avmIvxkL9iwlxA==:17 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=3MHTa3xtJbt8UvEQfM0A:9 a=CjuIK1q_8ugA:10 a=kU3m5UFqUzWtPP5fgv4A:9 a=-aSRE8QhW-JAV6biHavz:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjA0MDA0NCBTYWx0ZWRfXwKWBxtHQToMk zphb/UQIct9ClqBHk5yKWDit7TfAOl4gTjrhiF/bC6xHDIq2qdHREOfJ8v0dRguWBDT1C4DD7TU jK71V+2VnJHOoJXyhQnR2nMUJC/z8nD6K9HU8K8DZG7H7WyPAXnlibqa1wRgGIycH4Xuwtb/bAo SSeDl8O4NEwxPcykEP+r0v16od3raMTxLLFAWYG2vBDeehjALQR6aFa7XjkxevixmMcl/GexSHf 3iMoanmfGBiNAmNZy+gsRlI10RVCYznuK7F+6rwy88N/qrODpreElK8LIIxkfkw9VHy7Iol98Ni sZ3WtWhSWNC4765jxaRina4b4S/bJL6FXPH2LfTKaqdcqrYI8KgjHothGf+TgF5MFpAa2kh0a5a B8m2SoXMZfITJAbBkH+jMJ8GHiFdBtS+IFIenTWpf0waSqfNnLo0XVVXXMJSZcSXNmggyL+AVK5 Gm3qDp0nJe7koiW8HyQ== X-Proofpoint-GUID: ew0wlWOnmKpx5X1ySM9K-u-l5AsCzam5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-04_01,2026-12-03_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 clxscore=1011 phishscore=0 malwarescore=0 impostorscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612040044 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_031019_483782_CF5ED0F1 X-CRM114-Status: GOOD ( 23.66 ) X-Spam-Score: -2.8 (--) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============8157791294270590481==" Sender: "linux-phy" X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 --===============8157791294270590481== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IDHT15Y5BlYliXgI" Content-Disposition: inline --IDHT15Y5BlYliXgI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > QMP v5 and v7 use different offsets for the COM ready and common-status > registers, while the Ethernet SerDes readiness checks otherwise match. >=20 > Move the polling sequence into a helper and supply these two offsets > through match data. Populate the v5 offsets for SA8775P, preserving the > check order, masks, timeouts and error handling. >=20 > Signed-off-by: Mohd Ayaan Anwar Reviewed-by: Lorenzo Bianconi > --- > drivers/phy/qualcomm/phy-qcom-sgmii-eth.c | 92 +++++++++++++++++--------= ------ > 1 file changed, 52 insertions(+), 40 deletions(-) >=20 > diff --git a/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c b/drivers/phy/qual= comm/phy-qcom-sgmii-eth.c > index 25e49f2b6824..2aa32870dd69 100644 > --- a/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c > +++ b/drivers/phy/qualcomm/phy-qcom-sgmii-eth.c > @@ -39,6 +39,8 @@ struct qcom_dwmac_sgmii_phy_match_data { > phy_interface_t interface; > void (*init_1g)(struct regmap *regmap); > void (*init_2p5g)(struct regmap *regmap); > + u32 com_c_ready_status; > + u32 com_cmn_status; > }; > =20 > struct qcom_dwmac_sgmii_phy_data { > @@ -49,6 +51,53 @@ struct qcom_dwmac_sgmii_phy_data { > phy_interface_t interface; > }; > =20 > +static inline int > +qcom_dwmac_sgmii_phy_poll_status(struct regmap *regmap, unsigned int reg, > + unsigned int bit) > +{ > + unsigned int val; > + > + return regmap_read_poll_timeout(regmap, reg, val, > + val & bit, 1500, 750000); > +} > + > +static int qcom_dwmac_sgmii_phy_poll_ready(struct phy *phy) > +{ > + struct qcom_dwmac_sgmii_phy_data *data =3D phy_get_drvdata(phy); > + const struct qcom_dwmac_sgmii_phy_match_data *match_data =3D data->matc= h_data; > + struct device *dev =3D phy->dev.parent; > + > + if (qcom_dwmac_sgmii_phy_poll_status(data->regmap, > + QSERDES_QMP_PLL + match_data->com_c_ready_status, > + QSERDES_COM_C_READY)) { > + dev_err(dev, "QSERDES_COM_C_READY_STATUS timed-out"); > + return -ETIMEDOUT; > + } > + > + if (qcom_dwmac_sgmii_phy_poll_status(data->regmap, > + QSERDES_PCS + QPHY_PCS_PCS_READY_STATUS, > + QSERDES_PCS_READY)) { > + dev_err(dev, "PCS_READY timed-out"); > + return -ETIMEDOUT; > + } > + > + if (qcom_dwmac_sgmii_phy_poll_status(data->regmap, > + QSERDES_PCS + QPHY_PCS_PCS_READY_STATUS, > + QSERDES_PCS_SGMIIPHY_READY)) { > + dev_err(dev, "SGMIIPHY_READY timed-out"); > + return -ETIMEDOUT; > + } > + > + if (qcom_dwmac_sgmii_phy_poll_status(data->regmap, > + QSERDES_QMP_PLL + match_data->com_cmn_status, > + QSERDES_COM_C_PLL_LOCKED)) { > + dev_err(dev, "PLL Lock Status timed-out"); > + return -ETIMEDOUT; > + } > + > + return 0; > +} > + > static int > qcom_dwmac_sgmii_phy_select_init(const struct qcom_dwmac_sgmii_phy_match= _data *match_data, > int submode, void (**init)(struct regmap *regmap)) > @@ -246,20 +295,9 @@ static void qcom_dwmac_sgmii_phy_init_v5_2p5g(struct= regmap *regmap) > regmap_write(regmap, QSERDES_PCS + QPHY_PCS_PHY_START, 0x01); > } > =20 > -static inline int > -qcom_dwmac_sgmii_phy_poll_status(struct regmap *regmap, unsigned int reg, > - unsigned int bit) > -{ > - unsigned int val; > - > - return regmap_read_poll_timeout(regmap, reg, val, > - val & bit, 1500, 750000); > -} > - > static int qcom_dwmac_sgmii_phy_calibrate(struct phy *phy) > { > struct qcom_dwmac_sgmii_phy_data *data =3D phy_get_drvdata(phy); > - struct device *dev =3D phy->dev.parent; > void (*init)(struct regmap *regmap); > int ret; > =20 > @@ -269,35 +307,7 @@ static int qcom_dwmac_sgmii_phy_calibrate(struct phy= *phy) > =20 > init(data->regmap); > =20 > - if (qcom_dwmac_sgmii_phy_poll_status(data->regmap, > - QSERDES_QMP_PLL + QSERDES_V5_COM_C_READY_STATUS, > - QSERDES_COM_C_READY)) { > - dev_err(dev, "QSERDES_COM_C_READY_STATUS timed-out"); > - return -ETIMEDOUT; > - } > - > - if (qcom_dwmac_sgmii_phy_poll_status(data->regmap, > - QSERDES_PCS + QPHY_PCS_PCS_READY_STATUS, > - QSERDES_PCS_READY)) { > - dev_err(dev, "PCS_READY timed-out"); > - return -ETIMEDOUT; > - } > - > - if (qcom_dwmac_sgmii_phy_poll_status(data->regmap, > - QSERDES_PCS + QPHY_PCS_PCS_READY_STATUS, > - QSERDES_PCS_SGMIIPHY_READY)) { > - dev_err(dev, "SGMIIPHY_READY timed-out"); > - return -ETIMEDOUT; > - } > - > - if (qcom_dwmac_sgmii_phy_poll_status(data->regmap, > - QSERDES_QMP_PLL + QSERDES_V5_COM_CMN_STATUS, > - QSERDES_COM_C_PLL_LOCKED)) { > - dev_err(dev, "PLL Lock Status timed-out"); > - return -ETIMEDOUT; > - } > - > - return 0; > + return qcom_dwmac_sgmii_phy_poll_ready(phy); > } > =20 > static int qcom_dwmac_sgmii_phy_power_on(struct phy *phy) > @@ -448,6 +458,8 @@ static const struct qcom_dwmac_sgmii_phy_match_data s= a8775p_match_data =3D { > .interface =3D PHY_INTERFACE_MODE_SGMII, > .init_1g =3D qcom_dwmac_sgmii_phy_init_v5_1g, > .init_2p5g =3D qcom_dwmac_sgmii_phy_init_v5_2p5g, > + .com_c_ready_status =3D QSERDES_V5_COM_C_READY_STATUS, > + .com_cmn_status =3D QSERDES_V5_COM_CMN_STATUS, > }; > =20 > static const struct of_device_id qcom_dwmac_sgmii_phy_of_match[] =3D { >=20 > --=20 > 2.34.1 >=20 --IDHT15Y5BlYliXgI Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCaxKflwAKCRA6cBh0uS2t rLXKAQDmAKlwwfGWeuBZMUlZFVOvNMO4t1mkTYMeV0+y9emS9QD9HgHxaIDVrswi +up1XyHRFIhVjK8hG+0HUBhpwYlodgA= =cZ+4 -----END PGP SIGNATURE----- --IDHT15Y5BlYliXgI-- --===============8157791294270590481== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy --===============8157791294270590481==--