From nobody Mon Feb 9 14:00:30 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 DEDA219CC29 for ; Tue, 28 Jan 2025 09:37:57 +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=1738057079; cv=none; b=hSqPjtORsc2jiAVWJYu11Y3rwfZ0uOQrIvtJYOnUP5Tjw+z7ebIX7JscQ5UEDxNis5+2UdLI4lQg2XW6S3EMZecDFJI/YL/deEglzUjtdP+WBtJJdRzaSN9Ghj3RKu/rqK45w3L4NGFgKd72T7c4601jfaLJtPoNNfX1BlyMZiI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738057079; 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=toyh/ydsUk6NvGlC9lzFErNQwOPTFrU5y4BRSAqPmlaso517/rJUU9QjFmu7h5c0l4m3mpWb3xOWYxcGeFjzQJKQZjr5ubFmXCJ+aFnHFb6JJH/V/yIwV6ScRBr2xxynuVkhMCq3CWbb9ruRcXBcB/fDtEhGNdSawi8U/KtvZ+8= 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=ZfLiHYa4; 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="ZfLiHYa4" 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 50S8hVf6015015 for ; Tue, 28 Jan 2025 09:37:57 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=ZfLiHYa4Im3a0CL/ VTeC+ivUktlKOvyhZYvN8TI3a1Qeq8xZu+KEZQ8DnW59WQxx0pK2rvpyUhmuo2fo W/zMhMHM04z/AL3THZnuxLTVe7mCRrxQCu8U30CqiKi1wT83xwAlUyyqEmsda13+ Sb6IfLg4c9MUB2wzdXufHA88NLAZLvJX6wQUm0q/4Meqz8E/qpAWxajUiVT3zWzh azStLP7dsLa+LqLdp6ikPuI0fD5/eA7ib2CBJ8JW0qyRrM651frqrO05E9dgLE+q JE6o1cgaUKNUurlk4r7OdKAZys4ENBFe7mKxsa5y5ZbmDfiAWNLRiBIEEOTWMb8U UfAZ7A== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44euyq83gk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 28 Jan 2025 09:37:56 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2efa0eb9dacso10942118a91.1 for ; Tue, 28 Jan 2025 01:37:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738057075; x=1738661875; 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=RajPwpXFyzD/wIMV+3bIAEDQS9Dea6gDpVjTnNjfZSGE8HH+RSMiNGyEU6lrCXhwkj Wu2XKL0Ez1b/RWzQ1lLszIj70knuBQJ+aone7ueXUJT1TUG+sBREKRGMz+2uADrwXGt2 CYD1AcTCYx9et4aPTNWMYYL9jWI+KG/fjkAYyrTqBwcQ8ixauF5RhgPfrpWtmxOfDj/a jTwXEB4UnUphD78QaPsA75M6HIxCLOIot3ctfGyGbgKHgVkbN7nu4iRb8jhSkkIzYRaV YhdBd7cAQGEKIBpyAFI4kawIZqJ5Q+E0z6SaLf8J23E7hk9d6Ifd4Ec7DtmMwT5M3OJS +GSw== X-Forwarded-Encrypted: i=1; AJvYcCXox3Dfq07w5qUos+aWUUMOgrz9VRQ4HzmoYKxDDs3as/m4xAeXiYfZWs7Prd/Mpdnl/mlvLqJN+i7Pgeo=@vger.kernel.org X-Gm-Message-State: AOJu0YydZlPlwjrMmU+026uGSHP384qjTKe476QxfZjiMZF2u2CWKcIf ogyPv9qn9lTq+4dPZvzOx69l2VVDekK+OCqDI78BZoDSyTVkj+793P0kuN0vZEGjjsIyQCZ0yZ5 WpHQHCa1LeSMZrhcRsYx51s+aRRmi/FEbY9GYwR1xeTDEqRLBQavYMTk/rEdpcoo= X-Gm-Gg: ASbGnctmKgqeGTcOaI/4SiTLJXozu1LS/yVgJDKSzoFK6CVVU8t7xs+cUIDsIVegVHW X7UUdGmg3HarDn8zmfcw7LwNIIDxPJlm9bEe0bBIzXpYMNYj4ryQyKZPAxnaZXQ1XCO6sSD3opi MklhHM1C3r84FSnFLTqzx2gcZIMaxyqtTziS1xDWI4MiTriaJ/hMaYJaz1CyKhaGGECRW+CwZqK NJYPPwcNbjJg3rEsBAFk6ZXdbCDpWcKNwt2iIwmP31AzBnuVxUJu+o3VbG7kuQSv7pgwpZ8xjXg AKReuS9x103Waec9UL8OZsHPjInVBVKVB1T1yuKo X-Received: by 2002:a17:90b:51c5:b0:2f6:dc00:3af with SMTP id 98e67ed59e1d1-2f782d69fbamr54320259a91.34.1738057075376; Tue, 28 Jan 2025 01:37:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5sIxiF5nmw9i+VlL3P0wXzdaW4LZgy4ZJQLheHok4F3xy/YigDY6PUyHfI+AJzZrpgpjoKw== X-Received: by 2002:a17:90b:51c5:b0:2f6:dc00:3af with SMTP id 98e67ed59e1d1-2f782d69fbamr54320241a91.34.1738057075040; Tue, 28 Jan 2025 01:37:55 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f7ffa456absm9749501a91.2.2025.01.28.01.37.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2025 01:37:54 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 28 Jan 2025 15:07:39 +0530 Subject: [PATCH v5 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: <20250128-preset_v2-v5-1-4d230d956f8c@oss.qualcomm.com> References: <20250128-preset_v2-v5-0-4d230d956f8c@oss.qualcomm.com> In-Reply-To: <20250128-preset_v2-v5-0-4d230d956f8c@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=1738057065; l=1380; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=1cCWyVa5AK2/6g1dA5pRl5YsQKIo2vs/YZuAmrzjF+g=; b=uMo1LPVjRGhDnEqzRL2bDPna8OgGyap9m4wtZ8NDNFEtmtezqv+aOPdParO4WZvKreg3GwbVf ZAKvtL7Q0dpDpu45dBkTqR1tDwJEiVZENRYJKjG/yNaJEbtQn/PN3VI X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: a07l6ADtHvUygj5cSNUmsRkETi-AKOeY X-Proofpoint-GUID: a07l6ADtHvUygj5cSNUmsRkETi-AKOeY 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-28_03,2025-01-27_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 impostorscore=0 malwarescore=0 adultscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=934 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501280074 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 14:00:30 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 04C4A19D89E for ; Tue, 28 Jan 2025 09:38:01 +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=1738057083; cv=none; b=NMdCmaOKmTHBbXhcOIJ+CPvs1r9A4b7+WU9vbIypaCh/hBEmdYxHH8P5NWu41yEkl0cQI/2OlYJQeR3tWeVbXNlNWEyuG+KnuIqpbfSZ0JVDAG/rxZeK+ROs6q6U7ItOB7aPgQ/tUntXgM/1eO2fqWm1TwpiFvhUHz4WOyf9RvQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738057083; c=relaxed/simple; bh=TGay/ms07m+y9zjJNHgOuatl35sTzD0up2JKOYY0A7E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SCXM/8dwbHLf48nu+1ifxC4LgKorBIfakBxBYg7GYp/XdXJ4YeEkPNWPjVJdMz3reYdjeYd0HjEUsy4rJj1jHTjX4Bxra5BrWbhTKaoNtA27qnZVxI6XUYwzAPw645sTI3f/IUl5jRAp7S6Bhm8OGqINeIgfdUf/0+URMuh/gQ4= 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=VgOObJ2o; 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="VgOObJ2o" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50S9N8pO007114 for ; Tue, 28 Jan 2025 09:38:01 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= rxlAIbzt8Vr0dzxxhNrxsNUaklYUf2WYE46ISApfaPE=; b=VgOObJ2oftikIOAj suhZn8JTdJQmK143dbpREiqwislkcAzRRXypW6sjNEw6Mv/75ryIQaEyv/KcJgpW nAoCzgt9uuPnLptAg3CRbaDzoXLPBBgYaNwo0oShCA5cexhoxoxQTGdjdloYHA1h 5UUWI5zdyfX93IQStBwYc49/IeoxdEILBTdTmVes1HKT5loBftEabAe/ZuSOTxyi QGtzSHbzzpiZf7rlyLDxa6FgBOsYVdbwyyRck/k3fTkLA+npKwIhDRfH1PVVy2ep QMFpmnaSSA8go54F0Fz1fry2ECS/vK7nDsZceeQCakcozrLTjJRIfjQf7AmaY1wE SombKg== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44ed5g9wt1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 28 Jan 2025 09:38:01 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2ee8ced572eso11240851a91.0 for ; Tue, 28 Jan 2025 01:38:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738057080; x=1738661880; 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=rxlAIbzt8Vr0dzxxhNrxsNUaklYUf2WYE46ISApfaPE=; b=JK9toX4ncko2LQLIS7XhnmeFSU5MLx0Cz779BS1UA2jOgGJjtRCg849Oz/bTOduDoA ltHYeAZy5ADOB3vEyP7LJ1DrE9AouDbJnq48hR2FxiqLSkeGoKO4W1+Nt27dKLqm8Qnh IImime2VnKMjQxIV3aADomMfr1kNu7m3svYz/QowYDElZ14MS9yzegeYChWy2aELaU1U caUX35lH40wGlQ9Iqggal1/84/OzuHo/shOs3T+ePAbIVRg1/6lbWAHisqbb38bu1bRn Mmp4IN5nylKZKemWG0ZrWOmMEMZo8cocrhBNdZbhyHJEPlc8lf0U06IEno772cYfSiCQ czug== X-Forwarded-Encrypted: i=1; AJvYcCXP5RCx9ab9OoenJESp7H71AP62RzC4YM5sVSPtgzJPbAYZyV5J16AqF4M6M1Y7kMmFISniZOk09rFSCiw=@vger.kernel.org X-Gm-Message-State: AOJu0YyDTRQ0q7jQNYBVq8MAlyA2B3vMzq1HVw0pZj91jj7YLlFDGbB/ mtBpEWV3/LDQufvvs9RGiT/yQNJpeaUO4M47WC7H2eHGNLJVnOKIbD3uho+eyceTVKe10w0z/xw Sgo/VZo0C45sFVHtK/eOjPLOjRG4uA/ERCcuRblPnnnv+6U+SL02rP2AhJuLWU0A= X-Gm-Gg: ASbGnctpp2EeMGmt3YTqxt8WWUSsOWbWzru97DuqRZPW3DEeeFU2jMxwhUpDknJkvff H6WyPZ6GnQVMCOLgydMiC/yrQFoJ1fjz00Byc/YbLuy8tqmbPWl4OVd8cbXlIIbkOFmdkR1mYzV /3OwWaukiMln1j1cGJU9RvUbi4ExjEOh0358pQ5cS1A98jo5tFoCFKZTwNum9CjpM5AS1/qxtuW cvjOKs/PwfsZq6ajguPeyDBln5secVHnbJ5pRnh3fcVgnOuCGThguGdfQJ716RKooqexKXud6Q/ O7CTfcJ2k6xO8F01RvS9utW6p6SBZ0+dmnD/WrCI X-Received: by 2002:a17:90a:c883:b0:2ee:db8a:29f0 with SMTP id 98e67ed59e1d1-2f782d307bemr60669569a91.27.1738057080202; Tue, 28 Jan 2025 01:38:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/W32LARVaT98M7eGQaibLCxjVyDe4GPNQjsm0HAph9aB0GWABaluoxt4Re1G+cepsUIbb5g== X-Received: by 2002:a17:90a:c883:b0:2ee:db8a:29f0 with SMTP id 98e67ed59e1d1-2f782d307bemr60669541a91.27.1738057079811; Tue, 28 Jan 2025 01:37:59 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f7ffa456absm9749501a91.2.2025.01.28.01.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2025 01:37:59 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 28 Jan 2025 15:07:40 +0530 Subject: [PATCH v5 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: <20250128-preset_v2-v5-2-4d230d956f8c@oss.qualcomm.com> References: <20250128-preset_v2-v5-0-4d230d956f8c@oss.qualcomm.com> In-Reply-To: <20250128-preset_v2-v5-0-4d230d956f8c@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=1738057065; l=4552; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=TGay/ms07m+y9zjJNHgOuatl35sTzD0up2JKOYY0A7E=; b=fnzy8VtACyr0idXou2EqUam17uaKrrzxFsm7lx1gDobN243LChUtg/IaK7LgOvM1W2Z8URkMH zpe0OVV7wX2CzvGpJHIllzwTx1kh7YRmsHsqAFaP4qMXWsmDWacU4G1 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: KYfH9zzOwdPXCMAOhKK9MOrVSUh5so_K X-Proofpoint-ORIG-GUID: KYfH9zzOwdPXCMAOhKK9MOrVSUh5so_K 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-28_03,2025-01-27_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 spamscore=0 phishscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501280074 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 | 43 +++++++++++++++++++++++++++++++++++++++++++ drivers/pci/pci.h | 26 +++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index dacea3fc5128..835ffefb9741 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -826,3 +826,46 @@ 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 PCI_EQ_RESV; + ret =3D of_property_read_u16_array(dev->of_node, "eq-presets-8gts", + presets->eq_presets_8gts, num_lanes); + if (ret && ret !=3D -EINVAL) { + 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 PCI_EQ_RESV; + snprintf(name, sizeof(name), "eq-presets-%dgts", 8 << (i + 1)); + ret =3D of_property_read_u8_array(dev->of_node, name, + presets->eq_presets_Ngts[i], + num_lanes); + if (ret && ret !=3D -EINVAL) { + 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..1070b10751db 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,20 @@ static inline u64 pci_rebar_size_to_bytes(int size) =20 struct device_node; =20 +#define PCI_EQ_RESV 0xff + +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 +762,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 +811,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 14:00:30 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 B0F5519E7E2 for ; Tue, 28 Jan 2025 09:38:06 +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=1738057088; cv=none; b=lDTvNrWSuuf87t+SZ/zDhiwLvI4xvtv3iGrvbAhV4ENBEUmb/KfHIbjitLE2AIvH+/F8TvwRyXlvkSrGPB3L6oiBZbNlJUcfXkoDff5MTNOu8TKX63EXGXz9yxgj5AQGWmjaiaGzb2xfRASMA46Chyl+8DueGPsFMrvYLUVJTws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738057088; c=relaxed/simple; bh=aNUEDnnBXJmAjyo+Rv+xBzm6n/bBygSEIE3MuD7dTNE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=toCVuxRJ5RxENzzYJKkwFGSxDOZqQiOVkxqlSrIt5NLshLehaTbh05Ebgh3YhgjTuYI9HelQmzQc6ZQRNtAdYu3ncyYmv7GLLWLhUvMX6xc5q+EXusy/lWRQ5s5XUf9OYmtn903D/cmdgeh5m2qmX1fEQ4UUHLmR+pRaBdVyjIY= 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=k3vWDOUN; 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="k3vWDOUN" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50RMraDY032726 for ; Tue, 28 Jan 2025 09:38:06 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= XSzEhIRdosnOQdlh1gNHLhzWcdv9LO4gzDz9oRpq27k=; b=k3vWDOUNzKbltxew +htQSftzkCD+qxLObLypik1EJhnN9qVGUEORriupWZiy3nGcqG0XWEzGSSUpztOV 0OMBPTaeoLq7TACVcOXg3snufgWFMJUWDrhnvYqkwQnQ3FbnfHQOvWvK2HXjdizx 21qTePgO1h9I1ZTV6xq1zjJFt3irnm4FL2l3qr5WC4IpNcZenlZ9mRTat3qF23hT h4nLWCwWC1Jr5598pJoF9Sa/e0e0vrM4uIfp7rR1TuIQz5StLO++fa6+15eftiWN xHcV2fH6xWgfNl+yv1FmZHHs5gg6uHQL6RiBnRvJKb1Yt/T5wNITL3h5nSK+n5CA ZoDQmg== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44ekb89287-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 28 Jan 2025 09:38:05 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2ef80d30df1so10137638a91.1 for ; Tue, 28 Jan 2025 01:38:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738057085; x=1738661885; 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=XSzEhIRdosnOQdlh1gNHLhzWcdv9LO4gzDz9oRpq27k=; b=ketvoYbgSg7Obhqma47drE32X+12lUuYXTrJTM+dkEQ+eflU0UsX/d2dW7u+/86ZQE naHa/kAAHc4RBJMhYu0ki03gaPgxbkfNcVVvPsHiKo4shschrZ0sQb0/qRM2DwW9UmOw 118/saEdqfcsNJDARFbtDHQPwT8qkjK4pGE4xTsJwhJDbV1vHXm05Hm/KLNZ5/033qpG nXNL8BVo2g7iuKSmOKYo4HCXyCgsRVZJ+V5MMRDVTVnDnjyPtd98aKRmUNesz3uToFNG BJfZl4Ss4MFZUXshLDebH43B2innBx8Y4GPyOEBlo5K90q3Nvqu905k1+5b/o5BZc1u8 rp8g== X-Forwarded-Encrypted: i=1; AJvYcCWCd8/I8DjJ+AWxvMiBYYKftI+M74S25M/Ssh0s2YzcSicrW8HHdg4eq5rS1moXiUJDpqxqoAZWh8q/F5M=@vger.kernel.org X-Gm-Message-State: AOJu0YzHge4N1cyrAUU0iemsebHt25xQQ7gIF4nBcaaF+bGRUuXhRx22 ljv15YE+cwWHt3mbVF64ueO8rr+EabRaw6Wn7tAc4zh1velNasUGcFPC0GuLIq87P8OXQMoggtE 1g344lluTwBrUaQByB3rv2Jcw37WlJE6YflFrZpWaMwfXKckuzJgJ8oMjah4G2MQ= X-Gm-Gg: ASbGncsC3Gi6twXjAheKuKBae48a9Duyca8wEc+eYrR3dwRNvApJtZCIEXQ7mK0FfV3 Qr/veFwb1LUjZkbCaL9rRtmTxvhPl4lb3+2iXhCKnNu+1n1V86VJVdw8HZ/wleyS54iV51Y7Gei F/+M85Oj15t7vsoPCyAICD3kFjP1C8h5qX3p87HTROeXiJA0CxV2wkIMuzMlUd8YtB3glBa7+T4 qtUi3EVVG1/e39TZ5p2T8TJvf1iHKjMrB+hsFEw+mjhx1Xb2wEs+ysfPpCYn87GB74qASm6QV88 ujAfZzJoNtXsWJRUd8FeDROvAXzEGNQrii2DGW0i X-Received: by 2002:a17:90b:270d:b0:2ee:863e:9ffc with SMTP id 98e67ed59e1d1-2f782ca5d86mr59282589a91.21.1738057084950; Tue, 28 Jan 2025 01:38:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IESpE/6TmYCtn7vt9b8+M+eOqAHMi7X4Aa/jIxEhceUkinauqe95Ek3jOdkLhDitwInRCGZ4g== X-Received: by 2002:a17:90b:270d:b0:2ee:863e:9ffc with SMTP id 98e67ed59e1d1-2f782ca5d86mr59282565a91.21.1738057084592; Tue, 28 Jan 2025 01:38:04 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f7ffa456absm9749501a91.2.2025.01.28.01.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2025 01:38:04 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 28 Jan 2025 15:07:41 +0530 Subject: [PATCH v5 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: <20250128-preset_v2-v5-3-4d230d956f8c@oss.qualcomm.com> References: <20250128-preset_v2-v5-0-4d230d956f8c@oss.qualcomm.com> In-Reply-To: <20250128-preset_v2-v5-0-4d230d956f8c@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=1738057065; l=3427; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=aNUEDnnBXJmAjyo+Rv+xBzm6n/bBygSEIE3MuD7dTNE=; b=JcDyBKDyG0bP7cftM+W5ncKic8gdrE1Q9GqpbicZFepKvWWI1N1o99MUistpklv6aAFxq7qvQ zfrRJu4ShbwA9/G7L1H+z6Al+NvOzMVbk8ufaKbB7qgjF673jagnjCD X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: VZ4akHDWWC_kiyXUJW7pXtmeAYwbUP9b X-Proofpoint-ORIG-GUID: VZ4akHDWWC_kiyXUJW7pXtmeAYwbUP9b 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-28_03,2025-01-27_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501280074 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 | 12 +++++++++++- drivers/pci/controller/dwc/pcie-designware.h | 1 + 3 files changed, 15 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..1007248d3525 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -736,6 +736,14 @@ 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) +{ + u8 cap =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + u32 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 +1077,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 +1111,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 14:00:30 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 9CBA019F135 for ; Tue, 28 Jan 2025 09:38:11 +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=1738057093; cv=none; b=mqnw04IDiRJeq0YJF5ju6uP6Uuf8iIqL8PZ+12b/SfIZ9r1+itQLhHUaBtlM/pwepBh3HC3hadBzJXP7e2Kav9wfeZvp70u4Yaf1CduM7NN9xLO+hU75V4JFWbhp61hX7eP6iZGmXoGcJBaqn71ehgh95GmhJtOaUGCnPvUkiIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738057093; c=relaxed/simple; bh=3GLMUInncPOildJhljSbunLgceyGqCV+SYyFKStTklU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Um6dwn5+InqS2fZzhooIuDSqYukD949I/R9EBL6/twMPxPmM5C+a86+wEtk9Sa3pu04rqdXWX2AEBAXssXrt4Ngnba5JSbEpMBh9jR0/zVxOXmTD8sEadfBcQZsN0CAvsUdgufWFWJnozjF+x47oR0IbSJHqYAYV4tcqZCjGvlo= 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=XvdLifm6; 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="XvdLifm6" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50S3NEVE017509 for ; Tue, 28 Jan 2025 09:38: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= FUrEH7Zbq+Pqz4jtLHT1pz98odHEPBPyhXjpsIUNdUw=; b=XvdLifm6hdkZZgUm Z++MN/OnbClWT7V1EH8JGrevC8WJ1ndhOHMqKCZbU8UT4UypWDXqt3JLDUcDa/bA BShHgqypAsDh+jA9+lwUtj8aVJNXliSH7hGMfZyKHYAI5kv2giRuQjH6JCU/nBXQ 7IjZSt0s3K9D1OthlQOoC3gYz+epTH6JVZwo0P2QPMjql+z+muezyGIQ5sw+RyFk ExfJkGSizh83EOb4OjlYztIJKNxuK66+jCPxUbuc20H/RCCTmY3D5G+KKr3lfAiN 5ncs5+GOWYXmBll5sxwkWYNYtADHEI1MjKbyBfXVJ+LYgHW7jOfX2KWKRXfgp2y9 wmJ6MQ== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44ed5g9wtp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 28 Jan 2025 09:38:10 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-2f81a0d0a18so4471087a91.3 for ; Tue, 28 Jan 2025 01:38:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738057090; x=1738661890; 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=FUrEH7Zbq+Pqz4jtLHT1pz98odHEPBPyhXjpsIUNdUw=; b=HO6mko79+SvZkNqusXh+wgtfl1iD5V31W9hsSrKlbCW3UUnZLKTeq3gKfu8v8XQmmc JT6QqizTu1UJPcRfLCUfCdTMADP23SJL/EEvo/D59cf/4M6GqBYV2MNlgbKTLySbkjWE OrJArhL4EwoG2deP6Zk1f1LpeBMQh71wM7IxY6u0j30srUSmXLo4IDp4MQIlGiINMYJ5 cSWVR2YWQNqN9/cZdhb8c3YEddQWn7kUuCCG51TJKVSF1FvVz/s+rx+wrogAeITYbFfD JpbFyMGIm/Tsgt/RXYzVBsu3mGTx2UmPnnNWwJNfZeDAecd3jmXoPf9rxQ2Zq1PObqhm 5GCg== X-Forwarded-Encrypted: i=1; AJvYcCXS1i5n+pXokhuE2tjhrJJHo+xXe7Ko1dyG0QZlfrlAJ/Vz70Lg4mqGDseN1i/Zjgs5iHJouYFXq1SdwA4=@vger.kernel.org X-Gm-Message-State: AOJu0YzNpZxnS1R6w+L4fYj2lK+kwV8ttFvRtFU7TVRCqEDH/54Taz50 jfGoPWE9IJqj6pYVCQyS0tbSHqM6N3IohXBKkizwRUVOQEUbZgO4lRmSv0F7Kq2B0WBTwu3ehFR h5/LKMJUlNfheiSVyDjSFsPVxCNim/46tgzfCQOk86sSUSPOBWJlpkMCYf0vDDb8= X-Gm-Gg: ASbGncsJuIjEwu9z+hqfaGyTMwGkECl1QTlR/cteMwnUReqQbpijM3aUO9E/XZRaTW0 k8D+cFeSOeuhTUgnYjdpx+El0xpgmTJOYdHT8BFgJ0URl4wnKQI8LQoC9+f16aJfspa1HXiM4zk IyGiLuUrbzZaAvAPmUoShImBKW3c1ykyG0U5ehTqsX8v3bAr3Czg4KJW2w6sf9WbJ1S8WcD0DXb mVwGclALxWE1V66xoL+xOvira4ETqjJ+clkWtLWp0y4KgJvqXJ0tOjz5z3dGhV0x3+AAmra2Ruc A1qArXIAdfjZyQ23Rdcm5J2+5pvuWd9zfO5FgLEu X-Received: by 2002:a17:90b:3a05:b0:2ee:ed1c:e451 with SMTP id 98e67ed59e1d1-2f782cb083dmr66476741a91.15.1738057089764; Tue, 28 Jan 2025 01:38:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IELjHRrH1DA2cW0F8TVuPax9KYYfQkpneMo280DA/WRw8LZiZvNU1VaNAFZkLi0rVseiSnFJQ== X-Received: by 2002:a17:90b:3a05:b0:2ee:ed1c:e451 with SMTP id 98e67ed59e1d1-2f782cb083dmr66476710a91.15.1738057089391; Tue, 28 Jan 2025 01:38:09 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f7ffa456absm9749501a91.2.2025.01.28.01.38.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2025 01:38:09 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 28 Jan 2025 15:07:42 +0530 Subject: [PATCH v5 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: <20250128-preset_v2-v5-4-4d230d956f8c@oss.qualcomm.com> References: <20250128-preset_v2-v5-0-4d230d956f8c@oss.qualcomm.com> In-Reply-To: <20250128-preset_v2-v5-0-4d230d956f8c@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=1738057065; l=4585; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=3GLMUInncPOildJhljSbunLgceyGqCV+SYyFKStTklU=; b=qHlTKa0AShwpSvWJ0qQN32ORdr062CGGFRcChgoEZ8X80dOO2an4W+V5v0gBffldkbho0I3ft aM6ldVc1rWYCq+xQBO2VU3MUGj5Tp6915hOeu4LdWlKiHLAshFKZ3Ur X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: f9vsql8xRDNwddu6PKS3ZJv2PBtBNLEu X-Proofpoint-ORIG-GUID: f9vsql8xRDNwddu6PKS3ZJv2PBtBNLEu 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-28_03,2025-01-27_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 spamscore=0 phishscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501280074 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..f458b4c70053 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 PC= I_EQ_RESV) + 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 PCI_EQ_RESV) + 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