static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
{
- int err;
+ int err = 0;
if (phy->powered_on)
return 0;
- if (phy->is_ulpi_phy)
- err = ulpi_phy_power_on(phy);
- else
+ switch (phy->phy_type) {
+ case USBPHY_INTERFACE_MODE_UTMI:
err = utmi_phy_power_on(phy);
+ break;
+
+ case USBPHY_INTERFACE_MODE_ULPI:
+ err = ulpi_phy_power_on(phy);
+ break;
+
+ default:
+ break;
+ }
+
if (err)
return err;
static int tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
{
- int err;
+ int err = 0;
if (!phy->powered_on)
return 0;
- if (phy->is_ulpi_phy)
- err = ulpi_phy_power_off(phy);
- else
+ switch (phy->phy_type) {
+ case USBPHY_INTERFACE_MODE_UTMI:
err = utmi_phy_power_off(phy);
+ break;
+
+ case USBPHY_INTERFACE_MODE_ULPI:
+ err = ulpi_phy_power_off(phy);
+ break;
+
+ default:
+ break;
+ }
+
if (err)
return err;
usb_phy_set_wakeup(u_phy, false);
tegra_usb_phy_power_off(phy);
- if (!phy->is_ulpi_phy)
+ if (phy->phy_type == USBPHY_INTERFACE_MODE_UTMI)
utmip_pad_close(phy);
regulator_disable(phy->vbus);
goto disable_clk;
}
- if (!phy->is_ulpi_phy) {
+ if (phy->phy_type == USBPHY_INTERFACE_MODE_UTMI) {
err = utmip_pad_open(phy);
if (err)
goto disable_vbus;
return 0;
close_phy:
- if (!phy->is_ulpi_phy)
+ if (phy->phy_type == USBPHY_INTERFACE_MODE_UTMI)
utmip_pad_close(phy);
disable_vbus:
struct resource *res;
int err;
- tegra_phy->is_ulpi_phy = false;
-
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (!res) {
dev_err(&pdev->dev, "Failed to get UTMI pad regs\n");
{
struct device_node *np = pdev->dev.of_node;
struct tegra_usb_phy *tegra_phy;
- enum usb_phy_interface phy_type;
struct reset_control *reset;
struct gpio_desc *gpiod;
struct resource *res;
return err;
}
- phy_type = of_usb_get_phy_mode(np);
- switch (phy_type) {
+ tegra_phy->phy_type = of_usb_get_phy_mode(np);
+ switch (tegra_phy->phy_type) {
case USBPHY_INTERFACE_MODE_UTMI:
err = utmi_phy_probe(tegra_phy, pdev);
if (err)
break;
case USBPHY_INTERFACE_MODE_ULPI:
- tegra_phy->is_ulpi_phy = true;
-
tegra_phy->clk = devm_clk_get(&pdev->dev, "ulpi-link");
err = PTR_ERR_OR_ZERO(tegra_phy->clk);
if (err) {
default:
dev_err(&pdev->dev, "phy_type %u is invalid or unsupported\n",
- phy_type);
+ tegra_phy->phy_type);
return -EINVAL;
}