From patchwork Tue Feb 25 11:45:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13989884 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 35DED267F67 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=1740483947; cv=none; b=lV0A1rhtB/oBaKUC0QhCIlFCsWRcecd+jt5jHqCZTrXgJxaBHd3bmgwqdPts1mm7ri8UN+00Ih+mAcWXBaxlpAJUTj5obW0AHykrxZ52XkNw+nRag1p7772V80JuAs9kNZiorpKIm3dOHHCL15YbmK68HgV+3/S2hL8BnMnkltY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740483947; c=relaxed/simple; bh=cH6cJK5Ae1lKPS1EbcIIAvfveOkLU423Yy6ksQNO478=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WiGStfkRi87bomkiRw8v2S62/0WDrFUvN/tgwZyrCTCD2OpZFLJzJUHYvqgl74JOrBLFicxS1nbRpzUJ3Z9oz1Ma71bIVSX9yaKvJE30HZS5pjaU+o4U+e1vj83KA6onz2ElPq+4H1w9ucoTaujY956MQkftDwIf2EecGJCZ7KU= 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 (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51P8ZIqK031164 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-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44y6nu0rdu-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-f70.google.com with SMTP id 98e67ed59e1d1-2fc2fee4425so18528298a91.0 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=1740483943; x=1741088743; 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=VBJZICCwGETmXspLvhBijwu2eR/G4Ufq+bsJS/efqW7ctMF5CGyb+SEv8veH+1VqU0 rMBjbYtPq1L72TZz9wxLUzmjKK54DUfw1/IzvW41P9vHOW07QAYpwufpgmwTktHugL0p 2zsQ3U65DcaChn/GQnDuk/PqI3oEBY/VIDgtX5Ja7Yox0Y1FkyRoeGHhg9MdFvoOD/+6 rvDh4nE2wGuGdDnLEa0QsThDrf0Z8LJVa/IseMmUni+cKTezXI71zJk22k4J7XQx+AdI aaBYpeAVC23KeDY41Bamer13KDXpcE7iC+UqmGBXE1RxHvPGMfQwn1qfkxZAWgws+cB4 nG4w== X-Forwarded-Encrypted: i=1; AJvYcCUSmnTj77CyuJ8UCApNsGEbJSACOgFaogkSjYEIy5FNXiRX4ryjooq6lbKXPfO0Pf1TU0yitHS9QXU=@vger.kernel.org X-Gm-Message-State: AOJu0YzSXe2qrFcK6RFpj3T5sSVE4NeLX9QWA1VL+U9dfFc1te3c9eRY Byi2zVESRE+n9uTTd0x5WXe5K5dsdMFiuS/E0Y/eAYP1t5uC+YuqZup51Suzar/LpHOs+t6mIqR nJbYyjC9wDxJ0TQWxXtYlKc2LGy9+dBhogy1rlzLxTLPFhl0TrSf2U1t7bws= X-Gm-Gg: ASbGncvyRzKQcU2GJ25tGnqM6rUH73VRIsJUPm8ypHfHRAvIkR20QxnDx/BGPgwlgDL pjKfoQp2Qr4IBH3MuDI/bPyIQcO4geDZSfX4/2qoLtTdark0y9obUOsJNbLG3lOV0j6TP8XzU5f XeGSZszDibNk1uQIvIfAFq8Jryu+NnkXuz3D5nJPOmTmOYIgVueVlWV0tr1vcwvz3gcnXnDWw/x X/MvsnlCVrji2IoNmq+2RBqkbD2/TZ7XLDbGJm70iLi8mak/cZaBhhz7nalWRLGF9vtbXWcanuE sxEarRQ9DaxjdNNHiA/zF6UL2L6HTEv2lTZnMdJDeoOOTQB2WOA= X-Received: by 2002:a05:6a00:4f88:b0:730:a40f:e6ce with SMTP id d2e1a72fcca58-73426d85439mr23398659b3a.17.1740483943631; 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-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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=84?= =?utf-8?q?ski?= 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-ORIG-GUID: fGuSeqPEktrK2VOevwA_TEgqAUenLHY- X-Proofpoint-GUID: fGuSeqPEktrK2VOevwA_TEgqAUenLHY- 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 suspectscore=0 mlxlogscore=999 malwarescore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 bulkscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 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 --- 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/qcom/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 = <&pcie3_phy>; phy-names = "pciephy"; + eq-presets-8gts = /bits/ 16 <0x5555 0x5555 0x5555 0x5555 + 0x5555 0x5555 0x5555 0x5555>; + + eq-presets-16gts = /bits/ 8 <0x55 0x55 0x55 0x55 0x55 0x55 0x55 0x55>; + operating-points-v2 = <&pcie3_opp_table>; status = "disabled"; @@ -3411,6 +3416,10 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, phys = <&pcie6a_phy>; phy-names = "pciephy"; + eq-presets-8gts = /bits/ 16 <0x5555 0x5555 0x5555 0x5555>; + + eq-presets-16gts = /bits/ 8 <0x55 0x55 0x55 0x55>; + status = "disabled"; }; @@ -3538,6 +3547,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, phys = <&pcie5_phy>; phy-names = "pciephy"; + eq-presets-8gts = /bits/ 16 <0x5555 0x5555>; + status = "disabled"; }; @@ -3662,6 +3673,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, phys = <&pcie4_phy>; phy-names = "pciephy"; + eq-presets-8gts = /bits/ 16 <0x5555 0x5555>; + status = "disabled"; pcie4_port0: pcie@0 { From patchwork Tue Feb 25 11:45:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13989885 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 3E842268685 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 (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51P8mTgS032187 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-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44y6nu0re4-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-f199.google.com with SMTP id d9443c01a7336-220c86b3ef3so136578315ad.1 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=GjoyU67wCA1QuJvDdg/YGxwnHQyhfi875VC83NyhuBYcHlONJMfTw4JnaEkYL4WyCh F9d87oLyOaczC1C8l3qTOBhay7wOoVSnKsbR2sIu0LA3aG8/UAW1VD4H2BkDO0PKNlbO wBszXsJ7M2CTfJgY5q0IcAJENLU9u0+OvJtYItY00hHCHmNyEOwsFk7I9nsDKH/4aXci IBUvrVxrN8+WofrgIbEPO/2159Cj8+4NRHZ7DjnI5HVel4e+dxsXUDNX3G/lKGDSWDyA EQozSRtOS5XTh84OtRkh0AiYGDHERMYtFLuO1hay0+5JtM4lAfIfB4WVrYR84Rn28YZe 6LLw== X-Forwarded-Encrypted: i=1; AJvYcCU7OKFd9L7T4Jc4gj2DhjInDsSdwNYN4Gfbhu+4ibe0CkMPdRtS0pdrMfwZWf2jGqivqW3lPRsYU6c=@vger.kernel.org X-Gm-Message-State: AOJu0YyInm4I/13zs7MFJcHhiuW6m7xzXbLLIKnUg15Se1zj92dD/6L6 RkPtqaAaBd8ZNX9RLBxtAjbEpkLQsv2hpg5ZOYORKyPZHfrZqHPNxy1tt1IFD8tSxwo9Aw/53DU 9BB0dZD5E6pfnDRrpB4XBC0Tph2kT4DOx/Rw0JDGAWCkAdpylEjOvDChmS3Y= X-Gm-Gg: ASbGncu0bVr5DUrxzn/VFQromOVNeTioIy0u9P5wBEag2epdv+Zcy5bzwSbo5SEiNze I689Avig75s7Y8vFnTkhFaXuktqL4KI7u/FNVh6P7nhFwSD+LL69Fghk0MydsR/77wnGaeEt/VT U8sWufUZ6GRprIIaH+YEvpbF3DTFpPrYE4buT+EYegLqhp4cVxKivLcKUySuuigVx96jwYCN2KO Daf8sXtZeJL5pXuGdLmBi49FYcVXruM11UOdGYwP1iiYf+jpuWIwzKY9jKCH7oxaYZaPK0uyg4Y x4R+wouZzlia8p1MWvNbvCcs8Fe2MOtnR0VFW7JVSDVdeVDajpk= X-Received: by 2002:a05:6a00:8a17:b0:732:6a48:22f6 with SMTP id d2e1a72fcca58-7341410bb54mr27637498b3a.9.1740483948539; 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-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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=84?= =?utf-8?q?ski?= 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: EeGa7VgcwHBUUqAzBVKy9GVhbZy5guwY X-Proofpoint-GUID: EeGa7VgcwHBUUqAzBVKy9GVhbZy5guwY 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 suspectscore=0 mlxlogscore=999 malwarescore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 bulkscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 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 *node, 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 structure + * else assign default value 0xff to indicate property is not present. + * + * Return: 0 if the property is not available or successfully parsed; errno 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] = PCI_EQ_RESV; + ret = of_property_read_u16_array(dev->of_node, "eq-presets-8gts", + presets->eq_presets_8gts, num_lanes); + if (ret && ret != -EINVAL) { + dev_err(dev, "Error reading eq-presets-8gts :%d\n", ret); + return ret; + } + + for (int i = 0; i < EQ_PRESET_TYPE_MAX; i++) { + presets->eq_presets_Ngts[i][0] = PCI_EQ_RESV; + snprintf(name, sizeof(name), "eq-presets-%dgts", 8 << (i + 1)); + ret = of_property_read_u8_array(dev->of_node, name, + presets->eq_presets_Ngts[i], + num_lanes); + if (ret && ret != -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 +#define MAX_NR_LANES 16 + #define PCI_FIND_CAP_TTL 48 #define PCI_VSEC_ID_INTEL_TBT 0x1234 /* Thunderbolt */ @@ -808,6 +810,20 @@ static inline u64 pci_rebar_size_to_bytes(int size) struct device_node; +#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); int devm_of_pci_bridge_init(struct device *dev, struct pci_host_bridge *bridge); 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 */ struct of_changeset; From patchwork Tue Feb 25 11:45:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13989886 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 272F62686BC 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=1740483957; cv=none; b=CnlxSSI74XTqkcv8yWoVjMYToOcLCA/mgOv5pef3Xzt3eg2RSgJyP9fOqKtFMxvgAFE+iZZzOejifiEHFms/6r6dz0R4jsoShNpZNHzh8ecA292/gxPGwqmtVP5sjFsk4dDn/yGWIrLva6HOWaUwXYyTkaRn8WV4KNP5y+oQZ04= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740483957; c=relaxed/simple; bh=u4stSlHqt6SDmbNCOygNp94BXAp7R4cdNbXp5bogHOM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TUiVIvQq7NYTi0Si4QFMho+jq7MVSbY9IwBY308uaEnj/Gg3D+ZqZNWHtj1pb9LQhZ+XrjEdQLjmWQKQZKxGWxwOmlLiSryKJXp3UAdVn4T0YxgJVizVdXM9i+mTNgzKJ2xN2C4k0Mvu08snzZj/r9ToL/0DbUDxIbxXFXpyUEc= 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 51P8C6a8017995 for ; Tue, 25 Feb 2025 11:45:55 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-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44y5k68ud9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 11:45:54 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-221063a808dso108258075ad.1 for ; Tue, 25 Feb 2025 03:45:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740483953; x=1741088753; 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=P7Zkr1Cy4LbiH/6a1RZ+aAHdxzxT8lJYq3lI0rtZiItV33nsdPOpfFhVHtB/UOCTiR 00vP5tOi8QytCtcq/yXKNpA/RrX2wlruurIrdsLXGkUl3BysojBeb7xCwW/P/B0GMG+H ANrWZFSFLHikT/fEiyf8+tDMiCiSVCc7u5hioKIbmh88LKeOIBX9wKt7txfndJaYiDjP 6UNP65qrtjrNXCRdEN86UKU12NQ6Pkwfksv1ceZK95/zUj1VKgdW7KSUyVVo7D60H44i v6cTscaDMwCjxgf4/7+L2NprZj2VMGmqFkCN7P496etv+nPvH0SbJFBHSbmg8R6+lx06 utww== X-Forwarded-Encrypted: i=1; AJvYcCXjWjyMlJKHa0ryWenszJdGH+6sBDybAEdNp04jHEhGgIVhc+x6Lbvmp29rKkxt32cEdREs4gmKBoE=@vger.kernel.org X-Gm-Message-State: AOJu0YwoxJJoIgVtceF738vVvVfOKkopzjts/y8kwaHfbRgeP1oNmb08 /uJJO6MYqf+ABSmnEjMhpCPNLifbrP+IgNuSEQKneog+tuWwTPQ4TJB8Ni9w3fVSLwtzYmI3Uw+ JSQ9ozu7UGfrlnTA5ee0VPb21IHzspYaUKRd3Jzr21MMUNnMl6/kqpMgxy8Y= X-Gm-Gg: ASbGncvytwZoq5ivCoeSLvOuJTLv6jk+/ja6VjWaH9IvHKv+I02+6mQsdsQSRTGtbDk UR/bYkzJmB4tX2Kcg9DfRjth7oL3GUdSkFxd87+vWcKHDpckTFtPg2qgr31M28jlFk2J1cflVFu 8kYEMHHv99oB7ybEy3e4VT3j1d+Q0vGdiCZgJIe52lOZnP4sLoMPFdTA7s9D3gBFnmof2qhkm8X rSk5SXV+54ZUUG1MChbvW7ult8EI7arF/68HggNwNwUzSUQGCRi55z7/N1BPy1hqSqJOvRiMwE+ +h4B4HZU6p4eSlHEeVSmYpUlR6MM8drUBsMQxTM95xp7g3f+z8Q= X-Received: by 2002:a05:6a00:1810:b0:727:3fd5:b530 with SMTP id d2e1a72fcca58-73426d77f98mr23597980b3a.15.1740483953487; Tue, 25 Feb 2025 03:45:53 -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-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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=84?= =?utf-8?q?ski?= 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: is_VVOorQPTYdNINY-vulSo8f1SN2Je6 X-Proofpoint-GUID: is_VVOorQPTYdNINY-vulSo8f1SN2Je6 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/pci/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) dw_pcie_iatu_detect(pci); + if (pci->num_lanes < 1) + pci->num_lanes = 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/controller/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) } +int dw_pcie_link_get_max_link_width(struct dw_pcie *pci) +{ + u8 cap = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + u32 lnkcap = 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_lanes) { + int max_lanes = dw_pcie_link_get_max_link_width(pci); u32 lnkcap, lwsc, plc; u8 cap; - if (!num_lanes) + if (max_lanes == num_lanes) return; /* Set the number of lanes */ diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/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, size_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, From patchwork Tue Feb 25 11:45:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13989887 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 E492F268C79 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 (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51P8PYjK013305 for ; Tue, 25 Feb 2025 11:45:59 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 44y5wgrt2h-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-220d8599659so104310185ad.0 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=YTdbhBpi3cWdKPfXCw+ZemajZGfi9OEO9tcATdsU/lfy5WYjVg90axKxQM/cGXPqh5 R2/EB/lIAhndmOwW2SZ5h3Qh6lqTfk/El6okupNGEgxwPzDeBeM05VlbZLNndXDy7aft ZHMZCUGtHMvJXKhvN6k/Y7bAkfPhoMTpa+xnCjcEML2m89RUnHLqz/LvpMuafDbbb7/k 5LklROb3sbXGXE0yz+nQFCoBl05F8JzfZRE0pgP8FVqPs5ChDHmpLclKwJ/ZPqs1YzqS 1TtWpwwCKb6VU5jJCfJ0m1Vj/4ljcfzhWjBjWQSYeWhzpFuPh0JUnWyKmGnNtfBAcdC9 0J4g== X-Forwarded-Encrypted: i=1; AJvYcCX5Vyz+iFeUTm1az266At2UDNP23Y4i7hY1vYtTRWIHWtk/6Aj+y6HZ0oR8EN3pBY8uOAeDRWYjVvU=@vger.kernel.org X-Gm-Message-State: AOJu0YwNlZblQKalN+cpRMwkG0Iy+96z5QMlaA9S41vf3hyr27mutwRP LUmnYSsotFk+bZNlqWBLS0yu8LU8BRx27QswIYqUN/PQotGzrLQRZnm700XtSdGPQOVPNiSYeLg FzdaNi7tZaeGag+gXo7sRNpavtF2s9rlZkKcaPlpn5O3R61/6D+GZPNeLoH0= X-Gm-Gg: ASbGncs9Y+v5/cah1RzU2cfqguwH9pEwVfq+WOYgAjK74WS6AN6dY2s3qNNDUrNnGil Qsxj+ZLZ9/enO0agGCeiYVv42wRFUSsXJpRI121/TLPIVpPW6JrWU0ipEIIbo8aC4V3xE+E/K2q fSAOaUgyt8XoR2Gcg5k2dmh9uCCXOGaNfgEcuglzhsCNBIHMFtvBYJm9Yn/dAxUcwYGh+BbENZZ u0imu4DEF3cmOz2Fvkaiwh9Gkgh9D3tyGwCKtvsmlhJI8grDQ4VAeJnlyeYTgEDlibdklyOh/JJ RIpMs1U93hA7SVU6OWdtmNH0Cn0o5bjKn2ULUflBxeHpDR7NETs= X-Received: by 2002:a05:6a00:22c5:b0:732:2170:b6a3 with SMTP id d2e1a72fcca58-73426d963b2mr30573993b3a.21.1740483958285; 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-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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=84?= =?utf-8?q?ski?= 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-GUID: GuKFCYC45YtO389PaiA051bFydyFMN7B X-Proofpoint-ORIG-GUID: GuKFCYC45YtO389PaiA051bFydyFMN7B 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 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/pci/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 = dw_pcie_link_get_max_link_width(pci); + ret = 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; } +static void dw_pcie_program_presets(struct dw_pcie_rp *pp, enum pci_bus_speed speed) +{ + struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + u8 lane_eq_offset, lane_reg_size, cap_id; + u8 *presets; + u32 cap; + int i; + + if (speed == PCIE_SPEED_8_0GT) { + presets = (u8 *)pp->presets.eq_presets_8gts; + lane_eq_offset = PCI_SECPCI_LE_CTRL; + cap_id = PCI_EXT_CAP_ID_SECPCI; + /* For data rate of 8 GT/S each lane equalization control is 16bits wide*/ + lane_reg_size = 0x2; + } else if (speed == PCIE_SPEED_16_0GT) { + presets = pp->presets.eq_presets_Ngts[EQ_PRESET_TYPE_16GTS]; + lane_eq_offset = PCI_PL_16GT_LE_CTRL; + cap_id = PCI_EXT_CAP_ID_PL_16GT; + lane_reg_size = 0x1; + } else { + dev_WARN_ONCE(pci->dev, 1, "Not supported data rate %s\n", + pci_speed_string(speed)); + return; + } + + if (presets[0] == PCI_EQ_RESV) { + dev_WARN_ONCE(pci->dev, 1, + "Lane equalization preset properties are missing for %s\n", + pci_speed_string(speed)); + return; + } + + cap = 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 = 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 = to_dw_pcie_from_pp(pp); + enum pci_bus_speed speed = 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 >= PCIE_SPEED_8_0GT) + dw_pcie_program_presets(pp, PCIE_SPEED_8_0GT); + + if (speed >= 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 = 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); + 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/controller/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 +#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; }; 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 */ +/* 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