From patchwork Sat Mar 22 03:00:43 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: 14026141 X-Patchwork-Delegate: kw@linux.com 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 1D4D377102 for ; Sat, 22 Mar 2025 03:01:01 +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=1742612467; cv=none; b=H4wR6tX1chNSotoYJIl+RXflBHgnOOrQmlHXCYV01BkXrU5u7z5NKaQEi5rQoE132aSwUZvfFXf+dxLJG8GK48W/qgwTGEr7aOpZir/4IcqNZ1HMFy7cO6IWD3IXGUpTQziw3ZENrNoW+AKGNDGLgGd+hGPzRdO/8o/dHe4iLgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742612467; c=relaxed/simple; bh=J7qmsQ+A2fIonAzDIDVYg3tQK/uWUAEhXZI4HRbecCA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HXYNtPErolnYPfAItT4tVA8pyBxDqTI30WqNy+SkKYaCBOJSVCcOjHFxz41DHWWPrnzd07Vfq12UR0Yj9O4vByo9Zw3ezHpjy/pkgkmn5VvaaCDJ5EULgVgjzVSWGYaezcBc3DBN1L5+xUt1KQN4RN4SuvVqD2DuC5cOq/UC3hY= 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=Xvn7B/Lx; 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="Xvn7B/Lx" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52M2XoVU008159 for ; Sat, 22 Mar 2025 03:01: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= L6NsJ67mbWVdBD1xaBbCR7wFG6yiWcFKT01m4CKJ8jg=; b=Xvn7B/LxM41RQLJe lKRN+fhQ0575YtujuZ1ScgJnmaibFTSyI9VY/xHy1ab4jhDSeX9GCUZgU+YtNqqs VB4g/bg9jtnDJbwEShsgvc7W0JDdPOHpqPcTGM06HJTL9Ky5xT9gzogTeNn1aYQh jN1YuNVGULq1cbsgzJH2yNW5WoQ5Ihfjch8WnJyEkeEdD8nEdnM8F3rrlqJpVZID Le1Gx599KcNisM+3maHxzfGsiaKXdv88tjkJvA7+/Tdxa7LE5OfWGOW40qpzW+b1 fsVa4sAOc1CORyS9H96v+35+up3iw8iIc6knZmr+EG7CDCkTie8bFlYJJabCRQEG ejrixg== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45hmhk01em-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 22 Mar 2025 03:01:00 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-224192ff68bso36854985ad.1 for ; Fri, 21 Mar 2025 20:01:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742612459; x=1743217259; 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=L6NsJ67mbWVdBD1xaBbCR7wFG6yiWcFKT01m4CKJ8jg=; b=KNqEQWGAhzfdWeg/4Fuy3LW8SKzKKoc7NAg4l8reizXGQiSfwg9y2gC5FhutlLXZlr uTlcqkUIkDayqSrNxlUQZozxhxImiA/Umj93qU4/3ZLg69RC9sf5yzPL16Ro1ctX/wIa YsLFdxa+DVXMdXlNNx6WQMkYd7x+K59hhoF+VZ1e8pzMaXw6I3eWpgG4saDaMUIA34cp k4vElVVQgz8iOpgrkRIGtrkp90/pQwmP1Su7M+gQQrbN4M4mR3/fXaqBlcQcQnC+SW0Y F7DmcHggFDs5nvFDjM5Njmt6i+hXkaa+btjiUY8PLVOcGYxiMWnCFtpnMRiazZeUHXyY ylpw== X-Forwarded-Encrypted: i=1; AJvYcCVVtD62RhbJAD38RbTuvm773TRovO6MyXBI0k0okXuFyr2T6Lnj23Si0VRLvCGzzofwIqZR2LE9OM4=@vger.kernel.org X-Gm-Message-State: AOJu0YyEEGY4pIh7YZAIkpRbMr/pX6fp+RzZUzWzLHeUqdbP4oc0g67/ xxH5qjD5BcEXiPV53jgTXmV4T3K7EeRZNaSw79agsEWinpqywKKQVwXMCoFqBPTAVJ6//DJxMrx SZUF/QRXRQmVzyY/FBoTMmqsdBQEnuyT+oCAwgOgKsbjf8083TCGQ7U54wLWUychd1sc= X-Gm-Gg: ASbGncvLD+0N2mX0jJ1gMb1J5QvgqC0G4p47lxj4OtroRX5GJHiwF9Ge4zY8sezhpRu KEveKV4Bb9j+m6s5+FdPV0jo0vhp8KkZbWgkS1Sm4ZoZK3wGqlQgqBzTp9yP3lt70V76ZwXE0ug IH9WGuQA0qszJiQGBh8ZUlWnLFvBfZeJlrbGUXO/b4JCPGYpWlYMpHgcv06b7VODifR/LdPOGXr /4x5FnlfFVUiJDnPCLt0dEXLEOVLwW1rPF4vwXtyN81QZzv6/XTWzxLT19Wr9ufgYpDSOAmU4yZ j9MM8kSBp2Qbrf6nwmCdhqyI30Vf8oxlRN1fg5yVBnRbRdkYPgY= X-Received: by 2002:a17:903:41cf:b0:223:5e56:a1ce with SMTP id d9443c01a7336-22780e0a90cmr86917165ad.32.1742612458946; Fri, 21 Mar 2025 20:00:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyPGDyW8IrAOK+/PcXgL0d7SLEzCd55inihl6cMxYyLgi9/fFL6XvvpBDEyUXBHPph3ViRfw== X-Received: by 2002:a17:903:41cf:b0:223:5e56:a1ce with SMTP id d9443c01a7336-22780e0a90cmr86916595ad.32.1742612458395; Fri, 21 Mar 2025 20:00:58 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-227811bdca7sm25859945ad.137.2025.03.21.20.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 20:00:58 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Sat, 22 Mar 2025 08:30:43 +0530 Subject: [PATCH 1/3] dt-bindings: PCI: qcom: Move phy, wake & reset gpio's to root port Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250322-perst-v1-1-e5e4da74a204@oss.qualcomm.com> References: <20250322-perst-v1-0-e5e4da74a204@oss.qualcomm.com> In-Reply-To: <20250322-perst-v1-0-e5e4da74a204@oss.qualcomm.com> To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org Cc: linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, quic_vbadigan@quicinc.com, quic_mrana@quicinc.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1742612448; l=2972; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=J7qmsQ+A2fIonAzDIDVYg3tQK/uWUAEhXZI4HRbecCA=; b=PLdg+I9pHswAaTCNTR6hEMJ1mJz7oOkFCeznCwpsFEfqymTrHBQv+qBwt8btkyYnHQEToG65g Z6qUnOtyicSBTP6tWlvuqJlOZIRoP46fH4D5ouqxU2ZsoSA4B29eryl X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Authority-Analysis: v=2.4 cv=C4PpyRP+ c=1 sm=1 tr=0 ts=67de27ec cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA:10 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=stmhjgsGwY9JSZftE7EA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-GUID: 5_-qHpGvAdmjgtKA1_m26xxb2f8ZweNI X-Proofpoint-ORIG-GUID: 5_-qHpGvAdmjgtKA1_m26xxb2f8ZweNI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-22_01,2025-03-21_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 bulkscore=0 clxscore=1015 spamscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503220019 Move the phy, phy-names, wake-gpio's to the pcie root port node instead of the bridge node, as agreed upon in multiple places one instance is[1]. Update the qcom,pcie-common.yaml to include the phy, phy-names, and wake-gpios properties in the root port node. There is already reset-gpio defined for PERST# in pci-bus-common.yaml, start using that property instead of perst-gpio. For backward compatibility, do not remove any existing properties in the bridge node. [1] https://lore.kernel.org/linux-pci/20241211192014.GA3302752@bhelgaas/ Signed-off-by: Krishna Chaitanya Chundru --- .../devicetree/bindings/pci/qcom,pcie-common.yaml | 22 ++++++++++++++++++++++ .../devicetree/bindings/pci/qcom,pcie-sc7280.yaml | 18 ++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-common.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-common.yaml index 0480c58f7d99..258c21c01c72 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie-common.yaml +++ b/Documentation/devicetree/bindings/pci/qcom,pcie-common.yaml @@ -85,6 +85,28 @@ properties: opp-table: type: object +patternProperties: + "^pcie@": + type: object + $ref: /schemas/pci/pci-pci-bridge.yaml# + + properties: + reg: + maxItems: 1 + + phys: + maxItems: 1 + + phy-names: + items: + - const: pciephy + + wake-gpios: + description: GPIO controlled connection to WAKE# signal + maxItems: 1 + + unevaluatedProperties: false + required: - reg - reg-names diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-sc7280.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-sc7280.yaml index 76cb9fbfd476..c0a7cfdbfd2a 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie-sc7280.yaml +++ b/Documentation/devicetree/bindings/pci/qcom,pcie-sc7280.yaml @@ -162,9 +162,6 @@ examples: iommu-map = <0x0 &apps_smmu 0x1c80 0x1>, <0x100 &apps_smmu 0x1c81 0x1>; - phys = <&pcie1_phy>; - phy-names = "pciephy"; - pinctrl-names = "default"; pinctrl-0 = <&pcie1_clkreq_n>; @@ -173,7 +170,20 @@ examples: resets = <&gcc GCC_PCIE_1_BCR>; reset-names = "pci"; - perst-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; vddpe-3v3-supply = <&pp3300_ssd>; + pcieport1: pcie@0 { + device_type = "pci"; + reg = <0x0 0x0 0x0 0x0 0x0>; + bus-range = <0x01 0xff>; + + #address-cells = <3>; + #size-cells = <2>; + ranges; + phys = <&pcie1_phy>; + phy-names = "pciephy"; + + reset-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; + }; + }; }; From patchwork Sat Mar 22 03:00:44 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: 14026142 X-Patchwork-Delegate: kw@linux.com 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 7FA22137923 for ; Sat, 22 Mar 2025 03:01:06 +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=1742612468; cv=none; b=GrJMmGRt27BEZLhUHme+z+sT8CPHkcWFDnEoXdmTsVYDizwpkFokIBAQmik655GqUlyoYUvwIg8e0ZGRr+c4nN5tiZro/m9UzJcQK1+9vViUi6J5XhzvabhGBQlYXsCO9/h2kIxIJ11l9B3clig89DYHppnS2JJ9pDc4F2WMQ4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742612468; c=relaxed/simple; bh=Mk1edLjeulLTMsWslHQkThKj73LmX8ZgbviMLPagnkI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CbwMivbSHn0i2PWUGKY8fjjoWcwHaf6SmHuiyhh9X6WNQ+VqA7igkbUEpoYEdpTzDNeU8FYYHmZo+NLeQbIZ+8GMb6kDJlZev5dhhG1W+t+jltMPzp21StIFEOrLEIf+IwmKLBMEz8h262N1oYEKyd3uFb5BgfXhkU4xPct78NY= 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=V3YOo5E4; 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="V3YOo5E4" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52M2Y97s008300 for ; Sat, 22 Mar 2025 03:01:05 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= qnbsTuO3wM+rIKG65q6tA+xSo4IfOE/hHH/Jylcd7ZY=; b=V3YOo5E4FzWH4/I3 dcYMFDexS2rhJ0w9f28sdrT5xrHP9j7crvf9K7uLx8XpsEdDG7ttmVBCSw/RJuNO 5cginZBfL4kkDWpKUUNfD6iAN7OLszzTlK0LugjAS7VJEbt4dD50k1Y3ftE5BBft AJRY/2xote52JtMMdh4vxCRBmFibgS7YYSkwnu4BIjRgKTFZg9rrdhLA9H8HVQrb YxnE52gElN3hGl1GiFuJTYhZO3b02pLsxp+4/oV/mboN6lp9bufccS55AvT7qdDy /2j66gqjYJgPRENqQydt/npWwTjnztHmpAsIwg1jFH2XZ4t25AuN7qYJUdZbrWM7 D0r7Mg== 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 45hmhk01f2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 22 Mar 2025 03:01:05 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2ff52e1c56fso6586337a91.2 for ; Fri, 21 Mar 2025 20:01:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742612464; x=1743217264; 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=qnbsTuO3wM+rIKG65q6tA+xSo4IfOE/hHH/Jylcd7ZY=; b=pTje0n6q/sTZ+ECL8gfbONOMq8CSmKWjdE2/NqS1s9AF/fq4ofmNixYFG6Z8m/Tc8t yWEPzralV0T84v11EjEdlPNR9/95YRquG8URkNd/rijhLiaxfiLKb3hRk7hjlVqFCCEB dFC2yA5thtKbmPjZ571Ny//L0BdK0T+QRXyUFGEECEZTQ4dxdDPDH2O7zOJ+sxFB12/Z o2RNaxmIvKvsHqOWS++6duOa0+FJO4PKbxtT0qTGjp4SMIblc73n0CYRDKUUW0dQNNac WbPNGDW+nI98MIdXVrkycpXjYbvdaJt+NV0iwwP1JwV8dPrI+FTf4bk5Rrwdz6t/pzTY xBSQ== X-Forwarded-Encrypted: i=1; AJvYcCW2tIO8oM3q6qhVwaEaUesRT3LN5EA2ni+vLLYeLLsHwDkfolyCM3hBQv2OIg3GrdVbEgxuHdK7yq4=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2mGNz8NnLuzxupq2PqJd3zsNep0oobS8Pylkn+HL6Rh2I/IyQ jDXShus8hy7OsmgqV6O9whsySHKPTok66P/vSjtEcttUzutvFeHzux4LZj07JYYbBGOhkGo3XFo Otnj8V5TQ0ijHHCVG+gaMXptJUo5fLb2hVU4CpwkmxDky5N1M4vI2Az8Wf7g= X-Gm-Gg: ASbGncuBSlWA9loxJC9tPuBpuwO196y/YeTDgB0BgoJZAIw0kZLcjInEKQKuJfAcwWa L9b6L3bTLQjjhTOffNUk1W62A1Qs8zW+c8+1d50y2TKd/qwbzMjnQo6kTceqm/eFXGaHfWtRmtL DlYeeghTRthOm+xnF5lE9AAYmYmDo1adQqEBuMfLUlL/XyTBHB+PJnTOiqP71R3o3a2i2iP6L7C gG+Cf3CoSo2Zs1LgeA6SH1CnMRm2NXJSgaRU75Ur0bvngtNFOBGTR408Qc4aFixWJLg8kMSEX0B dPp3AwbRtzBa6B5ySjtNVQKMwlL/E4OSFe6AnqCoRbuQwp+JgqE= X-Received: by 2002:a17:90b:134b:b0:2ea:712d:9a82 with SMTP id 98e67ed59e1d1-3031001d8fcmr8904103a91.29.1742612463774; Fri, 21 Mar 2025 20:01:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG90SlEeOzwjAG8/jTpxWL8Qdku9YUbSnYd6BR/NTxrlPlwA20oiADL38sudK5desfQW+oqCg== X-Received: by 2002:a17:90b:134b:b0:2ea:712d:9a82 with SMTP id 98e67ed59e1d1-3031001d8fcmr8904057a91.29.1742612463252; Fri, 21 Mar 2025 20:01:03 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-227811bdca7sm25859945ad.137.2025.03.21.20.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 20:01:02 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Sat, 22 Mar 2025 08:30:44 +0530 Subject: [PATCH 2/3] arm64: qcom: sc7280: Move phy, perst to root port node Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250322-perst-v1-2-e5e4da74a204@oss.qualcomm.com> References: <20250322-perst-v1-0-e5e4da74a204@oss.qualcomm.com> In-Reply-To: <20250322-perst-v1-0-e5e4da74a204@oss.qualcomm.com> To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org Cc: linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, quic_vbadigan@quicinc.com, quic_mrana@quicinc.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1742612448; l=2998; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=Mk1edLjeulLTMsWslHQkThKj73LmX8ZgbviMLPagnkI=; b=FfuJzofQnA6RaPSugt0Q4M4HToM1ZYgkLq0yF97JcPWlxOf7f4cF22jJfbKML/DxrdBQ+uQ+8 MUNYHTRqWPxACk98gBHglV38vlOCSGzh61kC0/iulxzxd7glRsCS58k X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Authority-Analysis: v=2.4 cv=C4PpyRP+ c=1 sm=1 tr=0 ts=67de27f1 cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA:10 a=EUspDBNiAAAA:8 a=bvY3E1ByFFb03tV5gjAA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-GUID: yy6KdS57k88gQssbusbVfnv13KGD2pdp X-Proofpoint-ORIG-GUID: yy6KdS57k88gQssbusbVfnv13KGD2pdp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-22_01,2025-03-21_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 bulkscore=0 clxscore=1015 spamscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503220019 Move phy, perst, to root port from the controller node. Rename perst-gpios to reset-gpios to align with the expected naming convention of pci-bus-common.yaml. Signed-off-by: Krishna Chaitanya Chundru --- arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 5 ++++- arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi | 5 ++++- arch/arm64/boot/dts/qcom/sc7280-idp.dtsi | 5 ++++- arch/arm64/boot/dts/qcom/sc7280.dtsi | 7 +++---- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts index 7a36c90ad4ec..f54db6345b7a 100644 --- a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +++ b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts @@ -709,8 +709,11 @@ &mdss_edp_phy { status = "okay"; }; +&pcieport1 { + reset-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; +}; + &pcie1 { - perst-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; pinctrl-0 = <&pcie1_reset_n>, <&pcie1_wake_n>; pinctrl-names = "default"; diff --git a/arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi b/arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi index 2ba4ea60cb14..60b3cf50ea1d 100644 --- a/arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi @@ -472,10 +472,13 @@ &pcie1 { pinctrl-names = "default"; pinctrl-0 = <&pcie1_clkreq_n>, <&ssd_rst_l>, <&pe_wake_odl>; - perst-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; vddpe-3v3-supply = <&pp3300_ssd>; }; +&pcieport1 { + reset-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; +}; + &pm8350c_pwm { status = "okay"; }; diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi index 7370aa0dbf0e..19910670fc3a 100644 --- a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi @@ -414,9 +414,12 @@ &lpass_va_macro { vdd-micb-supply = <&vreg_bob>; }; +&pcieport1 { + reset-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; +}; + &pcie1 { status = "okay"; - perst-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; vddpe-3v3-supply = <&nvme_3v3_regulator>; diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi index 0f2caf36910b..6c21c320a2b5 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -2271,9 +2271,6 @@ pcie1: pcie@1c08000 { power-domains = <&gcc GCC_PCIE_1_GDSC>; - phys = <&pcie1_phy>; - phy-names = "pciephy"; - pinctrl-names = "default"; pinctrl-0 = <&pcie1_clkreq_n>; @@ -2284,7 +2281,7 @@ pcie1: pcie@1c08000 { status = "disabled"; - pcie@0 { + pcieport1: pcie@0 { device_type = "pci"; reg = <0x0 0x0 0x0 0x0 0x0>; bus-range = <0x01 0xff>; @@ -2292,6 +2289,8 @@ pcie@0 { #address-cells = <3>; #size-cells = <2>; ranges; + phys = <&pcie1_phy>; + phy-names = "pciephy"; }; }; From patchwork Sat Mar 22 03:00:45 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: 14026143 X-Patchwork-Delegate: kw@linux.com 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 33EDF149DE8 for ; Sat, 22 Mar 2025 03:01:11 +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=1742612473; cv=none; b=clnl38VW7dnhm+wlGVHWuhbO+s9VNajd3FdwTNqVNgnUV6vNAulmhkZjvef4JbzBFfnay6FLXtnoYK3IU9Wt3atpCmY5T7XdFnxdU+UyDH+leJl5MV4C1ljVnJq9STGTDWAVlJ5Y+ay4gMym9kgx6TFx9vQi18GZrRgzOQ9qAGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742612473; c=relaxed/simple; bh=OcsIuznLjZUAtjrb/hnQscAcM6N2IyI9O79LK0QxW3c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N6/ux0JJWIz/wmkbYVj0dfwMYT9JseGpx/i1NKLYi0RDral1rYqbh5rJ6QKq5XVZzmffZhcEnsUNbwNHaZJEC6vWtVBtALuauiQtsQc8BuxJqfDdLAQpmHOUzWGD3PhO/nKx9Vd6L0TZk4FWp/E5ih5KUOCBT4XPbt84MzeGcog= 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=LBPHggUd; 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="LBPHggUd" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52M0vtAY022106 for ; Sat, 22 Mar 2025 03:01:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 5TuaKD5nu/QplYVB4AwEHfIcahKIDJ4Ugxxeg3cp2iQ=; b=LBPHggUd2DVv923a WbFGLv5IL9sspzXjpzvMZOMni5WM6HiRGXa8kadOxxAL2YR/Y3Slf1Ds8UvRP5mX /aJ1dsnep4cZvpPTofvzrRzEkCfagVz6qz80noNY9sDjchB7jDiDHW/C7j4F7b96 VBPmdVCK0A92jkxgXgD/d8P3tJQ97BD0JmPuS3FX+eAtuVhIvpXjAqk8X0GlmKl3 3eyn7pjaEFOER6BNz0kM++XFBAlrF4TrTRXZfCFbOK0tnpFO81/msvr8YABwCNAN 3j7BouKWFOdNCLXmsMtNrcgzxvYohS5VtgDwm6NVtimUDhJQTHvcwqebqELQbKU7 MXywIA== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45h4wpjbb5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 22 Mar 2025 03:01:10 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-225ab228a37so36914845ad.2 for ; Fri, 21 Mar 2025 20:01:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742612469; x=1743217269; 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=5TuaKD5nu/QplYVB4AwEHfIcahKIDJ4Ugxxeg3cp2iQ=; b=jfhhyS0Nf3nac+PaE9uDCQsBSfy11kgwZOGjnuQlKMWkLmIB0RylYXtVA0BarNOAol N7OtPUXfcBFHwjg52JpWDSQ5OPtTRez83jDC4sgRsy+Gda/+IOQLjqMH+JlhjFx63ulq f32sIwXd+4+EWFSRLZsjCAlFY9NhgmdWYRR7NwEyk//1TJGNstOYxTuBJCIXvoyqMGV0 LJ3WIDGfmDS4Vf5jBTwKoUQZ3pHhBhowBFV5dO0FoK05cdlHL07u9sxNgasy5ZY+V10P 6QkYRQOAuGKGRC0bGFYVA8rq0Eqx37H0r1OlOq7c0e1d2oRI7lg8rurZzzWvLX0uqRyu RcuQ== X-Forwarded-Encrypted: i=1; AJvYcCWAS3yPyuZvGGxdG9mYHFbjEUB6oYOQ90X2omxGGu/+qAgdqO4hXWXuuFNh0uBltvGiJqv9xCk1MYI=@vger.kernel.org X-Gm-Message-State: AOJu0YxhLGkQhECOoBOkbDki7m3oPKorKdMtDVQvkWS3Pn2h5MkYnKij KPnoBcTFX/ZzJAomTU7CeEfq44dwyawoy7MSTKpWbAQoMG8BSR4rtJ5HHt/Rrhe+bwW5eeWRRue zTIS03dj3DsS73/OXK2iyAwKUdP1dPEz9HvsYxNDSZEWRZIb+C30Ab7iU7w0= X-Gm-Gg: ASbGncu3hzxeWHB9YhMXOB65KIO1BmFafUA65zEDX3iWHG7FOJaAffpkSrkL1QWzvqn BVewRxD7RktLtPQg+Z9Px5FwKQRxbuMn4uBOmyMa2JXdMfDw2ASJyn5EYSn9Pud3lGsLdFDyphe m14vv7c1BKl3GEhRQ607BVyDI1Z8YBgAGF00S97PHg2n2QOdd4XCIF6QfCLHJ3maUwWtgJe3kAa 0ZUjqw2++1WounBgv2Wu+QQ3Tu3pnDAGGfm5stkvmg5gBSCyjJ7tB2nS3SfadFh1AvhhuvRI8na 0laoqLko5mwnenmmXVUGQFc99kPuTBDEuGZwOySYqsd0bz4wnu0= X-Received: by 2002:a17:903:2286:b0:224:249f:9723 with SMTP id d9443c01a7336-22780e38317mr77072485ad.51.1742612468564; Fri, 21 Mar 2025 20:01:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEX0JuJ42Nry6a84KPdNyBZiNsGh22KBCKMNjpKA+L5XS01gQs1OjBDyxnkz6m4y+Kr0dA+Iw== X-Received: by 2002:a17:903:2286:b0:224:249f:9723 with SMTP id d9443c01a7336-22780e38317mr77072075ad.51.1742612468111; Fri, 21 Mar 2025 20:01:08 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-227811bdca7sm25859945ad.137.2025.03.21.20.01.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 20:01:07 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Sat, 22 Mar 2025 08:30:45 +0530 Subject: [PATCH 3/3] PCI: qcom: Add support for multi-root port Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250322-perst-v1-3-e5e4da74a204@oss.qualcomm.com> References: <20250322-perst-v1-0-e5e4da74a204@oss.qualcomm.com> In-Reply-To: <20250322-perst-v1-0-e5e4da74a204@oss.qualcomm.com> To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , cros-qcom-dts-watchers@chromium.org Cc: linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, quic_vbadigan@quicinc.com, quic_mrana@quicinc.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1742612448; l=7891; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=OcsIuznLjZUAtjrb/hnQscAcM6N2IyI9O79LK0QxW3c=; b=RBHOJiWkUKfaiWLxbUruJ9FvxtO4bp2bHH/7LUto9+ZwmBoOiS83AiN/jDW0Dj8b56pjtz2Jd k6A1tL/zwuhDVwrpJ3FLJD8F0WZqXI99izQHe3DrizktGict+45wrpA X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: GKiktbbzHSySXw3dL867xqtNPc8xajKp X-Proofpoint-GUID: GKiktbbzHSySXw3dL867xqtNPc8xajKp X-Authority-Analysis: v=2.4 cv=ZN3XmW7b c=1 sm=1 tr=0 ts=67de27f6 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA:10 a=EUspDBNiAAAA:8 a=KZ4ZsdeBRq2BojHjq4kA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-22_01,2025-03-21_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 clxscore=1015 phishscore=0 adultscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503220019 Move phy, perst handling to root port and provide a way to have multi-port logic. Currently, qcom controllers only support single port, and all properties are present in the controller node itself. This is incorrect, as properties like phy, perst, wake, etc. can vary per port and should be present in the root port node. pci-bus-common.yaml uses reset-gpios property for representing PERST, use same property instead of perst-gpios. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-qcom.c | 149 +++++++++++++++++++++++++++------ 1 file changed, 123 insertions(+), 26 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index e4d3366ead1f..6424dcfd3e1b 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -262,6 +262,11 @@ struct qcom_pcie_cfg { bool no_l0s; }; +struct qcom_pcie_port { + struct list_head list; + struct gpio_desc *reset; + struct phy *phy; +}; struct qcom_pcie { struct dw_pcie *pci; void __iomem *parf; /* DT parf */ @@ -276,21 +281,36 @@ struct qcom_pcie { struct dentry *debugfs; bool suspended; bool use_pm_opp; + struct list_head ports; }; #define to_qcom_pcie(x) dev_get_drvdata((x)->dev) static void qcom_ep_reset_assert(struct qcom_pcie *pcie) { - gpiod_set_value_cansleep(pcie->reset, 1); + struct qcom_pcie_port *port, *tmp; + + if (list_empty(&pcie->ports)) + gpiod_set_value_cansleep(pcie->reset, 1); + else + list_for_each_entry_safe(port, tmp, &pcie->ports, list) + gpiod_set_value_cansleep(port->reset, 1); + usleep_range(PERST_DELAY_US, PERST_DELAY_US + 500); } static void qcom_ep_reset_deassert(struct qcom_pcie *pcie) { + struct qcom_pcie_port *port, *tmp; + /* Ensure that PERST has been asserted for at least 100 ms */ msleep(100); - gpiod_set_value_cansleep(pcie->reset, 0); + if (list_empty(&pcie->ports)) + gpiod_set_value_cansleep(pcie->reset, 0); + else + list_for_each_entry_safe(port, tmp, &pcie->ports, list) + gpiod_set_value_cansleep(port->reset, 0); + usleep_range(PERST_DELAY_US, PERST_DELAY_US + 500); } @@ -1229,10 +1249,19 @@ static int qcom_pcie_link_up(struct dw_pcie *pci) return !!(val & PCI_EXP_LNKSTA_DLLLA); } +static void qcom_pcie_port_phy_off(struct qcom_pcie *pcie) +{ + struct qcom_pcie_port *port, *tmp; + + list_for_each_entry_safe(port, tmp, &pcie->ports, list) + phy_power_off(port->phy); +} + static int qcom_pcie_host_init(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct qcom_pcie *pcie = to_qcom_pcie(pci); + struct qcom_pcie_port *port, *tmp; int ret; qcom_ep_reset_assert(pcie); @@ -1241,13 +1270,27 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) if (ret) return ret; - ret = phy_set_mode_ext(pcie->phy, PHY_MODE_PCIE, PHY_MODE_PCIE_RC); - if (ret) - goto err_deinit; + if (list_empty(&pcie->ports)) { + ret = phy_set_mode_ext(pcie->phy, PHY_MODE_PCIE, PHY_MODE_PCIE_RC); + if (ret) + goto err_deinit; - ret = phy_power_on(pcie->phy); - if (ret) - goto err_deinit; + ret = phy_power_on(pcie->phy); + if (ret) + goto err_deinit; + } else { + list_for_each_entry_safe(port, tmp, &pcie->ports, list) { + ret = phy_set_mode_ext(port->phy, PHY_MODE_PCIE, PHY_MODE_PCIE_RC); + if (ret) + goto err_deinit; + + ret = phy_power_on(port->phy); + if (ret) { + qcom_pcie_port_phy_off(pcie); + goto err_deinit; + } + } + } if (pcie->cfg->ops->post_init) { ret = pcie->cfg->ops->post_init(pcie); @@ -1268,7 +1311,10 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) err_assert_reset: qcom_ep_reset_assert(pcie); err_disable_phy: - phy_power_off(pcie->phy); + if (list_empty(&pcie->ports)) + phy_power_off(pcie->phy); + else + qcom_pcie_port_phy_off(pcie); err_deinit: pcie->cfg->ops->deinit(pcie); @@ -1281,7 +1327,10 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp *pp) struct qcom_pcie *pcie = to_qcom_pcie(pci); qcom_ep_reset_assert(pcie); - phy_power_off(pcie->phy); + if (list_empty(&pcie->ports)) + phy_power_off(pcie->phy); + else + qcom_pcie_port_phy_off(pcie); pcie->cfg->ops->deinit(pcie); } @@ -1579,11 +1628,41 @@ static irqreturn_t qcom_pcie_global_irq_thread(int irq, void *data) return IRQ_HANDLED; } +static int qcom_pcie_parse_port(struct qcom_pcie *pcie, struct device_node *node) +{ + struct device *dev = pcie->pci->dev; + struct qcom_pcie_port *port; + struct gpio_desc *reset; + struct phy *phy; + + reset = devm_fwnode_gpiod_get(dev, of_fwnode_handle(node), + "reset", GPIOD_OUT_HIGH, "PERST#"); + if (IS_ERR(reset)) + return PTR_ERR(reset); + + phy = devm_of_phy_get(dev, node, "pciephy"); + if (IS_ERR(phy)) + return PTR_ERR(phy); + + port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + if (!port) + return -ENOMEM; + + port->reset = reset; + port->phy = phy; + INIT_LIST_HEAD(&port->list); + list_add_tail(&port->list, &pcie->ports); + + return 0; +} + static int qcom_pcie_probe(struct platform_device *pdev) { const struct qcom_pcie_cfg *pcie_cfg; unsigned long max_freq = ULONG_MAX; + struct qcom_pcie_port *port, *tmp; struct device *dev = &pdev->dev; + struct device_node *of_port; struct dev_pm_opp *opp; struct qcom_pcie *pcie; struct dw_pcie_rp *pp; @@ -1611,6 +1690,8 @@ static int qcom_pcie_probe(struct platform_device *pdev) if (ret < 0) goto err_pm_runtime_put; + INIT_LIST_HEAD(&pcie->ports); + pci->dev = dev; pci->ops = &dw_pcie_ops; pp = &pci->pp; @@ -1619,12 +1700,6 @@ static int qcom_pcie_probe(struct platform_device *pdev) pcie->cfg = pcie_cfg; - pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_HIGH); - if (IS_ERR(pcie->reset)) { - ret = PTR_ERR(pcie->reset); - goto err_pm_runtime_put; - } - pcie->parf = devm_platform_ioremap_resource_byname(pdev, "parf"); if (IS_ERR(pcie->parf)) { ret = PTR_ERR(pcie->parf); @@ -1647,12 +1722,6 @@ static int qcom_pcie_probe(struct platform_device *pdev) } } - pcie->phy = devm_phy_optional_get(dev, "pciephy"); - if (IS_ERR(pcie->phy)) { - ret = PTR_ERR(pcie->phy); - goto err_pm_runtime_put; - } - /* OPP table is optional */ ret = devm_pm_opp_of_add_table(dev); if (ret && ret != -ENODEV) { @@ -1699,9 +1768,31 @@ static int qcom_pcie_probe(struct platform_device *pdev) pp->ops = &qcom_pcie_dw_ops; - ret = phy_init(pcie->phy); - if (ret) - goto err_pm_runtime_put; + for_each_child_of_node(dev->of_node, of_port) { + ret = qcom_pcie_parse_port(pcie, of_port); + of_node_put(of_port); + if (ret) + break; + } + + /* Fallback to previous method */ + if (ret) { + pcie->phy = devm_phy_optional_get(dev, "pciephy"); + if (IS_ERR(pcie->phy)) { + ret = PTR_ERR(pcie->phy); + goto err_pm_runtime_put; + } + + pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_HIGH); + if (IS_ERR(pcie->reset)) { + ret = PTR_ERR(pcie->reset); + goto err_pm_runtime_put; + } + + ret = phy_init(pcie->phy); + if (ret) + goto err_pm_runtime_put; + } platform_set_drvdata(pdev, pcie); @@ -1746,10 +1837,16 @@ static int qcom_pcie_probe(struct platform_device *pdev) err_host_deinit: dw_pcie_host_deinit(pp); err_phy_exit: - phy_exit(pcie->phy); + if (list_empty(&pcie->ports)) + phy_exit(pcie->phy); + else + list_for_each_entry_safe(port, tmp, &pcie->ports, list) + phy_exit(port->phy); err_pm_runtime_put: pm_runtime_put(dev); pm_runtime_disable(dev); + list_for_each_entry_safe(port, tmp, &pcie->ports, list) + list_del(&port->list); return ret; }