From nobody Mon Feb 9 03:05:04 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35D1E267F60 for ; Tue, 25 Feb 2025 11:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740483949; cv=none; b=uF00XkCBhl6rcZfMtUUG9Z8CeyNcxMqcHGawAS70jIZlrxrYXl4n6ObOlHO/KSWhq+Og9Dx8rHp8FKOZjG2s3C54XbnxBaC+zqwhPg0gK8+IpDQC9Byw79pEJoVh0xB56bmbRL5typUJ2sROsHKUcgOOxsD0sIM0bJ1SbZU67po= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740483949; c=relaxed/simple; bh=cH6cJK5Ae1lKPS1EbcIIAvfveOkLU423Yy6ksQNO478=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B2XEkt9RzYRxoqj4rRFjKxJSbu8rPpDSfyLuX+7l5EPiIC3W6U8Z9KwFqtZtbnvC0TgkWalF9rs2Vk7KeYvw4SQaGvw3vagTo6XPqaOjWOagb88Uq61OmzJ12ae08teYAm4mO/kOe+J1cDoCD6HRwNjAWbGo2osvON2Q1NvLK6A= 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=CNDAswF8; arc=none smtp.client-ip=205.220.180.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="CNDAswF8" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51P8dnWw013317 for ; Tue, 25 Feb 2025 11:45:45 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= EGKt38W4f3xZD0hMtHhCvO5JvatGevs7OdH5fWqSmVE=; b=CNDAswF8ayjf6Q7d TZmgyWBsUi0g1EOPP0tuFGskCVSqf2raWrqknZUiK8+ioBGju17bIu2zzErcQmpl fO1GUhW3OLhLRuc2TIWRysmOsZVFMfaEQ3lApgn6SlY21FCPIoTw0u4egW2FnQbg ajlPmDYm5FfiQoje5Q/24Qa/JrBFVMhEUkMjoZCDNpTmwz59SX/Pqlc6s11Ui27V c/M1VQLFKoeBCj1Ebz6iJBCkXupRbCo64pP3cUjYPVf2yk2QiYGT4epfQGZTCdst mnVpZnpuPuCc4YEMIUrt2DA7nNjwiJaZ+l/reoK7gijvvOR1bJ4e4qhY2dYoXJ2C Ad6k0g== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44y5wgrt1k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 11:45:44 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2f83e54432dso18471168a91.2 for ; Tue, 25 Feb 2025 03:45:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740483944; x=1741088744; 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=EGKt38W4f3xZD0hMtHhCvO5JvatGevs7OdH5fWqSmVE=; b=EMz7VMYljPCQM1yrd5e49T06CY0qC5i68fWerucUDUSpG29nHQzI7i307GFRya917p jspyZc0Nf0c56CNXwLJiM4A5ZozA4w/AX492HsGsykp0Z+zVe2snkU0ITypEr5flElol GJlKj3QDOjmACOXdIVKNi/HvHnWt17uoeQRMjGnDBvcbVpfbksaWx6lk8HYtLY8/2zfR cIIz1vFsDhMQysP5nqFkbHB6doSK6DzOUeoQCrTfK6TuWiHWptYl3KEFn1Fa9m+bkMwG AiTCtW7fIs0K99tXxOtikM5f+SZxkGhB9DxjJ7DM9B14q4t++g/XR/VUBYqYQH+UAEq2 1fuQ== X-Forwarded-Encrypted: i=1; AJvYcCWsiKlNH612UdgJmuhcKcK9/xdgrS7EXrjD/0BmNsn1D7Lqj3hol0tWwYjyHMPeTs1o2WJbHkHQ39DHykE=@vger.kernel.org X-Gm-Message-State: AOJu0YyLGpiKWzSLoJkq7AgZnlTHH4YSNpRvhbh356IL/PmGuSHC5w1V gKo9B0OacIOfzWQ65vblcUN9y0zTfB8CCDaqlwul2Rs/4LxzNSsuIQfwoMHYvO4gf4TtPJ5an+x GfxkHBiKIJmKfkZIk8DD7UyTlRJl9w7VQH6hfChCIEVqqD0NEzU6ozzKLKJBnvyk= X-Gm-Gg: ASbGnct0FSjUdgLtTBpQMiehqzCXbdX74mBiGOhK2Dzzg5HROhxL7GWNMi89HeLHUlx A+z/ZmiYTNxAct0E0G6oKiYezZwgKEWfiH1dYJVLoKs4pgN02t7z5R+0y/TMETFlFIjYyTu9yGs oW93NY0qMD4pZrYySnyjCI92Y+WXFeuYgEsYMjnhOLj7bzcuyoR0i9bsehm6sS0S9IjCydF4DOQ 8wRX8nZZ6PyWQ8+23KrgRp+cQwd3iLDtwm8qk7M8ccP7nec3M5T6dwRZYKKbRgCmRl8Uq+BH5FA GzLHcPtcBjb3l9LeCTbN4E01pELOY+hKrh0TRLQi4Z8iVgFJPyQ= X-Received: by 2002:a05:6a00:4f88:b0:730:a40f:e6ce with SMTP id d2e1a72fcca58-73426d85439mr23398656b3a.17.1740483943626; Tue, 25 Feb 2025 03:45:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IH53d44YmSSgu0vz59WLwncGay6321eEVUl6u4lCgcM+mZ/SIJFyIXRVdtsf4iUG7rccPC/ig== X-Received: by 2002:a05:6a00:4f88:b0:730:a40f:e6ce with SMTP id d2e1a72fcca58-73426d85439mr23398626b3a.17.1740483943313; Tue, 25 Feb 2025 03:45:43 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7347a7f9bb1sm1331790b3a.92.2025.02.25.03.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 03:45:43 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 17:15:04 +0530 Subject: [PATCH v7 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: <20250225-preset_v6-v7-1-a593f3ef3951@oss.qualcomm.com> References: <20250225-preset_v6-v7-0-a593f3ef3951@oss.qualcomm.com> In-Reply-To: <20250225-preset_v6-v7-0-a593f3ef3951@oss.qualcomm.com> To: Bjorn Andersson , Konrad Dybcio , 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, quic_mrana@quicinc.com, quic_vbadigan@quicinc.com, Krishna Chaitanya Chundru , Konrad Dybcio X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740483933; l=1863; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=cH6cJK5Ae1lKPS1EbcIIAvfveOkLU423Yy6ksQNO478=; b=TDE/vhW0tt+TCyiVeC+7VmGtzLVU/FCyF+softJ/q8wTToMyQSDj+dVhEZ31Ykix3o93rNaW8 W3dfP+6sWsbDDTVJa0rfXGBObjJjrXntYldVwmUyGPB4sKrpWruw426 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: CwgxK1pakQNdzhzjOjbyUI0B3p1F_6fT X-Proofpoint-ORIG-GUID: CwgxK1pakQNdzhzjOjbyUI0B3p1F_6fT 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-02-25_04,2025-02-25_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 adultscore=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250082 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 Reviewed-by: Konrad Dybcio Reviewed-by: Manivannan Sadhasivam --- 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 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/x1e80100.dtsi b/arch/arm64/boot/dts/q= com/x1e80100.dtsi index 4936fa5b98ff..9a18b8f90145 100644 --- a/arch/arm64/boot/dts/qcom/x1e80100.dtsi +++ b/arch/arm64/boot/dts/qcom/x1e80100.dtsi @@ -3209,6 +3209,11 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, phys =3D <&pcie3_phy>; phy-names =3D "pciephy"; =20 + eq-presets-8gts =3D /bits/ 16 <0x5555 0x5555 0x5555 0x5555 + 0x5555 0x5555 0x5555 0x5555>; + + eq-presets-16gts =3D /bits/ 8 <0x55 0x55 0x55 0x55 0x55 0x55 0x55 0x55>; + operating-points-v2 =3D <&pcie3_opp_table>; =20 status =3D "disabled"; @@ -3411,6 +3416,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 0x5555 0x5555>; + + eq-presets-16gts =3D /bits/ 8 <0x55 0x55 0x55 0x55>; + status =3D "disabled"; }; =20 @@ -3538,6 +3547,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 @@ -3662,6 +3673,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 03:05:04 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E7CC268684 for ; Tue, 25 Feb 2025 11:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740483952; cv=none; b=LfexarKrdMZMfVC0NK7zSMuMcZQobUed9lajC8SKQvVeP27wzfdArY+GpkUV8q0+GIXW0tqYUZvgiw8klXEBHrQrVC5nPGNRCp9Sz58rVp/EBTzjcMh8aji+gnPTnu64NE9+ryEyijy4D8Sw25g4KOiv3rrL4Iaf7mPQXQ9AzyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740483952; c=relaxed/simple; bh=WMbOp27utSDkHhEXVAa3MHd/brdszfrzIwpx9Festsw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IRIBtnYXCEQQrA5TXUjdEdWuVotfDplyX8/Y8tLM92+6TMoTdtfV72WHxYdFD9B1PNdiazkvfI6/oRHJP2goPZ/JlxqIgU8dQxAltzj0apRbbaUD5wN+nC4bk+hSxpVe/tnjNBVh/UIogxVPA8Z6NEfcFF65vb3cSTezuXt6TTs= 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=bYGlIrkM; arc=none smtp.client-ip=205.220.180.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="bYGlIrkM" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51P8BqNC009763 for ; Tue, 25 Feb 2025 11:45:50 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= gFJWUCVZ6M2euvvcGUy752g9X1XZh3x6N7aMIvdjCOI=; b=bYGlIrkM6DiBBT0A kw29ytY0s9lpbWIKIjw4e64X9ayT8h0Iqa9fbajvrLVys+uVpctbACYrQzw6vLFw LCu0OmjrY3Znz7UvbeQ1BsZmEdEhTNOPUkUIGMIQ0yQmW4pMpv4zDYnkuVEsha3F SSRz3rnrvUJ7GSynDzKDtF/JfqdgQpGIc2OMMUDfB0EqIqwXXO++XXolnsyc6brv 3BcJ3IIFVV8LZB2urlJkzqEfSZchlAcgInBhaaYY7oXl3+BbQNoBzDdgsJnIlVH8 HmuYwG802O1kFFofNytxwgzvryX6g7c8Y3e2cUkytsxHynmtwB1c9GNP1xakM5+c rrGR8A== 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 44y3xngyd8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 11:45:49 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-220d6c10a17so121967825ad.0 for ; Tue, 25 Feb 2025 03:45:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740483948; x=1741088748; 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=gFJWUCVZ6M2euvvcGUy752g9X1XZh3x6N7aMIvdjCOI=; b=NTOa2pk1P3bC9KKln3N4FHDw8BPrgkgGYFzE7WlslBPqnMNo5ztbNVsPwUYcyROp8e +2m/AoTwH+VryWMwW1fhHJX8lP8KoM4vhmMVXS9yI69fzXzSpCSGiTz5vZjB66ZJZzMu b6UjbbVSWdSGCmxua5Idve9VYq3uqETFNU82gYYdcyTeik/FYhMRYPDa6Tb+s0AOUhkd +Oxkq1j4I9mI4+YfflhU5Sc1hUmGBb8SaT5BwHFVTdt3O//cpg74a/3yZLZjJJ/3FkQx s+VO1K2ZfsKaG08LQe8AcHl49xCq/iH7V2zf08JJzyhpEmp69zo4ZBb82OCGqDHDtocK rGDA== X-Forwarded-Encrypted: i=1; AJvYcCWWQT9+nzXILgj+jRirU+BDlgR1mKCtD+GlhussuSYG0dK9KX50HsEwBJd4tvBUBwh3rJuEsXHNmKNXWDo=@vger.kernel.org X-Gm-Message-State: AOJu0YwAQ/NDsZyHKMywbj4JualFj3JnyzVl7oW8ZaEO3NxU5yL8loSQ EqQQofMqVAs1gPqFp0PO2qGjalgrEksq4Mgu8eKHItuQ4eVlmk5EMi4/D1bi9Do2C8/SgZnx630 zEXWtNZbbC2sw6IHXwf5NAVp/BjOL5j/hnaHyW+YjQBNpzuCFhm29gKPPV1g2M9g= X-Gm-Gg: ASbGncszdRiR5pUbjxOtIv0mgLb6AtiRAZuwRQR4OH90S/S3PBhvEquwW/CRZbnvFe+ d6VbfrpOKdwcjqyK6FhgdL+mOQvwUJV1q/lNxdVKrDxg/aRpSd1UMwM9XOPjSmCsKRRSHAICpry Ev+Pz3mOwDWBHl8TvAcZLSFSOS3PwQSxomYipEaNxqAzC4IHUyS5rQFfjJbXO8BnhFkiwXX3Oj9 2OQ4B2tTL9V32YapEVcu4z+dveSFHaywy3rf0IJjOBXQvJPnCGnXwtM2UQN1y1SEXIZWonLJuMQ PcH+psOKNty/Ko/brFEM8epDZmAAhGwW0G35GB975Om0SMboKR0= X-Received: by 2002:a05:6a00:8a17:b0:732:6a48:22f6 with SMTP id d2e1a72fcca58-7341410bb54mr27637501b3a.9.1740483948548; Tue, 25 Feb 2025 03:45:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLEK0CZlrCWZb3Xuj6wszq4+kfT30Don9arlTNNmJDccEr1jdH+78HFestoRn7PlNMxSiSVg== X-Received: by 2002:a05:6a00:8a17:b0:732:6a48:22f6 with SMTP id d2e1a72fcca58-7341410bb54mr27637467b3a.9.1740483948142; Tue, 25 Feb 2025 03:45:48 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7347a7f9bb1sm1331790b3a.92.2025.02.25.03.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 03:45:47 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 17:15:05 +0530 Subject: [PATCH v7 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: <20250225-preset_v6-v7-2-a593f3ef3951@oss.qualcomm.com> References: <20250225-preset_v6-v7-0-a593f3ef3951@oss.qualcomm.com> In-Reply-To: <20250225-preset_v6-v7-0-a593f3ef3951@oss.qualcomm.com> To: Bjorn Andersson , Konrad Dybcio , 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, quic_mrana@quicinc.com, quic_vbadigan@quicinc.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740483933; l=4572; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=WMbOp27utSDkHhEXVAa3MHd/brdszfrzIwpx9Festsw=; b=dvX/auMBkpEgcGMORcBFgKOMtMkGSfVdVDfd6RF5iHlRcUBHnUXDQewFhufkMjDqeQhHJRWNB jOnND8g2ITtD1TzdG8zKakZMSC8tLm649lBS+5oJDId0yqYbdZJVByp X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: fcWGQl5ocpWYQnBDwe9LnezAzeAOuQNx X-Proofpoint-GUID: fcWGQl5ocpWYQnBDwe9LnezAzeAOuQNx 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-02-25_04,2025-02-25_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 priorityscore=1501 spamscore=0 malwarescore=0 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250082 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 | 27 ++++++++++++++++++++++++++- 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 7a806f5c0d20..9ebe7d0e4e0c 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -851,3 +851,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 + * else assign default value 0xff to indicate property is not present. + * + * Return: 0 if the property is not available or successfully parsed; errn= o otherwise. + */ +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 reading %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 01e51db8d285..c8d44b21ef03 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -9,6 +9,8 @@ struct pcie_tlp_log; /* 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 */ @@ -808,6 +810,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_get_pci_domain_nr(struct device_node *node); int of_pci_get_max_link_speed(struct device_node *node); @@ -822,7 +838,9 @@ 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); bool of_pci_supply_present(struct device_node *np); - +int of_pci_get_equalization_presets(struct device *dev, + struct pci_eq_presets *presets, + int num_lanes); #else static inline int of_get_pci_domain_nr(struct device_node *node) @@ -867,6 +885,13 @@ static inline bool of_pci_supply_present(struct device= _node *np) { return false; } + +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 03:05:04 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 116A3267B93 for ; Tue, 25 Feb 2025 11:45:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740483958; cv=none; b=W8yzK+Isho0gxUU31Q9aN1aEr5WBDqbgUBtq55Pbnj3zvyqJDxjpwWj6aRHCFuShVle42pTwMF3MPAF/5Rw7qPmNJGmW3ZkxQiSHg/E9/GX/KXt3iSB4B8K0vFhbsmj73gHjUAA2WUnQMtW0A/x30E6DW+2gLDlU3yOgqZk+Sl8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740483958; c=relaxed/simple; bh=u4stSlHqt6SDmbNCOygNp94BXAp7R4cdNbXp5bogHOM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KQdi3K2OvTdpuCJqDXRsa9uWRsjmr/cu+0H26713jkPqbaBMJ3/QmibvoFevpXAMKdQjrm7O70yvIUWDtI8CbwSHIlYOGzIo+ZD7212auVKjxxEcXZpgsirK4QcTjeqeogpgUM7j1kVi3MnHCyG9DJizEQoOuudomk5CHioAly0= 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=pNxv1FZD; arc=none smtp.client-ip=205.220.180.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="pNxv1FZD" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51P8opiY017279 for ; Tue, 25 Feb 2025 11:45:56 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= CL0lc3FSdVBtQAJZpLV5Pqt/+P+vvC1pRH/Z+SNoYHk=; b=pNxv1FZDgM6TnQ1b mK81TmbDhW/rQI2Y2M6MKYBwLuCKDpN47fU3jfck+PLlFGtfxiAU49ONE4Vi05yL VV+aT9zdyUX9G0YTViTPQWCnwBDvoTSDkK6IW4jKb2cjjWbgja8k77cWVTGwBIQv BLWbS8ZeVJwsiZp0aDG9AxJMNG6VANqQROBqVQVZEaJfX8TH88WiCWekj8ldEm25 2JU39X09Z/EV5mc801XiHJx5AfYDSd2GVm++8l8ZCtaWIF54al24YLkH1fSvtzPl hbm61So8XeA7LMZ01S5yA6XGxGRI489ENAgT3FZfuZpTgsuKkG6sSMzREM0rC+Ur VUsb4g== 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 44y5k68udd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 11:45:55 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-221063a808dso108258245ad.1 for ; Tue, 25 Feb 2025 03:45:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740483954; x=1741088754; 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=CL0lc3FSdVBtQAJZpLV5Pqt/+P+vvC1pRH/Z+SNoYHk=; b=hcph7zTz2Jx/T9wdRDclvHdFuf8Cczu+pl+O43rWTkjdF60yAFNNdJcIgyn5l05ko4 fhoS4yV3eyirEP0hEV/kXMwb58hkdrnLHtW0puR2O7xlBLIfoRsm0fOT2UI17v19zpW6 w2GalTc2Z1T+cH+vu3PEMFh4yiJHh+LVf24E5JgL6MKMEHqFjXDBfYcyxVoVSg7Gz/TX kalS1rYh+/HapHXtgSxFUxycfGjSxlI/C+v468ytoDj3rblvzPeg3ZO7OJ9aLCE8FJtF 7rF51AQ1/K4ABIxNqGlBjP7oH2Voga9wdp5LP80m+BFdv+83M8k6HIFIernRYNThEU5J nIVA== X-Forwarded-Encrypted: i=1; AJvYcCWPIWokVX9aocgEArQ9ruBZnF0je5iP4sESvCJgBbohvMYfGzRRTzjdmEaUPlCy+JsOG5+xk4iMnOs0NVM=@vger.kernel.org X-Gm-Message-State: AOJu0YyxASGGsmfkcTzWtdHif+9pSEgfXSIrgWRpoRdNsCLK5pm8iTf9 N9dSn5WRi8zLpiIYWdrAi5EqGndn15tgJkYAHIwpMExkTbMnhCwQ4enoD/FMnhMCqBxEqn4o5wP oJAoIqATyjdBgBQ46dHHvrLqAhxdN+UGeQaB3gXvMey4X39aCJsdSEQNl9rpM05c= X-Gm-Gg: ASbGncsf5qA5ca24ZFxNuO/gtsmD2vS3LVuzD68ho8HRZwABJBoC5S+Bzm/bebSDhjW /4RFs+BLCA9NOLHjv+Ba9dJmzFju9TFc1SF/PfacFiteMcF2URVrs2wXBXOkz7RQ1h5UqfwEYtL 1s72bdY6m/AQ+j6z2V+ZuYKaEOTgc30JwTHV9/sj9ZdcFeFAkpvkYB9PLMctc7eybvNUBy2/6b5 sFPLeFCO0vJRJ9bC8SLWDJ2sDLHctP5kVmMhRvM5DdAaBNjL6LrMnf9W04HxSVUTbW+QrQbARms dO4OifI+ORkowj2Lh4Nv3XY8JuQDNgJgu4ew27NayaiUk/5xXlo= X-Received: by 2002:a05:6a00:1810:b0:727:3fd5:b530 with SMTP id d2e1a72fcca58-73426d77f98mr23598036b3a.15.1740483954378; Tue, 25 Feb 2025 03:45:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IF98KPJ3NHHETIUHz7cVz0wu8yWb6paMuhFIuUIGnid4MPw8cUtFG1Nqb9e6yv3CwbN4XxWTQ== X-Received: by 2002:a05:6a00:1810:b0:727:3fd5:b530 with SMTP id d2e1a72fcca58-73426d77f98mr23597949b3a.15.1740483952968; Tue, 25 Feb 2025 03:45:52 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7347a7f9bb1sm1331790b3a.92.2025.02.25.03.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 03:45:52 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 17:15:06 +0530 Subject: [PATCH v7 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: <20250225-preset_v6-v7-3-a593f3ef3951@oss.qualcomm.com> References: <20250225-preset_v6-v7-0-a593f3ef3951@oss.qualcomm.com> In-Reply-To: <20250225-preset_v6-v7-0-a593f3ef3951@oss.qualcomm.com> To: Bjorn Andersson , Konrad Dybcio , 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, quic_mrana@quicinc.com, quic_vbadigan@quicinc.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740483933; l=3059; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=u4stSlHqt6SDmbNCOygNp94BXAp7R4cdNbXp5bogHOM=; b=oTMbuIEWa0kinDliVDvtm/fVhAbjJe+MxEG67fD9o1BGTgITJ7v/ldktwJIJaDX0WLUYw1xM3 yon9TibsZreBK0B2dZula3WaVgUj5R73uYw9ax9vYU/yFGK4l111H8P X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: eGxyNefL28kRv9wdjS4Kqm6NjnpiXO7J X-Proofpoint-GUID: eGxyNefL28kRv9wdjS4Kqm6NjnpiXO7J 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-02-25_04,2025-02-25_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250082 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 | 11 ++++++++++- drivers/pci/controller/dwc/pcie-designware.h | 1 + 3 files changed, 14 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 ffaded8f2df7..dd56cc02f4ef 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 145e7f579072..9fc5916867b6 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -737,12 +737,21 @@ 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) { + int max_lanes =3D dw_pcie_link_get_max_link_width(pci); u32 lnkcap, lwsc, plc; u8 cap; =20 - if (!num_lanes) + if (max_lanes =3D=3D num_lanes) return; =20 /* Set the number of lanes */ diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/con= troller/dwc/pcie-designware.h index 501d9ddfea16..61d1fb6b437b 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -488,6 +488,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 03:05:04 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E48AE268C77 for ; Tue, 25 Feb 2025 11:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740483962; cv=none; b=ajE39bU4kWiKC5I0bOao6oL9JBR2jvpVYgKz22nho35DPvM6SRr4o9G3Wg5JDHVcgAgAapwTOD5uSRX5fcCpgkIYSbgyhSB9cf82dF3KrXq6re9HXOji+jBhvz8ecyYtQ8UWeVLQN1ZaFQwMzdkf2ouv1DLJcL9HTUVylsGbsKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740483962; c=relaxed/simple; bh=pFcdNrDAhL7Xbm6OQtksZi4cGoUNQlf9iCCnxA9zgpc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ieZx7hpyouE4VFa4dCqvqw+OOruTVoW0ToDcVCrx+ZBloJITFBCFWVuYMHT6XgKGQnUwPzzYJdF0m3dz81iJkFi7VF0DuvTI6pxSfKMJk38dqL+p7Ok+1rKS2cIhmb12v2k70sUs2iO2O4BuNjl9UChLlbDkij+D1SszAkOSSbo= 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=F6dfTcNz; arc=none smtp.client-ip=205.220.180.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="F6dfTcNz" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51P8BqNF009763 for ; Tue, 25 Feb 2025 11:46:00 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= EJcYMRyGQkw8QY2ncGIv3icP3Wer3n1fNhPc10KzWt0=; b=F6dfTcNzyhR7IBut OCNnxSm+xVEQcV34HRqx8/9GqJFBSjqTznHjhQWc6vGUoasibMdntp/Jy97daygU XD2MXUyVDgU1mOZJ1AYWOoORoYDahyB4uD4YnEOIuTgMgvtYcg+IHZSBeoplVONr 1noOs9alMO0yibdRCgwJakn5iQ90xRUpXWrvC6CN4ZdvZu5+k5MSsUkjIdRSnzax HqqPpDd/fhQI/+g7gMMJ2xFmhC/SadAcXQSsyl3x5n9EWcXn4qqUHWIpFKV0uTmg aljOu5roQJ7wmtKKpr5kL8b1ALD0OZdV7GK+sGvZjsw4guy9AX89zc3+1tM5meGx JFoB2w== 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 44y3xngydv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 11:45:59 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-220ee2e7746so113518685ad.2 for ; Tue, 25 Feb 2025 03:45:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740483958; x=1741088758; 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=EJcYMRyGQkw8QY2ncGIv3icP3Wer3n1fNhPc10KzWt0=; b=R1HhqHk691+34OYgqFOHbpbzlYylYKQk6ovzlYfA5iBBuLS1ddCuQPfKr1HR7j2aBO oMgIivsut6+GCAcsOCLW2uxweuPtFViTSWOVOvEsEOTtig5YZhHM7VgcYmBKj4iCjnvI nb2m16A8d5K9hOs2mktIYccqnIQPId9sePne9ssknacTsEEjzVq98K2VJoOraj7DEVjZ Cs/vNO59mXwZvje0Rqbs5tyculZotzTJ2+VyWThaxicfCe3zNZ2dST+JlCPnFkYxNqU6 Csc2ngshp9RhOeOwt8UhxoZutxfxApRS/HDFzm1Yf/26LmhcUhzUpmYoqkBAwxQyQw3u ve6A== X-Forwarded-Encrypted: i=1; AJvYcCWj1aluYg4ouVDpkZYaf5HeUAouHLf92Hz3yG7iCQRXszl8L9rAkNpmcxV0fQypnnviwcBZ4eH1uP5Nznc=@vger.kernel.org X-Gm-Message-State: AOJu0Ywh5dOePghPmeJCkg4VXGbIiBK1eR6M/tTaiXfEhx3nzmaMKvzO ymceiMa0+32sK6T/UrIDL5Budm+UIeELKyTKHIj0EMCqbslTImv0KIEFVKVGa9SldP0BoiQu+eF OTlWlFUpXfb7o7QF8k48G2ovoHbdwfKxqJS2QCkxjjTMLmj5WuUm0m7TpW4SmXFg= X-Gm-Gg: ASbGncukcmcqCHTjHVCJAo/1phqmSPL5OiasXCqX9xNruWpCngGbRJaHxyyyEz6N1ZL 2ObXPrNBxMsP9431VCX3L2oytzzBT7rkqt/XT4BAu5+0ncHGhwhEMzRxlIXtol8lEmTfIDo0m+e eXZ+PBbEdb5R2BlDJAg14eeyOVyyNMYA1ZokgPs7jXzVvWxyMXWVY2nO5hIVDtdEcSjXbqFCSHb rSXeoHM2rbReXydKZ6Zsdft7LXooaJUoGkQAUPUmJ5Tb6tr6nbIkiaOBd/tgdpn7SBWcSm/0mz7 6XTp9lbD0G9BKZ0lX2psBEacjlFZYG2zsjnhkeqAZJuhHE4DuBI= X-Received: by 2002:a05:6a00:22c5:b0:732:2170:b6a3 with SMTP id d2e1a72fcca58-73426d963b2mr30573989b3a.21.1740483958281; Tue, 25 Feb 2025 03:45:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvHfsK827INp2OUOpMhbFB5TykPzqPp/lSDZEx2IWzQtTO3rjE9E3N8V1y2Pm2T7ObYclovw== X-Received: by 2002:a05:6a00:22c5:b0:732:2170:b6a3 with SMTP id d2e1a72fcca58-73426d963b2mr30573954b3a.21.1740483957820; Tue, 25 Feb 2025 03:45:57 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7347a7f9bb1sm1331790b3a.92.2025.02.25.03.45.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 03:45:57 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 17:15:07 +0530 Subject: [PATCH v7 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: <20250225-preset_v6-v7-4-a593f3ef3951@oss.qualcomm.com> References: <20250225-preset_v6-v7-0-a593f3ef3951@oss.qualcomm.com> In-Reply-To: <20250225-preset_v6-v7-0-a593f3ef3951@oss.qualcomm.com> To: Bjorn Andersson , Konrad Dybcio , 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, quic_mrana@quicinc.com, quic_vbadigan@quicinc.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740483933; l=5105; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=pFcdNrDAhL7Xbm6OQtksZi4cGoUNQlf9iCCnxA9zgpc=; b=BV/ghXP6XY1A4XML0m8XYu8Z0skAAgZIgIjY6gWhoPZplTS7w7dxIEWCxpU8tGv3fzSgbEHnC LE7AYc9lT2vAjc6f9b+Ag39P/ZCZt/s4+asJwyGGYbx92+UFd9noapw X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: MH7X0g1sZQvkdq6HIsyEcbk36rOWZzao X-Proofpoint-GUID: MH7X0g1sZQvkdq6HIsyEcbk36rOWZzao 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-02-25_04,2025-02-25_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 priorityscore=1501 spamscore=0 malwarescore=0 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250082 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 | 66 +++++++++++++++++++= ++++ drivers/pci/controller/dwc/pcie-designware.h | 3 ++ include/uapi/linux/pci_regs.h | 3 ++ 3 files changed, 72 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index dd56cc02f4ef..ea596119de92 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 @@ -808,6 +812,67 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) return 0; } =20 +static void dw_pcie_program_presets(struct dw_pcie_rp *pp, enum pci_bus_sp= eed speed) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + u8 lane_eq_offset, lane_reg_size, cap_id; + u8 *presets; + u32 cap; + int i; + + if (speed =3D=3D PCIE_SPEED_8_0GT) { + presets =3D (u8 *)pp->presets.eq_presets_8gts; + lane_eq_offset =3D PCI_SECPCI_LE_CTRL; + cap_id =3D PCI_EXT_CAP_ID_SECPCI; + /* For data rate of 8 GT/S each lane equalization control is 16bits wide= */ + lane_reg_size =3D 0x2; + } else if (speed =3D=3D PCIE_SPEED_16_0GT) { + presets =3D pp->presets.eq_presets_Ngts[EQ_PRESET_TYPE_16GTS]; + lane_eq_offset =3D PCI_PL_16GT_LE_CTRL; + cap_id =3D PCI_EXT_CAP_ID_PL_16GT; + lane_reg_size =3D 0x1; + } else { + dev_WARN_ONCE(pci->dev, 1, "Not supported data rate %s\n", + pci_speed_string(speed)); + return; + } + + if (presets[0] =3D=3D PCI_EQ_RESV) { + dev_WARN_ONCE(pci->dev, 1, + "Lane equalization preset properties are missing for %s\n", + pci_speed_string(speed)); + return; + } + + 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 < pci->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]; + + /* + * Lane equalization needs to be perfomed for all data rates + * the controller supports and for all supported lanes. + */ + + if (speed >=3D PCIE_SPEED_8_0GT) + dw_pcie_program_presets(pp, PCIE_SPEED_8_0GT); + + if (speed >=3D PCIE_SPEED_16_0GT) + dw_pcie_program_presets(pp, PCIE_SPEED_16_0GT); +} + int dw_pcie_setup_rc(struct dw_pcie_rp *pp) { struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); @@ -861,6 +926,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 61d1fb6b437b..30ae8d3f4282 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 @@ -381,6 +383,7 @@ struct dw_pcie_rp { int msg_atu_index; struct resource *msg_res; bool use_linkup_irq; + 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 3445c4970e4d..2cd20170adb4 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -1140,6 +1140,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