From patchwork Tue Feb 25 09:33:58 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: 13989628 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 22BDD26159F for ; Tue, 25 Feb 2025 09:34:36 +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=1740476078; cv=none; b=RKiZfM6VgFBc+uXkD3tXErmXWQ/C/PMdCWGtUP1nspznT7tvoISVleD3Qu2UOLJ2PC/LPkEltoBMOeZCikhoBM7ApEw9ENTioDlbsEf1ROn+y8iqFCOwarAM8XX3CeANPqoHbsAYBNP4/coGkkTgWv3dob2Qx6mN5qtcjZQEN8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476078; c=relaxed/simple; bh=VMaieC3p7d7h+BKd20qmksO2FRNzpQZ5H7nxfFEYOIs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZjMCLcFCYaAz8J3S9rH4dm4mSBSUfXk6y1nzRiDvuVbCIKkB42pJebEHE+75ZlkLQ2LdBHrPwk9h+rkHYhQEsuOY3zXejwUuPx5w8PuJMt00GqDYg6AwSAHM8Qd58WCzvaCgT7IK7srSu+JbHLYZzn232zbkXXG4Yz+Fj31pak4= 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=IwL/Tehi; 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="IwL/Tehi" 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 51P8XJ1g001961 for ; Tue, 25 Feb 2025 09:34:36 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= XsE5WvYbRTtHjWkWh0b8hh2A7z6b+pDn2VzrFovXRtY=; b=IwL/TehiJt6ARZuo Lb2dSAuX0wa1UEXr1/ds4U/0OLDjatl3I+X3xqfPk4QVzmc7cOt5KiFB1lUUhcnP mk9FtHJcbQidYH8shPKXKSrY1L9kDI/j9uv1WhDMukA6wGj4SR4R+2ZEd4SEBqbo VE2uI1PlYe77fRKoNnCkYG5PgQpGHYAD/DNR/97pClKkQgtghJdnp2JHx/yAxYbi OTcgLn5uBsTcT/DracVte1crgTJMfE/ROOBcfG0FLcrub6lHDPH4mUX36s7tP2OR zz5i/n5VgaiLMGE93uYZkfowkgJ2tnOHT5vK314m/7JHoR1GhSWAcVnEf0e71IFT xanhKQ== 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 44y7rk05xh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 09:34:36 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2fc2fee4425so18239794a91.0 for ; Tue, 25 Feb 2025 01:34:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476075; x=1741080875; 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=XsE5WvYbRTtHjWkWh0b8hh2A7z6b+pDn2VzrFovXRtY=; b=E6JjULs9Yhi1e/zFz8fPpy1I4y/s41F8Ix47YnB6FhztFiyHWIes70+3VfinadeprD 6UN6QeT821mvekVrIt5+Odo4RQR2QmU6H35IY8ykpwjDJ8E3nAfadK79Mah2ucB/EyKa 56KYspCcQAJ6dn2xbdFPpCg2DuLQFvTWPTK3SeaqT5KL/H3ivk8tutjTU90fsOOYmDDv dFkL3iBaqQNURimit5D9kc1hS5612Q1+7OoNQPdW4NBYrXWBwH1UoccPaN14hBddJn00 Ei1S5bFcDqEN0GSWJE6+5EvUrVQcaNSFuwYD2f6LvkrOksQhGz64NuBtnjXBNDO5cCiX YyKg== X-Forwarded-Encrypted: i=1; AJvYcCV/0D+crAiUjKlpxWMWe56E+xMau/myBVk6sgIEeR9nIW/zT4dMyJvt+SK0sl4/TrvdloaMPAQFssN5pozg@vger.kernel.org X-Gm-Message-State: AOJu0YwgA4nJwEw4sYu59gIud03pYYFz2+LKjKL9N77CP/twy8HjWYRh 5ZhG5jQSrSdzHg/UNgBs4lVNzPPVz0/NDo9rrh7Jzypr/WPZpFTR8qben+qguMmeEMyLB59WWhI lMzb3nCXX5ClUtc6t22fqLYDi3bxDWlx73nGfLTfitkZyEbmlZwquhQ6oGhHuYB9V X-Gm-Gg: ASbGncuV/o304MoomXid76tQ2Gbg7Gb4WGE4U+3eUupS4ADVYLplg2sghE+wgamvDtt Nu2VqpokPBSKPtWsqSVi0wH5cJyqG2ne2W+VJ3K5aFqTbeDsqBah2BuH5rdhyV951S+abHivDWm KUf/clPMBf2od8F1PpXXVFMHUsGeLKOuAZsKptYzbJ5cjoyZD86ck4fl/kg9kQQpRx4VkvLIKz+ JwgyJ6cKBvjsnXS0jSqpQtJ57jt/uOCHV06zMt943HSpnFCbMGevxqK8QpAiGWa1YGxkX2J2/6h rk9ppEgbvjL6n+v0CSpl9153hQVKRaXIpC7DUcXmtxdsGQTNF3w= X-Received: by 2002:a17:90b:38c3:b0:2f2:a664:df1a with SMTP id 98e67ed59e1d1-2fce779ffaemr29343148a91.2.1740476075254; Tue, 25 Feb 2025 01:34:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2B59jUe1Exesv/ylkZfCZktr0zWjqiDai3G8L/s1PyuX+VDChVsAlOE8MCqL5yJAHAxFlGQ== X-Received: by 2002:a17:90b:38c3:b0:2f2:a664:df1a with SMTP id 98e67ed59e1d1-2fce779ffaemr29343108a91.2.1740476074810; Tue, 25 Feb 2025 01:34:34 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe6a3dec52sm1080770a91.20.2025.02.25.01.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:34:34 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 15:03:58 +0530 Subject: [PATCH v4 01/10] dt-bindings: PCI: Add binding for Toshiba TC956x PCIe switch Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250225-qps615_v4_1-v4-1-e08633a7bdf8@oss.qualcomm.com> References: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> In-Reply-To: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> To: Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , chaitanya chundru , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Jingoo Han , Bartosz Golaszewski Cc: quic_vbadigan@quicnic.com, amitk@kernel.org, dmitry.baryshkov@linaro.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, jorge.ramirez@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740476062; l=5709; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=brkFgGbvu8Si1vNLuH/EyodmI+pPyxs89QuPsEBMO1M=; b=8VJIODrxDNySrUb8DA3brne3D67GwyM9bxMEYuBbY/IBld+zlE7Q3K59qObaWFZ78uPgyN+zR yjnkB/X8NU/D9ploAU1/XjeUiKoEQdlY9d7mdqAagOnOI4o9YZUgREw X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: qyUDCytIw9w-UR9jgnr9W1DhRGYp4erv X-Proofpoint-ORIG-GUID: qyUDCytIw9w-UR9jgnr9W1DhRGYp4erv 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_03,2025-02-24_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 phishscore=0 impostorscore=0 malwarescore=0 adultscore=0 spamscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250066 From: Krishna chaitanya chundru Add a device tree binding for the Toshiba TC956x PCIe switch, which provides an Ethernet MAC integrated to the 3rd downstream port and two downstream PCIe ports. Signed-off-by: Krishna chaitanya chundru Reviewed-by: Bjorn Andersson --- .../devicetree/bindings/pci/toshiba,tc956x.yaml | 178 +++++++++++++++++++++ 1 file changed, 178 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/toshiba,tc956x.yaml b/Documentation/devicetree/bindings/pci/toshiba,tc956x.yaml new file mode 100644 index 000000000000..ffed23004f0d --- /dev/null +++ b/Documentation/devicetree/bindings/pci/toshiba,tc956x.yaml @@ -0,0 +1,178 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/toshiba,tc956x.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Toshiba TC956x PCIe switch + +maintainers: + - Krishna chaitanya chundru + +description: | + Toshiba TC956x PCIe switch has one upstream and three downstream + ports. The 3rd downstream port has integrated endpoint device of + Ethernet MAC. Other two downstream ports are supposed to connect + to external device. + + The TC956x PCIe switch can be configured through I2C interface before + PCIe link is established to change FTS, ASPM related entry delays, + tx amplitude etc for better power efficiency and functionality. + +properties: + compatible: + items: + - enum: + - "pci1179,0623" + - const: pciclass,0604 + + reg: + maxItems: 1 + + i2c-parent: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: + A phandle to the parent I2C node and the slave address of the device + used to do configure tc956x to change FTS, tx amplitude etc. + items: + - description: Phandle to the I2C controller node + - description: I2C slave address + + vdd18-supply: true + + vdd09-supply: true + + vddc-supply: true + + vddio1-supply: true + + vddio2-supply: true + + vddio18-supply: true + + reset-gpios: + maxItems: 1 + description: + GPIO controlling the RESX# pin. + +allOf: + - $ref: "#/$defs/tc956x-node" + +patternProperties: + "^pcie@[1-3],0$": + description: + child nodes describing the internal downstream ports + the tc956x switch. + type: object + $ref: "#/$defs/tc956x-node" + unevaluatedProperties: false + +$defs: + tc956x-node: + type: object + + properties: + tc956x,tx-amplitude-microvolt: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Change Tx Margin setting for low power consumption. + + tc956x,no-dfe-support: + type: boolean + description: + Disable DFE (Decision Feedback Equalizer), which mitigates + intersymbol interference and some reflections caused by impedance mismatches. + + allOf: + - $ref: /schemas/pci/pci-pci-bridge.yaml# + +unevaluatedProperties: false + +required: + - vdd18-supply + - vdd09-supply + - vddc-supply + - vddio1-supply + - vddio2-supply + - vddio18-supply + - i2c-parent + - reset-gpios + +examples: + - | + #include + + pcie { + #address-cells = <3>; + #size-cells = <2>; + + pcie@0 { + device_type = "pci"; + reg = <0x0 0x0 0x0 0x0 0x0>; + + #address-cells = <3>; + #size-cells = <2>; + ranges; + bus-range = <0x01 0xff>; + + pcie@0,0 { + compatible = "pci1179,0623", "pciclass,0604"; + + reg = <0x10000 0x0 0x0 0x0 0x0>; + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges; + bus-range = <0x02 0xff>; + + i2c-parent = <&qup_i2c 0x77>; + + vdd18-supply = <&vdd>; + vdd09-supply = <&vdd>; + vddc-supply = <&vdd>; + vddio1-supply = <&vdd>; + vddio2-supply = <&vdd>; + vddio18-supply = <&vdd>; + + reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + + pcie@1,0 { + reg = <0x20800 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges; + bus-range = <0x03 0xff>; + + tc956x,no-dfe-support; + }; + + pcie@2,0 { + reg = <0x21000 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges; + bus-range = <0x04 0xff>; + }; + + pcie@3,0 { + reg = <0x21800 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges; + bus-range = <0x05 0xff>; + + tc956x,tx-amplitude-microvolt = <10>; + ethernet@0,0 { + reg = <0x50000 0x0 0x0 0x0 0x0>; + }; + + ethernet@0,1 { + reg = <0x50100 0x0 0x0 0x0 0x0>; + }; + }; + }; + }; + }; From patchwork Tue Feb 25 09:33:59 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: 13989629 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 C7568262D1B for ; Tue, 25 Feb 2025 09:34:42 +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=1740476084; cv=none; b=U57o3PLr5kux5Iwz4mm41zfqznq9qI5PzuU909aOfOBlbghv1gUt53GcuC4M7dfA2jscP8Im0opGJZVOUBAAQwzplZozLdxvL3FmrhmVjDhxTa2bwk4rXKG86YNT+IVxoV+o7IaGOsnD2oJFAdEpsSJa3iiv05pSRSL3S5A3ksQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476084; c=relaxed/simple; bh=HkGQp4f5hZyVT3mZhk8V9rDY2/ZkK33BHDhuHHrUTW8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l3byaUFa5ccYjZAIbFijdYSiTmEYxqnZwKdlfJcsdUesGaGzilWhVUAiJOQRgF0M2rSmzT4Kq92TYYWB86DW6z0S8Zc+zygFektdwA0uZ3w5gGRSeYTgFEl1Wdm/PvxJL/b/1x1X6FVKHKTxIsxmaMfVS/RLiaUOmWc0kOTjwto= 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=D8a0RB3r; 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="D8a0RB3r" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51P8Risu020077 for ; Tue, 25 Feb 2025 09:34:42 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= Cdyl6Kdke6YaeFojQXtf30VB8RI5y+oayrn/e2SqI6Y=; b=D8a0RB3r7zIiX+vO P22hM0d56Y79FwngHhr5l3MdaRqNiCG9Xq6hVKbmwfaXpwGFXsqFsyIgKMItAvva o+HtoO/IbkneTgwRxa/ji++FcBP/QKNM3EpRG0DgjHal2gknaecY1e474deYsVld 0jQ8SSJdvTVC9fRONNpTTLO/dklf7hpXSMTRf7fHjBTTZW+0tbVuhQQ/gM0ep/Cp oT71dscAGf6+TOln94yw2qkvnAE24NmNn+BdFfHhVQSRaBZOAu2JwdHPgi/YijhJ sEKggxgW35Y5SaBjZfp2fl8uPtHGJ7/uB/K+lvoJTzsqZOHQO1KJ3EoSiJs2JGZZ O9RJNQ== 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 44y6t2r76n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 09:34:42 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-2fc17c3eeb5so11314705a91.1 for ; Tue, 25 Feb 2025 01:34:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476081; x=1741080881; 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=Cdyl6Kdke6YaeFojQXtf30VB8RI5y+oayrn/e2SqI6Y=; b=exTOXaJvq++QnH24GiEZgvT+FNz2e9j0qMi0CU648BtrLaBz5W9Wq2AlJRc0Iqwyqw SGNoSsusLKFYx00MvDVNrqNKI4+I+/vRD3ID+hpenYYLFl3Q33SpSM3jEK4kln+MhgFd 8A+Ls/GGtWChGNx1PqQhVerbHzrRAmKHqBtqP7+YMGDLsoUwmWg5eCAxRH0tihNcpmCN 30QPhosH/xOZ8UobfdZkI/LVIkV4kNPmmEUT0WUpFkty52uLsXyorgcX1D+0UYenIu18 NS6G8nIHJ1QPTElf3nHr5440KFZ1BAp6jBF1eSnaUuVkpND6L4XaFSptzrdqK4OWPS9a ARdA== X-Forwarded-Encrypted: i=1; AJvYcCVGOCMfSFOFPROvzVRysXvDnAw9j1WCMhgO2B+ciVvTZPh4IsH/Rov9RtkhJFbiV1LsdqG05mg4oAfCM/TE@vger.kernel.org X-Gm-Message-State: AOJu0YydUO2f5vjl9H64pQ7LP2z6foPQwl5tCRI8NSS5p2iPrcDH44iQ qy5LcVNpyDxRDwywFstu4Y8dDQkGEhxw+4vpTdlfw5wJXUQS2JmkondxQOuEaKyEqmVqn8hG2+B WvM5eM4nVNjxe9V7f25aGX0yHjbguWbBbO2r6kp1M2NIHlvBbYrbwh/JNe5oJKJ0h X-Gm-Gg: ASbGncuBds6wBWjjYoVeqcP64OlRBMYnyl6iyvX3AXlUQ75urlbqZQyCDav0lPs/Nld YjUkcDC3z1sr3nvQxCvRUVsKAWZxc6hyal1LjojYK/jdaKZcoHo0Z8Jg41Mxa7D8rKKmLzzLF4M USgtJ+Rr/BZehUIv6tVpw6+qZT19UUJGxxgoayxv/56v6ekufxKxtn8K4oqsa8lan59CeXc+kAD lvBJ6G4ynpPxXJwjeXQPaaHv1oJltwm+G8Jmdr0+58kXB3+NtykbdOvYbIl9H4hoc/NVPsRMKA+ kuf757pd+ZgbI/zQjxovv4jYx1iJ+K6HZ5lKLTjiabB0SHeeyVE= X-Received: by 2002:a17:90b:2e8c:b0:2ee:d024:e4e2 with SMTP id 98e67ed59e1d1-2fce868cc3bmr29003221a91.7.1740476081287; Tue, 25 Feb 2025 01:34:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGr5dYTc2AoXKciY6yWDKYzrILdl2vJlc/XmwUCQsBft75O5wJyu8qmlUhamieBoEO53lW4w== X-Received: by 2002:a17:90b:2e8c:b0:2ee:d024:e4e2 with SMTP id 98e67ed59e1d1-2fce868cc3bmr29003190a91.7.1740476080871; Tue, 25 Feb 2025 01:34:40 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe6a3dec52sm1080770a91.20.2025.02.25.01.34.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:34:40 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 15:03:59 +0530 Subject: [PATCH v4 02/10] arm64: dts: qcom: qcs6490-rb3gen2: Add TC956x PCIe switch node Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250225-qps615_v4_1-v4-2-e08633a7bdf8@oss.qualcomm.com> References: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> In-Reply-To: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> To: Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , chaitanya chundru , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Jingoo Han , Bartosz Golaszewski Cc: quic_vbadigan@quicnic.com, amitk@kernel.org, dmitry.baryshkov@linaro.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, jorge.ramirez@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740476062; l=4401; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=HkGQp4f5hZyVT3mZhk8V9rDY2/ZkK33BHDhuHHrUTW8=; b=BHVLAnv7hiU61nR3ANxetqjSkTrZ6HoEYepvQt/giU0Nr3mEMACl/9nBOX6Sl2G/ZJ1qQXmue TwGPNgbYCDVAly1AM2MmUf3tpIrE2JpFaVOI/H/dBqAzcwVRe9Bvlfo X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: f7D00AvDwiqHQveGBkTdEPrZT8617iZG X-Proofpoint-GUID: f7D00AvDwiqHQveGBkTdEPrZT8617iZG 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_03,2025-02-24_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 spamscore=0 priorityscore=1501 mlxscore=0 phishscore=0 malwarescore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250066 Add a node for the TC956x PCIe switch, which has three downstream ports. Two embedded Ethernet devices are present on one of the downstream ports. Power to the TC956x is supplied through two LDO regulators, controlled by two GPIOs, which are added as fixed regulators. Configure the TC956x through I2C. Signed-off-by: Krishna Chaitanya Chundru Reviewed-by: Bjorn Andersson Acked-by: Manivannan Sadhasivam --- arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 116 +++++++++++++++++++++++++++ arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +- 2 files changed, 117 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts index 7a36c90ad4ec..13dbb24a3179 100644 --- a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +++ b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts @@ -218,6 +218,31 @@ vph_pwr: vph-pwr-regulator { regulator-min-microvolt = <3700000>; regulator-max-microvolt = <3700000>; }; + + vdd_ntn_0p9: regulator-vdd-ntn-0p9 { + compatible = "regulator-fixed"; + regulator-name = "VDD_NTN_0P9"; + gpio = <&pm8350c_gpios 2 GPIO_ACTIVE_HIGH>; + regulator-min-microvolt = <899400>; + regulator-max-microvolt = <899400>; + enable-active-high; + pinctrl-0 = <&ntn_0p9_en>; + pinctrl-names = "default"; + regulator-enable-ramp-delay = <4300>; + }; + + vdd_ntn_1p8: regulator-vdd-ntn-1p8 { + compatible = "regulator-fixed"; + regulator-name = "VDD_NTN_1P8"; + gpio = <&pm8350c_gpios 3 GPIO_ACTIVE_HIGH>; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + enable-active-high; + pinctrl-0 = <&ntn_1p8_en>; + pinctrl-names = "default"; + regulator-enable-ramp-delay = <10000>; + }; + }; &apps_rsc { @@ -735,6 +760,75 @@ &pcie1_phy { status = "okay"; }; +&pcie1_port { + pcie@0,0 { + compatible = "pci1179,0623", "pciclass,0604"; + reg = <0x10000 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + + device_type = "pci"; + ranges; + bus-range = <0x2 0xff>; + + vddc-supply = <&vdd_ntn_0p9>; + vdd18-supply = <&vdd_ntn_1p8>; + vdd09-supply = <&vdd_ntn_0p9>; + vddio1-supply = <&vdd_ntn_1p8>; + vddio2-supply = <&vdd_ntn_1p8>; + vddio18-supply = <&vdd_ntn_1p8>; + + i2c-parent = <&i2c0 0x77>; + + reset-gpios = <&pm8350c_gpios 1 GPIO_ACTIVE_LOW>; + + pcie@1,0 { + reg = <0x20800 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + + device_type = "pci"; + ranges; + bus-range = <0x3 0xff>; + }; + + pcie@2,0 { + reg = <0x21000 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + + device_type = "pci"; + ranges; + bus-range = <0x4 0xff>; + }; + + pcie@3,0 { + reg = <0x21800 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges; + bus-range = <0x5 0xff>; + + pcie@0,0 { + reg = <0x50000 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges; + }; + + pcie@0,1 { + reg = <0x50100 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + ranges; + }; + }; + }; +}; + &pm7325_gpios { kypd_vol_up_n: kypd-vol-up-n-state { pins = "gpio6"; @@ -839,6 +933,28 @@ &sdhc_2 { status = "okay"; }; +&pm8350c_gpios { + ntn_0p9_en: ntn-0p9-en-state { + pins = "gpio2"; + function = "normal"; + + bias-disable; + input-disable; + output-enable; + power-source = <0>; + }; + + ntn_1p8_en: ntn-1p8-en-state { + pins = "gpio3"; + function = "normal"; + + bias-disable; + input-disable; + output-enable; + power-source = <0>; + }; +}; + &tlmm { gpio-reserved-ranges = <32 2>, /* ADSP */ <48 4>; /* NFC */ diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi index 0f2caf36910b..b2e2b1f26731 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -2284,7 +2284,7 @@ pcie1: pcie@1c08000 { status = "disabled"; - pcie@0 { + pcie1_port: pcie@0 { device_type = "pci"; reg = <0x0 0x0 0x0 0x0 0x0>; bus-range = <0x01 0xff>; From patchwork Tue Feb 25 09:34:00 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: 13989630 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 DAB23263F35 for ; Tue, 25 Feb 2025 09:34:49 +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=1740476091; cv=none; b=bELhxx6bbbDiP7T7MUKs+Ldsyj+bPB9/sVCcPP919coF/rI2VmXAfwc7mvDtSj2uhupcYgv0PhAYIPquN3aWN/EIaP1Jm9MTYTyoBFptfLYv9313ImCg8qtHwRsTyvpkmkJl13fqA0n8hAdpOiFH1+4c2gttKrRjp3sx1yrErdg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476091; c=relaxed/simple; bh=oouLjGtH233lwoGhCTipl0h9nbjcJt//bXzApe/ONc8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Gauy+ZIDF1XJQ907qG1OM1m6VkH4MOQ62bz3r+AfZj0V2E1ntn8h4RhWR/uzxtC1IWGldqCXXq2W4y4vBSJy4ZBcN1MQpocoVE1mvS9XsLhehQrDBtI56hhJkKJDuKyOJZfG/NHIqwW8EF15pxoZyXJTBx9fI+H+zVsOrIAUNv4= 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=KVpJPcpr; 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="KVpJPcpr" 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 51P82QlI009756 for ; Tue, 25 Feb 2025 09:34:48 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= HSIJQ7jaFX6kCm1/h4SN9ZCiGBfl+wZu7rF9036LeAg=; b=KVpJPcprwsBl1cuT vVLv9LNMlBonLDMlxDG6pufWB/Mwmv9ZgSqH5dPojbcgYbMmWTMHe9IFd8h/eDuH IKeNKY56GCt18LglvLoJsoy/GdvQQJa3yl8soECWBnGrPxfCgbnT5ndfDF9sqkXl /10l1bqKgwGdyAzSZSqD0DOjBfedlDsegJwDIk4CCDohZsUPXI/0H278p8EfVRRz Egth2GqCWEngInIkaKOdHWW6Q2DMBOAAH69sC8EL7YLMu9IZOWwLyHZ+8/EQVXg1 Zf3GQwjmqXcNtWrPoBm3g2kXbKjJBAE7HDwfni1a+vutafq+gvKfnNPopB5JP+KQ HgQUeA== 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 44y3xngjqp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 09:34:48 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2fc0bc05bb5so11403186a91.2 for ; Tue, 25 Feb 2025 01:34:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476087; x=1741080887; 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=HSIJQ7jaFX6kCm1/h4SN9ZCiGBfl+wZu7rF9036LeAg=; b=qWti+b0whpLCMj8FdyZ6FJv9M9lHaoRZM5ZHZ5vs4IcqVNz1+I5gcmzj5wqk4XLnz0 UdWP9SMcp7E3ssNLqh9X2p2G7nPcSb0FHb7OS7UlaEihv1K6ZcZrlXOyPgjc7eJxQEq2 gqulYmfDCAQ9P8/lKBFvgeWpRNrtexA92iAzKL7tCOdkphMLM3C+tsdwxdO+b35kUTZF /dieIOLuQcsf+r63lk9OMxvr/wbDXBUa0Ipz8opDrNgPu+AW9epd174Ednr8oC2L3/D9 vGLwhhmZdiJp7wVtErgwc4tRn4d3lszeWzwDnPGf+2PqKDCucsxa5PvCBdafyIQAmDTE 08Lw== X-Forwarded-Encrypted: i=1; AJvYcCVVY0asj1n9vYnYhkYzsZRU0kB8GOUV7qejPR+9VUPgVSj9uMoQxaYoFlNTYTP1juX6/3Pl5AKLC4yShH7R@vger.kernel.org X-Gm-Message-State: AOJu0YzFdGAo+Hqifq2/0U0Rk0+HlYN1i7nVmSZXXxEQjs0wgjzTmAjk zGdnGalCQUObO5eHdJ9sLmwZHMy5hcYo7tIGmotSevowB6M+rGmniHjhIo1PkEjqsF3YOXMtZUm cuBF8OYg41cmEguy1wziMjv0gJdmoySjafNGrmWfeyqB9j4u5pgDSrQXMCPeGNRm9 X-Gm-Gg: ASbGncuI/EP88+LNwrEbha3bP7iZRmDR5QGXJ23DDAJi6RmNTJ99P/DXWjYotaUk8NF 8uxIU7Cw+0+ytEp1OzY4j6PhIKnlcT7HVZ/RicANqI/Ngi2qfgjIym4qm+uZ2lHGKyQPYQtCf7P +8PKmo+LSalGIJOGV7pczDpF4jGqvHbNChcsO3DFFROwUITetJyhOwzDD2MS0SxdvlZfFcmSGU0 HCSYIa52dzl8GpCWmo2dmC+CUSu7E0RYBSAzLj/Hzud5YBWf8xNoAK3nwKw55ZDhRGAD8ExGyjK z32F6Y6C4vxvsqircEn13Bi7OLvtRD7u91B91t6rTtKN1iNcKWw= X-Received: by 2002:a17:90b:2dc6:b0:2fa:1e3e:9be5 with SMTP id 98e67ed59e1d1-2fe68a2df32mr5100176a91.0.1740476087348; Tue, 25 Feb 2025 01:34:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkTr/zaRhtjk7yZHJlTH42C0GF7O7ieoM0aPS51ydoOaKSFln0kJiX7IFN15MoAYzjjQgltA== X-Received: by 2002:a17:90b:2dc6:b0:2fa:1e3e:9be5 with SMTP id 98e67ed59e1d1-2fe68a2df32mr5100129a91.0.1740476086972; Tue, 25 Feb 2025 01:34:46 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe6a3dec52sm1080770a91.20.2025.02.25.01.34.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:34:46 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 15:04:00 +0530 Subject: [PATCH v4 03/10] PCI: Add new start_link() & stop_link function ops Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250225-qps615_v4_1-v4-3-e08633a7bdf8@oss.qualcomm.com> References: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> In-Reply-To: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> To: Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , chaitanya chundru , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Jingoo Han , Bartosz Golaszewski Cc: quic_vbadigan@quicnic.com, amitk@kernel.org, dmitry.baryshkov@linaro.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, jorge.ramirez@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740476062; l=1500; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=oouLjGtH233lwoGhCTipl0h9nbjcJt//bXzApe/ONc8=; b=kKjEu1/eTiO/TVWz/OWc6m/yes9WPtkprKc9GkeIFwLfQFox/fnc7PZfPFwrmMqjVb+6o+fPF eWQ/SqN4b4hD9Kho7mMMbYbKHrs88VQru2moChKL1jQ8lcE+QFhHp9M X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: BnJGpS7uvmR065sjEnBEicSCKQBFNLYd X-Proofpoint-GUID: BnJGpS7uvmR065sjEnBEicSCKQBFNLYd 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_03,2025-02-24_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=831 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-2502250066 First controller driver probes, enables link training and scans the bus. When the PCI bridge is found, its child DT nodes will be scanned and pwrctrl devices will be created if needed. By the time pwrctrl driver probe gets called link training is already enabled by controller driver. Certain devices like TC956x which uses PCI pwrctl framework needs to configure the device before PCI link is up. As the controller driver already enables link training as part of its probe, the moment device is powered on, controller and device participates in the link training and link can come up immediately and maynot have time to configure the device. So we need to stop the link training by using stop_link() and enable them back after device is configured by using start_link(). Signed-off-by: Krishna Chaitanya Chundru --- include/linux/pci.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 47b31ad724fa..bbec32be668b 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -804,6 +804,8 @@ struct pci_ops { void __iomem *(*map_bus)(struct pci_bus *bus, unsigned int devfn, int where); int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val); int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); + int (*start_link)(struct pci_bus *bus); + void (*stop_link)(struct pci_bus *bus); }; /* From patchwork Tue Feb 25 09:34:01 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: 13989631 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 1D31C2627F1 for ; Tue, 25 Feb 2025 09:34:55 +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=1740476097; cv=none; b=U14Etj8to+u3U0YQzzlbvFvX4rUTaXTs0Z4LGnOys+r97u9HTDhMzrnepSIhjwRrxf6nqpB62UCxe2rjah4sCL3TAOQIiGOZ3YZho+imWkSvoyGroTln0PhsAjPyBVRkPk1pfpGxaT2QoO/WdOX/Ye2StrQGwPxqDTTdnygN7jo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476097; c=relaxed/simple; bh=w3BQV4GEVn3y93ZdP3UnB+XSKP+XiwrUWY/Bml6uy9g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ELdLi2zmzO7WrRHJ3f+8kMMRYhNzqnfglUcyT/8jCgcIrNZNNKhDTkYcYc6D2bbkDm3YI7t8MTjPeG1fBsZDRCDNCARPXLNDL2sdoK2gL6hyHpnoF7hsB3jt6msFTAP3J4HQ+Rr7j7S6Eh9RGkGbEWOT3clgIVSPq3juJKwysqM= 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=MYsKrDz4; 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="MYsKrDz4" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51P8e1bc009176 for ; Tue, 25 Feb 2025 09:34:54 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= PfVBAnMbd2bkW2PD02FjVQrfyFMHr5hxwFL2Mh9QfHQ=; b=MYsKrDz4OVpmk2U5 5tpxkw4/ypzQVD1NZfHTdvcovmqjxNPo49Z+z3XBPVj9tV/eFMUuawnXNSDC4Rwe qsGVx3xP22vetpyhA3ClGAtLOJVmPyGE2A8mu+FW5zyy4HlqMirIvg8XCm+SFdNc 9GtRlUd+dCPVaLMz+jLQpBhTbjkH2o6c2uv36XU4voLgw7UK2b9liGqZzwCUqmfz lEEOmFeUUa6fYA8iNnws8QETI0VfP0bFjouxwPvd1PsCJ1M5vjt95hCviaaknriN DqGIQkcYoDRCG/kF0yhBdlaSjuibhoQM+8Y65SjnXSmI8FHeC1jcZPPfhw8w6Xww vIYyLQ== 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 44y6y6rb0p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 09:34:54 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-2fc4fc93262so11819306a91.1 for ; Tue, 25 Feb 2025 01:34:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476093; x=1741080893; 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=PfVBAnMbd2bkW2PD02FjVQrfyFMHr5hxwFL2Mh9QfHQ=; b=HAvVAmUMKSYdmXF7tC6NUMCnKx6SMpWFV1pqgrClDRTC/Rnr8A9Y8UlXwNCufNCAZ4 rBB8mv+9gmD0rQmiBlvilV+2kRdF6jC1vyF0+YrPWb/1WjJwhA/t83tf1HkpZNibRMcQ 6+Q1zh5CXmrwNfDX81LSHFFI247xeBvpA8dhv5n5b4DECbXvB88MxCDOwYoDc8KAa7Rm 1wPcwvtf2e0ycvMptMTjvdRi5kKEo1ICYSxtRAzqzHzZ0VMDu5ORdwF3u7EofvtU2LpV /X7yGPRV8lCuLUYpzhEO2VNJGDgBQ/5QolUDjv4dTF+OrYHhBxiU8EryuA+lZC5dMhJ0 RiBw== X-Forwarded-Encrypted: i=1; AJvYcCX1W2EPUdS/NJFt0/H2pUZYc+8gOqElrskMjZfv+5R++7oL1XCwSToLexR+lNKUBVhWzc6b5tmxfLsXCpG6@vger.kernel.org X-Gm-Message-State: AOJu0Yxxee4hzem11BApeG3V6M8ccX3ljFFywc4vwci3rxM6oIo/k7Qm nJmH+hdzFfxT/N2xw5s8QAaMcfpfGGCtnfiaL+fgQ3adGK+TSokQ7S0vE0vL44u8ehYH2eh2IDE gB120zsjtQoa/AK0iNROcyNxJqzmqYiQvbz39JVbV1H/0KwY+U3SGk/SGTq2+eTd3 X-Gm-Gg: ASbGncv3/PUEusB4fa/tDYXcJJee3DHCCfcTYzhUgLkiy0m0vax0fzIjptYgIHgyIIQ 9wGfkxxLdTy8IKdvQtA8MMa6UDY0GDu83qGe5OHSUPxXHQTIK/ncTBgMpmW1wJQ3x/RAgY9KMkp 2oxaCi1+UX+b1BMOJn97Z4hI/NzFIb8E5Pq/JZ0NJ+bexxzxgDc8wyS0plAAjNMGHxCBoxc02kF WWmrroLcyZc0caBf2PBAUzKDoVFGC58LpYKEhugYTeeqmXDTiXsrhQNhb3w6UERfn+Icvj9EObL M3QSzgepL3JJacs4H6HB2f/R7AU+W9qpsl4SmrJKQu8ycvd2Ag8= X-Received: by 2002:a17:90b:2b8f:b0:2ee:ab04:1037 with SMTP id 98e67ed59e1d1-2fce78abacemr31839441a91.17.1740476093307; Tue, 25 Feb 2025 01:34:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfkUK8utPlxTxnPZ9mggiWDUCDDRGxOZv53sroMbh4/7yD0hJFXv+8HK7v+WABBzkzfhkZJQ== X-Received: by 2002:a17:90b:2b8f:b0:2ee:ab04:1037 with SMTP id 98e67ed59e1d1-2fce78abacemr31839414a91.17.1740476092989; Tue, 25 Feb 2025 01:34:52 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe6a3dec52sm1080770a91.20.2025.02.25.01.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:34:52 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 15:04:01 +0530 Subject: [PATCH v4 04/10] PCI: dwc: Add host_start_link() & host_start_link() hooks for dwc glue drivers Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250225-qps615_v4_1-v4-4-e08633a7bdf8@oss.qualcomm.com> References: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> In-Reply-To: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> To: Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , chaitanya chundru , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Jingoo Han , Bartosz Golaszewski Cc: quic_vbadigan@quicnic.com, amitk@kernel.org, dmitry.baryshkov@linaro.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, jorge.ramirez@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740476062; l=1526; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=w3BQV4GEVn3y93ZdP3UnB+XSKP+XiwrUWY/Bml6uy9g=; b=Ecnyx+01R7Ol61lB0SnLfgUmwTIIXPUGq+dcGYlCeRzL3eRvLpFInkEy3FC8hwma9M91qp/zo Ki3CTxY7zvgBrv57Lq970TQORFWxzP/T98htd0+Z+SOm8rMp5igpFGq X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: uv_X3N2M_VtGAJZkfbg-L9-ZOW67Y6sU X-Proofpoint-GUID: uv_X3N2M_VtGAJZkfbg-L9-ZOW67Y6sU 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_03,2025-02-24_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 malwarescore=0 phishscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=720 impostorscore=0 priorityscore=1501 bulkscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250066 Add host_start_link() and host_stop_link() functions to dwc glue drivers to register with start_link() and stop_link() of pci ops, allowing for better control over the link initialization and shutdown process. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-designware.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 501d9ddfea16..47f34dd12c39 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -435,6 +435,8 @@ struct dw_pcie_ops { enum dw_pcie_ltssm (*get_ltssm)(struct dw_pcie *pcie); int (*start_link)(struct dw_pcie *pcie); void (*stop_link)(struct dw_pcie *pcie); + int (*host_start_link)(struct dw_pcie *pcie); + void (*host_stop_link)(struct dw_pcie *pcie); }; struct dw_pcie { @@ -664,6 +666,20 @@ static inline void dw_pcie_stop_link(struct dw_pcie *pci) pci->ops->stop_link(pci); } +static inline int dw_pcie_host_start_link(struct dw_pcie *pci) +{ + if (pci->ops && pci->ops->host_start_link) + return pci->ops->host_start_link(pci); + + return 0; +} + +static inline void dw_pcie_host_stop_link(struct dw_pcie *pci) +{ + if (pci->ops && pci->ops->host_stop_link) + pci->ops->host_stop_link(pci); +} + static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci) { u32 val; From patchwork Tue Feb 25 09:34:02 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: 13989632 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 D9465265CDF for ; Tue, 25 Feb 2025 09:35:00 +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=1740476103; cv=none; b=mMB5aT2+W4czJMHiImY/URDxub8f/8p5JGQxQTTkhfkJlNTBwmBa0ilusERaAmIDQwVPNDAPVQ+MzMUNEgn8g/LeFQF/O753Ij7M7u/cOUBoT1CYFBTouJ1j/LL585NHjReJ1hQ9MPz3214pGHxsM2ojohEYYMGmsj8ZqJZCJCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476103; c=relaxed/simple; bh=anf9aES5VhlHQXEjRPr1CNKZ1r3sCkn3cMg87xu8Ys8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LPvW4flgPgYdwFxRSqBdENNCmC3rhrfRjTqgg07d+plzE4B4lQ7uimfTL5Dwr/8f4Cgzu0q4s9xK3MLzVo3QmvaGFnjd6ZW7XUg1lb9P9HWJ/XjG3LZ/Tgr/FKmA0Qqr9V+uK+GupfT8mEenFlib1cfSGMZy1ac3OXCmAiA6V6M= 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=NqfDCFVe; 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="NqfDCFVe" 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 51P7oIfS029205 for ; Tue, 25 Feb 2025 09:35: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= Ge8koW1LzXsU2LDTX9IJK1G1lfUQz/8lAGyXodJy67g=; b=NqfDCFVe9mR9XKz+ rhX0tmEm40EMKO4dO2+vEKutID3Ojcu0UZWy32jjdSO3Sky3fmxtnCbjtlmWc0tM gxuvDfkLjq/ZQAHUcm6gpiMY94Cyt+4iYnh9VvdDE0+Nw3Hye0+Xa0LSclgufp3u cv7ttbhPJKuOgL4mF8lWBd0D4AxirtVTQUySrpLwvP7HC6nbfCjUrZ43jnXEloGm Zm6ZoOunjetiRYQZuU2A13pvGFmsf4iCLPYpgVBYNOregHP+Ws6PHU7d0DjD0nvv NuIcG8aDSEjJjQwL3HEKnftS5OTnwPIFKRqhZXegqOXtc3cwSaHnY1500VnQt+5o FnHbLg== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44y49eggdn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 09:35:00 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-2fc0bc05afdso11996714a91.0 for ; Tue, 25 Feb 2025 01:35:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476099; x=1741080899; 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=Ge8koW1LzXsU2LDTX9IJK1G1lfUQz/8lAGyXodJy67g=; b=ZcTMsodyeaX8GN0TPA1Ca5GqlYCopuEDS9htnpZn04QeH/Kv9c7MGLwcHydHPKmgIO E3HLYvuy0MTJdSQPFwCnVzOi13UVv791Nge95omf5mJuPGWhVFcbQBJWbIv+Wt1d3wXQ eFnkSF3HR8yQMjeMYvOlekMF2GAkdckFiBorlWj2K6naVJXgp0XVVc808Jj+uSoDrtDU ib79MY9nsutfqH7alEuDOZMXuFO2XWw0kyWCFyfzOAhAU/TnVWLhIUzSC/xwsWSQLc/n vWCsBiYKUqizvBQjdwkW0lFx/8hxmcNChU2iD2da3q3Ek2uHC46Fo1c2SB+EIfLhIOlp +cig== X-Forwarded-Encrypted: i=1; AJvYcCXttYjE0thwaRTIGz4BFwTcX7QwvDax5TxIxfgolVcm//0rCUekFvFigSAGSRK2P4MCYpuDTsyZKOND4wla@vger.kernel.org X-Gm-Message-State: AOJu0Yx2930+fBclT29R02sqGXVVLTPvMxqli7JtF3t6nYKHA4i7f1pn j3cB8iRVISt8ArO6XLT2FtNvQ2VlTf60hjrFdYkyEKe3udzq8k/5PC0hqCKiWckZ9z++Pg9yijr wtr52kHsbEHF8kntF3v6geHY4U4J8UBCdkWPMhHRg0pDXauHl5W0ayhoXXf1HlVm/ X-Gm-Gg: ASbGncvMFXJfLmynFdEj3uf793o5+PIPNWTH1ANaDaNCqzAdNWzI8W2YOoCFmcm3/u3 2j0gNsYombP8lgH7jz/AtNAY1hhmprcZBfl5u+BXIZ5bPY5FlVh7DwgbqkumPuENrY4HHRvF8hR N+6Ig5dCnmvatuXSGQNFsrtXTTYeZTuhnBk+l7e7n3k+K0Zfb4J/xemuvfhmAlvylcvTHzvx+MV VawGd9/FEdpvXfhyjTAXSdndyPx4GNoT3KP4e9dIiYJyoWJLYka0rC8HaUSNBLzGi3Iu7ycQfdH +0huc7kvrwtFD114WumnBBkQdt9q0kVqfElVGZBnjUS2a4IJGDs= X-Received: by 2002:a17:90b:2590:b0:2ee:d63f:d73 with SMTP id 98e67ed59e1d1-2fe68ada4cemr4459011a91.11.1740476099377; Tue, 25 Feb 2025 01:34:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5p+lzZNoFjaemc5VbMk0MbdcpM4QkivSaX2gkc3c/LlopmSOWnSKhdc4+K7HgRdXVaU1feA== X-Received: by 2002:a17:90b:2590:b0:2ee:d63f:d73 with SMTP id 98e67ed59e1d1-2fe68ada4cemr4458969a91.11.1740476099006; Tue, 25 Feb 2025 01:34:59 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe6a3dec52sm1080770a91.20.2025.02.25.01.34.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:34:58 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 15:04:02 +0530 Subject: [PATCH v4 05/10] PCI: dwc: Implement .start_link(), .stop_link() hooks Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250225-qps615_v4_1-v4-5-e08633a7bdf8@oss.qualcomm.com> References: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> In-Reply-To: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> To: Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , chaitanya chundru , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Jingoo Han , Bartosz Golaszewski Cc: quic_vbadigan@quicnic.com, amitk@kernel.org, dmitry.baryshkov@linaro.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, jorge.ramirez@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740476062; l=1397; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=anf9aES5VhlHQXEjRPr1CNKZ1r3sCkn3cMg87xu8Ys8=; b=5UT8HaUdIyhECHts8RbBpBg87VX0b41ZXHl1X708NVXDjT+yLnC2S4Z5rMgprTKmbIQIryU66 /JtnQchHFSZCZ0pnFaKkUREV2argu9a5WVblwDnyNbBb2+FV11HvWa2 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: Q5BN6_xIbpiDkdtjNa8zM06VdS7vwHff X-Proofpoint-GUID: Q5BN6_xIbpiDkdtjNa8zM06VdS7vwHff 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_03,2025-02-24_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 impostorscore=0 spamscore=0 mlxlogscore=803 lowpriorityscore=0 mlxscore=0 adultscore=0 malwarescore=0 clxscore=1015 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250066 Implement stop_link() and start_link() function op for dwc drivers. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-designware-host.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index ffaded8f2df7..2d3ec61e8dfa 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -697,10 +697,28 @@ void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn, } EXPORT_SYMBOL_GPL(dw_pcie_own_conf_map_bus); +static int dw_pcie_op_start_link(struct pci_bus *bus) +{ + struct dw_pcie_rp *pp = bus->sysdata; + struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + + return dw_pcie_host_start_link(pci); +} + +static void dw_pcie_op_stop_link(struct pci_bus *bus) +{ + struct dw_pcie_rp *pp = bus->sysdata; + struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + + dw_pcie_host_stop_link(pci); +} + static struct pci_ops dw_pcie_ops = { .map_bus = dw_pcie_own_conf_map_bus, .read = pci_generic_config_read, .write = pci_generic_config_write, + .start_link = dw_pcie_op_start_link, + .stop_link = dw_pcie_op_stop_link, }; static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) From patchwork Tue Feb 25 09:34:03 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: 13989633 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 DBCC926138F for ; Tue, 25 Feb 2025 09:35:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476108; cv=none; b=VP2uBjz+W6AZoiqckuW6zaeQONALMOHgAJ0bJH/T3iZuC23qp6be/GKWT+reDbGAhXXHqFK+8OcQkijo6kO01yLDSz1SV3wkzbZRo2qfoH17JRWMzVLVjrhEvu/ksZKO4jpx9hnc95/6VFWlkHxZT7HTRHd3wTGhhruEAaFEJPM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476108; c=relaxed/simple; bh=cqpieFQ4yffdW6JHTht9pnvXXQf74NR7jAV+Si840rI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ct8Z3c1TU6L3p/kwGz4t965aCIPU0DF/Z26Uq/Wg2w8qv7AJbpoGNqaXRZBA3VARUSxJkfnWqixwsgoACtyY3oZ6IqG43voowcSXNCqTsAyfO2miBxnqBgeRzpzwZ1MzNdu7P5xfESBrvJFETCs4RWo6mWMrYHtarHsJ2Bg7O9w= 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=eEpfqewR; 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="eEpfqewR" 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 51P4ERBL002512 for ; Tue, 25 Feb 2025 09:35:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Q6YFxMqM846mSc+Tr4fu5o2Zex5KCBKuxSN2OETBscc=; b=eEpfqewRcfRH6YD+ DBSxYoqYgtZz0y2m3w50VuW0uulaGMz6dmXNh5Ajcf5MIu8W6A8Yd2XHCY9c3Uhm d0/kRR5MQdRqWgP5BITIFdzvo0PF11oQtfxeXls0UiEdEyj/0p6ZPN5reSTWek5H i5BTuf0ebHHTUkJlbfAuM92+zMLoTxSbfedrDvr10cc8d1PHsynwk8IWBYubYDqb LxeYXK3UXXYm25Wqxx0cJYFQnZHI8V6o+uMJorFFuk9cGp65HI+1m3pDZYlLbcn3 N6WTGECJooTWBx4SNAbziLHeNYKtfu8XkTTy5icxOMlwPBkzFQDVD/uEnTxhfS4Z zZjUfw== 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 4516nm8wf8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 09:35:06 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2fc46431885so18105314a91.2 for ; Tue, 25 Feb 2025 01:35:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476105; x=1741080905; 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=Q6YFxMqM846mSc+Tr4fu5o2Zex5KCBKuxSN2OETBscc=; b=ZpTGfDx0JvdSYGjsAULu0XRSoBO265fwGmx3gKrmw47l8Iiv1CNAJvclG+GH8z1+Y0 MGAehZAF++BXSbJw22BYU7HxNqIZqD6prHXFaYAlxQLcFovOIFUH2HBjfnEzgNq6dJnS kuPLcD3mq9e5i9FBBi3mEQb9aJqPal80gzcokhdnPXyUHqh81XNh/VhffypaMqxHbF1g ruLkiuKh4lnqhJLvgzwg/CSmeFzgw0LYKniC+dZNQRUJ3h5RVEERvHO9ll0LIuXB+3NG nMdGSi5Jl7o8Xoaxp1OdMPt/iW4KR2I9Xoe23YwvzVE2rayNp5+TESFw76XZhgxQPkKP hMRA== X-Forwarded-Encrypted: i=1; AJvYcCXYf93tNgEkFoH/fE6jPKY+Y4q+isZCyYYPWDAWXT3FUbEOH03QAc7rwR197HZhTx04f6i8LIJhRC1hFvMn@vger.kernel.org X-Gm-Message-State: AOJu0Yxc5/ZbLokPwsX8weodqz8ULEkrNpmHIN7AbMO42pBvUHLNsRs0 z4Vl2w7lSrPAFk0J9VYF+zMP9k0dYWD1fqYG7OmLrt7Vhn/0Os9FdyKPcPeQbU9GuYbSVBuHBa3 g++vvpKKCDTvr4V4UkYWoyr/f6sugPznJ39S6hv9ebgpmqTLVZe/sH8DgeTo36UWH X-Gm-Gg: ASbGncuOFcO9NPoVHFGSKLC8dc9hbm4U2SIWo2Ld7HWwJzegJeEaS9jWnyBp7f7JmkK MVfxGuezGsTYvMX6SJ0gb0fKU8H+YM8I5PblqCxsk9NHMlch4bV376MhxudPaRopHV3YmIQys3E HDb7nZJ2v9sObXQ6a0pj+qaMPpqFbT40AmxxVFufsALzo+QQm/Uq+i0QVyA9ZwAZBjjR+ijBP40 +9Yy3smK0se/ASMhTkieb2nasKsSt3HiyMNDJ9JPv93+Rx0bIm1ZCirQHAYElXSRBrOsL6N4+V7 6ue6McunpLzt2TgEUuzZr+QHsSZJpNEf5EAnntWDO+CmH+mw9C8= X-Received: by 2002:a17:90b:2b8b:b0:2f9:9ddd:689c with SMTP id 98e67ed59e1d1-2fce87247d0mr27790234a91.25.1740476105377; Tue, 25 Feb 2025 01:35:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHboVQx19IAka22tTopEyPevYSp2q5hMkX4eBoo9O54pF2jebrtXh/oJ5rVUGppNyCKsX3M1Q== X-Received: by 2002:a17:90b:2b8b:b0:2f9:9ddd:689c with SMTP id 98e67ed59e1d1-2fce87247d0mr27790209a91.25.1740476105011; Tue, 25 Feb 2025 01:35:05 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe6a3dec52sm1080770a91.20.2025.02.25.01.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:35:04 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 15:04:03 +0530 Subject: [PATCH v4 06/10] PCI: qcom: Add support for host_stop_link() & host_start_link() Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250225-qps615_v4_1-v4-6-e08633a7bdf8@oss.qualcomm.com> References: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> In-Reply-To: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> To: Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , chaitanya chundru , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Jingoo Han , Bartosz Golaszewski Cc: quic_vbadigan@quicnic.com, amitk@kernel.org, dmitry.baryshkov@linaro.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, jorge.ramirez@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740476062; l=2776; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=cqpieFQ4yffdW6JHTht9pnvXXQf74NR7jAV+Si840rI=; b=OwTMhSAouVxaRKBcVHXa8wc0KbtbtdhzaEINWGVy2gtJDOSqmekSlFwT9uTan0CDSLZLOzBJM r94UKKFN0PlBpeTayxKvpRzS4wTFncZfLUtc44YTr/74U4yw8AglTnu X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: rt1OFYT2C6xDm_YacR0PYrcilLAXJrHr X-Proofpoint-GUID: rt1OFYT2C6xDm_YacR0PYrcilLAXJrHr 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_03,2025-02-24_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 adultscore=0 clxscore=1015 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250066 Add support for host_stop_link() and host_start_link() for switches like TC956x, which require configuration before the PCIe link is established. Assert PERST# and disable LTSSM bit to prevent the PCIe controller from participating in link training during host_stop_link(). De-assert PERST# and enable LTSSM bit during host_start_link(). Introduce ltssm_disable function op to stop link training. For the switches like TC956x, which needs to configure it before the PCIe link is established. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-qcom.c | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index e4d3366ead1f..8c9c89417440 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -247,6 +247,7 @@ struct qcom_pcie_ops { void (*host_post_init)(struct qcom_pcie *pcie); void (*deinit)(struct qcom_pcie *pcie); void (*ltssm_enable)(struct qcom_pcie *pcie); + void (*ltssm_disable)(struct qcom_pcie *pcie); int (*config_sid)(struct qcom_pcie *pcie); }; @@ -618,6 +619,37 @@ static int qcom_pcie_post_init_1_0_0(struct qcom_pcie *pcie) return 0; } +static int qcom_pcie_host_start_link(struct dw_pcie *pci) +{ + struct qcom_pcie *pcie = to_qcom_pcie(pci); + + qcom_ep_reset_deassert(pcie); + + if (pcie->cfg->ops->ltssm_enable) + pcie->cfg->ops->ltssm_enable(pcie); + + return 0; +} + +static void qcom_pcie_host_stop_link(struct dw_pcie *pci) +{ + struct qcom_pcie *pcie = to_qcom_pcie(pci); + + qcom_ep_reset_assert(pcie); + + if (pcie->cfg->ops->ltssm_disable) + pcie->cfg->ops->ltssm_disable(pcie); +} + +static void qcom_pcie_2_3_2_ltssm_disable(struct qcom_pcie *pcie) +{ + u32 val; + + val = readl(pcie->parf + PARF_LTSSM); + val &= ~LTSSM_EN; + writel(val, pcie->parf + PARF_LTSSM); +} + static void qcom_pcie_2_3_2_ltssm_enable(struct qcom_pcie *pcie) { u32 val; @@ -1362,6 +1394,7 @@ static const struct qcom_pcie_ops ops_1_9_0 = { .host_post_init = qcom_pcie_host_post_init_2_7_0, .deinit = qcom_pcie_deinit_2_7_0, .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, + .ltssm_disable = qcom_pcie_2_3_2_ltssm_disable, .config_sid = qcom_pcie_config_sid_1_9_0, }; @@ -1429,6 +1462,8 @@ static const struct qcom_pcie_cfg cfg_sc8280xp = { static const struct dw_pcie_ops dw_pcie_ops = { .link_up = qcom_pcie_link_up, .start_link = qcom_pcie_start_link, + .host_start_link = qcom_pcie_host_start_link, + .host_stop_link = qcom_pcie_host_stop_link, }; static int qcom_pcie_icc_init(struct qcom_pcie *pcie) From patchwork Tue Feb 25 09:34: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: 13989634 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 5189826389C for ; Tue, 25 Feb 2025 09:35:13 +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=1740476114; cv=none; b=RoN4Pl44QKhXv/NaqNCAD21R85vswuDZJmD0zWWNLV4n5h9kMvcZ559ip7wUjUknW8eY3qg8iACyBZwzbNwCcGsoaBD5Tfd0I7ArHjGDowdDimHKNP2uahaLDx5tuPtVBhv8+WnJH+IlNfcmr1nMppOQ3aPuQtzyr4UJs3O096g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476114; c=relaxed/simple; bh=tBrPYy6jClIwhXSDiDX1gKatD1nRUDkWxKE00LALbY0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KqgzMZrR+qtGfqsGD7YvFyjai8TL3Tka+Y97pn/tGh8az/nPguxnRwiF5hCiXtpWDQ4WmqgkpyS5seLBJnqLcY/CRyCmbP9yAJBWcWhf45bm4KLc1GEl1tcgbzpBymvVCUk2plh4Ls2BWSufhbAQk0Csum2w4S9XdD1xW4kBilg= 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=pPVxlwnL; 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="pPVxlwnL" 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 51P4EVPt002548 for ; Tue, 25 Feb 2025 09:35:12 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= tpENwznM3Ab/FS3rch0QN0jlFBLvaM6eNF0S8OXyo28=; b=pPVxlwnLGqKCtAzD 8oGZKWQfLUjinLNDpxAGDEr9DYgepMjxSfBWCXgs2xw3Zvt3emN2AN0m7EStEE7M 3MqMGsFkdvFu3tnUpzBRuWA+dqZoaGXNCr0DhFTRJ8JoUjtK1fHTjWGwVFySNsVF 24XsKy+tWRUUkC6Cg3SVghssfvzZntZdBQWvLVPohZQO2OLeZIyDjs+PY1xI7zOQ ph2MJNs3w+u9aBSR2ysl/kSx7e3ebRtJ1gyV6ogyOmxP8H7nqIJMEeY3UnupEhDp HAqXOiFMC7tr0eCBTRxzKhNbecNeXKVBp1NYJIehehmUSXmCkDpdNrR02kvj/Ny6 JBdkXA== 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 4516nm8wfn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 09:35:12 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2fc17c3eeb5so11315788a91.1 for ; Tue, 25 Feb 2025 01:35:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476112; x=1741080912; 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=tpENwznM3Ab/FS3rch0QN0jlFBLvaM6eNF0S8OXyo28=; b=HGTZngebU1oVUTYpGBOsREq1VVmj0kUesYWts/mp1f0tD4qpD/rzYLMAFUIlVvile4 B0gHr0dKMfewWnvgxIqvZhUh57l99DZXUBH+3Fk3Fyb3vbgBUnjUOVG5TW7YC96spA1y u8PgAKTkDWvFDGCToExT15Kw0EXbFM+FxJ+3iHxSSPJGoiMholg6X8lS8mPOHcYZJ5Hy 1bWE1aJCEpc7DeXAfZMmqeLXWAJAej7N8sWlKycEPKfEbpsOVCWLd0uJqCsjgPfoYzGf R+5Z01+5K0csxBteVUZRH/rIex7McyLDUz8HTJsX1UZKm3FPoGztbI8iylXBB2FPcCZa qLng== X-Forwarded-Encrypted: i=1; AJvYcCUq9GjgCmk0FiNVg1rEEvnqZ+TwRY+f1KhaWl/+JzZFcXk/m+MCrXrwRN430M1PE45NGR4sVs/ZhlMZL8rG@vger.kernel.org X-Gm-Message-State: AOJu0YzHxT63RwSW/IN+vP33ECzhzb+3Nie1a8Ts5XCSyca0dzzy3ws3 hiBAIVx37TpUbLsYx4NJTW3agxUIbB5KK8kcnDqR2e+WSD6KGRWPICbeAmwYFiOF/0jn8LR4LMs nXAEJpPaqpvREyqdwTxjWCJWUc8saugmIFrT6bW9oJ0Q90ZJgk1vjFPpQtYeHgTYw X-Gm-Gg: ASbGncu48W6/7BqkwquH4bE2TA2dFvlOC3H0x1Shc5UjRzqvc4rGt6Jp/yMNINodqzs RRcALXzdstqogo2gY5U4MASBj77xNhoAREfHy8S63oSanvObUjkfTyQTEUdj/Dv8DQfsiBgaMbE JzKwHFW5uzFT7FsAQPxDWWd79/NomxxgWJtnMU7EVdJ/TfAPy8GkMYv2NMkoiwKeOaWCr725zzs Gq5BtHRpAhcBM8TqdovUioJojT728kbFmelCGvT3datfHJoz3AihCZGC76gRLRQoG26VvgDDeXp 8WG2oZ22y3bEYh4+PHcIUU+9mlvy40zHIHNQ1Svunt4WkvtGL1Y= X-Received: by 2002:a17:90a:da87:b0:2fa:1f1b:3db6 with SMTP id 98e67ed59e1d1-2fce875b1e1mr27083699a91.29.1740476111611; Tue, 25 Feb 2025 01:35:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXI2cvrJrVKemjd3SibfbqUc08kbM1mQxwPvC2ZFCfh6cLWmlluxx8UqPeRlPhYbWspo8iAA== X-Received: by 2002:a17:90a:da87:b0:2fa:1f1b:3db6 with SMTP id 98e67ed59e1d1-2fce875b1e1mr27083647a91.29.1740476111099; Tue, 25 Feb 2025 01:35:11 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe6a3dec52sm1080770a91.20.2025.02.25.01.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:35:10 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 15:04:04 +0530 Subject: [PATCH v4 07/10] PCI: PCI: Add pcie_is_link_active() to determine if the PCIe link is active Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250225-qps615_v4_1-v4-7-e08633a7bdf8@oss.qualcomm.com> References: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> In-Reply-To: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> To: Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , chaitanya chundru , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Jingoo Han , Bartosz Golaszewski Cc: quic_vbadigan@quicnic.com, amitk@kernel.org, dmitry.baryshkov@linaro.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, jorge.ramirez@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740476062; l=3655; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=tBrPYy6jClIwhXSDiDX1gKatD1nRUDkWxKE00LALbY0=; b=sWTPo/HUbrUlf1c9OljHc0r9e0NtdVWHAl2VC/CqIrM626UchAmAdMCqJTSBEo8myw9Mz5LL2 hVhB10xgeJHDYBM33pFrMLBjVlPzzzd0R5tcWBumfucXIME+yDNa6+t X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: Hkqz0z5qWomBuPxPM-ZopMNKk52V6r7C X-Proofpoint-GUID: Hkqz0z5qWomBuPxPM-ZopMNKk52V6r7C 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_03,2025-02-24_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 adultscore=0 clxscore=1015 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250066 Introduce a common API to check if the PCIe link is active, replacing duplicate code in multiple locations. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/hotplug/pciehp_hpc.c | 13 +------------ drivers/pci/pci.c | 26 +++++++++++++++++++++++--- include/linux/pci.h | 5 +++++ 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index bb5a8d9f03ad..d0a2efebb519 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -234,18 +234,7 @@ static void pcie_write_cmd_nowait(struct controller *ctrl, u16 cmd, u16 mask) */ int pciehp_check_link_active(struct controller *ctrl) { - struct pci_dev *pdev = ctrl_dev(ctrl); - u16 lnk_status; - int ret; - - ret = pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); - if (ret == PCIBIOS_DEVICE_NOT_FOUND || PCI_POSSIBLE_ERROR(lnk_status)) - return -ENODEV; - - ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA); - ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); - - return ret; + return pcie_is_link_active(ctrl_dev(ctrl)); } static bool pci_bus_check_dev(struct pci_bus *bus, int devfn) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 869d204a70a3..3d4fe6fefa13 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4907,7 +4907,6 @@ int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type) return 0; if (pcie_get_speed_cap(dev) <= PCIE_SPEED_5_0GT) { - u16 status; pci_dbg(dev, "waiting %d ms for downstream link\n", delay); msleep(delay); @@ -4923,8 +4922,7 @@ int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type) if (!dev->link_active_reporting) return -ENOTTY; - pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &status); - if (!(status & PCI_EXP_LNKSTA_DLLLA)) + if (pcie_is_link_active(dev)) return -ENOTTY; return pci_dev_wait(child, reset_type, @@ -6219,6 +6217,28 @@ void pcie_print_link_status(struct pci_dev *dev) } EXPORT_SYMBOL(pcie_print_link_status); +/** + * pcie_is_link_active() - Checks if the link is active or not + * @pdev: PCI device to query + * + * Check whether the link is active or not. + * + * If the config read returns error then return -ENODEV. + */ +int pcie_is_link_active(struct pci_dev *pdev) +{ + u16 lnk_status; + int ret; + + ret = pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); + if (ret == PCIBIOS_DEVICE_NOT_FOUND || PCI_POSSIBLE_ERROR(lnk_status)) + return -ENODEV; + + pci_dbg(pdev, "lnk_status = %x\n", lnk_status); + return !!(lnk_status & PCI_EXP_LNKSTA_DLLLA); +} +EXPORT_SYMBOL(pcie_is_link_active); + /** * pci_select_bars - Make BAR mask from the type of resource * @dev: the PCI device for which BAR mask is made diff --git a/include/linux/pci.h b/include/linux/pci.h index bbec32be668b..84bb98e61e8a 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1946,6 +1946,7 @@ pci_release_mem_regions(struct pci_dev *pdev) pci_select_bars(pdev, IORESOURCE_MEM)); } +int pcie_is_link_active(struct pci_dev *dev); #else /* CONFIG_PCI is not enabled */ static inline void pci_set_flags(int flags) { } @@ -2094,6 +2095,10 @@ pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, { return -ENOSPC; } + +static inline int pcie_is_link_active(struct pci_dev *dev) +{ return -ENODEV; } + #endif /* CONFIG_PCI */ /* Include architecture-dependent settings and functions */ From patchwork Tue Feb 25 09:34: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: 13989635 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 53671262D33 for ; Tue, 25 Feb 2025 09:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476123; cv=none; b=r+69nMEN2pqSZf6DP6iQrb4pVPUjn49RLnkXRkKeTW1c1QbwxLknG74wmsHJ/UaN6tYq3dSDjyB931P2FCsxqfo7eQIoZSqOMG6FUOhMCygK8T3oGZ6a4VU1yA5YDQB1w3a8IKBW2YLIsWqqQQ6cvEXeDxk6hI1sJRl/lBtvkv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476123; c=relaxed/simple; bh=LMnw2grkYulPRTIzz/uk3BUBKeG6SeucXy3zupQY8Lo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d3G7gnIlfeQ2Ki6wIBff4nVDo7dcKFVzUlGLCNcF/GiwAKmB83ZZFp4E946BIsHV3PI1/Ern8aTwntjZEmOZZzemHtknqwqICnfHvw50+hpq2rBL69JsAWLybSWD8LRici1x/arMFWGKrFeuSmbZe+Ht5nULdGlPb5wXtDmHKO4= 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=M023T7U3; 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="M023T7U3" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51ONZgEr021336 for ; Tue, 25 Feb 2025 09:35:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= A9fZdEtJLTLJ8I/rg1Bh+UlQAgG6IA4uwVW+hCCb4w0=; b=M023T7U3bPOMZASj /uS7BmWDLnG08iGcFBTPRKXQWmxfP1XflkDulWwP7jXxYayJVWhCjkICvzwpc1X0 yuMupGJ/9OXZi5R5FEu0MZvpeYxnu4epS4bonULx10ApqneIUjpU3ko5D7iHx549 4eYffLU/dPleLfqmNeBMN2BkfX08LViEo7SB14xB4yjHg3wm4alrMa9VgHBr6C9m C5kRj4lIXiadQwxanWNKpUDUiQ6weCsuOjEbu76f2FUVIaYr4EcicT5IRPyTNmZw rqQ5YyfZPePZP2V6dkpJWCwKkUIFkJ5wRaN6ll1sUpUU0ugxXqvRSupL76ZQ1bWw 7Wr2eQ== 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 44y6t2r78y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 09:35:19 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2fc0bc05bb5so11403983a91.2 for ; Tue, 25 Feb 2025 01:35:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476118; x=1741080918; 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=A9fZdEtJLTLJ8I/rg1Bh+UlQAgG6IA4uwVW+hCCb4w0=; b=jPHqECsSPissd929C591+6YU/ynE7YntA2FVEJQGRQiNLvjnNhT+z1oWS5SgIDSiXc 6EzSY1bQ7Cv+4voFZsyl2xWIvHKJ77N6gH+qLN2jSoJMIoc+BkPv7qKkkamGxgtRlHqJ j0K1VQv/kg2cvAajfDzK1nqKTCp1Wjp72GUc6paEwzWarQN9FvrKrDTzF+XFU8mFn/wz DMe3jc9zOZEqBG6JwonFB3micZo+jtu59wA4TgaXNC3raCB/PUBQ1ut4CZP0MVqILhD6 1F3z8we1pkownomfMagGC6UVnWh7n4eoX1eikxHzRn4DS2I9TRD5N8w0ZXqkN14K0WBu YC7g== X-Forwarded-Encrypted: i=1; AJvYcCUdEHHf6C11fDh4uAhyGLI1Go8Y3MHijHD5pNTUXxSbbxHc80kXxY8kAbyBxYjx/IC+KczaBtUHCdrBBTHq@vger.kernel.org X-Gm-Message-State: AOJu0YzTaTef1OBvFlfF9XNtQnHMS/D0dbt/WcTLhc7HLr74AEqvgp8g KJymEr7arKxGP1sw5M2FFZbgWizwdmW5ZZmBo8DipYZJKtqynf4KH5xa4MQ9BdxKl+Phw17JyUd lejGhu4Hrms8uKbaT/aT3jbi7qO48CiExQDDfKyxsfYYoJ2YPRs/krlwuyOERR1SK X-Gm-Gg: ASbGnctUv0p64PFvhoP6ZKlPs8CHIrOeDRPurA0YbiGBiZv6N3kmdPyamsymRV2/tUo QuOdrl18BjfVehtJ05NW6TtPGTiEZJQrWzvY7E1JNeVy7cr5ovGCOA1DxF+rg3upW0/pzt2GtN6 kk2au/MRVVZsD21MgztQE2T+r7OkA89YQkUG5SeQld+jv394lhm1JAuj/vcKe0MBUuDqPP5aIyq zWuOJ/zy+pF9y8vMxaPUpBUD1Ctn/5Mb9EnWbNsf9Cxj3uMY+cikHtRQUN47Qy/RPqGZEKN8Auo /0JcqVr41dh9I6ZAEGoW3jMeymnamGJnGqz3O8aaerOGco9xsN4= X-Received: by 2002:a17:90b:56d0:b0:2f5:747:cbd with SMTP id 98e67ed59e1d1-2fe68ae292bmr4764990a91.18.1740476118005; Tue, 25 Feb 2025 01:35:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpKoyaLC9BE0PgW+pLRLJ3ZL5Zr6S+ZXgHJQ0EqFLNIC8xFmJzelvUpI4UhVYHawu5ZXamxQ== X-Received: by 2002:a17:90b:56d0:b0:2f5:747:cbd with SMTP id 98e67ed59e1d1-2fe68ae292bmr4764958a91.18.1740476117514; Tue, 25 Feb 2025 01:35:17 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe6a3dec52sm1080770a91.20.2025.02.25.01.35.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:35:17 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 15:04:05 +0530 Subject: [PATCH v4 08/10] PCI: pwrctrl: Add power control driver for tc956x Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250225-qps615_v4_1-v4-8-e08633a7bdf8@oss.qualcomm.com> References: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> In-Reply-To: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> To: Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , chaitanya chundru , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Jingoo Han , Bartosz Golaszewski Cc: quic_vbadigan@quicnic.com, amitk@kernel.org, dmitry.baryshkov@linaro.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, jorge.ramirez@oss.qualcomm.com, Krishna Chaitanya Chundru , Bartosz Golaszewski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740476062; l=19426; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=LMnw2grkYulPRTIzz/uk3BUBKeG6SeucXy3zupQY8Lo=; b=Cv10bXTLgL5Oc+3lVkZ9LI4O1smWriwz9Z1xqx/d9AISdVgq1ccCvbQUruiIlTfIY3FQAzuDQ AM2ZSSmUUD9A7OPZMFTDz23i7s9rFAcwNYmKV8+QYyT8cAR/FWHsPKH X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: UEBYuLFJeAdFjvLD757m_xqjK-yR5Dad X-Proofpoint-GUID: UEBYuLFJeAdFjvLD757m_xqjK-yR5Dad 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_03,2025-02-24_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 spamscore=0 priorityscore=1501 mlxscore=0 phishscore=0 malwarescore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250066 TC956x is a PCIe switch which has one upstream and three downstream ports. To one of the downstream ports ethernet MAC is connected as endpoint device. Other two downstream ports are supposed to connect to external device. One Host can connect to TC956x by upstream port. TC956x switch needs to be configured after powering on and before PCIe link was up. The PCIe controller driver already enables link training at the host side even before this driver probe happens, due to this when driver enables power to the switch it participates in the link training and PCIe link may come up before configuring the switch through i2c. Once the link is up the configuration done through i2c will not have any affect.To prevent the host from participating in link training, disable link training on the host side to ensure the link does not come up before the switch is configured via I2C. Based up on dt property and type of the port, tc956x is configured through i2c. Signed-off-by: Krishna Chaitanya Chundru Reviewed-by: Bjorn Andersson Reviewed-by: Bartosz Golaszewski --- drivers/pci/pwrctrl/Kconfig | 6 + drivers/pci/pwrctrl/Makefile | 1 + drivers/pci/pwrctrl/pci-pwrctrl-tc956x.c | 625 +++++++++++++++++++++++++++++++ 3 files changed, 632 insertions(+) diff --git a/drivers/pci/pwrctrl/Kconfig b/drivers/pci/pwrctrl/Kconfig index 54589bb2403b..ae8a0a39f586 100644 --- a/drivers/pci/pwrctrl/Kconfig +++ b/drivers/pci/pwrctrl/Kconfig @@ -10,3 +10,9 @@ config PCI_PWRCTL_PWRSEQ tristate select POWER_SEQUENCING select PCI_PWRCTL + +config PCI_PWRCTRL_TC956X + tristate "PCI Power Control driver for TC956x PCIe switch" + select PCI_PWRCTL + help + Say Y here to enable the pwrctrl driver for TC956x PCIe switch. diff --git a/drivers/pci/pwrctrl/Makefile b/drivers/pci/pwrctrl/Makefile index 75c7ce531c7e..93f32871260b 100644 --- a/drivers/pci/pwrctrl/Makefile +++ b/drivers/pci/pwrctrl/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_PCI_PWRCTL) += pci-pwrctrl-core.o pci-pwrctrl-core-y := core.o obj-$(CONFIG_PCI_PWRCTL_PWRSEQ) += pci-pwrctrl-pwrseq.o +obj-$(CONFIG_PCI_PWRCTRL_TC956X) += pci-pwrctrl-tc956x.o diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc956x.c b/drivers/pci/pwrctrl/pci-pwrctrl-tc956x.c new file mode 100644 index 000000000000..bf72bbcae536 --- /dev/null +++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc956x.c @@ -0,0 +1,625 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../pci.h" + +#define TC956X_GPIO_CONFIG 0x801208 +#define TC956X_RESET_GPIO 0x801210 + +#define TC956X_BUS_CONTROL 0x801014 + +#define TC956X_PORT_L0S_DELAY 0x82496c +#define TC956X_PORT_L1_DELAY 0x824970 + +#define TC956X_EMBEDDED_ETH_DELAY 0x8200d8 +#define TC956X_ETH_L1_DELAY_MASK GENMASK(27, 18) +#define TC956X_ETH_L1_DELAY_VALUE(x) FIELD_PREP(TC956X_ETH_L1_DELAY_MASK, x) +#define TC956X_ETH_L0S_DELAY_MASK GENMASK(17, 13) +#define TC956X_ETH_L0S_DELAY_VALUE(x) FIELD_PREP(TC956X_ETH_L0S_DELAY_MASK, x) + +#define TC956X_NFTS_2_5_GT 0x824978 +#define TC956X_NFTS_5_GT 0x82497c + +#define TC956X_PORT_LANE_ACCESS_ENABLE 0x828000 + +#define TC956X_PHY_RATE_CHANGE_OVERRIDE 0x828040 +#define TC956X_PHY_RATE_CHANGE 0x828050 + +#define TC956X_TX_MARGIN 0x828234 + +#define TC956X_DFE_ENABLE 0x828a04 +#define TC956X_DFE_EQ0_MODE 0x828a08 +#define TC956X_DFE_EQ1_MODE 0x828a0c +#define TC956X_DFE_EQ2_MODE 0x828a14 +#define TC956X_DFE_PD_MASK 0x828254 + +#define TC956X_PORT_SELECT 0x82c02c +#define TC956X_PORT_ACCESS_ENABLE 0x82c030 + +#define TC956X_POWER_CONTROL 0x82b09c +#define TC956X_POWER_CONTROL_OVREN 0x82b2c8 + +#define TC956X_GPIO_MASK 0xfffffff3 + +#define TC956X_TX_MARGIN_MIN_VAL 400000 + +struct tc956x_pwrctrl_reg_setting { + unsigned int offset; + unsigned int val; +}; + +enum tc956x_pwrctrl_ports { + TC956X_USP, + TC956X_DSP1, + TC956X_DSP2, + TC956X_DSP3, + TC956X_ETHERNET, + TC956X_MAX +}; + +struct tc956x_pwrctrl_cfg { + u32 l0s_delay; + u32 l1_delay; + u32 tx_amp; + u8 nfts[2]; /* GEN1 & GEN2*/ + bool disable_dfe; + bool disable_port; +}; + +#define TC956X_PWRCTL_MAX_SUPPLY 6 + +struct tc956x_pwrctrl_ctx { + struct regulator_bulk_data supplies[TC956X_PWRCTL_MAX_SUPPLY]; + struct tc956x_pwrctrl_cfg cfg[TC956X_MAX]; + struct gpio_desc *reset_gpio; + struct i2c_adapter *adapter; + struct i2c_client *client; + struct pci_pwrctrl pwrctrl; +}; + +/* + * downstream port power off sequence, hardcoding the address + * as we don't know register names for these register offsets. + */ +static const struct tc956x_pwrctrl_reg_setting common_pwroff_seq[] = { + {0x82900c, 0x1}, + {0x829010, 0x1}, + {0x829018, 0x0}, + {0x829020, 0x1}, + {0x82902c, 0x1}, + {0x829030, 0x1}, + {0x82903c, 0x1}, + {0x829058, 0x0}, + {0x82905c, 0x1}, + {0x829060, 0x1}, + {0x8290cc, 0x1}, + {0x8290d0, 0x1}, + {0x8290d8, 0x1}, + {0x8290e0, 0x1}, + {0x8290e8, 0x1}, + {0x8290ec, 0x1}, + {0x8290f4, 0x1}, + {0x82910c, 0x1}, + {0x829110, 0x1}, + {0x829114, 0x1}, +}; + +static const struct tc956x_pwrctrl_reg_setting dsp1_pwroff_seq[] = { + {TC956X_PORT_ACCESS_ENABLE, 0x2}, + {TC956X_PORT_LANE_ACCESS_ENABLE, 0x3}, + {TC956X_POWER_CONTROL, 0x014f4804}, + {TC956X_POWER_CONTROL_OVREN, 0x1}, + {TC956X_PORT_ACCESS_ENABLE, 0x4}, +}; + +static const struct tc956x_pwrctrl_reg_setting dsp2_pwroff_seq[] = { + {TC956X_PORT_ACCESS_ENABLE, 0x8}, + {TC956X_PORT_LANE_ACCESS_ENABLE, 0x1}, + {TC956X_POWER_CONTROL, 0x014f4804}, + {TC956X_POWER_CONTROL_OVREN, 0x1}, + {TC956X_PORT_ACCESS_ENABLE, 0x8}, +}; + +/* + * Since all transfers are initiated by the probe, no locks are necessary, + * as there are no concurrent calls. + */ +static int tc956x_pwrctrl_i2c_write(struct i2c_client *client, + u32 reg_addr, u32 reg_val) +{ + struct i2c_msg msg; + u8 msg_buf[7]; + int ret; + + msg.addr = client->addr; + msg.len = 7; + msg.flags = 0; + + /* Big Endian for reg addr */ + put_unaligned_be24(reg_addr, &msg_buf[0]); + + /* Little Endian for reg val */ + put_unaligned_le32(reg_val, &msg_buf[3]); + + msg.buf = msg_buf; + ret = i2c_transfer(client->adapter, &msg, 1); + return ret == 1 ? 0 : ret; +} + +static int tc956x_pwrctrl_i2c_read(struct i2c_client *client, + u32 reg_addr, u32 *reg_val) +{ + struct i2c_msg msg[2]; + u8 wr_data[3]; + u32 rd_data; + int ret; + + msg[0].addr = client->addr; + msg[0].len = 3; + msg[0].flags = 0; + + /* Big Endian for reg addr */ + put_unaligned_be24(reg_addr, &wr_data[0]); + + msg[0].buf = wr_data; + + msg[1].addr = client->addr; + msg[1].len = 4; + msg[1].flags = I2C_M_RD; + + msg[1].buf = (u8 *)&rd_data; + + ret = i2c_transfer(client->adapter, &msg[0], 2); + if (ret == 2) { + *reg_val = get_unaligned_le32(&rd_data); + return 0; + } + + /* If only one message successfully completed, return -EIO */ + return ret == 1 ? -EIO : ret; +} + +static int tc956x_pwrctrl_i2c_bulk_write(struct i2c_client *client, + const struct tc956x_pwrctrl_reg_setting *seq, int len) +{ + int ret, i; + + for (i = 0; i < len; i++) { + ret = tc956x_pwrctrl_i2c_write(client, seq[i].offset, seq[i].val); + if (ret) + return ret; + } + + return 0; +} + +static int tc956x_pwrctrl_disable_port(struct tc956x_pwrctrl_ctx *ctx, + enum tc956x_pwrctrl_ports port) +{ + struct tc956x_pwrctrl_cfg *cfg = &ctx->cfg[port]; + const struct tc956x_pwrctrl_reg_setting *seq; + int ret, len; + + if (!cfg->disable_port) + return 0; + + if (port == TC956X_DSP1) { + seq = dsp1_pwroff_seq; + len = ARRAY_SIZE(dsp1_pwroff_seq); + } else { + seq = dsp2_pwroff_seq; + len = ARRAY_SIZE(dsp2_pwroff_seq); + } + + ret = tc956x_pwrctrl_i2c_bulk_write(ctx->client, seq, len); + if (ret) + return ret; + + return tc956x_pwrctrl_i2c_bulk_write(ctx->client, + common_pwroff_seq, ARRAY_SIZE(common_pwroff_seq)); +} + +static int tc956x_pwrctrl_set_l0s_l1_entry_delay(struct tc956x_pwrctrl_ctx *ctx, + enum tc956x_pwrctrl_ports port, bool is_l1, u32 ns) +{ + u32 rd_val, units; + int ret; + + if (!ns) + return 0; + + /* convert to units of 256ns */ + units = ns / 256; + + if (port == TC956X_ETHERNET) { + ret = tc956x_pwrctrl_i2c_read(ctx->client, TC956X_EMBEDDED_ETH_DELAY, &rd_val); + if (ret) + return ret; + + if (is_l1) + rd_val = u32_replace_bits(rd_val, units, TC956X_ETH_L1_DELAY_MASK); + else + rd_val = u32_replace_bits(rd_val, units, TC956X_ETH_L0S_DELAY_MASK); + + return tc956x_pwrctrl_i2c_write(ctx->client, TC956X_EMBEDDED_ETH_DELAY, rd_val); + } + + ret = tc956x_pwrctrl_i2c_write(ctx->client, TC956X_PORT_SELECT, BIT(port)); + if (ret) + return ret; + + return tc956x_pwrctrl_i2c_write(ctx->client, + is_l1 ? TC956X_PORT_L1_DELAY : TC956X_PORT_L0S_DELAY, units); +} + +static int tc956x_pwrctrl_set_tx_amplitude(struct tc956x_pwrctrl_ctx *ctx, + enum tc956x_pwrctrl_ports port, u32 amp) +{ + int port_access; + + if (amp < TC956X_TX_MARGIN_MIN_VAL) + return 0; + + /* txmargin = (Amp(uV) - 400000) / 3125 */ + amp = (amp - TC956X_TX_MARGIN_MIN_VAL) / 3125; + + switch (port) { + case TC956X_USP: + port_access = 0x1; + break; + case TC956X_DSP1: + port_access = 0x2; + break; + case TC956X_DSP2: + port_access = 0x8; + break; + default: + return -EINVAL; + }; + + struct tc956x_pwrctrl_reg_setting tx_amp_seq[] = { + {TC956X_PORT_ACCESS_ENABLE, port_access}, + {TC956X_PORT_LANE_ACCESS_ENABLE, 0x3}, + {TC956X_TX_MARGIN, amp}, + }; + + return tc956x_pwrctrl_i2c_bulk_write(ctx->client, tx_amp_seq, ARRAY_SIZE(tx_amp_seq)); +} + +static int tc956x_pwrctrl_disable_dfe(struct tc956x_pwrctrl_ctx *ctx, + enum tc956x_pwrctrl_ports port) +{ + struct tc956x_pwrctrl_cfg *cfg = &ctx->cfg[port]; + int port_access, lane_access = 0x3; + u32 phy_rate = 0x21; + + if (!cfg->disable_dfe) + return 0; + + switch (port) { + case TC956X_USP: + phy_rate = 0x1; + port_access = 0x1; + break; + case TC956X_DSP1: + port_access = 0x2; + break; + case TC956X_DSP2: + port_access = 0x8; + lane_access = 0x1; + break; + default: + return -EINVAL; + }; + + struct tc956x_pwrctrl_reg_setting disable_dfe_seq[] = { + {TC956X_PORT_ACCESS_ENABLE, port_access}, + {TC956X_PORT_LANE_ACCESS_ENABLE, lane_access}, + {TC956X_DFE_ENABLE, 0x0}, + {TC956X_DFE_EQ0_MODE, 0x411}, + {TC956X_DFE_EQ1_MODE, 0x11}, + {TC956X_DFE_EQ2_MODE, 0x11}, + {TC956X_DFE_PD_MASK, 0x7}, + {TC956X_PHY_RATE_CHANGE_OVERRIDE, 0x10}, + {TC956X_PHY_RATE_CHANGE, phy_rate}, + {TC956X_PHY_RATE_CHANGE, 0x0}, + {TC956X_PHY_RATE_CHANGE_OVERRIDE, 0x0}, + }; + + return tc956x_pwrctrl_i2c_bulk_write(ctx->client, + disable_dfe_seq, ARRAY_SIZE(disable_dfe_seq)); +} + +static int tc956x_pwrctrl_set_nfts(struct tc956x_pwrctrl_ctx *ctx, + enum tc956x_pwrctrl_ports port, u8 *nfts) +{ + struct tc956x_pwrctrl_reg_setting nfts_seq[] = { + {TC956X_NFTS_2_5_GT, nfts[0]}, + {TC956X_NFTS_5_GT, nfts[1]}, + }; + int ret; + + if (!nfts[0]) + return 0; + + ret = tc956x_pwrctrl_i2c_write(ctx->client, TC956X_PORT_SELECT, BIT(port)); + if (ret) + return ret; + + return tc956x_pwrctrl_i2c_bulk_write(ctx->client, nfts_seq, ARRAY_SIZE(nfts_seq)); +} + +static int tc956x_pwrctrl_assert_deassert_reset(struct tc956x_pwrctrl_ctx *ctx, bool deassert) +{ + int ret, val; + + ret = tc956x_pwrctrl_i2c_write(ctx->client, TC956X_GPIO_CONFIG, TC956X_GPIO_MASK); + if (ret) + return ret; + + val = deassert ? 0xc : 0; + + return tc956x_pwrctrl_i2c_write(ctx->client, TC956X_RESET_GPIO, val); +} + +static int tc956x_pwrctrl_parse_device_dt(struct tc956x_pwrctrl_ctx *ctx, struct device_node *node, + enum tc956x_pwrctrl_ports port) +{ + struct tc956x_pwrctrl_cfg *cfg; + int ret; + + cfg = &ctx->cfg[port]; + + /* Disable port if the status of the port is disabled. */ + if (!of_device_is_available(node)) { + cfg->disable_port = true; + return 0; + }; + + ret = of_property_read_u32(node, "aspm-l0s-entry-delay-ns", &cfg->l0s_delay); + if (ret && ret != -EINVAL) + return ret; + + ret = of_property_read_u32(node, "aspm-l1-entry-delay-ns", &cfg->l1_delay); + if (ret && ret != -EINVAL) + return ret; + + ret = of_property_read_u32(node, "qcom,tx-amplitude-microvolt", &cfg->tx_amp); + if (ret && ret != -EINVAL) + return ret; + + ret = of_property_read_u8_array(node, "nfts", cfg->nfts, 2); + if (ret && ret != -EINVAL) + return ret; + + cfg->disable_dfe = of_property_read_bool(node, "qcom,no-dfe-support"); + + return 0; +} + +static void tc956x_pwrctrl_power_off(struct tc956x_pwrctrl_ctx *ctx) +{ + gpiod_set_value(ctx->reset_gpio, 1); + + regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); +} + +static int tc956x_pwrctrl_bring_up(struct tc956x_pwrctrl_ctx *ctx) +{ + struct tc956x_pwrctrl_cfg *cfg; + int ret, i; + + ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); + if (ret < 0) + return dev_err_probe(ctx->pwrctrl.dev, ret, "cannot enable regulators\n"); + + gpiod_set_value(ctx->reset_gpio, 0); + + /* wait for the internal osc frequency to stablise */ + usleep_range(10000, 10500); + + ret = tc956x_pwrctrl_assert_deassert_reset(ctx, false); + if (ret) + goto power_off; + + for (i = 0; i < TC956X_MAX; i++) { + cfg = &ctx->cfg[i]; + ret = tc956x_pwrctrl_disable_port(ctx, i); + if (ret) { + dev_err(ctx->pwrctrl.dev, "Disabling port failed\n"); + goto power_off; + } + + ret = tc956x_pwrctrl_set_l0s_l1_entry_delay(ctx, i, false, cfg->l0s_delay); + if (ret) { + dev_err(ctx->pwrctrl.dev, "Setting L0s entry delay failed\n"); + goto power_off; + } + + ret = tc956x_pwrctrl_set_l0s_l1_entry_delay(ctx, i, true, cfg->l1_delay); + if (ret) { + dev_err(ctx->pwrctrl.dev, "Setting L1 entry delay failed\n"); + goto power_off; + } + + ret = tc956x_pwrctrl_set_tx_amplitude(ctx, i, cfg->tx_amp); + if (ret) { + dev_err(ctx->pwrctrl.dev, "Setting Tx amplitube failed\n"); + goto power_off; + } + + ret = tc956x_pwrctrl_set_nfts(ctx, i, cfg->nfts); + if (ret) { + dev_err(ctx->pwrctrl.dev, "Setting nfts failed\n"); + goto power_off; + } + + ret = tc956x_pwrctrl_disable_dfe(ctx, i); + if (ret) { + dev_err(ctx->pwrctrl.dev, "Disabling DFE failed\n"); + goto power_off; + } + } + + ret = tc956x_pwrctrl_assert_deassert_reset(ctx, true); + if (!ret) + return 0; + +power_off: + tc956x_pwrctrl_power_off(ctx); + return ret; +} + +static int tc956x_pwrctrl_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct pci_dev *pci_dev = to_pci_dev(dev->parent); + struct pci_host_bridge *bridge = pci_find_host_bridge(pci_dev->bus); + enum tc956x_pwrctrl_ports port; + struct tc956x_pwrctrl_ctx *ctx; + int ret, addr; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + + ret = of_property_read_u32_index(pdev->dev.of_node, "i2c-parent", 1, &addr); + if (ret) + return dev_err_probe(dev, ret, "Failed to read i2c-parent property\n"); + + ctx->adapter = of_find_i2c_adapter_by_node(of_parse_phandle(dev->of_node, "i2c-parent", 0)); + of_node_put(dev->of_node); + if (!ctx->adapter) + return dev_err_probe(dev, -EPROBE_DEFER, "Failed to find I2C adapter\n"); + + ctx->client = i2c_new_dummy_device(ctx->adapter, addr); + if (IS_ERR(ctx->client)) { + dev_err(dev, "Failed to create I2C client\n"); + i2c_put_adapter(ctx->adapter); + return PTR_ERR(ctx->client); + } + + ctx->supplies[0].supply = "vddc"; + ctx->supplies[1].supply = "vdd18"; + ctx->supplies[2].supply = "vdd09"; + ctx->supplies[3].supply = "vddio1"; + ctx->supplies[4].supply = "vddio2"; + ctx->supplies[5].supply = "vddio18"; + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), ctx->supplies); + if (ret) { + dev_err_probe(dev, ret, + "failed to get supply regulator\n"); + goto remove_i2c; + } + + ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(ctx->reset_gpio)) { + ret = dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), "failed to get reset GPIO\n"); + goto remove_i2c; + } + + pci_pwrctrl_init(&ctx->pwrctrl, dev); + + port = TC956X_USP; + ret = tc956x_pwrctrl_parse_device_dt(ctx, pdev->dev.of_node, port); + if (ret) { + dev_err(dev, "failed to parse device tree properties: %d\n", ret); + goto remove_i2c; + } + + /* + * Downstream ports are always children of the upstream port. + * The first node represents DSP1, the second node represents DSP2, and so on. + */ + for_each_child_of_node_scoped(pdev->dev.of_node, child) { + ret = tc956x_pwrctrl_parse_device_dt(ctx, child, port++); + if (ret) + break; + /* Embedded ethernet device are under DSP3 */ + if (port == TC956X_DSP3) + for_each_child_of_node_scoped(child, child1) { + ret = tc956x_pwrctrl_parse_device_dt(ctx, child1, port++); + if (ret) + break; + } + } + if (ret) { + dev_err(dev, "failed to parse device tree properties: %d\n", ret); + goto remove_i2c; + } + + if (!pcie_is_link_active(pci_dev) && bridge->ops->stop_link) + bridge->ops->stop_link(pci_dev->bus); + + ret = tc956x_pwrctrl_bring_up(ctx); + if (ret) + goto remove_i2c; + + if (!pcie_is_link_active(pci_dev) && bridge->ops->start_link) { + ret = bridge->ops->start_link(pci_dev->bus); + if (ret) + goto power_off; + } + + ret = devm_pci_pwrctrl_device_set_ready(dev, &ctx->pwrctrl); + if (ret) + goto power_off; + + platform_set_drvdata(pdev, ctx); + + return 0; + +power_off: + tc956x_pwrctrl_power_off(ctx); +remove_i2c: + i2c_unregister_device(ctx->client); + i2c_put_adapter(ctx->adapter); + return ret; +} + +static void tc956x_pwrctrl_remove(struct platform_device *pdev) +{ + struct tc956x_pwrctrl_ctx *ctx = platform_get_drvdata(pdev); + + tc956x_pwrctrl_power_off(ctx); + i2c_unregister_device(ctx->client); + i2c_put_adapter(ctx->adapter); +} + +static const struct of_device_id tc956x_pwrctrl_of_match[] = { + { .compatible = "pci1179,0623"}, + { } +}; +MODULE_DEVICE_TABLE(of, tc956x_pwrctrl_of_match); + +static struct platform_driver tc956x_pwrctrl_driver = { + .driver = { + .name = "pwrctrl-tc956x", + .of_match_table = tc956x_pwrctrl_of_match, + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + }, + .probe = tc956x_pwrctrl_probe, + .remove = tc956x_pwrctrl_remove, +}; +module_platform_driver(tc956x_pwrctrl_driver); + +MODULE_AUTHOR("Krishna chaitanya chundru "); +MODULE_DESCRIPTION("TC956x power control driver"); +MODULE_LICENSE("GPL"); From patchwork Tue Feb 25 09:34: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: 13989636 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 DDB372676C1 for ; Tue, 25 Feb 2025 09:35:25 +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=1740476127; cv=none; b=HoHVV8seDNP5W+n9UPBNa/S5NkUaikj291JGNBl+DkrJo/4ptce6LVfB1NO34ZT46NG/mJDfSOp6cnXAKpPQgUBHmfbnim8URkTV6KQpp7wbMgQEAoGRWp7dZm4zAcRLOZbIIOq/4xX55zT05OpGusUvzwsuaO9kP41JJ8Mv/ac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476127; c=relaxed/simple; bh=O6QdMw9pPsUSonExw1v1X4uasyeeZLrOu/yWsY9TlUk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oSq61+KyvwCGieBjUgVMGIcQUIYXFRrUnsEjljNZls4H/f21vS0W+CUcnjr3DUgP+i29sRLhs2yUieG1TwCAqxMkt775Xlw0Q2W6EzQu5PN3UlP0eUIopQzRhBE32ZWvaPE2bZ4ydZ2Zx3D4Wb1LgboeISr56D9QdXa2FfAUKns= 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=eNm5N69b; 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="eNm5N69b" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51P8N4mk020060 for ; Tue, 25 Feb 2025 09:35:25 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= 4aoaq0mjDOgIfsvFB0lVTIIe96cGBXl/hbTV2ZPb/9Q=; b=eNm5N69b5os5DY5X e+LeoRScIDgVKhf7EfRP8vq+aTAGREow7fMMROK7+gNMQOOioxoKjTj8pPPyOKIx ZGBeUqgwn1m3yHaj5OT+Pyxh6vu3CY5ZzIwpsDFvVIhS4YvhMgsS4fNPqWBEuQns hKu6n3f66OjMb8ubIQJnUXrxw0ywQYZIYnC+7jMlH9Ksn6y/rg1e+Vpd1DjBMdB5 GFs+qjYMx4NMA1AAWdFTshA4CRPb4bF4bSENGELPl1IS5K1zeWvGB5U1Z3TLtS6u 6Kdphgy7Nw1jKsHruG43KXq/ha33C1674IamyiSEsEMWDaiMC7ZPxge9u9n9xHY6 RaA7rA== 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 44y6t2r798-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 09:35:24 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2f2a9f056a8so11805246a91.2 for ; Tue, 25 Feb 2025 01:35:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476124; x=1741080924; 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=4aoaq0mjDOgIfsvFB0lVTIIe96cGBXl/hbTV2ZPb/9Q=; b=ia0yepI+rbQ3m0KTggYDAu4jREyX/bB+1N+gJEgQFKZ5/J3gFYTTcQIwKszVG9y83T wDlxJ5BD58EelHCRn2NI5qYxEIwTvfKN51NVpz8aVlRx4jKOXxwEOYrSb2eod4uMrgKI JTgtkqZ+bXpQZnJk+a1W1NWeDsdj56PL/JZDJNOlVmNdFNJvqVB/CeJsjXr5Gx9Cs9vH ZgR9kKC7ryxdXRkZ7NMTqZk5LlepmFYC5C/THStSMlTjVf5YTYzBMQgUPTp/mWafya3i jvo4SaH3u5zpgk2QdXBFquAbxCHLIF22bkylvil9lCCZLQ8uY4PFt2j5O92FDLy11T89 mVOQ== X-Forwarded-Encrypted: i=1; AJvYcCXjq6pdhcBScMvxYEZX9YAowhXGObfCdOx1QZdeuP94icCYHUlTcs8ETaXJduJtJpMapti4c7EZlktdKNua@vger.kernel.org X-Gm-Message-State: AOJu0Yx3ePpzFqvVYwkpFjTkq6P3Cuo6RzUNGPZtQ9lehdu9nhCY72eM vOBwzGc3yLe0eoIhAn4AA+FuS6Cs6+GgG2MmV1dZR8VbzxZB7LeJtUKkQhwVO90vq1yi1CT1pCn T2fVmGJy+GYNYqI3k8uEp8mV0n2qsGcqSDuHhFoDee5Y9gwrVXWJfoZWcQPrETANe X-Gm-Gg: ASbGncukIoQGO//MofDAZH5hYhBDLKQ2CsbSgBqr/BYtMxXB1e4hqmX89Sqbc2AKNkg YGCeFro2U8b6WFbtfZlavRHKVFS7+Xc/jOzn4RRvRmDEpZ7mzc6wgcpOPaIOqfwIeKUsMmQ3juS HA5sosbiQlDKGfx2SPcuheqvsfQGVSAHJCfo+enPSY+wEhfjxMGDbzvWv+Vhzg9x1Lm8/x/TgsZ 1iYXjMH9Tji0qL6ecaoncWUpvxVrioilfV4aQqr+fAQDuErsMsdJmLzqhAbAw1a80dDLy3OcAbj i60OQzr84pwSHm7JOvsCxk3BjeXS1+fPz85D9CUqrM84pxOGVWI= X-Received: by 2002:a17:90a:d643:b0:2ee:8031:cdbc with SMTP id 98e67ed59e1d1-2fce7af3f27mr23590178a91.23.1740476123976; Tue, 25 Feb 2025 01:35:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IEx8Q/7kpUvvQms6TaGdhGF/1FWj1acg1b6gZtuWR3LDxMd/AjBckVUsJULl3AKvVV8BfYDKQ== X-Received: by 2002:a17:90a:d643:b0:2ee:8031:cdbc with SMTP id 98e67ed59e1d1-2fce7af3f27mr23590147a91.23.1740476123583; Tue, 25 Feb 2025 01:35:23 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe6a3dec52sm1080770a91.20.2025.02.25.01.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:35:23 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 15:04:06 +0530 Subject: [PATCH v4 09/10] dt-bindings: PCI: qcom,pcie-sc7280: Add 'global' interrupt Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250225-qps615_v4_1-v4-9-e08633a7bdf8@oss.qualcomm.com> References: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> In-Reply-To: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> To: Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , chaitanya chundru , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Jingoo Han , Bartosz Golaszewski Cc: quic_vbadigan@quicnic.com, amitk@kernel.org, dmitry.baryshkov@linaro.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, jorge.ramirez@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740476062; l=2266; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=O6QdMw9pPsUSonExw1v1X4uasyeeZLrOu/yWsY9TlUk=; b=b1gIs1M9+w2uwq8aKEXnUyCHK9+vOyRbRv5s4qKcQEAZdCgZPuRWhO+GdKlQIBt9b/Bn2pEXT uruNXKmtI+CCHawO8jaBl+e3bTGGIRKv6bJTzcR/Oz3rUUio2gnzg1U X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: 18FYZMPtV0VOlEgD1im-cm6IBi6FN4u3 X-Proofpoint-GUID: 18FYZMPtV0VOlEgD1im-cm6IBi6FN4u3 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_03,2025-02-24_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 spamscore=0 priorityscore=1501 mlxscore=0 phishscore=0 malwarescore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250066 Qcom PCIe RC controllers are capable of generating 'global' SPI interrupt to the host CPU. This interrupt can be used by the device driver to handle PCIe link specific events such as Link up and Link down, which give the driver a chance to start bus enumeration on its own when link is up and initiate link training if link goes to a bad state. The PCIe driver can still work without this interrupt but it will provide a nice user experience when device gets plugged and removed. Hence, document it in the binding along with the existing MSI interrupts. Global interrupt is parsed as optional in driver, so adding it in bindings will not break the ABI. Signed-off-by: Krishna Chaitanya Chundru --- Documentation/devicetree/bindings/pci/qcom,pcie-sc7280.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-sc7280.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-sc7280.yaml index 76cb9fbfd476..7ae09ba8da60 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie-sc7280.yaml +++ b/Documentation/devicetree/bindings/pci/qcom,pcie-sc7280.yaml @@ -54,7 +54,7 @@ properties: interrupts: minItems: 8 - maxItems: 8 + maxItems: 9 interrupt-names: items: @@ -66,6 +66,7 @@ properties: - const: msi5 - const: msi6 - const: msi7 + - const: global resets: maxItems: 1 @@ -149,9 +150,10 @@ examples: , , , - ; + , + ; interrupt-names = "msi0", "msi1", "msi2", "msi3", - "msi4", "msi5", "msi6", "msi7"; + "msi4", "msi5", "msi6", "msi7", "global"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0x7>; interrupt-map = <0 0 0 1 &intc 0 0 0 434 IRQ_TYPE_LEVEL_HIGH>, From patchwork Tue Feb 25 09:34: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: 13989637 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 DAB90267720 for ; Tue, 25 Feb 2025 09:35:31 +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=1740476133; cv=none; b=VBnMd9ZKRr+WKgsEB7BxGzGvXuuCkN2n2B/0Beb7uz1o7vVy1tznaVfmgZADYkEyOLQMFhi75c1huMxJIpsKqrxaqDt7LSDxyuO3d78LfAqCs0Teo+RD9HBvEpiriZZrkZx3lLSbKQGEHT1exECwJWSmfWgtnCmDVuwykawIO5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740476133; c=relaxed/simple; bh=J9FPWpMy4pUYh48OOv9ER9vlynBjXbryZTb/XXp/SPY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LXeOw09F2Dibsi/TqDlx668QfApYPHnESHj2CM7r+3cgox/Khvccto6tgP3VHHnL+apWw56pVP5Llj1WI2oMLzyWf6RvO5GlXUpDCyO9vUKrkRaMWOu+ocKJomhawTb5ElWjSfVeXjbgnILSUd6dHc3x+V8p6HEnUi1NstPpM8c= 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=bOwZPU7x; 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="bOwZPU7x" 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 51P8WeDQ015207 for ; Tue, 25 Feb 2025 09:35:31 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= Id9QzYlVF4SSM5ossbE+J7tOH0yV5nBNwKnqTmgpscE=; b=bOwZPU7xYc6egLfE Xof6G0gTn+4RBzOFvOeMRkzLWcFjeJ0vq6gVC07z8jfEr+Sq1GW6dvotTK4/TFTG tz66NR5MKb/GdFExhm/8qEbCoJBPMYFdhGVxgdxr4xhO+QutN0P0vbwrrWo4Db/y 1uiitMUSn/Mh7fG2wsC/OWWscDbn2WGjxr9kFf+r23ySwFwv+gzuL8m9FdxRoDqt YQ7NHiXzQDvjZvxBtwxLgxrGgRNH6WpkgzFAYhn+itFllNp5L+6Lmbmv0s+rx2mX eBu8RITCmNXrJjDAoTIwAMw1vJdxVMG2TKwhCzHPp125zwkyNWjVMSWkuiFPpZ0Y prILCw== 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 450kqg4hv0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 25 Feb 2025 09:35:31 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-2f2a9f056a8so11805419a91.2 for ; Tue, 25 Feb 2025 01:35:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740476130; x=1741080930; 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=Id9QzYlVF4SSM5ossbE+J7tOH0yV5nBNwKnqTmgpscE=; b=lI9iGlfxJGasd05fCIbjSHg+UoHSBhLV5WaSzKVbxgtBZgUJ+d0lqpqfST7vdwy5vJ WMoihhLpySK4Do0Jfl6ZWV2qeVmahYl7SbyqLNP/vV4Zm7x8MbC6sR4vgf0H3NE3q+IK +eT3qwVLQXG12RWzgbLZN28hEL+rjgXwWKZYPRq2knD5lU44B1h5ca7/yRkIzr56Ss+p 66dM12TNE27MnawOXeKkt8pJd4oe/67+b5w1p8CRt0el7Q06Ty3+Krt9iywG0FM6Vkgj sV8MzP5qZrVqCK1rpX5u+4x2aI5+DIBhKrjbVMWapqacAYC6oWOCTDNpc2CR4W4Ksj5x zG9g== X-Forwarded-Encrypted: i=1; AJvYcCWED3S4o+nCsCmx8b0ZqEww/4mFSyciMVu2w1osoLva8n3uzxFce3gGC+D3BhubBG+JbCCNdpjp/Y+ckjZ5@vger.kernel.org X-Gm-Message-State: AOJu0Yx3dL/W6OGaVtIwwVxT147tqu2cDXLWmqGLxlh0mNbIhn+e5FlI 28hU9JFeAqBSddkEJzpwlyRBcGPH9+f/0MIGJGlKF0ejVcy8TheIKRW3wfUicQRWyEC/rhNwqZy rIzA0PlBgZxb5r1EZ5C4mtf9LVNdrzsGIoq5nmu1UKCbvpR9S6PU76D7/t7uHrP/I X-Gm-Gg: ASbGnctxq/+cpBkZacWA5xys/6e159EFFw9izH/ieKTQdAoKJ/k8i7vBJQ/NcHgHjn9 YPEFzHDHl1RADvPOgyrfLA/MXfa5BJA3qpa61VdzOhHTZlw2tw0GO0mUME7WNBvIMAB5kvlvlvk v41s38lXhZ8/cPeT9S4CcAJNh58l0unOQtP16RpYOXRz+/J5boqzRdrEqU2Hqoa+vfLAYX38Hxb g7tsph/1E4XN6NfSPlEDex9BRWvzV9CMg6qdz8/rvcagHcjKpBNXGgUEYb0keOFxUyIVCwmhrXl jdpaxL2iWivag99WDZZaQTYQNV1B0xd28RwyoFyRK/OIkVp1ODk= X-Received: by 2002:a17:90b:2590:b0:2ea:5dea:eb0a with SMTP id 98e67ed59e1d1-2fce769a8aemr26694210a91.4.1740476130265; Tue, 25 Feb 2025 01:35:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHz30ox0pDjSCuTt9O9dB7MKT/+6sp1RCPDV+Hn7y4uwuJiwd9xcSnmP6sOZP+2onXPWAjN9A== X-Received: by 2002:a17:90b:2590:b0:2ea:5dea:eb0a with SMTP id 98e67ed59e1d1-2fce769a8aemr26694191a91.4.1740476129901; Tue, 25 Feb 2025 01:35:29 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fe6a3dec52sm1080770a91.20.2025.02.25.01.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 01:35:29 -0800 (PST) From: Krishna Chaitanya Chundru Date: Tue, 25 Feb 2025 15:04:07 +0530 Subject: [PATCH v4 10/10] arm64: dts: qcom: sc7280: Add 'global' interrupt to the PCIe RC nodes Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250225-qps615_v4_1-v4-10-e08633a7bdf8@oss.qualcomm.com> References: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> In-Reply-To: <20250225-qps615_v4_1-v4-0-e08633a7bdf8@oss.qualcomm.com> To: Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , chaitanya chundru , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org, Jingoo Han , Bartosz Golaszewski Cc: quic_vbadigan@quicnic.com, amitk@kernel.org, dmitry.baryshkov@linaro.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, jorge.ramirez@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740476062; l=1320; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=J9FPWpMy4pUYh48OOv9ER9vlynBjXbryZTb/XXp/SPY=; b=WOlWMX+kIeY2N8YTUwAYj0VddkFeHag0EknvUTM3VaxmVM236/nVGuRz/ImSIHtcCmYtacv/T +cR0HO8dFH7BLzzTFlAbRrRlSOW1jZI8utrAjX1hgYW4Mo2UkayZR+u X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: NGUG1-gfIxtWe0dfel2Pw8VV-L8v3DZd X-Proofpoint-ORIG-GUID: NGUG1-gfIxtWe0dfel2Pw8VV-L8v3DZd 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_03,2025-02-24_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 mlxscore=0 spamscore=0 clxscore=1015 mlxlogscore=678 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2502250066 Qcom PCIe RC controllers are capable of generating 'global' SPI interrupt to the host CPUs. This interrupt can be used by the device driver to identify events such as PCIe link specific events, safety events, etc... Hence, add it to the PCIe RC node along with the existing MSI interrupts. Signed-off-by: Krishna Chaitanya Chundru Reviewed-by: Dmitry Baryshkov --- arch/arm64/boot/dts/qcom/sc7280.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi index b2e2b1f26731..6d71353592c9 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -2225,9 +2225,10 @@ pcie1: pcie@1c08000 { , , , - ; + , + ; interrupt-names = "msi0", "msi1", "msi2", "msi3", - "msi4", "msi5", "msi6", "msi7"; + "msi4", "msi5", "msi6", "msi7", "global"; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0x7>; interrupt-map = <0 0 0 1 &intc 0 0 0 434 IRQ_TYPE_LEVEL_HIGH>,