@@ -81,15 +81,25 @@ static int tegra_reset_usb_controller(struct platform_device *pdev)
struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct tegra_ehci_hcd *tegra =
(struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv;
+ bool has_utmi_pad_registers = false;
+ dev_info(&pdev->dev, "%s-%d\n", __func__, __LINE__);
phy_np = of_parse_phandle(pdev->dev.of_node, "nvidia,phy", 0);
if (!phy_np)
return -ENOENT;
- if (!usb1_reset_attempted) {
- struct reset_control *usb1_reset;
+ if (of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers"))
+ has_utmi_pad_registers = true;
+
+ /* If we are usb1 and usb1 has been reset, then we are done */
+ if (usb1_reset_attempted && has_utmi_pad_registers)
+ goto out;
+ /* If we are not usb1 and usb1 has not been reset, then reset it now */
+ if (!usb1_reset_attempted && !has_utmi_pad_registers) {
+ struct reset_control *usb1_reset;
usb1_reset = of_reset_control_get(phy_np, "utmi-pads");
+
if (IS_ERR(usb1_reset)) {
dev_warn(&pdev->dev,
"can't get utmi-pads reset from the PHY\n");
@@ -99,18 +109,17 @@ static int tegra_reset_usb_controller(struct platform_device *pdev)
reset_control_assert(usb1_reset);
udelay(1);
reset_control_deassert(usb1_reset);
+ reset_control_put(usb1_reset);
}
-
- reset_control_put(usb1_reset);
- usb1_reset_attempted = true;
}
- if (!of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers")) {
- reset_control_assert(tegra->rst);
- udelay(1);
- reset_control_deassert(tegra->rst);
- }
+ reset_control_assert(tegra->rst);
+ udelay(1);
+ reset_control_deassert(tegra->rst);
+
+ usb1_reset_attempted = true;
+out:
of_node_put(phy_np);
return 0;