Aux and Ref clk are missing in PCIe qcom driver. Add support in the driver to fix PCIe initialization in ipq806x.
Fixes: 82a823833f4e PCI: qcom: Add Qualcomm PCIe controller driver Signed-off-by: Sham Muthayyan smuthayy@codeaurora.org Signed-off-by: Ansuel Smith ansuelsmth@gmail.com Cc: stable@vger.kernel.org # v4.5+ --- drivers/pci/controller/dwc/pcie-qcom.c | 44 ++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 5ea527a6bd9f..2a39dfdccfc8 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -88,6 +88,8 @@ struct qcom_pcie_resources_2_1_0 { struct clk *iface_clk; struct clk *core_clk; struct clk *phy_clk; + struct clk *aux_clk; + struct clk *ref_clk; struct reset_control *pci_reset; struct reset_control *axi_reset; struct reset_control *ahb_reset; @@ -246,6 +248,14 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (IS_ERR(res->phy_clk)) return PTR_ERR(res->phy_clk);
+ res->aux_clk = devm_clk_get_optional(dev, "aux"); + if (IS_ERR(res->aux_clk)) + return PTR_ERR(res->aux_clk); + + res->ref_clk = devm_clk_get_optional(dev, "ref"); + if (IS_ERR(res->ref_clk)) + return PTR_ERR(res->ref_clk); + res->pci_reset = devm_reset_control_get_exclusive(dev, "pci"); if (IS_ERR(res->pci_reset)) return PTR_ERR(res->pci_reset); @@ -278,6 +288,8 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->core_clk); clk_disable_unprepare(res->phy_clk); + clk_disable_unprepare(res->aux_clk); + clk_disable_unprepare(res->ref_clk); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); }
@@ -307,16 +319,32 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) goto err_assert_ahb; }
+ ret = clk_prepare_enable(res->core_clk); + if (ret) { + dev_err(dev, "cannot prepare/enable core clock\n"); + goto err_clk_core; + } + ret = clk_prepare_enable(res->phy_clk); if (ret) { dev_err(dev, "cannot prepare/enable phy clock\n"); goto err_clk_phy; }
- ret = clk_prepare_enable(res->core_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable core clock\n"); - goto err_clk_core; + if (res->aux_clk) { + ret = clk_prepare_enable(res->aux_clk); + if (ret) { + dev_err(dev, "cannot prepare/enable aux clock\n"); + goto err_clk_aux; + } + } + + if (res->ref_clk) { + ret = clk_prepare_enable(res->ref_clk); + if (ret) { + dev_err(dev, "cannot prepare/enable ref clock\n"); + goto err_clk_ref; + } }
ret = reset_control_deassert(res->ahb_reset); @@ -372,10 +400,14 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) return 0;
err_deassert_ahb: - clk_disable_unprepare(res->core_clk); -err_clk_core: + clk_disable_unprepare(res->ref_clk); +err_clk_ref: + clk_disable_unprepare(res->aux_clk); +err_clk_aux: clk_disable_unprepare(res->phy_clk); err_clk_phy: + clk_disable_unprepare(res->core_clk); +err_clk_core: clk_disable_unprepare(res->iface_clk); err_assert_ahb: regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
Hi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver").
The bot has tested the following trees: v5.6.8, v5.4.36, v4.19.119, v4.14.177, v4.9.220.
v5.6.8: Build OK! v5.4.36: Build OK! v4.19.119: Build failed! Errors: drivers/pci/controller/dwc/pcie-qcom.c:240:17: error: implicit declaration of function ‘devm_clk_get_optional’; did you mean ‘devm_gpiod_get_optional’? [-Werror=implicit-function-declaration]
v4.14.177: Failed to apply! Possible dependencies: 68e7c15ceb8d ("PCI: qcom: Use regulator bulk api for apq8064 supplies")
v4.9.220: Failed to apply! Possible dependencies: 11a61a860281 ("PCI: dwc: Use PTR_ERR_OR_ZERO to simplify code") 19ce01cc8cbc ("PCI: dwc: all: Rename cfg_read/cfg_write to read/write") 1d77040bde2d ("PCI: layerscape: Add LS1046a support") 1f6c4501c667 ("PCI: dra7xx: Group PHY API invocations") 244e00071fd8 ("PCI: qcom: Explicitly request exclusive reset control") 40f67fb2c384 ("PCI: dwc: designware: Get device pointer at the start of dw_pcie_host_init()") 442ec4c04d12 ("PCI: dwc: all: Split struct pcie_port into host-only and core structures") 5d0f1b84c526 ("PCI: qcom: Reorder to put v0 functions together, v1 functions together, etc") 9bcf0a6fdc50 ("PCI: dwc: all: Use platform_set_drvdata() to save private data") ab5fe4f4d31e ("PCI: dra7xx: Add support to force RC to work in GEN1 mode") d0491fc39bdd ("PCI: qcom: Add support for MSM8996 PCIe controller") e594233803aa ("PCI: layerscape: Remove redundant error message from ls_pcie_probe()") ebe85a44aad4 ("PCI: dra7xx: Enable MSI and legacy interrupts simultaneously")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
On Fri, May 01, 2020 at 12:06:08AM +0200, Ansuel Smith wrote:
Aux and Ref clk are missing in PCIe qcom driver. Add support in the driver to fix PCIe initialization in ipq806x.
Fixes: 82a823833f4e PCI: qcom: Add Qualcomm PCIe controller driver Signed-off-by: Sham Muthayyan smuthayy@codeaurora.org Signed-off-by: Ansuel Smith ansuelsmth@gmail.com Cc: stable@vger.kernel.org # v4.5+
Doesn't strike me as stable material. Looks like new h/w enablement.
drivers/pci/controller/dwc/pcie-qcom.c | 44 ++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 5ea527a6bd9f..2a39dfdccfc8 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -88,6 +88,8 @@ struct qcom_pcie_resources_2_1_0 { struct clk *iface_clk; struct clk *core_clk; struct clk *phy_clk;
- struct clk *aux_clk;
- struct clk *ref_clk; struct reset_control *pci_reset; struct reset_control *axi_reset; struct reset_control *ahb_reset;
@@ -246,6 +248,14 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (IS_ERR(res->phy_clk)) return PTR_ERR(res->phy_clk);
- res->aux_clk = devm_clk_get_optional(dev, "aux");
- if (IS_ERR(res->aux_clk))
return PTR_ERR(res->aux_clk);
- res->ref_clk = devm_clk_get_optional(dev, "ref");
- if (IS_ERR(res->ref_clk))
return PTR_ERR(res->ref_clk);
Seems like you'd want to report an error for ipq608x? Based on the commit msg, they aren't optional.
- res->pci_reset = devm_reset_control_get_exclusive(dev, "pci"); if (IS_ERR(res->pci_reset)) return PTR_ERR(res->pci_reset);
@@ -278,6 +288,8 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->core_clk); clk_disable_unprepare(res->phy_clk);
- clk_disable_unprepare(res->aux_clk);
- clk_disable_unprepare(res->ref_clk); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
} @@ -307,16 +319,32 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) goto err_assert_ahb; }
- ret = clk_prepare_enable(res->core_clk);
Perhaps use the bulk api.
- if (ret) {
dev_err(dev, "cannot prepare/enable core clock\n");
goto err_clk_core;
- }
- ret = clk_prepare_enable(res->phy_clk); if (ret) { dev_err(dev, "cannot prepare/enable phy clock\n"); goto err_clk_phy; }
- ret = clk_prepare_enable(res->core_clk);
- if (ret) {
dev_err(dev, "cannot prepare/enable core clock\n");
goto err_clk_core;
- if (res->aux_clk) {
ret = clk_prepare_enable(res->aux_clk);
if (ret) {
dev_err(dev, "cannot prepare/enable aux clock\n");
goto err_clk_aux;
}
- }
- if (res->ref_clk) {
ret = clk_prepare_enable(res->ref_clk);
if (ret) {
dev_err(dev, "cannot prepare/enable ref clock\n");
goto err_clk_ref;
}}
ret = reset_control_deassert(res->ahb_reset); @@ -372,10 +400,14 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) return 0; err_deassert_ahb:
- clk_disable_unprepare(res->core_clk);
-err_clk_core:
- clk_disable_unprepare(res->ref_clk);
+err_clk_ref:
- clk_disable_unprepare(res->aux_clk);
+err_clk_aux: clk_disable_unprepare(res->phy_clk); err_clk_phy:
- clk_disable_unprepare(res->core_clk);
+err_clk_core: clk_disable_unprepare(res->iface_clk); err_assert_ahb: regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); -- 2.25.1
Hi Ansuel,
On 5/1/20 1:06 AM, Ansuel Smith wrote:
Aux and Ref clk are missing in PCIe qcom driver. Add support in the driver to fix PCIe initialization in ipq806x.
Fixes: 82a823833f4e PCI: qcom: Add Qualcomm PCIe controller driver Signed-off-by: Sham Muthayyan smuthayy@codeaurora.org Signed-off-by: Ansuel Smith ansuelsmth@gmail.com Cc: stable@vger.kernel.org # v4.5+
drivers/pci/controller/dwc/pcie-qcom.c | 44 ++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 5ea527a6bd9f..2a39dfdccfc8 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -88,6 +88,8 @@ struct qcom_pcie_resources_2_1_0 { struct clk *iface_clk; struct clk *core_clk; struct clk *phy_clk;
- struct clk *aux_clk;
- struct clk *ref_clk; struct reset_control *pci_reset; struct reset_control *axi_reset; struct reset_control *ahb_reset;
@@ -246,6 +248,14 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (IS_ERR(res->phy_clk)) return PTR_ERR(res->phy_clk);
- res->aux_clk = devm_clk_get_optional(dev, "aux");
- if (IS_ERR(res->aux_clk))
return PTR_ERR(res->aux_clk);
- res->ref_clk = devm_clk_get_optional(dev, "ref");
- if (IS_ERR(res->ref_clk))
return PTR_ERR(res->ref_clk);
- res->pci_reset = devm_reset_control_get_exclusive(dev, "pci"); if (IS_ERR(res->pci_reset)) return PTR_ERR(res->pci_reset);
@@ -278,6 +288,8 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->core_clk); clk_disable_unprepare(res->phy_clk);
- clk_disable_unprepare(res->aux_clk);
- clk_disable_unprepare(res->ref_clk); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
} @@ -307,16 +319,32 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) goto err_assert_ahb; }
- ret = clk_prepare_enable(res->core_clk);
- if (ret) {
dev_err(dev, "cannot prepare/enable core clock\n");
goto err_clk_core;
- }
- ret = clk_prepare_enable(res->phy_clk); if (ret) { dev_err(dev, "cannot prepare/enable phy clock\n"); goto err_clk_phy; }
- ret = clk_prepare_enable(res->core_clk);
- if (ret) {
dev_err(dev, "cannot prepare/enable core clock\n");
goto err_clk_core;
- if (res->aux_clk) {
you don't need this check, clk_prepare_enable handles NULL
ret = clk_prepare_enable(res->aux_clk);
if (ret) {
dev_err(dev, "cannot prepare/enable aux clock\n");
goto err_clk_aux;
}
- }
- if (res->ref_clk) {
here too
ret = clk_prepare_enable(res->ref_clk);
if (ret) {
dev_err(dev, "cannot prepare/enable ref clock\n");
goto err_clk_ref;
}}
ret = reset_control_deassert(res->ahb_reset); @@ -372,10 +400,14 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) return 0; err_deassert_ahb:
- clk_disable_unprepare(res->core_clk);
-err_clk_core:
- clk_disable_unprepare(res->ref_clk);
+err_clk_ref:
- clk_disable_unprepare(res->aux_clk);
+err_clk_aux: clk_disable_unprepare(res->phy_clk); err_clk_phy:
- clk_disable_unprepare(res->core_clk);
+err_clk_core: clk_disable_unprepare(res->iface_clk); err_assert_ahb: regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
linux-stable-mirror@lists.linaro.org