Commit 6b44d1e9 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'phy-for-4.5-rc' of...

Merge tag 'phy-for-4.5-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy into usb-linus

Kishon writes:

phy: for 4.5-rc

*) Fix error handling code in phy core [phy_power_on()]
*) phy-twl4030-usb fixes for unloading the module
*) Restrict phy-hi6220-usb to HiSilicon arm64
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parents 89140fda 58a66dba
...@@ -224,6 +224,7 @@ config PHY_MT65XX_USB3 ...@@ -224,6 +224,7 @@ config PHY_MT65XX_USB3
config PHY_HI6220_USB config PHY_HI6220_USB
tristate "hi6220 USB PHY support" tristate "hi6220 USB PHY support"
depends on (ARCH_HISI && ARM64) || COMPILE_TEST
select GENERIC_PHY select GENERIC_PHY
select MFD_SYSCON select MFD_SYSCON
help help
......
...@@ -275,20 +275,21 @@ EXPORT_SYMBOL_GPL(phy_exit); ...@@ -275,20 +275,21 @@ EXPORT_SYMBOL_GPL(phy_exit);
int phy_power_on(struct phy *phy) int phy_power_on(struct phy *phy)
{ {
int ret; int ret = 0;
if (!phy) if (!phy)
return 0; goto out;
if (phy->pwr) { if (phy->pwr) {
ret = regulator_enable(phy->pwr); ret = regulator_enable(phy->pwr);
if (ret) if (ret)
return ret; goto out;
} }
ret = phy_pm_runtime_get_sync(phy); ret = phy_pm_runtime_get_sync(phy);
if (ret < 0 && ret != -ENOTSUPP) if (ret < 0 && ret != -ENOTSUPP)
return ret; goto err_pm_sync;
ret = 0; /* Override possible ret == -ENOTSUPP */ ret = 0; /* Override possible ret == -ENOTSUPP */
mutex_lock(&phy->mutex); mutex_lock(&phy->mutex);
...@@ -296,19 +297,20 @@ int phy_power_on(struct phy *phy) ...@@ -296,19 +297,20 @@ int phy_power_on(struct phy *phy)
ret = phy->ops->power_on(phy); ret = phy->ops->power_on(phy);
if (ret < 0) { if (ret < 0) {
dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); dev_err(&phy->dev, "phy poweron failed --> %d\n", ret);
goto out; goto err_pwr_on;
} }
} }
++phy->power_count; ++phy->power_count;
mutex_unlock(&phy->mutex); mutex_unlock(&phy->mutex);
return 0; return 0;
out: err_pwr_on:
mutex_unlock(&phy->mutex); mutex_unlock(&phy->mutex);
phy_pm_runtime_put_sync(phy); phy_pm_runtime_put_sync(phy);
err_pm_sync:
if (phy->pwr) if (phy->pwr)
regulator_disable(phy->pwr); regulator_disable(phy->pwr);
out:
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(phy_power_on); EXPORT_SYMBOL_GPL(phy_power_on);
......
...@@ -715,6 +715,7 @@ static int twl4030_usb_probe(struct platform_device *pdev) ...@@ -715,6 +715,7 @@ static int twl4030_usb_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); pm_runtime_set_autosuspend_delay(&pdev->dev, 2000);
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
/* Our job is to use irqs and status from the power module /* Our job is to use irqs and status from the power module
* to keep the transceiver disabled when nothing's connected. * to keep the transceiver disabled when nothing's connected.
...@@ -750,6 +751,7 @@ static int twl4030_usb_remove(struct platform_device *pdev) ...@@ -750,6 +751,7 @@ static int twl4030_usb_remove(struct platform_device *pdev)
struct twl4030_usb *twl = platform_get_drvdata(pdev); struct twl4030_usb *twl = platform_get_drvdata(pdev);
int val; int val;
usb_remove_phy(&twl->phy);
pm_runtime_get_sync(twl->dev); pm_runtime_get_sync(twl->dev);
cancel_delayed_work(&twl->id_workaround_work); cancel_delayed_work(&twl->id_workaround_work);
device_remove_file(twl->dev, &dev_attr_vbus); device_remove_file(twl->dev, &dev_attr_vbus);
...@@ -757,6 +759,13 @@ static int twl4030_usb_remove(struct platform_device *pdev) ...@@ -757,6 +759,13 @@ static int twl4030_usb_remove(struct platform_device *pdev)
/* set transceiver mode to power on defaults */ /* set transceiver mode to power on defaults */
twl4030_usb_set_mode(twl, -1); twl4030_usb_set_mode(twl, -1);
/* idle ulpi before powering off */
if (cable_present(twl->linkstat))
pm_runtime_put_noidle(twl->dev);
pm_runtime_mark_last_busy(twl->dev);
pm_runtime_put_sync_suspend(twl->dev);
pm_runtime_disable(twl->dev);
/* autogate 60MHz ULPI clock, /* autogate 60MHz ULPI clock,
* clear dpll clock request for i2c access, * clear dpll clock request for i2c access,
* disable 32KHz * disable 32KHz
...@@ -771,11 +780,6 @@ static int twl4030_usb_remove(struct platform_device *pdev) ...@@ -771,11 +780,6 @@ static int twl4030_usb_remove(struct platform_device *pdev)
/* disable complete OTG block */ /* disable complete OTG block */
twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB);
if (cable_present(twl->linkstat))
pm_runtime_put_noidle(twl->dev);
pm_runtime_mark_last_busy(twl->dev);
pm_runtime_put(twl->dev);
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