Skip to contentSkip to conversation

phy: for-4.5 -rc cycle

GIT PULL New Kishon Vijay Abraham I 2 participants 6 messages Feb 10, 2016 – Feb 12, 2016 Generic PHY framework

lore
Share & tools
lore
#0 lore raw

Hi Greg,

Please find the pull request for this -rc cycle below. It contains a fix in phy core, twl4030-usb phy driver and a fix in Kconfig.

Consider merging it to this -rc cycle. Let me know if you want me to change anything.

Cheers
Kishon

The following changes since commit 92e963f50fc74041b5e9e744c330dca48e04f08d:

Linux 4.5-rc1 (2016-01-24 13:06:47 -0800)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/phy-for-4.5-rc

for you to fetch changes up to 58a66dba1beac2121d931cda4682ae4d40816af5:

phy: twl4030-usb: Fix unbalanced pm_runtime_enable on module reload (2016-02-10 11:46:01 +0530)

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

----------------------------------------------------------------
Geert Uytterhoeven (1):
phy: Restrict phy-hi6220-usb to HiSilicon arm64

Shawn Lin (1):
phy: core: fix wrong err handle for phy_power_on

Tony Lindgren (2):
phy: twl4030-usb: Relase usb phy on unload
phy: twl4030-usb: Fix unbalanced pm_runtime_enable on module reload

 drivers/phy/Kconfig           |    1 +
 drivers/phy/phy-core.c        |   16 +++++++++-------
 drivers/phy/phy-twl4030-usb.c |   14 +++++++++-----
 3 files changed, 19 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 phy: Restrict phy-hi6220-usb to HiSilicon arm64

From: Geert Uytterhoeven <[email protected]>

The HiSilicon Hi6220 USB PHY is available in HiSilicon Hi6220 SoCs only. Restrict it to HiSilicon arm64, unless compile-testing.

---
 drivers/phy/Kconfig |    1 +
 1 file changed, 1 insertion(+)
drivers/phy/Kconfig +1 -0
index e7e117d..0124d17 100644
@@ -224,6 +224,7 @@ config PHY_MT65XX_USB3
 
 config PHY_HI6220_USB
 	tristate "hi6220 USB PHY support"
+	depends on (ARCH_HISI && ARM64) || COMPILE_TEST
 	select GENERIC_PHY
 	select MFD_SYSCON
 	help
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 phy: core: fix wrong err handle for phy_power_on

In reply to Kishon Vijay Abraham I

From: Shawn Lin <[email protected]>

If phy_pm_runtime_get_sync failed but we already enable regulator, current code return directly without doing regulator_disable. This patch fix this problem and cleanup err handle of phy_power_on to be more readable.

Fixes 3be88125d85d ("phy: core: Support regulator ...")
Cc <[email protected]> # v3.18+
Cc Roger Quadros <[email protected]>
Cc Axel Lin <[email protected]>
---
 drivers/phy/phy-core.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/phy/phy-core.c +9 -7
index 8c7f27d..e7e574d 100644
@@ -275,20 +275,21 @@ EXPORT_SYMBOL_GPL(phy_exit);
 
 int phy_power_on(struct phy *phy)
 {
-	int ret;
+	int ret = 0;
 
 	if (!phy)
-		return 0;
+		goto out;
 
 	if (phy->pwr) {
 		ret = regulator_enable(phy->pwr);
 		if (ret)
-			return ret;
+			goto out;
 	}
 
 	ret = phy_pm_runtime_get_sync(phy);
 	if (ret < 0 && ret != -ENOTSUPP)
-		return ret;
+		goto err_pm_sync;
+
 	ret = 0; /* Override possible ret == -ENOTSUPP */
 
 	mutex_lock(&phy->mutex);
@@ -296,19 +297,20 @@ int phy_power_on(struct phy *phy)
 		ret = phy->ops->power_on(phy);
 		if (ret < 0) {
 			dev_err(&phy->dev, "phy poweron failed --> %d\n", ret);
-			goto out;
+			goto err_pwr_on;
 		}
 	}
 	++phy->power_count;
 	mutex_unlock(&phy->mutex);
 	return 0;
 
-out:
+err_pwr_on:
 	mutex_unlock(&phy->mutex);
 	phy_pm_runtime_put_sync(phy);
+err_pm_sync:
 	if (phy->pwr)
 		regulator_disable(phy->pwr);
-
+out:
 	return ret;
 }
 EXPORT_SYMBOL_GPL(phy_power_on);
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/4 phy: twl4030-usb: Relase usb phy on unload

In reply to Kishon Vijay Abraham I

From: Tony Lindgren <[email protected]>

Otherwise rmmod omap2430; rmmod phy-twl4030-usb; modprobe omap2430 will try to use a non-existing phy and oops:

Unable to handle kernel paging request at virtual address b6f7c1f0

...
[<c048a284>] (devm_usb_get_phy_by_node) from [<bf0758ac>] (omap2430_musb_init+0x44/0x2b4 [omap2430]) [<bf0758ac>] (omap2430_musb_init [omap2430]) from [<bf055ec0>] (musb_init_controller+0x194/0x878 [musb_hdrc])

---
 drivers/phy/phy-twl4030-usb.c |    1 +
 1 file changed, 1 insertion(+)
drivers/phy/phy-twl4030-usb.c +1 -0
index 4a3fc6e..fe5538f 100644
@@ -750,6 +750,7 @@ static int twl4030_usb_remove(struct platform_device *pdev)
 	struct twl4030_usb *twl = platform_get_drvdata(pdev);
 	int val;
 
+	usb_remove_phy(&twl->phy);
 	pm_runtime_get_sync(twl->dev);
 	cancel_delayed_work(&twl->id_workaround_work);
 	device_remove_file(twl->dev, &dev_attr_vbus);
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/4 phy: twl4030-usb: Fix unbalanced pm_runtime_enable on module reload

In reply to Kishon Vijay Abraham I

From: Tony Lindgren <[email protected]>

If we reload phy-twl4030-usb, we get a warning about unbalanced pm_runtime_enable. Let's fix the issue and also fix idling of the device on unload before we attempt to shut it down.

If we don't properly idle the PHY before shutting it down on removal, the twl4030 ends up consuming about 62mW of extra power compared to running idle with the module loaded.

---
 drivers/phy/phy-twl4030-usb.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/phy/phy-twl4030-usb.c +8 -5
index fe5538f..840f3ea 100644
@@ -715,6 +715,7 @@ static int twl4030_usb_probe(struct platform_device *pdev)
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, 2000);
 	pm_runtime_enable(&pdev->dev);
+	pm_runtime_get_sync(&pdev->dev);
 
 	/* Our job is to use irqs and status from the power module
 	 * to keep the transceiver disabled when nothing's connected.
@@ -758,6 +759,13 @@ static int twl4030_usb_remove(struct platform_device *pdev)
 	/* set transceiver mode to power on defaults */
 	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,
 	 * clear dpll clock request for i2c access,
 	 * disable 32KHz
@@ -772,11 +780,6 @@ static int twl4030_usb_remove(struct platform_device *pdev)
 	/* disable complete OTG block */
 	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;
 }
 
Signature · 1 line
1.7.9.5
#5 lore raw
In reply to Kishon Vijay Abraham I
Quoted 11 lines · Kishon Vijay Abraham I

Hi Greg,

Please find the pull request for this -rc cycle below. It contains a fix in phy core, twl4030-usb phy driver and a fix in Kconfig.

Consider merging it to this -rc cycle. Let me know if you want me to change anything.

Cheers
Kishon

Quoted 7 lines

The following changes since commit 92e963f50fc74041b5e9e744c330dca48e04f08d:

Linux 4.5-rc1 (2016-01-24 13:06:47 -0800)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/phy-for-4.5-rc

Pulled and pushed out, thanks.

greg k-h