kernel: bump 5.4 to 5.4.73
[openwrt/openwrt.git] / target / linux / ipq806x / patches-5.4 / 096-PCI-qcom-Make-sure-PCIe-is-reset-before-init-for-rev.patch
1 From 1960d75e3251659be8276529e4d01cf6993d9f4a Mon Sep 17 00:00:00 2001
2 From: Ansuel Smith <ansuelsmth@gmail.com>
3 Date: Tue, 1 Sep 2020 14:21:44 +0200
4 Subject: [PATCH] PCI: qcom: Make sure PCIe is reset before init for rev 2.1.0
5
6 Qsdk U-Boot can incorrectly leave the PCIe interface in an undefined
7 state if bootm command is used instead of bootipq. This is caused by the
8 not deinit of PCIe when bootm is called. Reset the PCIe before init
9 anyway to fix this U-Boot bug.
10
11 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
12 Fixes: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver")
13 Cc: stable@vger.kernel.org # v4.19+
14 ---
15 drivers/pci/controller/dwc/pcie-qcom.c | 13 +++++++++++++
16 1 file changed, 13 insertions(+)
17
18 --- a/drivers/pci/controller/dwc/pcie-qcom.c
19 +++ b/drivers/pci/controller/dwc/pcie-qcom.c
20 @@ -296,6 +296,9 @@ static void qcom_pcie_deinit_2_1_0(struc
21 reset_control_assert(res->por_reset);
22 reset_control_assert(res->ext_reset);
23 reset_control_assert(res->phy_reset);
24 +
25 + writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL);
26 +
27 regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
28 }
29
30 @@ -308,6 +311,16 @@ static int qcom_pcie_init_2_1_0(struct q
31 u32 val;
32 int ret;
33
34 + /* reset the PCIe interface as uboot can leave it undefined state */
35 + reset_control_assert(res->pci_reset);
36 + reset_control_assert(res->axi_reset);
37 + reset_control_assert(res->ahb_reset);
38 + reset_control_assert(res->por_reset);
39 + reset_control_assert(res->ext_reset);
40 + reset_control_assert(res->phy_reset);
41 +
42 + writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL);
43 +
44 ret = regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies);
45 if (ret < 0) {
46 dev_err(dev, "cannot enable regulators\n");