From nobody Mon Feb 9 17:59:22 2026 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 C811123B0 for ; Fri, 24 Jan 2025 11:23:10 +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=1737717792; cv=none; b=Zt/D8hfHsJ2H4sbWLUa6YihxvZkbXDuut0xYfgeQaKST3r+dddwhBpOKP4lWOTP7ZSQgbpkTGHCHK9rcL9bP+OErc5zJ/PIBWz+HhSe6+FfQ1pysrmCPlG7FWfUbpvXiTcyfyVNKJzAtYSAQ3qSG9irJqWNA84ItQhWyfLf0Egw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737717792; c=relaxed/simple; bh=1cCWyVa5AK2/6g1dA5pRl5YsQKIo2vs/YZuAmrzjF+g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ehoUiwgBOVWA8ssxP5RELsVTQURZyVKEZpIMT+HvVDBUnJrSkR8GRjUFkbTy2MmKXACgw/hwl4mZqWCkEe7AyUq19ACSRrMUcnVWfPLMb1OhqtoECWy9IlEqurMpBXdyaTDwV3O6YzZxNxprKvY7SQeyQBtL8VKQlc8dRSX6Fco= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=On3/Jag2; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="On3/Jag2" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50OAKR9U018290 for ; Fri, 24 Jan 2025 11:23:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= r3fyHfyMlBiD4pkCqczBKmlgoz+Ny2UI/7GNprFqSSU=; b=On3/Jag2cLhSaqMy tCFOKub8I2bQ1uB37dtEsbiCox22aIxINxnSwwnmEJW7Zs64uvW1b9yfP7vCDeoR dhefG0720a/IuXkFjqHbflzDuLhx5Y/KBdbPzE+iIcmjPTffWFWmrHNpFV7++L0d uSaO5JOTdfbahldA/9yccU4SeE576331ZiiUKMh785Bthm02WXH4qA9sSKfdJ3WR Y/W/vRzk6s4CxSin4rjQ+/m6W6jfbF1hHWd30E+5goptIUL03nFOuBMHvZ+EM0dq yw+i/crA4jN5/4C/vbtKQUGLISmRc8RRYH/A7DqBr5/IgchFrkYZb0qHE4/GJmtd O55jTg== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44c91ag71r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 24 Jan 2025 11:23:09 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2166f9f52fbso59967345ad.2 for ; Fri, 24 Jan 2025 03:23:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737717787; x=1738322587; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r3fyHfyMlBiD4pkCqczBKmlgoz+Ny2UI/7GNprFqSSU=; b=HcympJHBgRaFDaz53AzHD6qOkEGEwoPI5gc/V6q9wRcz7vlaBgXZpE2C959KXp83mE H/1xVoonFe/VZ7hSxWBFg0z57ViUm0uI0gJqoCsubqQjKGqL8KjOGuhKhtk1SxVgaAOe +BUMmJ8kZ4ylpp2+4jN9nr6fb2jNj+RTtcy9457EwV6wa1JRk/3pxHbbs882QZ0VQygT sJ3ti0uF8pLPbpcS3wcj712tG1eS83ow2tWdHXGGfgrtyomvVfDipJDeBm3epWpT/G4x yqhGsWCS1qHmkWWz96zVSFJl+eTJmn5tgqmq4F4GhklruIecNs/yqY34M8M/xNP8dqQo P4lA== X-Forwarded-Encrypted: i=1; AJvYcCUeaiIT9djKxOm41r/onN0VWSSvV4xMIfv7siv/sXddKr4duACooVQcyCmSATqR7lk1o/PW6m5xVlMh6Mk=@vger.kernel.org X-Gm-Message-State: AOJu0Yxrkl96zfjW1bQKT14iYlk48fg6VATxF+y3HXy+iXDHQeeh8D2/ E6rfJiEI3l1JM/VW1R4Eg8hf+qukI9VnXdEOiSpLflCkzq9BFj7tx5574qyNDtck3WxC1c2E5Bm Ssx6wj99jkkQKKm7poEPI33Rs2phVB7vg70Vs2Duj37nYgUOFz3BQvX31iAetZ3k= X-Gm-Gg: ASbGncsuaav0KFBUV/qjKEfS3bHOd/59t5l2/BYHZ3U750z/+siMq80fIepF8SsihQg D3+Y+SKza2ILZCxuWNCxTvbisi0TXn1DhwtqNOU0zeZBr8kKvxNjYlVchGMhFg6EFuCvTufgU7u 2GPY/Hb7U+0iAPdZs7gkkVJqeGg3MiyNZXtxKnlBd6791lYA4BPUe+l1Prx1F5dU/8yOQFHbdPL yfLu/E30yH752oMzYvMhDybeb5AuNOnehmCp+2a+q+ZiKrUAwIiA+Z/SY/ca4d5/lQfeTqkKSjV 8DdmQwZfIMKrlRUyCqV3whTm2qSENA== X-Received: by 2002:a17:902:e544:b0:21a:87d1:168a with SMTP id d9443c01a7336-21c3563c6e6mr493276965ad.41.1737717787505; Fri, 24 Jan 2025 03:23:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFy2tDIcgxd5++o9SOPR2tYwiD2dziflaSrZA/gwxFQXN3UBI1mtwMZRzdExbNkM+eWLzrPqw== X-Received: by 2002:a17:902:e544:b0:21a:87d1:168a with SMTP id d9443c01a7336-21c3563c6e6mr493276635ad.41.1737717787163; Fri, 24 Jan 2025 03:23:07 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21da414cc20sm14025385ad.165.2025.01.24.03.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 03:23:06 -0800 (PST) From: Krishna Chaitanya Chundru Date: Fri, 24 Jan 2025 16:52:47 +0530 Subject: [PATCH v4 1/4] arm64: dts: qcom: x1e80100: Add PCIe lane equalization preset properties Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250124-preset_v2-v4-1-0b512cad08e1@oss.qualcomm.com> References: <20250124-preset_v2-v4-0-0b512cad08e1@oss.qualcomm.com> In-Reply-To: <20250124-preset_v2-v4-0-0b512cad08e1@oss.qualcomm.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Helgaas , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, konrad.dybcio@oss.qualcomm.com, quic_mrana@quicinc.com, quic_vbadigan@quicinc.com, Bjorn Andersson , Konrad Dybcio , Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737717776; l=1380; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=1cCWyVa5AK2/6g1dA5pRl5YsQKIo2vs/YZuAmrzjF+g=; b=O3T80ZKL0sUlxwGUvDzRVdMKESDBubPScoivfbYlONH8VRavEh0VwCnLXbPceheS0NYL3m5N4 iwVCUDvQjQfA5Jkf9dzx6putbgPDoxEbIiDQADqY0XC42Cc5Dh7zv04 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: cIOraJmFZW09GFgPK4rkG1veY_oMBiXr X-Proofpoint-GUID: cIOraJmFZW09GFgPK4rkG1veY_oMBiXr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-24_04,2025-01-23_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=934 spamscore=0 phishscore=0 clxscore=1015 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501240083 Add PCIe lane equalization preset properties for 8 GT/s and 16 GT/s data rates used in lane equalization procedure. Signed-off-by: Krishna Chaitanya Chundru --- This patch depends on the this dt binding pull request which got recently merged: https://github.com/devicetree-org/dt-schema/pull/146 --- arch/arm64/boot/dts/qcom/x1e80100.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/x1e80100.dtsi b/arch/arm64/boot/dts/q= com/x1e80100.dtsi index a36076e3c56b..6a2074297030 100644 --- a/arch/arm64/boot/dts/qcom/x1e80100.dtsi +++ b/arch/arm64/boot/dts/qcom/x1e80100.dtsi @@ -2993,6 +2993,10 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, phys =3D <&pcie6a_phy>; phy-names =3D "pciephy"; =20 + eq-presets-8gts =3D /bits/ 16 <0x5555 0x5555>; + + eq-presets-16gts =3D /bits/ 8 <0x55 0x55>; + status =3D "disabled"; }; =20 @@ -3115,6 +3119,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, phys =3D <&pcie5_phy>; phy-names =3D "pciephy"; =20 + eq-presets-8gts =3D /bits/ 16 <0x5555 0x5555>; + status =3D "disabled"; }; =20 @@ -3235,6 +3241,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, phys =3D <&pcie4_phy>; phy-names =3D "pciephy"; =20 + eq-presets-8gts =3D /bits/ 16 <0x5555 0x5555>; + status =3D "disabled"; =20 pcie4_port0: pcie@0 { --=20 2.34.1 From nobody Mon Feb 9 17:59:22 2026 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 4E03C21B8F8 for ; Fri, 24 Jan 2025 11:23:14 +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=1737717795; cv=none; b=ALNkF/gyZzzv0HUjbkJJXQ9gDnmZD4GuKH/y3pXkURU0u8R9Nq3ML3O/vMbguzjSQMwhhXHkLAxWw/0tri51YfSmxG5+Nu2J/UKMGAYDLs5lfWyY1oCX9fjFMWN5723qCOzCEoOF4jsT603s571CorOTNIQS8nFXfGAObc5tq6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737717795; c=relaxed/simple; bh=f7z3CtNmxsHSKM03nohqE7aPIUwkTTXaD4CtcTYvgDI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LcHUIQqr2LMIlGEwye8uvlH9Spy14YsLZjdRgBg2X9C1/U3QK4l8nT854G6DbzEJMoJR4cmVuBtTtvsMHY4zx1fIhf+Lbxi2nIIv4KX+SPwnBwfHkISQSX8YTRaSMvUMiY+Q/1MTu3ZcNQ0Kf7mNBPmGNbGCElEWy9EGcUh56+k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=kkZbhuBd; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="kkZbhuBd" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50O3JIEu028339 for ; Fri, 24 Jan 2025 11:23:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= oPZTHj57MEyCMgMIvbxGmIatD2m1gGCN5WI13Bi7xRU=; b=kkZbhuBdHl1uAuGJ HBFUN73RL2SeQ2BP7OmraJE1AqijhtepG7nv+ExmAFRGZat08YNjwrP14rl7YmtU Ihq0L45meBLwIjzKFyg8PLtsHKfpMN1wzjtbJb9U9RiixlSzGKfnzhMaYxXFF9wv SuREmW9tKRklReA9raAGhXmUtJzipF0L9zQLoxUVQ9mde5ozXy5q0+Lh58oz6O7P 0zlr1zjIHcXnjfTOhTsQ29UCvl5cjMwFcfBfPFCk2ClcqKVbb5Ut5ZNYhMeliVhS FttmKtjxUxzYHwKtjbsKQxqohm/xkZ8iHLCzxNDpzDhgHo80rG5Z6c2xoYhYR2i3 TMBDew== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44c2uj96fn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 24 Jan 2025 11:23:13 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2166464e236so53611865ad.1 for ; Fri, 24 Jan 2025 03:23:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737717793; x=1738322593; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oPZTHj57MEyCMgMIvbxGmIatD2m1gGCN5WI13Bi7xRU=; b=vTWBlenwTMFP1pC/u3RxQHMtSzkkL9LNay2PuSBrTpaIlq2+Szq4Aaj5jT889l+d18 MYF1pMRIdd+jo4hgc0LER/CIk68dMMy665a2tQ/xkUSledEHm2fapk9+eCP1p0AiSTnO 8w9VMuV2o8/dUXTyvWY4z1IhRBfyq3Br+Ct3iAoXWF/uIXsJXi09S1D56CBQNxkvEu7M I0d08ekWhyp6iglZTSMTV/iQxrkjuMgTB380KZokCV6xpSa9IjcxA1DesPXko/r5IjUP ZsWWnORBWasOOe904B1ZvTpUZXri3VfYZd14vaMywHh31dqcVqXD3u3yg4jQLGLohBXx H4rw== X-Forwarded-Encrypted: i=1; AJvYcCUhArlQcsw5Z3dh1VgTVa5VawoKxQ7HAfOQyYx6xB+lhgbIa+9lJx5uoWMsukUMvgZwxoC7SyZG/gqd+Gw=@vger.kernel.org X-Gm-Message-State: AOJu0YzD96mQALYe25OD1t3ZCPzVYkbJAC2WFrNsVU0lz7Oag98re0TF I9pqe6MKbTbZMxcHKrsXFIi2Chyo2l/jLKluvbhflMLtO+FZ1Z8jXvpCXaOTDlEZ2eLbQsDG6RP YJuMSKggkjaWEbc3Q0fskq4Lt6519dhxpJrA1TXbyJHkScBYdqMCMDrUC/ngNars= X-Gm-Gg: ASbGnctVsATHZ3qBY2QpvvRNNu9kLYKWPjN2iRszoqOhVjdXB6S4C3FrxO4X0D/kfqF ok/4tFjBNRwk7ygFlWZhorhYmEhgIDYsFjB419rqQS83xmzW0tMsD9JOz5iZ0wIiLSjLkrlah3N wsbYzq81DmymwhsclTcJ1rTJ2/F7wiJwcxq5rrkpdoSOh2ylSxtGiwJYi88oCtky52PK4ltFTMD CDz32DqeL0ssAkapaWungdh/mtmv/mqryHHNLW7xC2yK5YpjHcHVOSGkgC3fKKuVMcuG7UboOcN tJFvTv+8HCryhzHytrgg2Uf4SU6M+A== X-Received: by 2002:a17:902:f681:b0:216:1cfa:2bda with SMTP id d9443c01a7336-21c3564858emr475850395ad.43.1737717792788; Fri, 24 Jan 2025 03:23:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEr5DYYXHE2G/vBfLJJCN6ckREbrK5+wnUplikzoVZhqw80AYnBOws3G++Q2Ix4csuj5Tuxeg== X-Received: by 2002:a17:902:f681:b0:216:1cfa:2bda with SMTP id d9443c01a7336-21c3564858emr475849925ad.43.1737717792330; Fri, 24 Jan 2025 03:23:12 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21da414cc20sm14025385ad.165.2025.01.24.03.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 03:23:11 -0800 (PST) From: Krishna Chaitanya Chundru Date: Fri, 24 Jan 2025 16:52:48 +0530 Subject: [PATCH v4 2/4] PCI: of: Add API to retrieve equalization presets from device tree Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250124-preset_v2-v4-2-0b512cad08e1@oss.qualcomm.com> References: <20250124-preset_v2-v4-0-0b512cad08e1@oss.qualcomm.com> In-Reply-To: <20250124-preset_v2-v4-0-0b512cad08e1@oss.qualcomm.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Helgaas , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, konrad.dybcio@oss.qualcomm.com, quic_mrana@quicinc.com, quic_vbadigan@quicinc.com, Bjorn Andersson , Konrad Dybcio , Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737717776; l=4612; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=f7z3CtNmxsHSKM03nohqE7aPIUwkTTXaD4CtcTYvgDI=; b=ONmPOabKI/5+CXlcVHrVmoVXeeLa+NbJKA7XyAUP+yvdzFIStSgyQzc7zxbrQEzYeC/fnPWAJ KCBUFQE8411CxldWCVXPOcrFJlTYhQcHAoFUXYQDP7askNWfbP5Nxd1 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: SVn3OIbuYcx2iKtyg8w0mfbifQe3aukO X-Proofpoint-GUID: SVn3OIbuYcx2iKtyg8w0mfbifQe3aukO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-24_04,2025-01-23_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 mlxscore=0 impostorscore=0 malwarescore=0 adultscore=0 suspectscore=0 bulkscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501240083 PCIe equalization presets are predefined settings used to optimize signal integrity by compensating for signal loss and distortion in high-speed data transmission. As per PCIe spec 6.0.1 revision section 8.3.3.3 & 4.2.4 for data rates of 8.0 GT/s, 16.0 GT/s, 32.0 GT/s, and 64.0 GT/s, there is a way to configure lane equalization presets for each lane to enhance the PCIe link reliability. Each preset value represents a different combination of pre-shoot and de-emphasis values. For each data rate, different registers are defined: for 8.0 GT/s, registers are defined in section 7.7.3.4; for 16.0 GT/s, in section 7.7.5.9, etc. The 8.0 GT/s rate has an extra receiver preset hint, requiring 16 bits per lane, while the remaining data rates use 8 bits per lane. Based on the number of lanes and the supported data rate, this function reads the device tree property and stores in the presets structure. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/of.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/pci/pci.h | 24 +++++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index dacea3fc5128..7aa17c0042c5 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -826,3 +826,50 @@ u32 of_pci_get_slot_power_limit(struct device_node *no= de, return slot_power_limit_mw; } EXPORT_SYMBOL_GPL(of_pci_get_slot_power_limit); + +/** + * of_pci_get_equalization_presets - Parses the "eq-presets-ngts" property. + * + * @dev: Device containing the properties. + * @presets: Pointer to store the parsed data. + * @num_lanes: Maximum number of lanes supported. + * + * If the property is present read and store the data in the preset struct= ure + * assign default value 0xff to indicate property is not present. + * + * If the property is not found or is invalid, returns 0. + */ +int of_pci_get_equalization_presets(struct device *dev, + struct pci_eq_presets *presets, + int num_lanes) +{ + char name[20]; + int ret; + + presets->eq_presets_8gts[0] =3D 0xff; + if (of_property_present(dev->of_node, "eq-presets-8gts")) { + ret =3D of_property_read_u16_array(dev->of_node, "eq-presets-8gts", + presets->eq_presets_8gts, num_lanes); + if (ret) { + dev_err(dev, "Error reading eq-presets-8gts %d\n", ret); + return ret; + } + } + + for (int i =3D 0; i < EQ_PRESET_TYPE_MAX; i++) { + presets->eq_presets_Ngts[i][0] =3D 0xff; + snprintf(name, sizeof(name), "eq-presets-%dgts", 8 << (i + 1)); + if (of_property_present(dev->of_node, name)) { + ret =3D of_property_read_u8_array(dev->of_node, name, + presets->eq_presets_Ngts[i], + num_lanes); + if (ret) { + dev_err(dev, "Error %s %d\n", name, ret); + return ret; + } + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(of_pci_get_equalization_presets); diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 14d00ce45bfa..3a8c04e3b30d 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -7,6 +7,8 @@ /* Number of possible devfns: 0.0 to 1f.7 inclusive */ #define MAX_NR_DEVFNS 256 =20 +#define MAX_NR_LANES 16 + #define PCI_FIND_CAP_TTL 48 =20 #define PCI_VSEC_ID_INTEL_TBT 0x1234 /* Thunderbolt */ @@ -732,6 +734,18 @@ static inline u64 pci_rebar_size_to_bytes(int size) =20 struct device_node; =20 +enum equalization_preset_type { + EQ_PRESET_TYPE_16GTS, + EQ_PRESET_TYPE_32GTS, + EQ_PRESET_TYPE_64GTS, + EQ_PRESET_TYPE_MAX +}; + +struct pci_eq_presets { + u16 eq_presets_8gts[MAX_NR_LANES]; + u8 eq_presets_Ngts[EQ_PRESET_TYPE_MAX][MAX_NR_LANES]; +}; + #ifdef CONFIG_OF int of_pci_parse_bus_range(struct device_node *node, struct resource *res); int of_get_pci_domain_nr(struct device_node *node); @@ -746,7 +760,9 @@ void pci_set_bus_of_node(struct pci_bus *bus); void pci_release_bus_of_node(struct pci_bus *bus); =20 int devm_of_pci_bridge_init(struct device *dev, struct pci_host_bridge *br= idge); - +int of_pci_get_equalization_presets(struct device *dev, + struct pci_eq_presets *presets, + int num_lanes); #else static inline int of_pci_parse_bus_range(struct device_node *node, struct resource *res) @@ -793,6 +809,12 @@ static inline int devm_of_pci_bridge_init(struct devic= e *dev, struct pci_host_br return 0; } =20 +static inline int of_pci_get_equalization_presets(struct device *dev, + struct pci_eq_presets *presets, + int num_lanes) +{ + return 0; +} #endif /* CONFIG_OF */ =20 struct of_changeset; --=20 2.34.1 From nobody Mon Feb 9 17:59:22 2026 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 82D3321C179 for ; Fri, 24 Jan 2025 11:23:19 +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=1737717801; cv=none; b=XPGpEXoxuABk3zLbsLH/DqK3g8buQjQwTm3orfDKqSKtPqxXZ8knShnBF1CVTWNTYAr3R9/4BdqpdxGCZj9/ArB/Wc2ifbWKxIO45Vt17/nZvvvsWYoupxSSGnIVIb8sndCJBMz79W83qS1bUHP6mJLg7ITnhwj63DXW7jrJfbU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737717801; c=relaxed/simple; bh=5rxRkPnumzzfAdemdZBFDf4pCGC4z3dLReWUJOLysOk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eEEQhTE1Z4TmwyRAaTCj9G4GPkF/CEZm/aQn5eYkiski8R5W3U1v8hxmikCTFYDZEVuXfni3QRVl56rjFjwQA//9e9l8G/XAFvFGQmx97Gm4zSPK/nek3LQpYIyCcsCQIiY7sD7+/5sjUq2LUrHKyIwIYMjZ9p08+3esirGYHlE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=D5NYFeEC; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="D5NYFeEC" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50O8bhdr031191 for ; Fri, 24 Jan 2025 11:23:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= yQsJM/reDtTZynjk4EeE4bMecMMhIsTfkx5E7VPjZRU=; b=D5NYFeECrB+NIu2h 0RjuRpUEOxguxk9hUACSGBKDDxE71BQn0PWFc6KO3j7zTlHLAt0o2ky4Ao+8XKtl 2zQ3rWfdUNtddM9z9k+5HCD01oknrLI6JnEe+Do7/vrQTCRlrRR8uGCUlVUrx0nR 7kveaNHmapp4HOqsWjmk/IpidsBSKmIh27p66QgDh5bd2FGJnGh8FUD0c16LYPhm gMrp5OZot+3wCkSQ11hZsreTMgFhg82YxNs0b66bWkRdXo4whZ16DvHRjTdR5eJB JuYwNnLNoaGk9V4bR7D9qVtt0aEpokDyNgPDskvkKymWdj2bQZ7k4Vw9+S/90VYJ 0R6Umw== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44c7h50gp2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 24 Jan 2025 11:23:18 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2161d5b3eb5so38820035ad.3 for ; Fri, 24 Jan 2025 03:23:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737717798; x=1738322598; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yQsJM/reDtTZynjk4EeE4bMecMMhIsTfkx5E7VPjZRU=; b=MEC62aqck/nMPs5XTBQl8n7FYBfeI68gdlkcAUbq3mXMIo5PLwPNhPTK2uklZQHct0 2KhINWYX05OkSTRRXummvWWjGFB7maMh+0RuQlVWndvNGnztDGnbSVe1dQx/2Q4RArPQ kBmayih4RDSZncamD0zl4C2MsbFxaA2i8/r4KU+lE6u3hwhx9Y1fjuOdhCBpFvS7NuN+ ZhPSkSW1oNNbS4s7dvAL5/fn8AwmJxrfuAfSR8TFKYn9kvBcBhYUFJ6YPIs+TBgxi/jO gpKFYStgGwAuGzizufUpr4OlDYwme4ySZ0EgaChoQlC4y2ZMATW3aIPfrdK9tTFjef4s FGDg== X-Forwarded-Encrypted: i=1; AJvYcCVqTxYdEYTXh2SlTCxN6wxL/mzmRDWFdVTe+P1iCiUjryUjFwFFFLte/vfkPzJXSu1c2XMOZjwR3FCrwBQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxkmotgDhhMEN+3mHmZrBz6Bp36LsdGjam5s9Z24DTulaLh5q9p gyqHqHJbsY0Km69+0k7y3g4vUC71xNyKUm+pcMOLykhZZOGCFQW2OyApP/ZAT1J+Fh7mmc4ab0Z i9Xe3F00uV44hZskugk+1xGxIMmh5LArH93jUqq1EjpiqybYNDpmbRjvEz91sBFk= X-Gm-Gg: ASbGncv3F7TjuA3ng8OPQfcFQBTirTSSFm5783hFsjQpibbFuc8wNC2JYmzV2ubfbGP aoZzOZYJhtbU+HYlLTWonxTcgl0d3Kp0dMJXca2xOJ4ZHfl6cMMVgesM8+k9dlf9kepudLVpNXM +hM2Whipv3nzG8ucDr6E6PRh80VP5G6Z6yXY9/kIrbEgS+9Xjx/9cp6wvn6TMdT2IC5ddml28kG ur0Tzph2lLbDxeq1cup2nLFKQjwUTTVNixgDKhqLrhQBlCzf+2PPkk+dGHtZrvePk+HG+vtttEa ptDeikjcix+zvGrVnu2R4W98NuwscA== X-Received: by 2002:a17:902:ea11:b0:216:3889:6f6f with SMTP id d9443c01a7336-21c353ef827mr388132655ad.17.1737717797949; Fri, 24 Jan 2025 03:23:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3Jqk6JwmPr0oV22Ct9YC/haBNCR5+wlGUm1dWyD9lp1UJigU4ZqRujgW8yn5pehGWZ6HDsQ== X-Received: by 2002:a17:902:ea11:b0:216:3889:6f6f with SMTP id d9443c01a7336-21c353ef827mr388132335ad.17.1737717797512; Fri, 24 Jan 2025 03:23:17 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21da414cc20sm14025385ad.165.2025.01.24.03.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 03:23:17 -0800 (PST) From: Krishna Chaitanya Chundru Date: Fri, 24 Jan 2025 16:52:49 +0530 Subject: [PATCH v4 3/4] PCI: dwc: Improve handling of PCIe lane configuration Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250124-preset_v2-v4-3-0b512cad08e1@oss.qualcomm.com> References: <20250124-preset_v2-v4-0-0b512cad08e1@oss.qualcomm.com> In-Reply-To: <20250124-preset_v2-v4-0-0b512cad08e1@oss.qualcomm.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Helgaas , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, konrad.dybcio@oss.qualcomm.com, quic_mrana@quicinc.com, quic_vbadigan@quicinc.com, Bjorn Andersson , Konrad Dybcio , Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737717776; l=3448; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=5rxRkPnumzzfAdemdZBFDf4pCGC4z3dLReWUJOLysOk=; b=DonzVQzdHIl/WfHGG9u0Cqbhe1IO8nnLwtceD1UvRCtOb+1eL/WEb1u3AvWnzxwtvnu2w+jjh /JUC2z5bR+ZBzFWy77WB08SVCXfQqFBvYWAlzX4NH0b3nqUKL7QSwTF X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: pHAPiYsO6JiFM3wn0ZUPX0NkChMGB9H8 X-Proofpoint-GUID: pHAPiYsO6JiFM3wn0ZUPX0NkChMGB9H8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-24_04,2025-01-23_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 malwarescore=0 impostorscore=0 clxscore=1015 adultscore=0 suspectscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501240083 Currently even if the number of lanes hardware supports is equal to the number lanes provided in the devicetree, the driver is trying to configure again the maximum number of lanes which is not needed. Update number of lanes only when it is not equal to hardware capability. And also if the num-lanes property is not present in the devicetree update the num_lanes with the maximum hardware supports. Introduce dw_pcie_link_get_max_link_width() to get the maximum lane width the hardware supports. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-designware-host.c | 3 +++ drivers/pci/controller/dwc/pcie-designware.c | 14 +++++++++++++- drivers/pci/controller/dwc/pcie-designware.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index 3e41865c7290..2cd0acbf9e18 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -504,6 +504,9 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) =20 dw_pcie_iatu_detect(pci); =20 + if (pci->num_lanes < 1) + pci->num_lanes =3D dw_pcie_link_get_max_link_width(pci); + /* * Allocate the resource for MSG TLP before programming the iATU * outbound window in dw_pcie_setup_rc(). Since the allocation depends diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index 6d6cbc8b5b2c..acb2a963ae1a 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -736,6 +736,16 @@ static void dw_pcie_link_set_max_speed(struct dw_pcie = *pci) =20 } =20 +int dw_pcie_link_get_max_link_width(struct dw_pcie *pci) +{ + u32 lnkcap; + u8 cap; + + cap =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + lnkcap =3D dw_pcie_readl_dbi(pci, cap + PCI_EXP_LNKCAP); + return FIELD_GET(PCI_EXP_LNKCAP_MLW, lnkcap); +} + static void dw_pcie_link_set_max_link_width(struct dw_pcie *pci, u32 num_l= anes) { u32 lnkcap, lwsc, plc; @@ -1069,6 +1079,7 @@ void dw_pcie_edma_remove(struct dw_pcie *pci) =20 void dw_pcie_setup(struct dw_pcie *pci) { + int num_lanes =3D dw_pcie_link_get_max_link_width(pci); u32 val; =20 dw_pcie_link_set_max_speed(pci); @@ -1102,5 +1113,6 @@ void dw_pcie_setup(struct dw_pcie *pci) val |=3D PORT_LINK_DLL_LINK_EN; dw_pcie_writel_dbi(pci, PCIE_PORT_LINK_CONTROL, val); =20 - dw_pcie_link_set_max_link_width(pci, pci->num_lanes); + if (num_lanes !=3D pci->num_lanes) + dw_pcie_link_set_max_link_width(pci, pci->num_lanes); } diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/con= troller/dwc/pcie-designware.h index 347ab74ac35a..500e793c9361 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -486,6 +486,7 @@ void dw_pcie_write_dbi2(struct dw_pcie *pci, u32 reg, s= ize_t size, u32 val); int dw_pcie_link_up(struct dw_pcie *pci); void dw_pcie_upconfig_setup(struct dw_pcie *pci); int dw_pcie_wait_for_link(struct dw_pcie *pci); +int dw_pcie_link_get_max_link_width(struct dw_pcie *pci); int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, const struct dw_pcie_ob_atu_cfg *atu); int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, int index, int type, --=20 2.34.1 From nobody Mon Feb 9 17:59:22 2026 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 230AD21C19F for ; Fri, 24 Jan 2025 11:23:24 +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=1737717806; cv=none; b=HB7FsJE5CJ3g75XisA+3jcdNcIgTkulQ0P3K0hofW1c4qBl76olT2FWpjPdaZmMNdK8+nSa2+6S7v53C2nPetbYuK+cJGBOLMyhigj9unhc6ohp0cbN5aJozlyKzh60Mth5Icjl5Qm3jTjtK75vqy32Ai+KJ9nsDravo5ItxR5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737717806; c=relaxed/simple; bh=aAQ+D093YPpgryfubEJA4YQRIxQgMZqUwYCwdO3dLmA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=J9pMZmONd3U5ej+31sJXgf/GMOASkOs+s/zUpdgYMDkht7sN6aI4CWLd0cimdDcI/riB92vCJga6dbQRLCRD3Dcml67oGLn8uLy9lJzb3uUopxJAoRcs/hi42nkcaLzPP3g3s52yoDlHOdWGNY6XuJyCsYGo+E3AL7V+1Ml/gh4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=jY85dQoY; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="jY85dQoY" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50O8cEgU031777 for ; Fri, 24 Jan 2025 11:23:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= iDG9cPvoCK8z7X2aaaeCh0RKjsgrck+iVE1+Sq1KuNQ=; b=jY85dQoY1iihLG9Z VN0RjJswK9xU36xn5wzhEL1JDkC12+wKM/pO5kmNnZk+TK0wqjoEog+C1iIz63ux OZjPYcsVBH0IJZ5w7f0Dsherwz2Mgsr9jikMhkxblCviGJ86QVSX3EFCoQFsiFJE yd4I+RHRse3byQGJVWIqXd7mlOLVi8HhiEcw+VF06Vnk8i67AARI6URwDLNaFczv CXmCRhZeX0e/RqKlOhKOpXexsU3wfgQvnXa09qTXnadEjpZRSbsJmx/fu8XeYK9B nvt3tnHQW9imFId4Eqf98EDOcckQocwKDFm289KH2sRVb9Ygs60CLqVceodDFmHb e2yMnQ== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44c7h50gp8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 24 Jan 2025 11:23:24 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-216387ddda8so46576075ad.3 for ; Fri, 24 Jan 2025 03:23:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737717803; x=1738322603; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iDG9cPvoCK8z7X2aaaeCh0RKjsgrck+iVE1+Sq1KuNQ=; b=RXFWYG2lfHgGUNLbbtUuebal+S3L9H5a3c1deoAneUxrMfKZsOnQbf+4KnnNmeD+HN fWgXWgABAjDx16954yUDDNT5ot/JgVkLUU5iJczYNNsOcURAZMBpSx5dhrz9+r81NAOR EC6R2YXcYw5MmffKtipZw0D52hIhMr4aMHHieO7j+KRAYEuj4m3i/ifQZhCMzf8TGHIi 6bfTfQayYvjVNh+pjt5WBMXhmOWBYw3cPozj5yVU5yqv3XfIY/U6z8HvjIRhpxUAZLux jYm8ein5g9mPEVtzHAJvs29aL+qZ4/P/M/ON3eCCFQYunykNmuIKFmccj6ErlNueM5Vi HAHw== X-Forwarded-Encrypted: i=1; AJvYcCUe35mnIBi8xUCCuSetEAwwvDQADYc/GrVWkP9WEjXjCvYbNxVQ2jgKCrNowFMz4rQxAM0ULgdAaPp5stc=@vger.kernel.org X-Gm-Message-State: AOJu0YxcbqJEjT4J8OiiAX+OkPCNHoSYGQFVFr3tfNk+hpT85hAoROK1 uKhPRNbnIS//jdpblQdwQSiuZ7cOfElyU0pbtExsPGO8s9orDsICREHEKFG05yz3NDv4TRIJ3aJ IOTerhnhNb9Qm2dBPt8lDulYbmTDmInw3RcjH8gofLJNVZ0pvhUksJwF3szRRKZc= X-Gm-Gg: ASbGncuaozQEaWPEKYMvOPipnZLdHY3H/41cRqlZ4qiABxXAKJ+7LRXwkBYaxs68Cn8 rAqDvNYKCZCe6IrOKWP6Q6IvJLkL0KkYyMK0eXZ2RR1uDDb2j610/J+yWbkgEc6VrxqzpiuezK6 cOltqH98wwbIKocs001hXJR75cAznV8GtDV2qJr7iKYA9Hop5S3QxAbNl/6hHXScjxCEsDnlkrs mVNq0aO7ZN5L7uu1MWOKtWbrns6z9CWF48XnUZnlo5SHesF+kxsL+W5Uo56J5IMU4GQcJ7UzYMI tx56MXVfWp52cyAqHe33zo9UigUuKw== X-Received: by 2002:a17:902:eccd:b0:216:410d:4c67 with SMTP id d9443c01a7336-21c355c8efbmr494063005ad.41.1737717803173; Fri, 24 Jan 2025 03:23:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNcJImFw4UsAKq5Do4gBFlgHd9ffTPhv64PVSXU5XRkZR6vPBecdycKhiJ4wLS04GjTnsMOA== X-Received: by 2002:a17:902:eccd:b0:216:410d:4c67 with SMTP id d9443c01a7336-21c355c8efbmr494062655ad.41.1737717802771; Fri, 24 Jan 2025 03:23:22 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21da414cc20sm14025385ad.165.2025.01.24.03.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 03:23:22 -0800 (PST) From: Krishna Chaitanya Chundru Date: Fri, 24 Jan 2025 16:52:50 +0530 Subject: [PATCH v4 4/4] PCI: dwc: Add support for configuring lane equalization presets Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250124-preset_v2-v4-4-0b512cad08e1@oss.qualcomm.com> References: <20250124-preset_v2-v4-0-0b512cad08e1@oss.qualcomm.com> In-Reply-To: <20250124-preset_v2-v4-0-0b512cad08e1@oss.qualcomm.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Helgaas , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, konrad.dybcio@oss.qualcomm.com, quic_mrana@quicinc.com, quic_vbadigan@quicinc.com, Bjorn Andersson , Konrad Dybcio , Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737717776; l=4571; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=aAQ+D093YPpgryfubEJA4YQRIxQgMZqUwYCwdO3dLmA=; b=zCquekUDbmf6cUZgPiq91xAlARj7f0SrBOVKD9h7yHqvGVwQ4bbjaXOJlFfJEa9ac27BiOr/E j+BC9Oj5Gv5BW5Si3aH7b6v13mKdWRMRXkIAHpJtElNMyPS4taqzWpp X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: 3gVgCka1AnUJ1YyxNCot1wmpntZOD2Sz X-Proofpoint-GUID: 3gVgCka1AnUJ1YyxNCot1wmpntZOD2Sz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-24_04,2025-01-23_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 malwarescore=0 impostorscore=0 clxscore=1015 adultscore=0 suspectscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501240083 PCIe equalization presets are predefined settings used to optimize signal integrity by compensating for signal loss and distortion in high-speed data transmission. Based upon the number of lanes and the data rate supported, write the preset data read from the device tree in to the lane equalization control registers. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-designware-host.c | 41 +++++++++++++++++++= ++++ drivers/pci/controller/dwc/pcie-designware.h | 3 ++ include/uapi/linux/pci_regs.h | 3 ++ 3 files changed, 47 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index 2cd0acbf9e18..eced862fb8dd 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -507,6 +507,10 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) if (pci->num_lanes < 1) pci->num_lanes =3D dw_pcie_link_get_max_link_width(pci); =20 + ret =3D of_pci_get_equalization_presets(dev, &pp->presets, pci->num_lanes= ); + if (ret) + goto err_free_msi; + /* * Allocate the resource for MSG TLP before programming the iATU * outbound window in dw_pcie_setup_rc(). Since the allocation depends @@ -802,6 +806,42 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) return 0; } =20 +static void dw_pcie_program_presets(struct dw_pcie *pci, u8 cap_id, u8 lan= e_eq_offset, + u8 lane_reg_size, u8 *presets, u8 num_lanes) +{ + u32 cap; + int i; + + cap =3D dw_pcie_find_ext_capability(pci, cap_id); + if (!cap) + return; + + /* + * Write preset values to the registers byte-by-byte for the given + * number of lanes and register size. + */ + for (i =3D 0; i < num_lanes * lane_reg_size; i++) + dw_pcie_writeb_dbi(pci, cap + lane_eq_offset + i, presets[i]); +} + +static void dw_pcie_config_presets(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + enum pci_bus_speed speed =3D pcie_link_speed[pci->max_link_speed]; + + /* For data rate of 8 GT/S each lane equalization control is 16bits wide = */ + if (speed >=3D PCIE_SPEED_8_0GT && pp->presets.eq_presets_8gts[0] !=3D 0x= ff) + dw_pcie_program_presets(pci, PCI_EXT_CAP_ID_SECPCI, PCI_SECPCI_LE_CTRL, + 0x2, (u8 *)pp->presets.eq_presets_8gts, pci->num_lanes); + + /* For data rate of 16 GT/S each lane equalization control is 8bits wide = */ + if (speed >=3D PCIE_SPEED_16_0GT && + pp->presets.eq_presets_Ngts[EQ_PRESET_TYPE_16GTS][0] !=3D 0xff) + dw_pcie_program_presets(pci, PCI_EXT_CAP_ID_PL_16GT, PCI_PL_16GT_LE_CTRL, + 0x1, pp->presets.eq_presets_Ngts[EQ_PRESET_TYPE_16GTS], + pci->num_lanes); +} + int dw_pcie_setup_rc(struct dw_pcie_rp *pp) { struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); @@ -855,6 +895,7 @@ int dw_pcie_setup_rc(struct dw_pcie_rp *pp) PCI_COMMAND_MASTER | PCI_COMMAND_SERR; dw_pcie_writel_dbi(pci, PCI_COMMAND, val); =20 + dw_pcie_config_presets(pp); /* * If the platform provides its own child bus config accesses, it means * the platform uses its own address translation component rather than diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/con= troller/dwc/pcie-designware.h index 500e793c9361..b12b33944df4 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -25,6 +25,8 @@ #include #include =20 +#include "../../pci.h" + /* DWC PCIe IP-core versions (native support since v4.70a) */ #define DW_PCIE_VER_365A 0x3336352a #define DW_PCIE_VER_460A 0x3436302a @@ -379,6 +381,7 @@ struct dw_pcie_rp { bool use_atu_msg; int msg_atu_index; struct resource *msg_res; + struct pci_eq_presets presets; }; =20 struct dw_pcie_ep_ops { diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index 12323b3334a9..68fc8873bc60 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -1118,6 +1118,9 @@ #define PCI_DLF_CAP 0x04 /* Capabilities Register */ #define PCI_DLF_EXCHANGE_ENABLE 0x80000000 /* Data Link Feature Exchange= Enable */ =20 +/* Secondary PCIe Capability 8.0 GT/s */ +#define PCI_SECPCI_LE_CTRL 0x0c /* Lane Equalization Control Register */ + /* Physical Layer 16.0 GT/s */ #define PCI_PL_16GT_LE_CTRL 0x20 /* Lane Equalization Control Register */ #define PCI_PL_16GT_LE_CTRL_DSP_TX_PRESET_MASK 0x0000000F --=20 2.34.1