Skip to content

Commit 8b6f033

Browse files
AnsuelLorenzo Pieralisi
authored andcommitted
PCI: qcom: Add missing ipq806x clocks in PCIe driver
Aux and Ref clk are missing in PCIe qcom driver. Add support for this optional clks for ipq8064/apq8064 SoC. Link: https://lore.kernel.org/r/[email protected] Fixes: 82a8238 ("PCI: qcom: Add Qualcomm PCIe controller driver") Signed-off-by: Sham Muthayyan <[email protected]> Signed-off-by: Ansuel Smith <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Rob Herring <[email protected]> Acked-by: Stanimir Varbanov <[email protected]>
1 parent b3a9e3b commit 8b6f033

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

drivers/pci/controller/dwc/pcie-qcom.c

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ struct qcom_pcie_resources_2_1_0 {
8888
struct clk *iface_clk;
8989
struct clk *core_clk;
9090
struct clk *phy_clk;
91+
struct clk *aux_clk;
92+
struct clk *ref_clk;
9193
struct reset_control *pci_reset;
9294
struct reset_control *axi_reset;
9395
struct reset_control *ahb_reset;
@@ -246,6 +248,14 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie)
246248
if (IS_ERR(res->phy_clk))
247249
return PTR_ERR(res->phy_clk);
248250

251+
res->aux_clk = devm_clk_get_optional(dev, "aux");
252+
if (IS_ERR(res->aux_clk))
253+
return PTR_ERR(res->aux_clk);
254+
255+
res->ref_clk = devm_clk_get_optional(dev, "ref");
256+
if (IS_ERR(res->ref_clk))
257+
return PTR_ERR(res->ref_clk);
258+
249259
res->pci_reset = devm_reset_control_get_exclusive(dev, "pci");
250260
if (IS_ERR(res->pci_reset))
251261
return PTR_ERR(res->pci_reset);
@@ -278,6 +288,8 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie)
278288
clk_disable_unprepare(res->iface_clk);
279289
clk_disable_unprepare(res->core_clk);
280290
clk_disable_unprepare(res->phy_clk);
291+
clk_disable_unprepare(res->aux_clk);
292+
clk_disable_unprepare(res->ref_clk);
281293
regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
282294
}
283295

@@ -307,16 +319,28 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
307319
goto err_assert_ahb;
308320
}
309321

322+
ret = clk_prepare_enable(res->core_clk);
323+
if (ret) {
324+
dev_err(dev, "cannot prepare/enable core clock\n");
325+
goto err_clk_core;
326+
}
327+
310328
ret = clk_prepare_enable(res->phy_clk);
311329
if (ret) {
312330
dev_err(dev, "cannot prepare/enable phy clock\n");
313331
goto err_clk_phy;
314332
}
315333

316-
ret = clk_prepare_enable(res->core_clk);
334+
ret = clk_prepare_enable(res->aux_clk);
317335
if (ret) {
318-
dev_err(dev, "cannot prepare/enable core clock\n");
319-
goto err_clk_core;
336+
dev_err(dev, "cannot prepare/enable aux clock\n");
337+
goto err_clk_aux;
338+
}
339+
340+
ret = clk_prepare_enable(res->ref_clk);
341+
if (ret) {
342+
dev_err(dev, "cannot prepare/enable ref clock\n");
343+
goto err_clk_ref;
320344
}
321345

322346
ret = reset_control_deassert(res->ahb_reset);
@@ -372,10 +396,14 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
372396
return 0;
373397

374398
err_deassert_ahb:
375-
clk_disable_unprepare(res->core_clk);
376-
err_clk_core:
399+
clk_disable_unprepare(res->ref_clk);
400+
err_clk_ref:
401+
clk_disable_unprepare(res->aux_clk);
402+
err_clk_aux:
377403
clk_disable_unprepare(res->phy_clk);
378404
err_clk_phy:
405+
clk_disable_unprepare(res->core_clk);
406+
err_clk_core:
379407
clk_disable_unprepare(res->iface_clk);
380408
err_assert_ahb:
381409
regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);

0 commit comments

Comments
 (0)