Skip to content

Commit 4c69f68

Browse files
konradybcioshashim-quic
authored andcommitted
FROMLIST: PCI: qcom: reshuffle reset logic in 2_7_0 .init
At least on SC8280XP, if the PCIe reset is asserted, the corresponding AUX_CLK will be stuck at 'off'. This has not been an issue so far, since the reset is both left de-asserted by the previous boot stages and the driver only toggles it briefly in .init. As part of the upcoming suspend procedure however, the reset will be held asserted. Assert the reset (which may end up being a NOP in some cases) and de-assert it back *before* turning on the clocks in preparation for introducing RC powerdown and reinitialization. Link: https://lore.kernel.org/linux-pci/20240210-topic-8280_pcie-v2-0-1cef4b606883@linaro.org/ Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Signed-off-by: Krishna Chaitanya Chundru <krichai@qti.qualcomm.com>
1 parent 82f2b0b commit 4c69f68

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -944,27 +944,27 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie)
944944
return ret;
945945
}
946946

947-
ret = clk_bulk_prepare_enable(res->num_clks, res->clks);
948-
if (ret < 0)
949-
goto err_disable_regulators;
950-
947+
/* Assert the reset to hold the RC in a known state */
951948
ret = reset_control_assert(res->rst);
952949
if (ret) {
953950
dev_err(dev, "reset assert failed (%d)\n", ret);
954-
goto err_disable_clocks;
951+
goto err_disable_regulators;
955952
}
956-
957953
usleep_range(1000, 1500);
958954

955+
/* GCC_PCIE_n_AUX_CLK won't come up if the reset is asserted */
959956
ret = reset_control_deassert(res->rst);
960957
if (ret) {
961958
dev_err(dev, "reset deassert failed (%d)\n", ret);
962-
goto err_disable_clocks;
959+
goto err_disable_regulators;
963960
}
964-
965961
/* Wait for reset to complete, required on SM8450 */
966962
usleep_range(1000, 1500);
967963

964+
ret = clk_bulk_prepare_enable(res->num_clks, res->clks);
965+
if (ret < 0)
966+
goto err_disable_regulators;
967+
968968
/* configure PCIe to RC mode */
969969
writel(DEVICE_TYPE_RC, pcie->parf + PARF_DEVICE_TYPE);
970970

@@ -994,8 +994,6 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie)
994994
writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
995995

996996
return 0;
997-
err_disable_clocks:
998-
clk_bulk_disable_unprepare(res->num_clks, res->clks);
999997
err_disable_regulators:
1000998
regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
1001999

0 commit comments

Comments
 (0)