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: Kishon Vijay Abraham I <kishon@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJWutjaAAoJEA5ceFyATYLZKsIQAJkmjS4Hnb6fvOiQ/K8ZzZap
 Z3drObZoPBedN2iuBi9i0+kPXcu0QAmLjVGOHJZwTDhV9mPxY5g0Ct5xzSGCJPH3
 m+WXxrl1Y7eum2nvN2SQz1hqURpdjJwuUpzQH2Q2S/8RMK8ml7UYXJCX0wP7ZzHj
 Dg5pWR5f0L8K7SmpypSkAfIZ/KAJ7E1Mg8tgkzUOvjmEqc/o6oezGS3kVMZEqyIa
 kvvxOaJDPXa0bh52NQF8IXmE99keBx0hC9TG9+AYKTqNpl1YZeZNxxB5ooqAnJOL
 4sy2bFmav7Ft0501zMxTb6mP0KC+dj+c499P+Cl8hqmMbcEy9QMgIV13Yzr8dbUI
 /woC/BSNUB2lNpl2oli2VqFRrhMpJl5UOPu4lPLGSplVw3ViEjvDIjutF8dDuN6L
 98cFSzSKvyfzRlQ29KbFIyKog54Mo/YOGxlGmjpAm05c5dWlWi7ZriyOukKv85gb
 7gKp6+UNs9lrC4yTi3V6fOnuTocr5TfwwfAAKlsHwkQaT3Mm64dig9rdfzmT/c3+
 Htea2Y2lU7CCsW0mNkT3hNZ9wpFu4BNTa9fBh5oRs+UxDiGbtJlZTvcBVZ8MYfwG
 PCeCbCJzw0pLW0Ya5ePOSJ0VbUgqwT1SDryikmZxg/paXzpza5GDQ0/lNcBkaaDt
 08nXceE2HGf/RavUmrPe
 =s8Mo
 -----END PGP SIGNATURE-----

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: Kishon Vijay Abraham I <kishon@ti.com>
This commit is contained in:
Greg Kroah-Hartman 2016-02-11 20:10:58 -08:00
commit 6b44d1e9bf
3 changed files with 19 additions and 12 deletions

View File

@ -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

View File

@ -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)
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);

View File

@ -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)
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)
/* 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)
/* 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;
} }