@@ -882,6 +882,31 @@ static int tegra_pcie_port_phy_power_on(struct tegra_pcie_port *port)
return 0;
}
+static int tegra_pcie_port_phy_enable(struct tegra_pcie *pcie)
+{
+ if (pcie->legacy_phy) {
+ if (pcie->phy)
+ err = phy_power_on(pcie->phy);
+ else
+ err = tegra_pcie_phy_enable(pcie);
+
+ if (err < 0)
+ dev_err(pcie->dev, "failed to power on PHY: %d\n", err);
+
+ return err;
+ }
+
+ list_for_each_entry(port, &pcie->ports, list) {
+ err = tegra_pcie_port_phy_power_on(port);
+ if (err < 0) {
+ dev_err(pcie->dev, "failed to power on PCIe port: %d\n",
+ err);
+ return err;
+ }
+ }
+ return 0;
+}
+
static int tegra_pcie_enable_controller(struct tegra_pcie *pcie)
{
const struct tegra_pcie_soc_data *soc = pcie->soc_data;
@@ -921,25 +946,9 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie)
afi_writel(pcie, value, AFI_FUSE);
}
- if (!pcie->legacy_phy) {
- list_for_each_entry(port, &pcie->ports, list) {
- err = tegra_pcie_port_phy_power_on(port);
- if (err < 0) {
- dev_err(pcie->dev,
- "failed to power on PCIe port: %d\n",
- err);
- return err;
- }
- }
- } else {
- if (!pcie->phy)
- err = tegra_pcie_phy_enable(pcie);
- else
- err = phy_power_on(pcie->phy);
-
- if (err < 0)
- dev_err(pcie->dev, "failed to power on PHY: %d\n", err);
- }
+ err = tegra_pcie_port_phy_enable(pcie);
+ if (err < 0)
+ return err;
/* take the PCIe interface module out of reset */
reset_control_deassert(pcie->pcie_xrst);