summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2022-05-24 16:42:25 -0500
committerBjorn Helgaas <bhelgaas@google.com>2022-05-24 16:42:25 -0500
commit979db15b4a7124a8a2c5198426d5aa9176b1fdc6 (patch)
tree6ab4d1b6fc9594cdddecf9bf98c0315100c37e6c /drivers/pci
parent8d8270069cfb3118076f9a49e60bed4daff29558 (diff)
parent1d565935e3b9ccc682631e0bc6e415a7f48295d9 (diff)
Merge branch 'remotes/lorenzo/pci/mediatek'
- Fix refcount leak in mtk_pcie_subsys_powerup() (Miaoqian Lin) - Reset PHY and MAC at probe time (AngeloGioacchino Del Regno) * remotes/lorenzo/pci/mediatek: PCI: mediatek-gen3: Assert resets to ensure expected init state PCI: mediatek: Fix refcount leak in mtk_pcie_subsys_powerup()
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/controller/pcie-mediatek-gen3.c8
-rw-r--r--drivers/pci/controller/pcie-mediatek.c1
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c
index 3e8d70bfabc6..5d9fd36b02d1 100644
--- a/drivers/pci/controller/pcie-mediatek-gen3.c
+++ b/drivers/pci/controller/pcie-mediatek-gen3.c
@@ -838,6 +838,14 @@ static int mtk_pcie_setup(struct mtk_gen3_pcie *pcie)
if (err)
return err;
+ /*
+ * The controller may have been left out of reset by the bootloader
+ * so make sure that we get a clean start by asserting resets here.
+ */
+ reset_control_assert(pcie->phy_reset);
+ reset_control_assert(pcie->mac_reset);
+ usleep_range(10, 20);
+
/* Don't touch the hardware registers before power up */
err = mtk_pcie_power_up(pcie);
if (err)
diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
index ddfbd4aebdec..be8bd919cb88 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
@@ -1008,6 +1008,7 @@ static int mtk_pcie_subsys_powerup(struct mtk_pcie *pcie)
"mediatek,generic-pciecfg");
if (cfg_node) {
pcie->cfg = syscon_node_to_regmap(cfg_node);
+ of_node_put(cfg_node);
if (IS_ERR(pcie->cfg))
return PTR_ERR(pcie->cfg);
}