Skip to contentSkip to conversation

phy: for 4.0 -rc cycle

GIT PULL New Kishon Vijay Abraham I 2 participants 25 messages Mar 13, 2015 – Mar 18, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Greg,

Please find the pull request for 4.0 -rc cycle. We should thank Axel Lin for reviewing all the PHY drivers and sending fixes. This also includes a fix from Thierry Reding in phy core.

Let me know if I have to change something.

Thanks
Kishon

The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

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

for you to fetch changes up to b1ff3231b2d4197ef5024f9c57ffc6cfa562590c:

phy: omap-usb2: Fix missing clk_prepare call when using old dt name (2015-03-13 17:14:39 +0530)

----------------------------------------------------------------
contains fixes all over drivers/phy

----------------------------------------------------------------
Axel Lin (19):
phy: miphy28lp: Avoid calling of_get_child_count() multiple times
phy: miphy365x: Avoid calling of_get_child_count() multiple times
phy: armada375-usb2: Set drvdata for phy and use it
phy: xgene: Remove duplicate code to set ctx->dev
phy: miphy28lp: Add missing .owner field in miphy28lp_ops
phy: exynos-mipi-video: Fixup the test for state->regmap
phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations
phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function
phy: hix5hd2-sata: Check return value of platform_get_resource
phy: samsung-usb2: Remove NULL terminating entry from phys array
phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation
phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path
phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0]
phy: twl4030-usb: Remove redundant assignment for twl->linkstat
phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof
phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof
phy: core: Fixup return value of phy_exit when !pm_runtime_enabled
phy: ti/omap: Fix modalias
phy: omap-usb2: Fix missing clk_prepare call when using old dt name

Thierry Reding (1):
phy: Find the right match in devm_phy_destroy()

 drivers/phy/phy-armada375-usb2.c    |    3 ++-
 drivers/phy/phy-core.c              |   11 ++++++-----
 drivers/phy/phy-exynos-dp-video.c   |   24 ++++--------------------
 drivers/phy/phy-exynos-mipi-video.c |   11 ++++-------
 drivers/phy/phy-exynos4210-usb2.c   |    1 -
 drivers/phy/phy-exynos4x12-usb2.c   |    1 -
 drivers/phy/phy-exynos5-usbdrd.c    |    2 +-
 drivers/phy/phy-exynos5250-usb2.c   |    1 -
 drivers/phy/phy-hix5hd2-sata.c      |    3 +++
 drivers/phy/phy-miphy28lp.c         |   13 +++++++------
 drivers/phy/phy-miphy365x.c         |   12 ++++++------
 drivers/phy/phy-omap-control.c      |    2 +-
 drivers/phy/phy-omap-usb2.c         |    7 ++++---
 drivers/phy/phy-rockchip-usb.c      |    6 +++---
 drivers/phy/phy-ti-pipe3.c          |   12 ++++--------
 drivers/phy/phy-twl4030-usb.c       |    1 -
 drivers/phy/phy-xgene.c             |    1 -
 17 files changed, 45 insertions(+), 66 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/20 phy: miphy28lp: Avoid calling of_get_child_count() multiple times

From: Axel Lin <[email protected]>

Currently, of_get_child_count() is called in each iteration of the for loop in miphy28lp_xlate(). This patch stores the return value of of_get_child_count() in miphy_dev->nphys and call of_get_child_count() once in miphy28lp_probe().

---
 drivers/phy/phy-miphy28lp.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/phy/phy-miphy28lp.c +6 -5
index 9b2848e..d444932 100644
@@ -228,6 +228,7 @@ struct miphy28lp_dev {
 	struct regmap *regmap;
 	struct mutex miphy_mutex;
 	struct miphy28lp_phy **phys;
+	int nphys;
 };
 
 struct miphy_initval {
@@ -1116,7 +1117,7 @@ static struct phy *miphy28lp_xlate(struct device *dev,
 		return ERR_PTR(-EINVAL);
 	}
 
-	for (index = 0; index < of_get_child_count(dev->of_node); index++)
+	for (index = 0; index < miphy_dev->nphys; index++)
 		if (phynode == miphy_dev->phys[index]->phy->dev.of_node) {
 			miphy_phy = miphy_dev->phys[index];
 			break;
@@ -1200,15 +1201,15 @@ static int miphy28lp_probe(struct platform_device *pdev)
 	struct miphy28lp_dev *miphy_dev;
 	struct phy_provider *provider;
 	struct phy *phy;
-	int chancount, port = 0;
-	int ret;
+	int ret, port = 0;
 
 	miphy_dev = devm_kzalloc(&pdev->dev, sizeof(*miphy_dev), GFP_KERNEL);
 	if (!miphy_dev)
 		return -ENOMEM;
 
-	chancount = of_get_child_count(np);
-	miphy_dev->phys = devm_kzalloc(&pdev->dev, sizeof(phy) * chancount,
+	miphy_dev->nphys = of_get_child_count(np);
+	miphy_dev->phys = devm_kzalloc(&pdev->dev,
+				       sizeof(phy) * miphy_dev->nphys,
 				       GFP_KERNEL);
 	if (!miphy_dev->phys)
 		return -ENOMEM;
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/20 phy: miphy365x: Avoid calling of_get_child_count() multiple times

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

Currently, of_get_child_count() is called in each iteration of the for loop in miphy365x_xlate(). This patch stores the return value of of_get_child_count() in miphy_dev->nphys and call of_get_child_count() once in miphy365x_probe().

---
 drivers/phy/phy-miphy365x.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/phy/phy-miphy365x.c +6 -5
index 6c80154..61177a6 100644
@@ -150,6 +150,7 @@ struct miphy365x_dev {
 	struct regmap *regmap;
 	struct mutex miphy_mutex;
 	struct miphy365x_phy **phys;
+	int nphys;
 };
 
 /*
@@ -485,7 +486,7 @@ static struct phy *miphy365x_xlate(struct device *dev,
 		return ERR_PTR(-EINVAL);
 	}
 
-	for (index = 0; index < of_get_child_count(dev->of_node); index++)
+	for (index = 0; index < miphy_dev->nphys; index++)
 		if (phynode == miphy_dev->phys[index]->phy->dev.of_node) {
 			miphy_phy = miphy_dev->phys[index];
 			break;
@@ -541,15 +542,15 @@ static int miphy365x_probe(struct platform_device *pdev)
 	struct miphy365x_dev *miphy_dev;
 	struct phy_provider *provider;
 	struct phy *phy;
-	int chancount, port = 0;
-	int ret;
+	int ret, port = 0;
 
 	miphy_dev = devm_kzalloc(&pdev->dev, sizeof(*miphy_dev), GFP_KERNEL);
 	if (!miphy_dev)
 		return -ENOMEM;
 
-	chancount = of_get_child_count(np);
-	miphy_dev->phys = devm_kzalloc(&pdev->dev, sizeof(phy) * chancount,
+	miphy_dev->nphys = of_get_child_count(np);
+	miphy_dev->phys = devm_kzalloc(&pdev->dev,
+				       sizeof(phy) * miphy_dev->nphys,
 				       GFP_KERNEL);
 	if (!miphy_dev->phys)
 		return -ENOMEM;
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/20 phy: armada375-usb2: Set drvdata for phy and use it

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

At the context we have pointer to struct phy, it's useful to call phy_get_drvdata() to get the address of cluster_phy. This has slightly better readability than calling dev_get_drvdata(phy->dev.parent).

---
 drivers/phy/phy-armada375-usb2.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/phy/phy-armada375-usb2.c +2 -1
index 7c99ca2..8ccc395 100644
@@ -37,7 +37,7 @@ static int armada375_usb_phy_init(struct phy *phy)
 	struct armada375_cluster_phy *cluster_phy;
 	u32 reg;
 
-	cluster_phy = dev_get_drvdata(phy->dev.parent);
+	cluster_phy = phy_get_drvdata(phy);
 	if (!cluster_phy)
 		return -ENODEV;
 
@@ -131,6 +131,7 @@ static int armada375_usb_phy_probe(struct platform_device *pdev)
 	cluster_phy->reg = usb_cluster_base;
 
 	dev_set_drvdata(dev, cluster_phy);
+	phy_set_drvdata(phy, cluster_phy);
 
 	phy_provider = devm_of_phy_provider_register(&pdev->dev,
 						     armada375_usb_phy_xlate);
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/20 phy: xgene: Remove duplicate code to set ctx->dev

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

Set it once is enough and it's done after devm_kzalloc().

---
 drivers/phy/phy-xgene.c |    1 -
 1 file changed, 1 deletion(-)
drivers/phy/phy-xgene.c +0 -1
index 29214a3..2263cd0 100644
@@ -1704,7 +1704,6 @@ static int xgene_phy_probe(struct platform_device *pdev)
 	for (i = 0; i < MAX_LANE; i++)
 		ctx->sata_param.speed[i] = 2; /* Default to Gen3 */
 
-	ctx->dev = &pdev->dev;
 	platform_set_drvdata(pdev, ctx);
 
 	ctx->phy = devm_phy_create(ctx->dev, NULL, &xgene_phy_ops);
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/20 phy: miphy28lp: Add missing .owner field in miphy28lp_ops

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

Add missing .owner field in miphy28lp_ops, which is used for refcounting.

---
 drivers/phy/phy-miphy28lp.c |    1 +
 1 file changed, 1 insertion(+)
drivers/phy/phy-miphy28lp.c +1 -0
index d444932..4fe1755 100644
@@ -1139,6 +1139,7 @@ static struct phy *miphy28lp_xlate(struct device *dev,
 
 static struct phy_ops miphy28lp_ops = {
 	.init = miphy28lp_init,
+	.owner = THIS_MODULE,
 };
 
 static int miphy28lp_probe_resets(struct device_node *node,
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 6/20 phy: exynos-mipi-video: Fixup the test for state->regmap

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

syscon_regmap_lookup_by_phandle() returns ERR_PTR on error. Thus don't use null test against state->regmap.

---
 drivers/phy/phy-exynos-mipi-video.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-exynos-mipi-video.c +1 -1
index f017b2f..d196493 100644
@@ -59,7 +59,7 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 	else
 		reset = EXYNOS4_MIPI_PHY_SRESETN;
 
-	if (state->regmap) {
+	if (!IS_ERR(state->regmap)) {
 		mutex_lock(&state->mutex);
 		regmap_read(state->regmap, offset, &val);
 		if (on)
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 7/20 phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

The state->regmap is initialized by devm_regmap_init_mmio().
So it's fine to use spin_lock rather than mutex to protct state->regmap rmw operations.

[[email protected]: Found an issue with the original patch w.r.t unbalanced
spin_lock call]

---
 drivers/phy/phy-exynos-mipi-video.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/phy/phy-exynos-mipi-video.c +3 -6
index d196493..df7519a 100644
@@ -43,7 +43,6 @@ struct exynos_mipi_video_phy {
 	} phys[EXYNOS_MIPI_PHYS_NUM];
 	spinlock_t slock;
 	void __iomem *regs;
-	struct mutex mutex;
 	struct regmap *regmap;
 };
 
@@ -59,8 +58,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 	else
 		reset = EXYNOS4_MIPI_PHY_SRESETN;
 
+	spin_lock(&state->slock);
+
 	if (!IS_ERR(state->regmap)) {
-		mutex_lock(&state->mutex);
 		regmap_read(state->regmap, offset, &val);
 		if (on)
 			val |= reset;
@@ -72,11 +72,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 		else if (!(val & EXYNOS4_MIPI_PHY_RESET_MASK))
 			val &= ~EXYNOS4_MIPI_PHY_ENABLE;
 		regmap_write(state->regmap, offset, val);
-		mutex_unlock(&state->mutex);
 	} else {
 		addr = state->regs + EXYNOS_MIPI_PHY_CONTROL(id / 2);
 
-		spin_lock(&state->slock);
 		val = readl(addr);
 		if (on)
 			val |= reset;
@@ -90,9 +88,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 			val &= ~EXYNOS4_MIPI_PHY_ENABLE;
 
 		writel(val, addr);
-		spin_unlock(&state->slock);
 	}
 
+	spin_unlock(&state->slock);
 	return 0;
 }
 
@@ -158,7 +156,6 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(dev, state);
 	spin_lock_init(&state->slock);
-	mutex_init(&state->mutex);
 
 	for (i = 0; i < EXYNOS_MIPI_PHYS_NUM; i++) {
 		struct phy *phy = devm_phy_create(dev, NULL,
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 8/20 phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

If IS_ERR(state->regs) the .probe fails.
So IS_ERR(state->regs) test in exynos_dp_video_phy_pwr_isol() is not necessary. exynos_dp_video_phy_pwr_isol() simply does a regmap_update_bits() call now, just call regmap_update_bits() instead and return proper return value.

---
 drivers/phy/phy-exynos-dp-video.c |   24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)
drivers/phy/phy-exynos-dp-video.c +4 -20
index f86cbe6..179cbf9 100644
@@ -30,28 +30,13 @@ struct exynos_dp_video_phy {
 	const struct exynos_dp_video_phy_drvdata *drvdata;
 };
 
-static void exynos_dp_video_phy_pwr_isol(struct exynos_dp_video_phy *state,
-							unsigned int on)
-{
-	unsigned int val;
-
-	if (IS_ERR(state->regs))
-		return;
-
-	val = on ? 0 : EXYNOS5_PHY_ENABLE;
-
-	regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset,
-			   EXYNOS5_PHY_ENABLE, val);
-}
-
 static int exynos_dp_video_phy_power_on(struct phy *phy)
 {
 	struct exynos_dp_video_phy *state = phy_get_drvdata(phy);
 
 	/* Disable power isolation on DP-PHY */
-	exynos_dp_video_phy_pwr_isol(state, 0);
-
-	return 0;
+	return regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset,
+				  EXYNOS5_PHY_ENABLE, EXYNOS5_PHY_ENABLE);
 }
 
 static int exynos_dp_video_phy_power_off(struct phy *phy)
@@ -59,9 +44,8 @@ static int exynos_dp_video_phy_power_off(struct phy *phy)
 	struct exynos_dp_video_phy *state = phy_get_drvdata(phy);
 
 	/* Enable power isolation on DP-PHY */
-	exynos_dp_video_phy_pwr_isol(state, 1);
-
-	return 0;
+	return regmap_update_bits(state->regs, state->drvdata->phy_ctrl_offset,
+				  EXYNOS5_PHY_ENABLE, 0);
 }
 
 static struct phy_ops exynos_dp_video_phy_ops = {
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH 9/20 phy: hix5hd2-sata: Check return value of platform_get_resource

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

This prevent NULL pointer dereference if res is NULL.

---
 drivers/phy/phy-hix5hd2-sata.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/phy/phy-hix5hd2-sata.c +3 -0
index 34915b4..d6b2265 100644
@@ -147,6 +147,9 @@ static int hix5hd2_sata_phy_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+
 	priv->base = devm_ioremap(dev, res->start, resource_size(res));
 	if (!priv->base)
 		return -ENOMEM;
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 10/20 phy: samsung-usb2: Remove NULL terminating entry from phys array

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

Current code uses num_phys settings to tell the number of entries in phys. Thus remove the NULL terminating entry from phys array which is not necessary.

---
 drivers/phy/phy-exynos4210-usb2.c |    1 -
 drivers/phy/phy-exynos4x12-usb2.c |    1 -
 drivers/phy/phy-exynos5250-usb2.c |    1 -
 3 files changed, 3 deletions(-)
drivers/phy/phy-exynos4210-usb2.c +0 -1
index 236a52a..f30bbb0 100644
@@ -250,7 +250,6 @@ static const struct samsung_usb2_common_phy exynos4210_phys[] = {
 		.power_on	= exynos4210_power_on,
 		.power_off	= exynos4210_power_off,
 	},
-	{},
 };
 
 const struct samsung_usb2_phy_config exynos4210_usb2_phy_config = {
drivers/phy/phy-exynos4x12-usb2.c +0 -1
index 0b9de88..765da90 100644
@@ -361,7 +361,6 @@ static const struct samsung_usb2_common_phy exynos4x12_phys[] = {
 		.power_on	= exynos4x12_power_on,
 		.power_off	= exynos4x12_power_off,
 	},
-	{},
 };
 
 const struct samsung_usb2_phy_config exynos3250_usb2_phy_config = {
drivers/phy/phy-exynos5250-usb2.c +0 -1
index 1c139aa..2ed1735 100644
@@ -391,7 +391,6 @@ static const struct samsung_usb2_common_phy exynos5250_phys[] = {
 		.power_on	= exynos5250_power_on,
 		.power_off	= exynos5250_power_off,
 	},
-	{},
 };
 
 const struct samsung_usb2_phy_config exynos5250_usb2_phy_config = {
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH 11/20 phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

Code simplification. No functional change.

---
 drivers/phy/phy-ti-pipe3.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/phy/phy-ti-pipe3.c +3 -7
index 95c88f9..ed72b0d 100644
@@ -165,15 +165,11 @@ static int ti_pipe3_dpll_wait_lock(struct ti_pipe3 *phy)
 		cpu_relax();
 		val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);
 		if (val & PLL_LOCK)
-			break;
+			return 0;
 	} while (!time_after(jiffies, timeout));
 
-	if (!(val & PLL_LOCK)) {
-		dev_err(phy->dev, "DPLL failed to lock\n");
-		return -EBUSY;
-	}
-
-	return 0;
+	dev_err(phy->dev, "DPLL failed to lock\n");
+	return -EBUSY;
 }
 
 static int ti_pipe3_dpll_program(struct ti_pipe3 *phy)
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH 12/20 phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

If rockchip_usb_phy_power() fails, we need to call clk_disable_unprepare() before return. This is to ensure we have balanced clk_enable/disable calls. Also remove unneeded ret checking in rockchip_usb_phy_power_off.

---
 drivers/phy/phy-rockchip-usb.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/phy/phy-rockchip-usb.c +3 -3
index 22011c3..7d4c336 100644
@@ -61,8 +61,6 @@ static int rockchip_usb_phy_power_off(struct phy *_phy)
 		return ret;
 
 	clk_disable_unprepare(phy->clk);
-	if (ret)
-		return ret;
 
 	return 0;
 }
@@ -78,8 +76,10 @@ static int rockchip_usb_phy_power_on(struct phy *_phy)
 
 	/* Power up usb phy analog blocks by set siddq 0 */
 	ret = rockchip_usb_phy_power(phy, 0);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(phy->clk);
 		return ret;
+	}
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
#13 lore raw

PATCH 13/20 phy: Find the right match in devm_phy_destroy()

In reply to Kishon Vijay Abraham I

From: Thierry Reding <[email protected]>

devm_phy_create() stores the pointer to the new PHY at the address returned by devres_alloc(). The res parameter passed to devm_phy_match() is therefore the location where the pointer to the PHY is stored, hence it needs to be dereferenced before comparing to the match data in order to find the correct match.

---
 drivers/phy/phy-core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/phy/phy-core.c +3 -1
index a12d353..04fc84f 100644
@@ -52,7 +52,9 @@ static void devm_phy_consume(struct device *dev, void *res)
 
 static int devm_phy_match(struct device *dev, void *res, void *match_data)
 {
-	return res == match_data;
+	struct phy **phy = res;
+
+	return *phy == match_data;
 }
 
 /**
Signature · 1 line
1.7.9.5
#14 lore raw

PATCH 14/20 phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0]

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

Current code uses args->args[0] as array subscript of phy_drd->phys[]. So the valid value range for args->args[0] is 0 ... EXYNOS5_DRDPHYS_NUM - 1.

Reviewed by: Vivek Gautam <[email protected]>

---
 drivers/phy/phy-exynos5-usbdrd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-exynos5-usbdrd.c +1 -1
index 0437401..e2a0be7 100644
@@ -531,7 +531,7 @@ static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev,
 {
 	struct exynos5_usbdrd_phy *phy_drd = dev_get_drvdata(dev);
 
-	if (WARN_ON(args->args[0] > EXYNOS5_DRDPHYS_NUM))
+	if (WARN_ON(args->args[0] >= EXYNOS5_DRDPHYS_NUM))
 		return ERR_PTR(-ENODEV);
 
 	return phy_drd->phys[args->args[0]].phy;
Signature · 1 line
1.7.9.5
#15 lore raw

PATCH 15/20 phy: twl4030-usb: Remove redundant assignment for twl->linkstat

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

It's pointless to set twl->linkstat twice.

---
 drivers/phy/phy-twl4030-usb.c |    1 -
 1 file changed, 1 deletion(-)
drivers/phy/phy-twl4030-usb.c +0 -1
index 8e87f54..bc42d6a 100644
@@ -666,7 +666,6 @@ static int twl4030_usb_probe(struct platform_device *pdev)
 	twl->dev		= &pdev->dev;
 	twl->irq		= platform_get_irq(pdev, 0);
 	twl->vbus_supplied	= false;
-	twl->linkstat		= -EINVAL;
 	twl->linkstat		= OMAP_MUSB_UNKNOWN;
 
 	twl->phy.dev		= twl->dev;
Signature · 1 line
1.7.9.5
#16 lore raw

PATCH 16/20 phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

Prefer devm_kcalloc over devm_kzalloc with multiply. In additional, use sizeof(phy) is incorrect, fix it.

---
 drivers/phy/phy-miphy365x.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/phy/phy-miphy365x.c +2 -3
index 61177a6..51b459d 100644
@@ -549,9 +549,8 @@ static int miphy365x_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	miphy_dev->nphys = of_get_child_count(np);
-	miphy_dev->phys = devm_kzalloc(&pdev->dev,
-				       sizeof(phy) * miphy_dev->nphys,
-				       GFP_KERNEL);
+	miphy_dev->phys = devm_kcalloc(&pdev->dev, miphy_dev->nphys,
+				       sizeof(*miphy_dev->phys), GFP_KERNEL);
 	if (!miphy_dev->phys)
 		return -ENOMEM;
 
Signature · 1 line
1.7.9.5
#17 lore raw

PATCH 17/20 phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

Prefer devm_kcalloc over devm_kzalloc with multiply. In additional, use sizeof(phy) is incorrect, fix it.

---
 drivers/phy/phy-miphy28lp.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/phy/phy-miphy28lp.c +2 -3
index 4fe1755..9334352 100644
@@ -1209,9 +1209,8 @@ static int miphy28lp_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	miphy_dev->nphys = of_get_child_count(np);
-	miphy_dev->phys = devm_kzalloc(&pdev->dev,
-				       sizeof(phy) * miphy_dev->nphys,
-				       GFP_KERNEL);
+	miphy_dev->phys = devm_kcalloc(&pdev->dev, miphy_dev->nphys,
+				       sizeof(*miphy_dev->phys), GFP_KERNEL);
 	if (!miphy_dev->phys)
 		return -ENOMEM;
 
Signature · 1 line
1.7.9.5
#18 lore raw

PATCH 18/20 phy: core: Fixup return value of phy_exit when !pm_runtime_enabled

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

When phy_pm_runtime_get_sync() returns -ENOTSUPP, phy_exit() also returns -ENOTSUPP if !phy->ops->exit. Fix it.
Also move the code to override ret close to the code we got ret. I think it is less error prone this way.

---
 drivers/phy/phy-core.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/phy/phy-core.c +3 -4
index 04fc84f..3791838 100644
@@ -225,6 +225,7 @@ int phy_init(struct phy *phy)
 	ret = phy_pm_runtime_get_sync(phy);
 	if (ret < 0 && ret != -ENOTSUPP)
 		return ret;
+	ret = 0; /* Override possible ret == -ENOTSUPP */
 
 	mutex_lock(&phy->mutex);
 	if (phy->init_count == 0 && phy->ops->init) {
@@ -233,8 +234,6 @@ int phy_init(struct phy *phy)
 			dev_err(&phy->dev, "phy init failed --> %d\n", ret);
 			goto out;
 		}
-	} else {
-		ret = 0; /* Override possible ret == -ENOTSUPP */
 	}
 	++phy->init_count;
 
@@ -255,6 +254,7 @@ int phy_exit(struct phy *phy)
 	ret = phy_pm_runtime_get_sync(phy);
 	if (ret < 0 && ret != -ENOTSUPP)
 		return ret;
+	ret = 0; /* Override possible ret == -ENOTSUPP */
 
 	mutex_lock(&phy->mutex);
 	if (phy->init_count == 1 && phy->ops->exit) {
@@ -289,6 +289,7 @@ int phy_power_on(struct phy *phy)
 	ret = phy_pm_runtime_get_sync(phy);
 	if (ret < 0 && ret != -ENOTSUPP)
 		return ret;
+	ret = 0; /* Override possible ret == -ENOTSUPP */
 
 	mutex_lock(&phy->mutex);
 	if (phy->power_count == 0 && phy->ops->power_on) {
@@ -297,8 +298,6 @@ int phy_power_on(struct phy *phy)
 			dev_err(&phy->dev, "phy poweron failed --> %d\n", ret);
 			goto out;
 		}
-	} else {
-		ret = 0; /* Override possible ret == -ENOTSUPP */
 	}
 	++phy->power_count;
 	mutex_unlock(&phy->mutex);
Signature · 1 line
1.7.9.5
#19 lore raw

PATCH 19/20 phy: ti/omap: Fix modalias

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

Remove extra space in MODULE_ALIAS.

---
 drivers/phy/phy-omap-control.c |    2 +-
 drivers/phy/phy-omap-usb2.c    |    2 +-
 drivers/phy/phy-ti-pipe3.c     |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/phy/phy-omap-control.c +1 -1
index efe724f..93252e0 100644
@@ -360,7 +360,7 @@ static void __exit omap_control_phy_exit(void)
 }
 module_exit(omap_control_phy_exit);
 
-MODULE_ALIAS("platform: omap_control_phy");
+MODULE_ALIAS("platform:omap_control_phy");
 MODULE_AUTHOR("Texas Instruments Inc.");
 MODULE_DESCRIPTION("OMAP Control Module PHY Driver");
 MODULE_LICENSE("GPL v2");
drivers/phy/phy-omap-usb2.c +1 -1
index 6f4aef3..c4917b2 100644
@@ -383,7 +383,7 @@ static struct platform_driver omap_usb2_driver = {
 
 module_platform_driver(omap_usb2_driver);
 
-MODULE_ALIAS("platform: omap_usb2");
+MODULE_ALIAS("platform:omap_usb2");
 MODULE_AUTHOR("Texas Instruments Inc.");
 MODULE_DESCRIPTION("OMAP USB2 phy driver");
 MODULE_LICENSE("GPL v2");
drivers/phy/phy-ti-pipe3.c +1 -1
index ed72b0d..2ba610b 100644
@@ -604,7 +604,7 @@ static struct platform_driver ti_pipe3_driver = {
 
 module_platform_driver(ti_pipe3_driver);
 
-MODULE_ALIAS("platform: ti_pipe3");
+MODULE_ALIAS("platform:ti_pipe3");
 MODULE_AUTHOR("Texas Instruments Inc.");
 MODULE_DESCRIPTION("TI PIPE3 phy driver");
 MODULE_LICENSE("GPL v2");
Signature · 1 line
1.7.9.5
#20 lore raw

PATCH 20/20 phy: omap-usb2: Fix missing clk_prepare call when using old dt name

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

Current code does not call clk_prepare(phy->optclk) when using the old usb_otg_ss_refclk960m name. Fix it.

---
 drivers/phy/phy-omap-usb2.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/phy/phy-omap-usb2.c +3 -2
index c4917b2..4757e76 100644
@@ -296,10 +296,11 @@ static int omap_usb2_probe(struct platform_device *pdev)
 			dev_warn(&pdev->dev,
 				 "found usb_otg_ss_refclk960m, please fix DTS\n");
 		}
-	} else {
-		clk_prepare(phy->optclk);
 	}
 
+	if (!IS_ERR(phy->optclk))
+		clk_prepare(phy->optclk);
+
 	usb_add_phy_dev(&phy->phy);
 
 	return 0;
Signature · 1 line
1.7.9.5
#21 lore raw
In reply to Kishon Vijay Abraham I
Quoted 17 lines · Kishon Vijay Abraham I

Hi Greg,

Please find the pull request for 4.0 -rc cycle. We should thank Axel Lin for reviewing all the PHY drivers and sending fixes. This also includes a fix from Thierry Reding in phy core.

Let me know if I have to change something.

Thanks
Kishon

The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

Quoted 9 lines

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

for you to fetch changes up to b1ff3231b2d4197ef5024f9c57ffc6cfa562590c:

phy: omap-usb2: Fix missing clk_prepare call when using old dt name (2015-03-13 17:14:39 +0530)

----------------------------------------------------------------
contains fixes all over drivers/phy

That's a horrible pull request summary. Please at least give me something "real" to go on here. As it is, would you accept such a changelog entry?

I'll just take the individual patches, to keep this out of the commit log...

thanks,

greg k-h

#22 lore raw

Hi Greg,

Quoted 28 lines · Greg KH
Quoted 17 lines · Kishon Vijay Abraham I

Hi Greg,

Please find the pull request for 4.0 -rc cycle. We should thank Axel Lin for reviewing all the PHY drivers and sending fixes. This also includes a fix from Thierry Reding in phy core.

Let me know if I have to change something.

Thanks
Kishon

The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

   Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

Quoted 9 lines

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

for you to fetch changes up to b1ff3231b2d4197ef5024f9c57ffc6cfa562590c:

phy: omap-usb2: Fix missing clk_prepare call when using old dt name (2015-03-13 17:14:39 +0530)

----------------------------------------------------------------
contains fixes all over drivers/phy

Quoted 6 lines

That's a horrible pull request summary. Please at least give me something "real" to go on here. As it is, would you accept such a changelog entry?

I'll just take the individual patches, to keep this out of the commit log...

sorry, I'll send an updated pull request if that is okay.

Thanks
Kishon

#23 lore raw
In reply to Greg KH

Hi Greg,

Please find the updated pull request for 4.0 -rc. This mostly consists of fixes done by Axel Lin all over the PHY drivers. It also includes a couple of fixes in phy core.

Let me know if I have to change something.

Thanks
Kishon

The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

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

for you to fetch changes up to b1ff3231b2d4197ef5024f9c57ffc6cfa562590c:

phy: omap-usb2: Fix missing clk_prepare call when using old dt name
(2015-03-13 17:14:39 +0530)

----------------------------------------------------------------
contains fixes all over drivers/phy and includes the following *) Using phy_get_drvdata instead of dev_get_drvdata in armada375-usb2.c *) Fixes w.r.t checking return values in regmap APIs, protecting regmap ops
with spin lock and directly using regmap_update_bits instead of having a separate function to do the same in the various PHYs used in exynos.
*) check return value in platform_get_resource of hix5hd2-sata PHY *) Removed NULL terminating entry from phys array and fix off-by-one
valid value checking for args->args[0] in of_xlate of exynos USB PHY.
*) Fixup rockchip_usb_phy_power_on failure path
*) Fix devm_phy_match to find the correct match in phy core and also fix to
return the correct value from PHY APIs if PM runtime is not enabled.
*) Removed redundant code in twl4030 and xgene
*) Fixed sizeof during memory allocation in miphy PHYs
*) simplify ti_pipe3_dpll_wait_lock implementation, fix missing clk_prepare
when using old dt name and nit pick in MOUDLE_ALIAS in TI PHYs.

----------------------------------------------------------------
Axel Lin (19):
phy: miphy28lp: Avoid calling of_get_child_count() multiple times
phy: miphy365x: Avoid calling of_get_child_count() multiple times
phy: armada375-usb2: Set drvdata for phy and use it
phy: xgene: Remove duplicate code to set ctx->dev
phy: miphy28lp: Add missing .owner field in miphy28lp_ops
phy: exynos-mipi-video: Fixup the test for state->regmap
phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations
phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function
phy: hix5hd2-sata: Check return value of platform_get_resource
phy: samsung-usb2: Remove NULL terminating entry from phys array
phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation
phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path
phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0]
phy: twl4030-usb: Remove redundant assignment for twl->linkstat
phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof
phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof
phy: core: Fixup return value of phy_exit when !pm_runtime_enabled
phy: ti/omap: Fix modalias
phy: omap-usb2: Fix missing clk_prepare call when using old dt name

Thierry Reding (1):
phy: Find the right match in devm_phy_destroy()

 drivers/phy/phy-armada375-usb2.c    |    3 ++-
 drivers/phy/phy-core.c              |   11 ++++++-----
 drivers/phy/phy-exynos-dp-video.c   |   24 ++++--------------------
 drivers/phy/phy-exynos-mipi-video.c |   11 ++++-------
 drivers/phy/phy-exynos4210-usb2.c   |    1 -
 drivers/phy/phy-exynos4x12-usb2.c   |    1 -
 drivers/phy/phy-exynos5-usbdrd.c    |    2 +-
 drivers/phy/phy-exynos5250-usb2.c   |    1 -
 drivers/phy/phy-hix5hd2-sata.c      |    3 +++
 drivers/phy/phy-miphy28lp.c         |   13 +++++++------
 drivers/phy/phy-miphy365x.c         |   12 ++++++------
 drivers/phy/phy-omap-control.c      |    2 +-
 drivers/phy/phy-omap-usb2.c         |    7 ++++---
 drivers/phy/phy-rockchip-usb.c      |    6 +++---
 drivers/phy/phy-ti-pipe3.c          |   12 ++++--------
 drivers/phy/phy-twl4030-usb.c       |    1 -
 drivers/phy/phy-xgene.c             |    1 -
 17 files changed, 45 insertions(+), 66 deletions(-)
#24 lore raw
Quoted 11 lines · Kishon Vijay Abraham I

Hi Greg,

Please find the updated pull request for 4.0 -rc. This mostly consists of fixes done by Axel Lin all over the PHY drivers. It also includes a couple of fixes in phy core.

Let me know if I have to change something.

Thanks
Kishon

Quoted 8 lines

The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

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

All pulled and pushed out, thanks.

greg k-h