From patchwork Wed May 1 04:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650165 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61557433CB; Wed, 1 May 2024 04:08:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536489; cv=none; b=nK+F4B8US0CXVf9usmiDLieVCRXbSIXVaug0+DP4kdmBjRObG/0ksB37ip0Q3ZXnRloUCSyK27J6Hv+VhJHcfdU5L/4l6k3f6lGkGV85XJO0XSpckioH5ybGwcGJ/oqLmftIfhiMcskTsL679vQZMMeTuMdHhoZsTcPgPXegf3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536489; c=relaxed/simple; bh=hTXTBAcEL8gMHMEYQjxjqOhus0GQvyCJWh1hLepjz8Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F342le+1lJD/jXA0U7JHK7tICzWbVUrhm7X7MLYWiIKK860s7c5xGH01nA/8Wu2bV7nUGOLxcO7O9oC+VGenzl4KCwc/d0NMnP3pJCWal8tvKECu8TD1JilkPL+uGLEM84E5on+S4Mou3PWDiFD1OF3TT9YcLYvv9UWEptbmHTM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZmfRuR4T; arc=none smtp.client-ip=209.85.167.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZmfRuR4T" Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3c8644aa3feso1980658b6e.1; Tue, 30 Apr 2024 21:08:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536487; x=1715141287; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=53QnHnVF7bqkRAf/NYE3eZQ50tFTHOIRODlZaYfoSVE=; b=ZmfRuR4TxvkC5Vw0zjiIH8r9kBSFptuxZtGqLDKqce8S+UBRTaKuPi4xpXIt4ssChj tly43tHHFaul6HZW4AWrl0Q9PwBJCiR5uGJBclE4vpMIMO9wYKcaGTcrJSenNep4T/gs gKfeJgnQXHBKru0q4kiMUm6fzu4X4niBETYbh9GfvBBNyUnC1SvDvc/9vvOvioAJ7NpM u6D/C7qoqhMjUP8ys4I5xQ61JBOCB0+NbfRoMpoIMevBmTD6X+X/iGuSN0P+hK1eoKo3 80vumvo4/JLVPQZEdv6/gFO3X99GZJkYHwV9QkEXQO+mgAvZpnqvyRD0AUXb0Iol3GdM EsKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536487; x=1715141287; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=53QnHnVF7bqkRAf/NYE3eZQ50tFTHOIRODlZaYfoSVE=; b=lPQ1T4DwHvb8L6SkAW++CnZNC8DD7p95dYiA1ElgkHPbCygNClgXhCXwJvwwyZ9ywN d6dy12ZRzLhAFDtqf4WIxeSIhS4/DM/Sp8fb8UBvNt4LFSq6msr7c7fPnmmFDTMDlgB/ L5U5cDyZ4nh3cWKpqpXal48A438p22QMwgmdADUcJvt7UktpxC/+moUfCc5wEQx8tCmJ JvRk5J/asVL4+hawF+ZRM1dEYcj505LVapIqH1lvmhA4BGOlkYkwclZayrzc5QuXqCeM VU6h5G2wXGTtitfnmZx5OlSz3+Onpn5HuZrwKP06ACMlzqPknZX8FqChqF9auLuNyicO C0Cw== X-Forwarded-Encrypted: i=1; AJvYcCW0Thr0sbAsybsR0e3WLzM8qBMhMhb4VouLHpLCN5eL3OErpFrBgvS374yJf+HE22iSKoGgSKIpb9UfDEaL9ByseK2l2TvI/6DkxYByGyceK4Dbmjg/NgfWPTicLS3glFpUgL1iQB2Lspz5rQpwQKX6hv5HvCDesQk9Z3Y9dQTCxzIlx1Q= X-Gm-Message-State: AOJu0YxwCoMpoZWq0UHiVw6CLXPuEgm161zTD1ECusFhsf0ycTBlw9p1 /woCMNmgDecOxGrAwj8axq80lcwNanc8rdAmyUAwZeA5xtFQMgkr X-Google-Smtp-Source: AGHT+IHLjsBG7zzyJ43r+52W9nzgFGgnrrXmfIif9WOG2DGC2hwDYnPkLo+V/3KvGIUkIklJJw+RdQ== X-Received: by 2002:a05:6808:d9:b0:3c5:fa5c:7762 with SMTP id t25-20020a05680800d900b003c5fa5c7762mr1514306oic.44.1714536487474; Tue, 30 Apr 2024 21:08:07 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:07 -0700 (PDT) From: Alexandru Gagniuc To: Bjorn Andersson , Konrad Dybcio , Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 3/8] dt-bindings: PCI: qcom: Add IPQ9574 PCIe controller Date: Tue, 30 Apr 2024 23:07:45 -0500 Message-Id: <20240501040800.1542805-4-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 IPQ9574 has PCIe controllers which are almost identical to IPQ6018. The difference is that the "iface" clock is replaced by the "snoc", and "anoc". The "sleep" reset is replaced by an "aux" reset. Document these differences along with the compatible string. Signed-off-by: Alexandru Gagniuc Acked-by: Rob Herring (Arm) --- .../devicetree/bindings/pci/qcom,pcie.yaml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie.yaml index cf9a6910b542..ac6d2b1b8702 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.yaml +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.yaml @@ -26,6 +26,7 @@ properties: - qcom,pcie-ipq8064-v2 - qcom,pcie-ipq8074 - qcom,pcie-ipq8074-gen3 + - qcom,pcie-ipq9574 - qcom,pcie-msm8996 - qcom,pcie-qcs404 - qcom,pcie-sdm845 @@ -161,6 +162,7 @@ allOf: enum: - qcom,pcie-ipq6018 - qcom,pcie-ipq8074-gen3 + - qcom,pcie-ipq9574 then: properties: reg: @@ -397,6 +399,39 @@ allOf: - const: axi_m_sticky # AXI Master Sticky reset - const: axi_s_sticky # AXI Slave Sticky reset + - if: + properties: + compatible: + contains: + enum: + - qcom,pcie-ipq9574 + then: + properties: + clocks: + minItems: 4 + maxItems: 4 + clock-names: + items: + - const: axi_m # AXI Master clock + - const: axi_s # AXI Slave clock + - const: axi_bridge # AXI bridge clock + - const: anoc + - const: snoc + - const: rchng + resets: + minItems: 8 + maxItems: 8 + reset-names: + items: + - const: pipe # PIPE reset + - const: aux # AUX reset + - const: sticky # Core Sticky reset + - const: axi_m # AXI Master reset + - const: axi_s # AXI Slave reset + - const: axi_s_sticky # AXI Slave Sticky reset + - const: axi_m_sticky # AXI Master Sticky reset + - const: ahb # AHB Reset + - if: properties: compatible: @@ -507,6 +542,7 @@ allOf: - qcom,pcie-ipq8064v2 - qcom,pcie-ipq8074 - qcom,pcie-ipq8074-gen3 + - qcom,pcie-ipq9574 - qcom,pcie-qcs404 then: required: @@ -566,6 +602,7 @@ allOf: - qcom,pcie-ipq8064-v2 - qcom,pcie-ipq8074 - qcom,pcie-ipq8074-gen3 + - qcom,pcie-ipq9574 - qcom,pcie-qcs404 then: properties: From patchwork Wed May 1 04:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650166 Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48F644596F; Wed, 1 May 2024 04:08:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536492; cv=none; b=JnmF2kbNlYYdRUFFt8AZU6uLgpcJBGYA6ULgYc2cPndpNGKXbxu9QFFo7xeJ8VQXzZMIKoHk5WFhufn0OfrL+68DtFLba31gXwptg7X0uht+OsEwNOA1vv+qC+B8O8jdjjY7XXAmWJ6lKegsl8PNhwt36LgSapsult9pZkneBSc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536492; c=relaxed/simple; bh=q/n7/c+QbGO75Lsgh28Q9qhp+mrAJbfJBpNBP1WUkQ8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vFECc3MQ3LmJYIghCz/57eP7MDz4yS5NbbJlUxS8zOK6LjJCiZLLEk24VxJwnAUgsLOqmrHxjzc3VzGeVHfCHSKONGJ9gZExMK3D6+D+9zLA/IwIaXMSFamaLPoowviqPYZRLTqdXDIWpXf27ti8trsZ3YHhXVCPKJ87kNVlVbw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GLTIPTY0; arc=none smtp.client-ip=209.85.167.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GLTIPTY0" Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3c74b643aebso3805049b6e.0; Tue, 30 Apr 2024 21:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536489; x=1715141289; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rKfzhKYKdzfcfGJdATuhwe4qCNYS9PL4DLkhaYC5y3s=; b=GLTIPTY0Hq1pWXnypyihlap6eKW7ljBXZcbnJajrEE0UMNxDFIf3K6sumgzcJGMRY2 PGcM0B93V/7SM6CAyyZAAyIb3knLUOMEq7E8EugSRvTUn2w83jR6a8KVjPqmAI8sn+3g /x2nAerIt0BNnp2eC5QrN3ja4Z9El/ldBrI7+WxsiFHbJ3LndYR8sS3FS1Jt3+sOQ69/ DWVGomdipebJkhoJHKHblnC8UiJ2Wh+Pq6veQQyjTK3Q1IDuiRjKtZv/Vwgy73x4yAL4 pFll/cpPzykymPjYweNo+hvRiGgBTTjnYels3/PcwHHcKrh0eQylEUurbvz2TXjqJNqD BtHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536489; x=1715141289; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rKfzhKYKdzfcfGJdATuhwe4qCNYS9PL4DLkhaYC5y3s=; b=n+65mTkijXY7VRp05hwE7i/oKLchxr6XceNgK65fl580nBYIioCHUKBL49yxB6PFU/ p7dfjGiQlMx0zb0at5cXk0Aye2lI3lOLh8v4TVRcMERrQbTGsNRbKXEP90YF6KS8UJ7E XGvX9ocvbTNlzYq0b1pzUiU0s2+tLx9suSNCiSJKWEoRNoxSO1hrz/nKXDSxypVRj5IP iULdqiBGp8B19fMHLayLYmvCCPd9G9FGMZdJN+d9AO8X/Y2DyNe8MD4fdr+XM3Cuwu6Q z4Dv5+d4MOq5y5rYXA8Eq2DTi76PsJuGhYTWfBdRJD7k2gJYBXSSymm8PNA3folDNyRS fz+A== X-Forwarded-Encrypted: i=1; AJvYcCX+JMqfeaYbLTWv1uJoic4oMJDLMALbsimts42ujGfJ3c8MHxqxYfL+SODO0+HNht0tRitG5Lx66890YgMut/QFpOe3ZZ9X2zXVg1E+Av3XK3hr0yWJ3TQyHtS0A2vrVPsQoXhFA2LzXQ== X-Gm-Message-State: AOJu0YxmO7gKKY2RWYS023pCfeJZDRgaweHebtE+IXxQN6WmCLJZIGNH 8T74Aw6O5xpSqr9t5atvoKFPXPNwp5atfvsXb30ZTMJPn0x7gk3u X-Google-Smtp-Source: AGHT+IHhb4n32OpjOv3XR6FHqiHxm6BXcmLCYIZ5hupKrkDUI/unZnOrBPNzjlAFDWnwTmmk31JHng== X-Received: by 2002:a05:6808:6089:b0:3c5:dd52:fd6f with SMTP id de9-20020a056808608900b003c5dd52fd6fmr1651690oib.31.1714536489204; Tue, 30 Apr 2024 21:08:09 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:08 -0700 (PDT) From: Alexandru Gagniuc To: Manivannan Sadhasivam , Bjorn Andersson , Konrad Dybcio , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v4 4/8] PCI: qcom: Switch to devm_clk_bulk_get_all() API to get the clocks from Devicetree Date: Tue, 30 Apr 2024 23:07:46 -0500 Message-Id: <20240501040800.1542805-5-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Manivannan Sadhasivam There is no need for the device drivers to validate the clocks defined in Devicetree. The validation should be performed by the DT schema and the drivers should just get all the clocks from DT. Right now the driver hardcodes the clock info and validates them against DT which is redundant. So use devm_clk_bulk_get_all() that just gets all the clocks defined in DT and get rid of all static clocks info from the driver. This simplifies the driver. Signed-off-by: Manivannan Sadhasivam Signed-off-by: Alexandru Gagniuc [moved clks to struct qcom_pcie to reduce code duplication] --- drivers/pci/controller/dwc/pcie-qcom.c | 163 ++++--------------------- 1 file changed, 25 insertions(+), 138 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 14772edcf0d3..ea81ff68d433 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -154,58 +154,42 @@ #define QCOM_PCIE_LINK_SPEED_TO_BW(speed) \ Mbps_to_icc(PCIE_SPEED2MBS_ENC(pcie_link_speed[speed])) -#define QCOM_PCIE_1_0_0_MAX_CLOCKS 4 struct qcom_pcie_resources_1_0_0 { - struct clk_bulk_data clks[QCOM_PCIE_1_0_0_MAX_CLOCKS]; struct reset_control *core; struct regulator *vdda; }; -#define QCOM_PCIE_2_1_0_MAX_CLOCKS 5 #define QCOM_PCIE_2_1_0_MAX_RESETS 6 #define QCOM_PCIE_2_1_0_MAX_SUPPLY 3 struct qcom_pcie_resources_2_1_0 { - struct clk_bulk_data clks[QCOM_PCIE_2_1_0_MAX_CLOCKS]; struct reset_control_bulk_data resets[QCOM_PCIE_2_1_0_MAX_RESETS]; int num_resets; struct regulator_bulk_data supplies[QCOM_PCIE_2_1_0_MAX_SUPPLY]; }; -#define QCOM_PCIE_2_3_2_MAX_CLOCKS 4 #define QCOM_PCIE_2_3_2_MAX_SUPPLY 2 struct qcom_pcie_resources_2_3_2 { - struct clk_bulk_data clks[QCOM_PCIE_2_3_2_MAX_CLOCKS]; struct regulator_bulk_data supplies[QCOM_PCIE_2_3_2_MAX_SUPPLY]; }; -#define QCOM_PCIE_2_3_3_MAX_CLOCKS 5 #define QCOM_PCIE_2_3_3_MAX_RESETS 7 struct qcom_pcie_resources_2_3_3 { - struct clk_bulk_data clks[QCOM_PCIE_2_3_3_MAX_CLOCKS]; struct reset_control_bulk_data rst[QCOM_PCIE_2_3_3_MAX_RESETS]; }; -#define QCOM_PCIE_2_4_0_MAX_CLOCKS 4 #define QCOM_PCIE_2_4_0_MAX_RESETS 12 struct qcom_pcie_resources_2_4_0 { - struct clk_bulk_data clks[QCOM_PCIE_2_4_0_MAX_CLOCKS]; - int num_clks; struct reset_control_bulk_data resets[QCOM_PCIE_2_4_0_MAX_RESETS]; int num_resets; }; -#define QCOM_PCIE_2_7_0_MAX_CLOCKS 15 #define QCOM_PCIE_2_7_0_MAX_SUPPLIES 2 struct qcom_pcie_resources_2_7_0 { - struct clk_bulk_data clks[QCOM_PCIE_2_7_0_MAX_CLOCKS]; - int num_clks; struct regulator_bulk_data supplies[QCOM_PCIE_2_7_0_MAX_SUPPLIES]; struct reset_control *rst; }; -#define QCOM_PCIE_2_9_0_MAX_CLOCKS 5 struct qcom_pcie_resources_2_9_0 { - struct clk_bulk_data clks[QCOM_PCIE_2_9_0_MAX_CLOCKS]; struct reset_control *rst; }; @@ -247,6 +231,8 @@ struct qcom_pcie { struct icc_path *icc_mem; const struct qcom_pcie_cfg *cfg; struct dentry *debugfs; + struct clk_bulk_data *clks; + int num_clks; bool suspended; }; @@ -337,22 +323,6 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (ret) return ret; - res->clks[0].id = "iface"; - res->clks[1].id = "core"; - res->clks[2].id = "phy"; - res->clks[3].id = "aux"; - res->clks[4].id = "ref"; - - /* iface, core, phy are required */ - ret = devm_clk_bulk_get(dev, 3, res->clks); - if (ret < 0) - return ret; - - /* aux, ref are optional */ - ret = devm_clk_bulk_get_optional(dev, 2, res->clks + 3); - if (ret < 0) - return ret; - res->resets[0].id = "pci"; res->resets[1].id = "axi"; res->resets[2].id = "ahb"; @@ -373,7 +343,7 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); reset_control_bulk_assert(res->num_resets, res->resets); writel(1, pcie->parf + PARF_PHY_CTRL); @@ -413,7 +383,6 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *pcie) { - struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; struct device_node *node = dev->of_node; @@ -425,7 +394,7 @@ static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *pcie) val &= ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); - ret = clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret) return ret; @@ -476,21 +445,11 @@ static int qcom_pcie_get_resources_1_0_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_1_0_0 *res = &pcie->res.v1_0_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; - int ret; res->vdda = devm_regulator_get(dev, "vdda"); if (IS_ERR(res->vdda)) return PTR_ERR(res->vdda); - res->clks[0].id = "iface"; - res->clks[1].id = "aux"; - res->clks[2].id = "master_bus"; - res->clks[3].id = "slave_bus"; - - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); - if (ret < 0) - return ret; - res->core = devm_reset_control_get_exclusive(dev, "core"); return PTR_ERR_OR_ZERO(res->core); } @@ -500,7 +459,7 @@ static void qcom_pcie_deinit_1_0_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_1_0_0 *res = &pcie->res.v1_0_0; reset_control_assert(res->core); - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); regulator_disable(res->vdda); } @@ -517,7 +476,7 @@ static int qcom_pcie_init_1_0_0(struct qcom_pcie *pcie) return ret; } - ret = clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret) { dev_err(dev, "cannot prepare/enable clocks\n"); goto err_assert_reset; @@ -532,7 +491,7 @@ static int qcom_pcie_init_1_0_0(struct qcom_pcie *pcie) return 0; err_disable_clks: - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); err_assert_reset: reset_control_assert(res->core); @@ -580,15 +539,6 @@ static int qcom_pcie_get_resources_2_3_2(struct qcom_pcie *pcie) if (ret) return ret; - res->clks[0].id = "aux"; - res->clks[1].id = "cfg"; - res->clks[2].id = "bus_master"; - res->clks[3].id = "bus_slave"; - - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); - if (ret < 0) - return ret; - return 0; } @@ -596,7 +546,7 @@ static void qcom_pcie_deinit_2_3_2(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_3_2 *res = &pcie->res.v2_3_2; - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); } @@ -613,7 +563,7 @@ static int qcom_pcie_init_2_3_2(struct qcom_pcie *pcie) return ret; } - ret = clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret) { dev_err(dev, "cannot prepare/enable clocks\n"); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); @@ -661,18 +611,6 @@ static int qcom_pcie_get_resources_2_4_0(struct qcom_pcie *pcie) bool is_ipq = of_device_is_compatible(dev->of_node, "qcom,pcie-ipq4019"); int ret; - res->clks[0].id = "aux"; - res->clks[1].id = "master_bus"; - res->clks[2].id = "slave_bus"; - res->clks[3].id = "iface"; - - /* qcom,pcie-ipq4019 is defined without "iface" */ - res->num_clks = is_ipq ? 3 : 4; - - ret = devm_clk_bulk_get(dev, res->num_clks, res->clks); - if (ret < 0) - return ret; - res->resets[0].id = "axi_m"; res->resets[1].id = "axi_s"; res->resets[2].id = "axi_m_sticky"; @@ -700,7 +638,7 @@ static void qcom_pcie_deinit_2_4_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_4_0 *res = &pcie->res.v2_4_0; reset_control_bulk_assert(res->num_resets, res->resets); - clk_bulk_disable_unprepare(res->num_clks, res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); } static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie) @@ -726,7 +664,7 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie) usleep_range(10000, 12000); - ret = clk_bulk_prepare_enable(res->num_clks, res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret) { reset_control_bulk_assert(res->num_resets, res->resets); return ret; @@ -742,16 +680,6 @@ static int qcom_pcie_get_resources_2_3_3(struct qcom_pcie *pcie) struct device *dev = pci->dev; int ret; - res->clks[0].id = "iface"; - res->clks[1].id = "axi_m"; - res->clks[2].id = "axi_s"; - res->clks[3].id = "ahb"; - res->clks[4].id = "aux"; - - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); - if (ret < 0) - return ret; - res->rst[0].id = "axi_m"; res->rst[1].id = "axi_s"; res->rst[2].id = "pipe"; @@ -769,9 +697,7 @@ static int qcom_pcie_get_resources_2_3_3(struct qcom_pcie *pcie) static void qcom_pcie_deinit_2_3_3(struct qcom_pcie *pcie) { - struct qcom_pcie_resources_2_3_3 *res = &pcie->res.v2_3_3; - - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); } static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie) @@ -801,7 +727,7 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie) */ usleep_range(2000, 2500); - ret = clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret) { dev_err(dev, "cannot prepare/enable clocks\n"); goto err_assert_resets; @@ -862,8 +788,6 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; - unsigned int num_clks, num_opt_clks; - unsigned int idx; int ret; res->rst = devm_reset_control_array_get_exclusive(dev); @@ -877,37 +801,6 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) if (ret) return ret; - idx = 0; - res->clks[idx++].id = "aux"; - res->clks[idx++].id = "cfg"; - res->clks[idx++].id = "bus_master"; - res->clks[idx++].id = "bus_slave"; - res->clks[idx++].id = "slave_q2a"; - - num_clks = idx; - - ret = devm_clk_bulk_get(dev, num_clks, res->clks); - if (ret < 0) - return ret; - - res->clks[idx++].id = "tbu"; - res->clks[idx++].id = "ddrss_sf_tbu"; - res->clks[idx++].id = "aggre0"; - res->clks[idx++].id = "aggre1"; - res->clks[idx++].id = "noc_aggr"; - res->clks[idx++].id = "noc_aggr_4"; - res->clks[idx++].id = "noc_aggr_south_sf"; - res->clks[idx++].id = "cnoc_qx"; - res->clks[idx++].id = "sleep"; - res->clks[idx++].id = "cnoc_sf_axi"; - - num_opt_clks = idx - num_clks; - res->num_clks = idx; - - ret = devm_clk_bulk_get_optional(dev, num_opt_clks, res->clks + num_clks); - if (ret < 0) - return ret; - return 0; } @@ -925,7 +818,7 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) return ret; } - ret = clk_bulk_prepare_enable(res->num_clks, res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret < 0) goto err_disable_regulators; @@ -977,7 +870,7 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) return 0; err_disable_clocks: - clk_bulk_disable_unprepare(res->num_clks, res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); err_disable_regulators: regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); @@ -1015,7 +908,7 @@ static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0; - clk_bulk_disable_unprepare(res->num_clks, res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); } @@ -1101,17 +994,6 @@ static int qcom_pcie_get_resources_2_9_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_9_0 *res = &pcie->res.v2_9_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; - int ret; - - res->clks[0].id = "iface"; - res->clks[1].id = "axi_m"; - res->clks[2].id = "axi_s"; - res->clks[3].id = "axi_bridge"; - res->clks[4].id = "rchng"; - - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); - if (ret < 0) - return ret; res->rst = devm_reset_control_array_get_exclusive(dev); if (IS_ERR(res->rst)) @@ -1122,9 +1004,7 @@ static int qcom_pcie_get_resources_2_9_0(struct qcom_pcie *pcie) static void qcom_pcie_deinit_2_9_0(struct qcom_pcie *pcie) { - struct qcom_pcie_resources_2_9_0 *res = &pcie->res.v2_9_0; - - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); } static int qcom_pcie_init_2_9_0(struct qcom_pcie *pcie) @@ -1153,7 +1033,7 @@ static int qcom_pcie_init_2_9_0(struct qcom_pcie *pcie) usleep_range(2000, 2500); - return clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + return clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); } static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie) @@ -1561,6 +1441,13 @@ static int qcom_pcie_probe(struct platform_device *pdev) goto err_pm_runtime_put; } + pcie->num_clks = devm_clk_bulk_get_all(dev, &pcie->clks); + if (pcie->num_clks < 0) { + ret = pcie->num_clks; + dev_err(dev, "Failed to get clocks\n"); + goto err_pm_runtime_put; + } + ret = qcom_pcie_icc_init(pcie); if (ret) goto err_pm_runtime_put; From patchwork Wed May 1 04:07:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650167 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 027F547A62; Wed, 1 May 2024 04:08:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536493; cv=none; b=LQqplOL0AM6azzb6EyffmQGNO7upaDDZQ5TQH4OQnWgNO1buNnbEuw6euamCUso1xvu06mM/+fJey6I8ALCF6W+uHMnT35AHNXuZ8lPRg9cYnjonFiqCzTpmsCNedWSOZNFO7WxUp5/vpVLTzL64HMhJIl/95nv7nyqrAwjSqEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536493; c=relaxed/simple; bh=2cKONyUhvqsDbdbaoKbjY2AvnOp4SE0Z8KCFA6jaKJI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qw3RJCyoEtUNt6RaQc5SbTj9mF5imFiRWj17p3O/T25i05k9VXUaAw7vAmlfdjrkYQZOYfEKZ8BBOK41xdrTXNMrbJmZT8nigLLrFms99Z6RWm6Rkz+3rKXKtwL0JMdJJbfYVm5uXipcC41EMQ2I4DLxeSRaWA3svTe1rwVFHg0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XqnpAGDR; arc=none smtp.client-ip=209.85.167.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XqnpAGDR" Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3c7513a991cso4345180b6e.1; Tue, 30 Apr 2024 21:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536491; x=1715141291; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SI71NoupknAET1jl5DuELYiP8ivpPOCBg6fYut4RUIg=; b=XqnpAGDRNHbXKbPJJSilIy+sOtTlD8kQtWYsSlzUgjFOnrh28qSQah6cThcb2FheXI 9eyBJo8QtRdg/kQ4Sv5Uvz8gTd2297GG1FSQz9Lny5SmrCRNN74G/S7MgVAG9k0StXfr bhA8BNjBfE3bRwdA4X905JY4554UhaVzDfAs45QJRVbwnEyoGML6K3BTPghmxcl3JXTx Evc+XJR3KXosZedpZOtu6+nw2pN0FKtjf4h34kwCq2oP8XbvKI4aSrV34rMH350kOPg5 tUrocuKpVSXATO348ZTe+N39F4qoObJ+U36DltZA7jTrNWgfn6Nt/tbhif5HntUok5Sp O9Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536491; x=1715141291; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SI71NoupknAET1jl5DuELYiP8ivpPOCBg6fYut4RUIg=; b=mX8QHka32BhMQJa+ViHbqpKQZq8BH+aG8E78q19jG+14bC5mekGtP9VVkLTlsOD1O4 QwGNr8w3f81kjNtxRQOV008hNjsz63bitZieDoReSmWO+5AFhjJ9Uqw9pkHj6+1Guy5l Ckgia4xFfSpu2brhmZKcDJ4Nh2aSD2UjASqw6XMhBdbR1MaGlYW4Ys79C2atkm1dUSwS a8en5FI21zxxe60cXnVqNzMsiMGmsmWyhG8WygNSvidzjJclKLUdu8nK3vr0kkMrNXnt DMm2FI1AClj79OAbgdtBaLZQ2H7to6KIsbtEIg0E1faiBsslqSpgsUF0LHsgWCBr4iIg 747A== X-Forwarded-Encrypted: i=1; AJvYcCXzhOYLpHFPnGbcMIRaJ2EaJItYjPARiaOj4R3ygusvQTgGv8nIRcrljhVNbl8hIshaDKNDTJiJtj5VkUpfl3JL4ciquxqLyTZeQQXoDmmjBfZoYnLrDbo2uTePczvRIylGbs3jBZsFMQ== X-Gm-Message-State: AOJu0YwQ49WXPQmHBt/49nsB1B2uirDu1fmQ1/PuuOSR5Wo2UolgKwRf g4SvjfiY9cLvR+l5zsvy4wxIhTlCcLFKUUkpvd+WxYFhCoj5LtPp X-Google-Smtp-Source: AGHT+IGWkFSZCO+ZZ/YO1r4ABUoLVDbfdhiB69s9e2f41K99hiJkGkFuG2kvrL0k3rjMtPTuJWCe5w== X-Received: by 2002:a05:6808:1919:b0:3c8:4228:e6d4 with SMTP id bf25-20020a056808191900b003c84228e6d4mr1973871oib.9.1714536490966; Tue, 30 Apr 2024 21:08:10 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:10 -0700 (PDT) From: Alexandru Gagniuc To: Manivannan Sadhasivam , Bjorn Andersson , Konrad Dybcio , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v4 5/8] PCI: qcom: Add support for IPQ9574 Date: Tue, 30 Apr 2024 23:07:47 -0500 Message-Id: <20240501040800.1542805-6-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 IPQ9574 has four PCIe controllers: two single-lane Gen3, and two dual-lane Gen3. The controllers are identical from a software perspective, with the differences appearing in the PHYs. Add a compatible for the PCIe on IPQ9574. Signed-off-by: Alexandru Gagniuc --- drivers/pci/controller/dwc/pcie-qcom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index ea81ff68d433..e61888e6c63d 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1551,6 +1551,7 @@ static const struct of_device_id qcom_pcie_match[] = { { .compatible = "qcom,pcie-ipq8064-v2", .data = &cfg_2_1_0 }, { .compatible = "qcom,pcie-ipq8074", .data = &cfg_2_3_3 }, { .compatible = "qcom,pcie-ipq8074-gen3", .data = &cfg_2_9_0 }, + { .compatible = "qcom,pcie-ipq9574", .data = &cfg_2_9_0 }, { .compatible = "qcom,pcie-msm8996", .data = &cfg_2_3_2 }, { .compatible = "qcom,pcie-qcs404", .data = &cfg_2_4_0 }, { .compatible = "qcom,pcie-sa8540p", .data = &cfg_sc8280xp },