Commit 6351653f authored by Nagarjuna Kristam's avatar Nagarjuna Kristam Committed by Greg Kroah-Hartman

usb: host: xhci-tegra: Correct phy enable sequence

XUSB phy needs to be enabled before un-powergating the power partitions.
However in the current sequence, it happens opposite. Correct the phy
enable and powergating partition sequence to avoid any boot hangs.
Signed-off-by: default avatarNagarjuna Kristam <nkristam@nvidia.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarJui Chang Kuo <jckuo@nvidia.com>
Tested-by: default avatarJon Hunter <jonathanh@nvidia.com>
Acked-by: default avatarThierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/1572859470-7823-1-git-send-email-nkristam@nvidia.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b38bcc8e
...@@ -763,7 +763,6 @@ static int tegra_xusb_runtime_suspend(struct device *dev) ...@@ -763,7 +763,6 @@ static int tegra_xusb_runtime_suspend(struct device *dev)
{ {
struct tegra_xusb *tegra = dev_get_drvdata(dev); struct tegra_xusb *tegra = dev_get_drvdata(dev);
tegra_xusb_phy_disable(tegra);
regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies); regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
tegra_xusb_clk_disable(tegra); tegra_xusb_clk_disable(tegra);
...@@ -787,16 +786,8 @@ static int tegra_xusb_runtime_resume(struct device *dev) ...@@ -787,16 +786,8 @@ static int tegra_xusb_runtime_resume(struct device *dev)
goto disable_clk; goto disable_clk;
} }
err = tegra_xusb_phy_enable(tegra);
if (err < 0) {
dev_err(dev, "failed to enable PHYs: %d\n", err);
goto disable_regulator;
}
return 0; return 0;
disable_regulator:
regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
disable_clk: disable_clk:
tegra_xusb_clk_disable(tegra); tegra_xusb_clk_disable(tegra);
return err; return err;
...@@ -1188,6 +1179,12 @@ static int tegra_xusb_probe(struct platform_device *pdev) ...@@ -1188,6 +1179,12 @@ static int tegra_xusb_probe(struct platform_device *pdev)
*/ */
platform_set_drvdata(pdev, tegra); platform_set_drvdata(pdev, tegra);
err = tegra_xusb_phy_enable(tegra);
if (err < 0) {
dev_err(&pdev->dev, "failed to enable PHYs: %d\n", err);
goto put_hcd;
}
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
if (pm_runtime_enabled(&pdev->dev)) if (pm_runtime_enabled(&pdev->dev))
err = pm_runtime_get_sync(&pdev->dev); err = pm_runtime_get_sync(&pdev->dev);
...@@ -1196,7 +1193,7 @@ static int tegra_xusb_probe(struct platform_device *pdev) ...@@ -1196,7 +1193,7 @@ static int tegra_xusb_probe(struct platform_device *pdev)
if (err < 0) { if (err < 0) {
dev_err(&pdev->dev, "failed to enable device: %d\n", err); dev_err(&pdev->dev, "failed to enable device: %d\n", err);
goto disable_rpm; goto disable_phy;
} }
tegra_xusb_config(tegra, regs); tegra_xusb_config(tegra, regs);
...@@ -1282,9 +1279,11 @@ static int tegra_xusb_probe(struct platform_device *pdev) ...@@ -1282,9 +1279,11 @@ static int tegra_xusb_probe(struct platform_device *pdev)
put_rpm: put_rpm:
if (!pm_runtime_status_suspended(&pdev->dev)) if (!pm_runtime_status_suspended(&pdev->dev))
tegra_xusb_runtime_suspend(&pdev->dev); tegra_xusb_runtime_suspend(&pdev->dev);
disable_rpm: put_hcd:
pm_runtime_disable(&pdev->dev);
usb_put_hcd(tegra->hcd); usb_put_hcd(tegra->hcd);
disable_phy:
tegra_xusb_phy_disable(tegra);
pm_runtime_disable(&pdev->dev);
put_powerdomains: put_powerdomains:
if (!of_property_read_bool(pdev->dev.of_node, "power-domains")) { if (!of_property_read_bool(pdev->dev.of_node, "power-domains")) {
tegra_powergate_power_off(TEGRA_POWERGATE_XUSBC); tegra_powergate_power_off(TEGRA_POWERGATE_XUSBC);
...@@ -1321,6 +1320,8 @@ static int tegra_xusb_remove(struct platform_device *pdev) ...@@ -1321,6 +1320,8 @@ static int tegra_xusb_remove(struct platform_device *pdev)
tegra_xusb_powerdomain_remove(&pdev->dev, tegra); tegra_xusb_powerdomain_remove(&pdev->dev, tegra);
} }
tegra_xusb_phy_disable(tegra);
tegra_xusb_padctl_put(tegra->padctl); tegra_xusb_padctl_put(tegra->padctl);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment