Skip to content

Commit

Permalink
PCI: mediatek-gen3: Assert resets to ensure expected init state
Browse files Browse the repository at this point in the history
[ Upstream commit 1d56593 ]

The controller may have been left out of reset by the bootloader,
in which case, before the powerup sequence, the controller will be
found preconfigured with values that were set before booting the
kernel: this produces a controller failure, with the result of
a failure during the mtk_pcie_startup_port() sequence as the PCIe
link never gets up.

To ensure that we get a clean start in an expected state, assert
both the PHY and MAC resets before executing the controller
power-up sequence.

Link: https://lore.kernel.org/r/[email protected]
Fixes: d3bf75b ("PCI: mediatek-gen3: Add MediaTek Gen3 driver for MT8192")
Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Lorenzo Pieralisi <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
AngeloGioacchino Del Regno authored and gregkh committed Jun 9, 2022
1 parent cae9356 commit 8c90701
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/pci/controller/pcie-mediatek-gen3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8c90701

Please sign in to comment.