* [PATCH v3 0/2] PCI: qcom: fix PCIe support on sm8250 @ 2020-12-31 12:37 Dmitry Baryshkov 2020-12-31 12:37 ` [PATCH v3 1/2] dt-bindings: pci: qcom: Document ddrss_sf_tbu clock for sm8250 Dmitry Baryshkov 2020-12-31 12:37 ` [PATCH v3 2/2] PCI: qcom: add support for ddrss_sf_tbu clock Dmitry Baryshkov 0 siblings, 2 replies; 4+ messages in thread From: Dmitry Baryshkov @ 2020-12-31 12:37 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Rob Herring, Lorenzo Pieralisi Cc: linux-arm-msm, Manivannan Sadhasivam, linux-pci Some sm8250 platforms require additional clock to be enabled for PCIe to function. In case it is disabled, PCIe access will result in IOMMU timeouts. Add device tree binding and driver support for this clock. Changes since v2: - Split this clock handling from qcom_pcie_get_resources_2_7_0() - Change comment to point that the clock is required rather than optional Changes since v1: - Added Fixes: tags, as respective patches have hit the upstream Linux tree. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 1/2] dt-bindings: pci: qcom: Document ddrss_sf_tbu clock for sm8250 2020-12-31 12:37 [PATCH v3 0/2] PCI: qcom: fix PCIe support on sm8250 Dmitry Baryshkov @ 2020-12-31 12:37 ` Dmitry Baryshkov 2020-12-31 12:37 ` [PATCH v3 2/2] PCI: qcom: add support for ddrss_sf_tbu clock Dmitry Baryshkov 1 sibling, 0 replies; 4+ messages in thread From: Dmitry Baryshkov @ 2020-12-31 12:37 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Rob Herring, Lorenzo Pieralisi Cc: linux-arm-msm, Manivannan Sadhasivam, linux-pci On SM8250 additional clock is required for PCIe devices to access NOC. Document this clock in devicetree bindings. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Fixes: 458168247ccc ("dt-bindings: pci: qcom: Document PCIe bindings for SM8250 SoC") --- Documentation/devicetree/bindings/pci/qcom,pcie.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt b/Documentation/devicetree/bindings/pci/qcom,pcie.txt index 3b55310390a0..c87806f76a43 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.txt +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt @@ -142,6 +142,7 @@ - "bus_slave" Slave AXI clock - "slave_q2a" Slave Q2A clock - "tbu" PCIe TBU clock + - "ddrss_sf_tbu" PCIe SF TBU clock, required on sm8250 - "pipe" PIPE clock - resets: -- 2.29.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 2/2] PCI: qcom: add support for ddrss_sf_tbu clock 2020-12-31 12:37 [PATCH v3 0/2] PCI: qcom: fix PCIe support on sm8250 Dmitry Baryshkov 2020-12-31 12:37 ` [PATCH v3 1/2] dt-bindings: pci: qcom: Document ddrss_sf_tbu clock for sm8250 Dmitry Baryshkov @ 2020-12-31 12:37 ` Dmitry Baryshkov 2021-01-13 13:28 ` Manivannan Sadhasivam 1 sibling, 1 reply; 4+ messages in thread From: Dmitry Baryshkov @ 2020-12-31 12:37 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Rob Herring, Lorenzo Pieralisi Cc: linux-arm-msm, Manivannan Sadhasivam, linux-pci On SM8250 additional clock is required for PCIe devices to access NOC. Update PCIe controller driver to control this clock. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Fixes: e1dd639e374a ("PCI: qcom: Add SM8250 SoC support") --- drivers/pci/controller/dwc/pcie-qcom.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index affa2713bf80..84c5a0a897dd 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -159,8 +159,9 @@ struct qcom_pcie_resources_2_3_3 { struct reset_control *rst[7]; }; +#define QCOM_PCIE_2_7_0_MAX_CLOCKS 6 struct qcom_pcie_resources_2_7_0 { - struct clk_bulk_data clks[6]; + struct clk_bulk_data clks[QCOM_PCIE_2_7_0_MAX_CLOCKS + 1]; /* + 1 for sf_tbu */ struct regulator_bulk_data supplies[2]; struct reset_control *pci_reset; struct clk *pipe_clk; @@ -1153,7 +1154,7 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) res->clks[4].id = "slave_q2a"; res->clks[5].id = "tbu"; - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); + ret = devm_clk_bulk_get(dev, QCOM_PCIE_2_7_0_MAX_CLOCKS, res->clks); if (ret < 0) return ret; @@ -1161,6 +1162,22 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) return PTR_ERR_OR_ZERO(res->pipe_clk); } +static int qcom_pcie_get_resources_1_9_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; + int ret; + + ret = qcom_pcie_get_resources_2_7_0(pcie); + if (ret < 0) + return ret; + + /* Required clock for SM8250 */ + res->clks[6].clk = devm_clk_get_optional(dev, "ddrss_sf_tbu"); + return PTR_ERR_OR_ZERO(res->clks[6].clk); +} + static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0; @@ -1437,7 +1454,7 @@ static const struct qcom_pcie_ops ops_2_7_0 = { /* Qcom IP rev.: 1.9.0 */ static const struct qcom_pcie_ops ops_1_9_0 = { - .get_resources = qcom_pcie_get_resources_2_7_0, + .get_resources = qcom_pcie_get_resources_1_9_0, .init = qcom_pcie_init_2_7_0, .deinit = qcom_pcie_deinit_2_7_0, .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, -- 2.29.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 2/2] PCI: qcom: add support for ddrss_sf_tbu clock 2020-12-31 12:37 ` [PATCH v3 2/2] PCI: qcom: add support for ddrss_sf_tbu clock Dmitry Baryshkov @ 2021-01-13 13:28 ` Manivannan Sadhasivam 0 siblings, 0 replies; 4+ messages in thread From: Manivannan Sadhasivam @ 2021-01-13 13:28 UTC (permalink / raw) To: Dmitry Baryshkov Cc: Andy Gross, Bjorn Andersson, Rob Herring, Lorenzo Pieralisi, linux-arm-msm, linux-pci Hi Dmitry, On Thu, Dec 31, 2020 at 03:37:31PM +0300, Dmitry Baryshkov wrote: > On SM8250 additional clock is required for PCIe devices to access NOC. > Update PCIe controller driver to control this clock. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > Fixes: e1dd639e374a ("PCI: qcom: Add SM8250 SoC support") > --- > drivers/pci/controller/dwc/pcie-qcom.c | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index affa2713bf80..84c5a0a897dd 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -159,8 +159,9 @@ struct qcom_pcie_resources_2_3_3 { > struct reset_control *rst[7]; > }; > > +#define QCOM_PCIE_2_7_0_MAX_CLOCKS 6 > struct qcom_pcie_resources_2_7_0 { > - struct clk_bulk_data clks[6]; > + struct clk_bulk_data clks[QCOM_PCIE_2_7_0_MAX_CLOCKS + 1]; /* + 1 for sf_tbu */ > struct regulator_bulk_data supplies[2]; > struct reset_control *pci_reset; > struct clk *pipe_clk; > @@ -1153,7 +1154,7 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) > res->clks[4].id = "slave_q2a"; > res->clks[5].id = "tbu"; > > - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); > + ret = devm_clk_bulk_get(dev, QCOM_PCIE_2_7_0_MAX_CLOCKS, res->clks); > if (ret < 0) > return ret; > > @@ -1161,6 +1162,22 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) > return PTR_ERR_OR_ZERO(res->pipe_clk); > } > > +static int qcom_pcie_get_resources_1_9_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; > + int ret; > + > + ret = qcom_pcie_get_resources_2_7_0(pcie); > + if (ret < 0) > + return ret; > + > + /* Required clock for SM8250 */ Since you are using a dedicated ops for getting the resources, why can't you use a dedicated resource struct as "qcom_pcie_resources_1_9_0" and just use the total no of clocks as 7? Also as I mentioned in previous iteration, the "sf_tbu" clock is not optional. Thanks, Mani > + res->clks[6].clk = devm_clk_get_optional(dev, "ddrss_sf_tbu"); > + return PTR_ERR_OR_ZERO(res->clks[6].clk); > +} > + > static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) > { > struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0; > @@ -1437,7 +1454,7 @@ static const struct qcom_pcie_ops ops_2_7_0 = { > > /* Qcom IP rev.: 1.9.0 */ > static const struct qcom_pcie_ops ops_1_9_0 = { > - .get_resources = qcom_pcie_get_resources_2_7_0, > + .get_resources = qcom_pcie_get_resources_1_9_0, > .init = qcom_pcie_init_2_7_0, > .deinit = qcom_pcie_deinit_2_7_0, > .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, > -- > 2.29.2 > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-13 13:29 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-12-31 12:37 [PATCH v3 0/2] PCI: qcom: fix PCIe support on sm8250 Dmitry Baryshkov 2020-12-31 12:37 ` [PATCH v3 1/2] dt-bindings: pci: qcom: Document ddrss_sf_tbu clock for sm8250 Dmitry Baryshkov 2020-12-31 12:37 ` [PATCH v3 2/2] PCI: qcom: add support for ddrss_sf_tbu clock Dmitry Baryshkov 2021-01-13 13:28 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).