From patchwork Mon Dec 23 06:51:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13918533 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 5674F18D622 for ; Mon, 23 Dec 2024 06:51:35 +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=1734936696; cv=none; b=a/3wsQB5WlZWbBLUsUNN1MRgcJUUXrXdQwCaoxD2qA19XAFtuhTnQHMX4rOGEo0W51H0pGKyXN0UDYsu+b6c1+vAwuXCGxrIu/G4HgjPGS2Uz6vwXvMoNrD0UVjKPMhLU9ef/Pq7ZrzbOKbrApTbaNrJSPE1YKj3HPpk8Tqcmyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734936696; 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=hr7Buy0lT+zUcXawcahZTrz2oZAMcALAVoQYx3tjp9qBijDptr/J6EK/ztpB/zIVwuDxT7qVP2q4xFmubx0E/d0n4Pt4KTvYTf1azDXf/LhnFArDdVOkVgwv4n5mdtyVxfL5qHGjguI2eD0rEqgWWibcpPCXyajqCXaLRdKoCGA= 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=iR+7AoTI; 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="iR+7AoTI" 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 4BN3CUhj007809 for ; Mon, 23 Dec 2024 06:51:34 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=iR+7AoTI5k1sOEGT xbNmaqLnVFj5LCAgmfT+Cf0JZ2g3NSmkr39YKReYMvI+YKdCO8b0ncGjxazOavms iDZ86bY7NbfXgiWnV554EwqzVhEvZKBk9Kk7OiyXu+WXALUjmwY7w2ijPqHKMay8 gNkdYB42gVG0YgRpeoS7mcpQ6JYaFefDiIWhZT8hIvPvchksPMvgy9ZrKp9rS8jC uaCBZlwM0LLyKn9aYw88bsNdcMnaUs3Xc9C0PR36D+XcmeW98ugBCDo3dTaLBL2q Gy46DpusJXiayfXjfvXZEem9IeaLcGeJn9GquP0+O4TUeF798Jt7NNF//atsyQJ3 gXxCrw== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43pyrprr2e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 23 Dec 2024 06:51:34 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2166464e236so60698675ad.1 for ; Sun, 22 Dec 2024 22:51:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734936693; x=1735541493; 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=ANvBw1URurwPuLI4Q7ZOIEBYS9xkj4CrGiv5W+xOmgP6LyVuTkkXb8wo95Dub8gttj Z/nqwNv7oLXqur/z0PQfn/aYB76R6yf7Ojg866wTKGVs5tuXTlDME+6x0e/IcNaPovCo r1gpg6qV6nQMxBzBx8f9HrcZvYRGGWuuA/7aB036Wca7XcXjpNVfqpVAtRxrWqk1hxKB RXKJnrmorIH+INWQsvmxUEizujfUD292WMBGtSa0WxWwIdZ9p/+ddSzHWU5YKVS9IZmJ eqnAp4gNN5VqLEWvtNDANvai3a3PdGKwj8mXGUh7c3qh9qVVNiT0Go34I6dTgxsISP4A 074w== X-Forwarded-Encrypted: i=1; AJvYcCUCBq/EX5SG6MSIKU2Md0GUds1UkaRNZLRMygC3SNyc0LZuXeAIhpNKitp3Wpz4l2+165Y2jDus6NU=@vger.kernel.org X-Gm-Message-State: AOJu0YxYCo4HF6hmUpofN8U5FDtKhvfugwWgWzKEFUA1y+8QRhFuNvYo n81gAsGXnHefn+W5vJ1dlUiz1cJbxcGes2JbR8jSb/sNosqgYPsLCKsU7cbsFT9B/f0gMtgTtNz XKRj0wi8XGtH4sJZQslmgZ/sT1sk4oUT3TMjU6FmgHA+pouHSei+HL0gEyKI= X-Gm-Gg: ASbGncu+jON5v3E4+4lKJPqaRtIWJR6LGf82xawPjvEMUBinL25FKYAftR3dw9qxoyS fjhLZOflYLuR5zG1ZZvvCqKYR5Van+mMy0VKy7a8iIU7N7wRlJvNcnohGiwWGl+J5OG+WjLCOim 4X9VWUXA11/4IUwhq/q2DD76YVdu3e3S3Y4ONSFp6pZU0g3M12SIVxb16aA56lyP+2wX9F/gv08 EgisKhNb3JNPDZ/HsRmSQpiaKfwHRz+3Kmsen/pRRlDnN6GOrwYxQCFYrS2KFBPoTs3r+Ztn98E yXe0P2Iw3FrD9FeA X-Received: by 2002:a17:903:22c6:b0:216:2474:3c9f with SMTP id d9443c01a7336-219e6f38177mr158490555ad.52.1734936693201; Sun, 22 Dec 2024 22:51:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlj6SyzFJBx5rNy9TZZL+0N5FIrCQWKe50bVBLK5VVHJb/y3WmnXlcafYRW6ANLlzpYPjV5w== X-Received: by 2002:a17:903:22c6:b0:216:2474:3c9f with SMTP id d9443c01a7336-219e6f38177mr158490325ad.52.1734936692892; Sun, 22 Dec 2024 22:51:32 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f4413sm66570155ad.172.2024.12.22.22.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 22:51:32 -0800 (PST) From: Krishna Chaitanya Chundru Date: Mon, 23 Dec 2024 12:21:14 +0530 Subject: [PATCH v3 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: <20241223-preset_v2-v3-1-a339f475caf5@oss.qualcomm.com> References: <20241223-preset_v2-v3-0-a339f475caf5@oss.qualcomm.com> In-Reply-To: <20241223-preset_v2-v3-0-a339f475caf5@oss.qualcomm.com> To: 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, 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=1734936683; l=1380; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=1cCWyVa5AK2/6g1dA5pRl5YsQKIo2vs/YZuAmrzjF+g=; b=s3e3TGtJRqA29PmDdzWAUKd4dKAi16hOJG07WXrsTiXkTuNMf3o+/YJJJUd7aq/bDpszcnRCz sczssJdJRTeBx5zj5yQMBEY6jqJG9fv5U7MMmy2Lgz0fyTUssPFfBbG X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: H3a05gNsLlUhVxDHsHLqh5d1dSMvualo X-Proofpoint-GUID: H3a05gNsLlUhVxDHsHLqh5d1dSMvualo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 impostorscore=0 bulkscore=0 mlxlogscore=931 priorityscore=1501 malwarescore=0 spamscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412230059 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/qcom/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 = <&pcie6a_phy>; phy-names = "pciephy"; + eq-presets-8gts = /bits/ 16 <0x5555 0x5555>; + + eq-presets-16gts = /bits/ 8 <0x55 0x55>; + status = "disabled"; }; @@ -3115,6 +3119,8 @@ &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, phys = <&pcie5_phy>; phy-names = "pciephy"; + eq-presets-8gts = /bits/ 16 <0x5555 0x5555>; + status = "disabled"; }; @@ -3235,6 +3241,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 Mon Dec 23 06:51:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13918534 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 C77CE18FDAE for ; Mon, 23 Dec 2024 06:51:39 +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=1734936701; cv=none; b=GpKceHTmofr83lMvl955VaZl//fL+7aBDn2XfI90Ez/gzKIc9u5Xj2fadSn2VBm5B+ARcezMYJlcOD8sYwgptwzmUqVVf4Xp47IovN/nVHEDL4YHbZtFTcjAigqR0QwpLbfL9MR+ngHd0s7ylpK/eyYN6m/V3ptQZWaRGAwm74Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734936701; c=relaxed/simple; bh=BTyoDXzoLq9s40NBa/pshroRWzYAGvXUT/nxju8J8D0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u48zxA3QFvy1HnDRykVj423Nqey6fn3VnpLXlIv0Y3NCj+jPedCt9xnnGl4ApncMi6jm6QSpCdrHnv8bD4OIt63Ax3zZ18HIxur/LcezHbOrKaj9acM+Ufhhr99pZuVnWHS2aWl/XOOUsifljxzyeNIR+IgyWkkIvAp7MTv9kM0= 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=PrImAiqQ; 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="PrImAiqQ" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BN5rXG3018305 for ; Mon, 23 Dec 2024 06:51:39 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= AK+hrs/JALBW0DD9HIign1EsYk4zdtIZIxy745tr+Bk=; b=PrImAiqQFPSBJxK3 +wfp93jsw/tqnxqeXsWUKGeBe/TG6xQf3G1o5V+GHq0CIvxrH0F+1Kowm+GiLNLs 1M9fCrk0NUKXL/TqOuwCCyBc8yfLXPFNFz45aaWYDf6UyE2o5uwiVVymTZqLrQ5j k2rQazVzVXVYgYDi+yq0Z0MAbEgB6YPyA2Vmkxq3gdM5eVoSNOwzY5W8yu4GKm0N xZZ4WZAjM5hl8HvXfDbauCWkuyMpQXnGifqoYsAQqNY4v7Vo+UTwEpQrPPZoz6n7 9vmFlqg8T6LnX7us4ayFznqyv+SvxAK3SB0Sq7IorZ/J3CP7i+riZE8ZzlIpnV8h rXNCkg== 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 43q24587b3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 23 Dec 2024 06:51:39 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2163dc0f689so58433945ad.1 for ; Sun, 22 Dec 2024 22:51:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734936698; x=1735541498; 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=AK+hrs/JALBW0DD9HIign1EsYk4zdtIZIxy745tr+Bk=; b=PsYmZV/lQyElFeHyoS5IBdXRxx+eIYZ3XifBeFzXMuHN0zDBod98U729W86Bsun79g Yb6sGQcW8d4As1dDwc6HlNSqId+hUGJeybFJ0STT0covqa1hhAtTL5vpIfIoJm62c8ea v/nTsRIgriKiMD7wnykuzoYYjVaBIbAJv7ne7FoMUre6+OvfR4iw2xNusysK/9GLLZzy 5a63v+cwoVu35KZMGFEkTpSK/iBCVZ6QhjgJQ+7MAnvJaYI1Mcwvsmy/FgsS1cHc6zru fqFzlVsBHp7Bg7XOopXKhw6XHwdJ/gsuh/bZ2VL7TqyB3KF1pocI5ifn+Mc3bjuQ7vPO cgBg== X-Forwarded-Encrypted: i=1; AJvYcCWcrym7amDUpVSjyxhE5wfSg0P4ECu22lZ4h4JpxCmtBWxQUqYQKD9V8/XoMHz9lhjV+3O2ryT2Uz4=@vger.kernel.org X-Gm-Message-State: AOJu0YxsUU1Uu9UCFFZkpOUQ8qNG8xd82Ha/JDjORN6HGeLA8F69M0LB UI2DH2NCST45g7pvlZf4eQNyCQm5Rh50nl7yvGjmAOknQPTUgJ41P7LEkiVyhSEfgGRvYNoYjO6 LsPkN/3Tsw6NuyNHRfOa89t4bjHHT2i+Jsyh+SHVQnYqmPMtQedVXpxyu0no= X-Gm-Gg: ASbGncvmqNzyK5wb1ACENcOe/K4SxG5crfbOWwDUfwsWnuMnkTc9f/JGZzXR3cR/TWw SY5bXSjityFmqA6dv/sng0iXq0hwRFzOTm/Xek/5lzMrcSDRsbggapTpDJ6qE1qPfDYpHgvtuzL crJ0aSUqHnZTPOGMjlz6zfJBfnrQZfWuJG2oMg+/3yS9R54rFpv6KmdL+LZUuvmmc9Op8hEpWLo CfGQ0ONDy9xOhoXnRoD3iXAQMtvWhRWlBQMTXrvXf7LV4w9J6fBz36JoaJqdjUa3cuSgOsU4BAU zH15KvcacPfQ/mBg X-Received: by 2002:a17:902:ec85:b0:216:45b9:43ad with SMTP id d9443c01a7336-219e6ed1eefmr150810735ad.34.1734936698294; Sun, 22 Dec 2024 22:51:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmyRzksNnCrLRhxeP2eVQ5twQbsfm7dxy0tN7QPXZbzY5KftXPGqbFNRDaKO+aqvJ521z9Sg== X-Received: by 2002:a17:902:ec85:b0:216:45b9:43ad with SMTP id d9443c01a7336-219e6ed1eefmr150810435ad.34.1734936697856; Sun, 22 Dec 2024 22:51:37 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f4413sm66570155ad.172.2024.12.22.22.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 22:51:37 -0800 (PST) From: Krishna Chaitanya Chundru Date: Mon, 23 Dec 2024 12:21:15 +0530 Subject: [PATCH v3 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: <20241223-preset_v2-v3-2-a339f475caf5@oss.qualcomm.com> References: <20241223-preset_v2-v3-0-a339f475caf5@oss.qualcomm.com> In-Reply-To: <20241223-preset_v2-v3-0-a339f475caf5@oss.qualcomm.com> To: 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, 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=1734936683; l=4075; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=BTyoDXzoLq9s40NBa/pshroRWzYAGvXUT/nxju8J8D0=; b=WbEgznFVUiIIA5kOqXb6wHzrGIrLipGcVwfWec9f7V29xYB1V8QAE4wm921/s+il2t/w4zCUF 4JnRRyWJXUwAhi/RIOS2chQ+iYTPdzo0NH8YNI8CsG+4eBOVnIhVKEc X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: DRn_FEZeO_e_eeZbpFOkCfnNsKlBtWNS X-Proofpoint-GUID: DRn_FEZeO_e_eeZbpFOkCfnNsKlBtWNS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412230059 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 | 45 +++++++++++++++++++++++++++++++++++++++++++++ drivers/pci/pci.h | 17 +++++++++++++++-- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index dacea3fc5128..99e0e7ae12e9 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -826,3 +826,48 @@ 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); + +int of_pci_get_equalization_presets(struct device *dev, + struct pci_eq_presets *presets, + int num_lanes) +{ + char name[20]; + void **preset; + void *temp; + int ret; + + if (of_property_present(dev->of_node, "eq-presets-8gts")) { + presets->eq_presets_8gts = devm_kzalloc(dev, sizeof(u16) * num_lanes, GFP_KERNEL); + if (!presets->eq_presets_8gts) + return -ENOMEM; + + ret = of_property_read_u16_array(dev->of_node, "eq-presets-8gts", + presets->eq_presets_8gts, num_lanes); + if (ret) { + dev_err(dev, "Error reading eq-presets-8gts %d\n", ret); + return ret; + } + } + + for (int i = 1; i < sizeof(struct pci_eq_presets) / sizeof(void *); i++) { + snprintf(name, sizeof(name), "eq-presets-%dgts", 8 << i); + if (of_property_present(dev->of_node, name)) { + temp = devm_kzalloc(dev, sizeof(u8) * num_lanes, GFP_KERNEL); + if (!temp) + return -ENOMEM; + + ret = of_property_read_u8_array(dev->of_node, name, + temp, num_lanes); + if (ret) { + dev_err(dev, "Error %s %d\n", name, ret); + return ret; + } + + preset = (void **)((u8 *)presets + i * sizeof(void *)); + *preset = temp; + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(of_pci_get_equalization_presets); diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 14d00ce45bfa..82362d58bedc 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -731,7 +731,12 @@ static inline u64 pci_rebar_size_to_bytes(int size) } struct device_node; - +struct pci_eq_presets { + void *eq_presets_8gts; + void *eq_presets_16gts; + void *eq_presets_32gts; + void *eq_presets_64gts; +}; #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 +751,9 @@ void pci_set_bus_of_node(struct pci_bus *bus); void pci_release_bus_of_node(struct pci_bus *bus); int devm_of_pci_bridge_init(struct device *dev, struct pci_host_bridge *bridge); - +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 +800,12 @@ static inline int devm_of_pci_bridge_init(struct device *dev, struct pci_host_br return 0; } +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 Mon Dec 23 06:51:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13918535 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 001E11714B4 for ; Mon, 23 Dec 2024 06:51:44 +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=1734936706; cv=none; b=IfTBTKt9n0hKCIjDTL4gLGqX9L+raTCHoENQedZTcXX6jf/QMn/SU3/JeH6ZWOB8Y0t7YmY9qKgDtmKPAsXGAt3auw8hhYwjPBMs4MPKXL7QkBW6IobDntebVobMnaKBZzEdrQlaCLJBQfa4xjTjMLNlHLY370xzjgDYjzcqa7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734936706; c=relaxed/simple; bh=5rxRkPnumzzfAdemdZBFDf4pCGC4z3dLReWUJOLysOk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mFQDwSghLk+OJCMcwEpwRM2iHj/TuyV3atCyps1Na+S1vKmKH1UV+Ag7VTqsg6tW25Dsj2Lul3TEUhMyBbVbVw4w49T+8MlWSe4hD/hb+X9iMvJDcpOZllkeREBVhdJeSeo25yNutWqUUODjJwuQGqnHwKHng1YfaE6O5/maxyQ= 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=GZxUTt+6; 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="GZxUTt+6" 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 4BN6mOwJ004675 for ; Mon, 23 Dec 2024 06:51:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= yQsJM/reDtTZynjk4EeE4bMecMMhIsTfkx5E7VPjZRU=; b=GZxUTt+63nkN28l4 ErRIGOg66rHzOF8MvAYQAOxy5xBL0D+Y2UiODN5qTbrWMS2bWhlGdxc9rF6qB/lQ CcyF7M6Sge9F6eOp+vnBt0VwSUGXFaZ4ez5js4i574puhU0+uNx2DDxVEyONg4kB o+hAEpmohQddcmDLQYo7/uc0DefWQVsxdI31hjbC3VQKZGhd/KJdG3zJY9d3mvj7 qWAYNia3CcfESSqcQ+8qQU/FiJaha0xajMJA7+4gYSfdJWX6XESXrEuSz2+Wipkt Guukl7bmA0UuJJxvl6WdIEaCDMDr1PuF8Ji+llfBLR1Urm9w2OAD34eTea5dgtdJ FPgEdA== 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 43q2ww80dv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 23 Dec 2024 06:51:44 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2ee46799961so5228946a91.2 for ; Sun, 22 Dec 2024 22:51:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734936703; x=1735541503; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yQsJM/reDtTZynjk4EeE4bMecMMhIsTfkx5E7VPjZRU=; b=dTHLSV7th4l6g7d93sQZYXb7GhYg2aia49EFpMpOes0kg0R2gk4u57yhmy/4sXfxzW +NLxc3YqsqTQVCvZIyg5NjV0Sdp7LQ50nPurbYybJfKnEDTGecYfvMTSHMWBS+gv9rSJ uERM5sPoJ2tPY5laWJBb9YSjXD61Ar1waG7jbZQTH7weIr26aQmPMvfWfVkFj/ShGbNf IvnYdaF9ru4PppkdlL2CXTnZ59ZvdxV9z8MrHX2JIOoMkpHFtV9ykRGdnzGNTEALHBr/ slWdbAxh5wbAjmtSbhGMq8tmmJ3DMZTWkqU6VnGPtHkRipr/+DNve0FUWCSSwVEE7Etl OJng== X-Forwarded-Encrypted: i=1; AJvYcCUgYTWiNc4XMGAtBXGSd29hzOiVJdxTi5oym2wDUr8mhkRSB9QQ+3KX6ML7uTUQ/It0M1Y47MhsJ6k=@vger.kernel.org X-Gm-Message-State: AOJu0YzOycpUCKgDFtVxXv4ldMsuDL5zB1xYVtM88cmoe0Y34k353sqf cjb6olISZNtrkf7wnkyd63rxIWMF3GRl99NHwqpr68HxcRLWTZnq5wUka29s5M/F0AXGEHRi9pa qGTCuJ9ncTfzkE7ctzmJHhTWOKYfyeZhLDJNsdByjkZLSYLBfypWccGlqO/w= X-Gm-Gg: ASbGnctIh0iTfciKAHStHCmrzzUBHJRerW0zIkTezSSWOtsgma2XfjU93OIPrd4QM6A 3IH95CuVE+HHfSBdm/h9wG3jrTQrULRa4Yp6hpHyScZBv/hEDupQD7S0U1visNOHZBUP9YRj1T/ W0GlHAeXS3Lnf3iyUSCp84hFWtrmKic6gKVmTuevJXtAIT2Rtsik+y/OlGNqh37xWamkf3+kR8w +0GYvo5C0ReEyIZ7DTmMh3dyizddr9oMb8i4cGdrSE+l+AEGhI0ZT8lHCCNa/fFiGZ0GmT68PPJ xDdTZNmfYc12SdHQ X-Received: by 2002:a17:90b:5245:b0:2ee:d958:1b18 with SMTP id 98e67ed59e1d1-2f452f01c34mr14869506a91.36.1734936703251; Sun, 22 Dec 2024 22:51:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3Eevay4cFpBOZVpfqRhKjBVEV/hQa4faos0PEeOW7zqFrwQ+g3KW2ARs1mbw6xpw+YV7mDQ== X-Received: by 2002:a17:90b:5245:b0:2ee:d958:1b18 with SMTP id 98e67ed59e1d1-2f452f01c34mr14869492a91.36.1734936702884; Sun, 22 Dec 2024 22:51:42 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f4413sm66570155ad.172.2024.12.22.22.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 22:51:42 -0800 (PST) From: Krishna Chaitanya Chundru Date: Mon, 23 Dec 2024 12:21:16 +0530 Subject: [PATCH v3 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: <20241223-preset_v2-v3-3-a339f475caf5@oss.qualcomm.com> References: <20241223-preset_v2-v3-0-a339f475caf5@oss.qualcomm.com> In-Reply-To: <20241223-preset_v2-v3-0-a339f475caf5@oss.qualcomm.com> To: 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, 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=1734936683; l=3448; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=5rxRkPnumzzfAdemdZBFDf4pCGC4z3dLReWUJOLysOk=; b=drL2ws+ekg+rOEN2EVcQ1pdTOuJQRBj/bcvcwDRYsyjofzJvw6CLCHfF4MwD0uTP7SNSAYHbU 6K0Q/nsao9xDp7HKpXRtGxBFuIQbpsdVoekFT9GlMpHFH7Ktk0yNqsb X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: 2F60hYcX73drZa3JqzmZZs_5RxYSUfWK X-Proofpoint-GUID: 2F60hYcX73drZa3JqzmZZs_5RxYSUfWK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 suspectscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412230059 Currently even if the number of lanes hardware supports is equal to the number lanes provided in the devicetree, the driver is trying to configure again the maximum number of lanes which is not needed. Update number of lanes only when it is not equal to hardware capability. And also if the num-lanes property is not present in the devicetree update the num_lanes with the maximum hardware supports. Introduce dw_pcie_link_get_max_link_width() to get the maximum lane width the hardware supports. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-designware-host.c | 3 +++ drivers/pci/controller/dwc/pcie-designware.c | 14 +++++++++++++- drivers/pci/controller/dwc/pcie-designware.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/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) 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 6d6cbc8b5b2c..acb2a963ae1a 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -736,6 +736,16 @@ static void dw_pcie_link_set_max_speed(struct dw_pcie *pci) } +int dw_pcie_link_get_max_link_width(struct dw_pcie *pci) +{ + u32 lnkcap; + u8 cap; + + cap = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + 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) { u32 lnkcap, lwsc, plc; @@ -1069,6 +1079,7 @@ void dw_pcie_edma_remove(struct dw_pcie *pci) void dw_pcie_setup(struct dw_pcie *pci) { + int num_lanes = dw_pcie_link_get_max_link_width(pci); u32 val; dw_pcie_link_set_max_speed(pci); @@ -1102,5 +1113,6 @@ void dw_pcie_setup(struct dw_pcie *pci) val |= PORT_LINK_DLL_LINK_EN; dw_pcie_writel_dbi(pci, PCIE_PORT_LINK_CONTROL, val); - dw_pcie_link_set_max_link_width(pci, pci->num_lanes); + if (num_lanes != 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/controller/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, 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 Mon Dec 23 06:51:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13918536 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 3EA351925A3 for ; Mon, 23 Dec 2024 06:51:50 +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=1734936711; cv=none; b=Em93+e+hS5usen8FlZjK3e2euCxx2js/El/iIbRHmHxGaaeqHk6LbbovJaDEk+xjUQRXivCKHq5rvCbBcBznu+ATK1AznO0j439pLPH+QswWWxsQNhxrb/rHq4GkQsXW3zlETxJlFI7Yut/yBxGrx0l8KK1oO9tnwWufar5IAEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734936711; c=relaxed/simple; bh=9iPBkilViQhwzYPPM4sGNw+fIqURUBi25muzZfoAfiY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SEGUu2cn+KF0JPyQjTfXkGDqYJdsuTBEyyJyJnzkBDH/hJO2Kk33P8cWw8fiVWxc8ln/bLT5zFX6JtnrOMarR+LIv1EuIrG8paqPrhk5OFsYPIsf04z9CFnrntOCKmWtTYteFwIhbMhWO4jIKcxKy/Ohd/VizqYvaLWRSLm+UUM= 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=PwOt+mBq; 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="PwOt+mBq" 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 4BN6Bp9e021186 for ; Mon, 23 Dec 2024 06:51:49 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= Af5Mt+ubKBOdlLcQnRmqNtqGK3efOnrGl6vcLswMaIA=; b=PwOt+mBqgbowC7Er 7ZCnO+xMGjbUf+Z2zfgA0EOhdcn/zD4I0i+JmHz2sFxLygn2Sm1LXX2bTDDUG0aJ J3CJKCqL/d5ixS3IhVK7kzKwDOy4PB9TJr8x7Ic9oLcNdQ9OKRTHnt+EhRviVmP7 NfQt7GLfAGv8X9ZwfTSCqhg9KdD/+6Vxhokd2yMia09RYCW5LFfvtnZy71LVw2wK pwPFYHXVZahMK1x5Nb/UcBqJoJw0mmy1ezeQyYDlIDLBS7CaiMlqii0AbfcADK3g 3axP/GCkOwlxIQ4jDqaA8dXGOZOw7XuuYK3lG37W6RrKXM3n0+Hdbnq4ev/uSS5H oPqZBw== 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 43q2cm04w0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 23 Dec 2024 06:51:49 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2166855029eso33969125ad.0 for ; Sun, 22 Dec 2024 22:51:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734936708; x=1735541508; 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=Af5Mt+ubKBOdlLcQnRmqNtqGK3efOnrGl6vcLswMaIA=; b=AnwF2uSQNwghcUeUNf1Udq2f2vsnDVaQy9mfAIOvWPfHKcQE/9J9OQdAjuLNR+l74/ vwCq/jE4KjMh8Xirqh0QP3VRBgpFL06ZunSjftIp/3Lri7pxIPhbegAkhj3nmbEyR37+ +h2v6EIj9jkxxXJqf/QP3CNdFyNoz5thbfLlUyw7DujSuKoaQcYtsbKrr63DMJYChzoe jFm4o+/jHmMaxVT2Rc1iyRXdecpFyudwOxptwdEZGr7x1pw738cLjzrx3RK8PnUgcAA0 /HKZepGX60uCt4TK27xFQfj2pqz2dQYkcsoNJofA9wbloyzAvptL2IaMi5efnQrDgui6 tlpA== X-Forwarded-Encrypted: i=1; AJvYcCUBHHF65GVJP2tJUvkIi8OhXl0BpSBfq8PoW0TRfzUMJ4KkZPUXoHXI7IktZozeG9u3mKivcwHsHnU=@vger.kernel.org X-Gm-Message-State: AOJu0YwtwranSzb8XI/F2nrlVpQEKiY8+XXnMv1S+L6D1UZf7llZfS4g bBBvDnVj9PuTYUZwVEEvqA0fUHspZiBFut0fPvDrcHz1kKEYNSCgiSFNeRIdspn39jKBK9cjhzg 0OUkTqxycssFjUo9Hm8XI1FjzyiNTc1gieBFFqlpxzTgam5kV8TaBaejgjlI= X-Gm-Gg: ASbGncsSg1XML8Jj/QFI4SNGKWJ1KiXnKlPw5ZnvBht4d1lk88TdWNmpfMCHyBWOECG sC0idk8pQ314VVgwr8JJuKLV/tGvIwVaqC1V/HfL9/Qwl2Fje9yXIclFf78jvIar6idPIACYot/ l7unCQG2kLQn/NHGoa7zpzcP9yfIHKlYaH1KkTJDFLREhMsrwzKezU6Q4svntF+kSrv0Iq4FrFJ QlQzDQTh/OInU/S2c+Dem2GnnHDUAOoIFfm6TQ0VvJEoTdHdYLDkm4At8FTgrAmt+iQgimTPrx0 oQPxx8ori1VyRBCz X-Received: by 2002:a17:902:f550:b0:215:a04a:89d5 with SMTP id d9443c01a7336-219e6e859d8mr146177755ad.2.1734936708267; Sun, 22 Dec 2024 22:51:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEk8WqNVvkHrK7paVwQxUN5NMRNU3kN7hnEse7CjQZ60CfVOf6MFP4KpKXQ+8mcS0z/A+N3cg== X-Received: by 2002:a17:902:f550:b0:215:a04a:89d5 with SMTP id d9443c01a7336-219e6e859d8mr146177455ad.2.1734936707863; Sun, 22 Dec 2024 22:51:47 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f4413sm66570155ad.172.2024.12.22.22.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 22:51:47 -0800 (PST) From: Krishna Chaitanya Chundru Date: Mon, 23 Dec 2024 12:21:17 +0530 Subject: [PATCH v3 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: <20241223-preset_v2-v3-4-a339f475caf5@oss.qualcomm.com> References: <20241223-preset_v2-v3-0-a339f475caf5@oss.qualcomm.com> In-Reply-To: <20241223-preset_v2-v3-0-a339f475caf5@oss.qualcomm.com> To: 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, 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=1734936683; l=4481; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=9iPBkilViQhwzYPPM4sGNw+fIqURUBi25muzZfoAfiY=; b=gS2BejIAVW4y1KKMIVp945bWdoLFPZUKUzHejFKMdxOxL4KXiwMNODLhU/6WZDUojv79IDOZJ xqAL0kAce8eBeR6yhG4Z0jRojKIQ0Lu9ZjMoE0Mp05Q7jGZQ80kpyD8 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: 20EK5JIftrhJA3b6pnJeTwfmxsB3TFm5 X-Proofpoint-ORIG-GUID: 20EK5JIftrhJA3b6pnJeTwfmxsB3TFm5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 spamscore=0 phishscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 bulkscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412230059 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, read the devicetree property and write it in to the lane equalization control registers. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-designware-host.c | 39 +++++++++++++++++++++++ drivers/pci/controller/dwc/pcie-designware.h | 3 ++ include/uapi/linux/pci_regs.h | 3 ++ 3 files changed, 45 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 2cd0acbf9e18..22d3d350918e 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 @@ -802,6 +806,40 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) return 0; } +static void dw_pcie_program_presets(struct dw_pcie *pci, u8 cap_id, u8 lane_eq_offset, + u8 lane_reg_size, u8 *presets, u8 num_lanes) +{ + u32 cap; + int i; + + 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 < 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]; + + /* For data rate of 8 GT/S each lane equalization control is 16bits wide */ + if (speed >= PCIE_SPEED_8_0GT && pp->presets.eq_presets_8gts) + dw_pcie_program_presets(pci, PCI_EXT_CAP_ID_SECPCI, PCI_SECPCI_LE_CTRL, + 0x2, pp->presets.eq_presets_8gts, pci->num_lanes); + + /* For data rate of 16 GT/S each lane equalization control is 8bits wide */ + if (speed >= PCIE_SPEED_16_0GT && pp->presets.eq_presets_16gts) + dw_pcie_program_presets(pci, PCI_EXT_CAP_ID_PL_16GT, PCI_PL_16GT_LE_CTRL, + 0x1, pp->presets.eq_presets_16gts, pci->num_lanes); +} + int dw_pcie_setup_rc(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); @@ -855,6 +893,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 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 +#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; }; 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 */ +/* 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