Skip to contentSkip to conversation

USB chipidea i.MX: use framework phy handling

PATCH New Sascha Hauer 5 participants 15 messages Jan 31, 2013 – Feb 27, 2013

Subsystems (3)
lore
Share & tools
lore

Sascha Hauer

author maintainer
#0 lore raw

PATCH 1/1 USB chipidea i.MX: use framework phy handling

This series switches the mxs phy and the i.MX chipidea support from homegrew phy support to use usb_add_phy_dev/devm_usb_get_phy_by_phandle.

Based on

[PATCH v2] Add USB of helpers and use them in the chipidea driver

But I think this could also be applied separately if necessary.

Sascha

----------------------------------------------------------------
Sascha Hauer (2):
USB mxs-phy: Register phy with framework
USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy

 drivers/usb/chipidea/ci13xxx_imx.c |   31 ++++++++++---------------------
 drivers/usb/otg/mxs-phy.c          |    9 +++++++++
 2 files changed, 19 insertions(+), 21 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 USB mxs-phy: Register phy with framework

We now have usb_add_phy_dev(), so use it to register with the framework to be able to find the phy from the USB driver.

---
 drivers/usb/otg/mxs-phy.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/usb/otg/mxs-phy.c +9 -0
index 5158332..5b39885 100644
@@ -127,6 +127,7 @@ static int mxs_phy_probe(struct platform_device *pdev)
 	void __iomem *base;
 	struct clk *clk;
 	struct mxs_phy *mxs_phy;
+	int ret;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
@@ -166,11 +167,19 @@ static int mxs_phy_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, &mxs_phy->phy);
 
+	ret = usb_add_phy_dev(&mxs_phy->phy);
+	if (ret)
+		return ret;
+
 	return 0;
 }
 
 static int mxs_phy_remove(struct platform_device *pdev)
 {
+	struct mxs_phy *mxs_phy = platform_get_drvdata(pdev);
+
+	usb_remove_phy(&mxs_phy->phy);
+
 	platform_set_drvdata(pdev, NULL);
 
 	return 0;
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 1/2 USB mxs-phy: Register phy with framework

Quoted 4 lines · Sascha Hauer

We now have usb_add_phy_dev(), so use it to register with the framework to be able to find the phy from the USB driver.

Quoted 37 lines
---
  drivers/usb/otg/mxs-phy.c |    9 +++++++++
  1 file changed, 9 insertions(+)
drivers/usb/otg/mxs-phy.c +9 -0
index 5158332..5b39885 100644
@@ -127,6 +127,7 @@ static int mxs_phy_probe(struct platform_device *pdev)
  	void __iomem *base;
  	struct clk *clk;
  	struct mxs_phy *mxs_phy;
+	int ret;
 
  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  	if (!res) {
@@ -166,11 +167,19 @@ static int mxs_phy_probe(struct platform_device *pdev)
 
  	platform_set_drvdata(pdev, &mxs_phy->phy);
 
+	ret = usb_add_phy_dev(&mxs_phy->phy);
+	if (ret)
+		return ret;
+
  	return 0;
  }
 
  static int mxs_phy_remove(struct platform_device *pdev)
  {
+	struct mxs_phy *mxs_phy = platform_get_drvdata(pdev);
+
+	usb_remove_phy(&mxs_phy->phy);
+
  	platform_set_drvdata(pdev, NULL);
 
  	return 0;
#3 lore raw

PATCH 1/2 USB mxs-phy: Register phy with framework

In reply to Sascha Hauer
Quoted 30 lines · Sascha Hauer

We now have usb_add_phy_dev(), so use it to register with the framework to be able to find the phy from the USB driver.

---
 drivers/usb/otg/mxs-phy.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/usb/otg/mxs-phy.c +5 -0
index 5158332..5b39885 100644
@@ -127,6 +127,7 @@ static int mxs_phy_probe(struct platform_device *pdev)
 	void __iomem *base;
 	struct clk *clk;
 	struct mxs_phy *mxs_phy;
+	int ret;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
@@ -166,11 +167,19 @@ static int mxs_phy_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, &mxs_phy->phy);
 
+	ret = usb_add_phy_dev(&mxs_phy->phy);
+	if (ret)
+		return ret;
+
 	return 0;
 }

drivers/usb/otg/mxs-phy.c static int mxs_phy_probe(struct platform_device *pdev) · line 185

Quoted 10 lines
drivers/usb/otg/mxs-phy.c +4 -0
 
 static int mxs_phy_remove(struct platform_device *pdev)
 {
+	struct mxs_phy *mxs_phy = platform_get_drvdata(pdev);
+
+	usb_remove_phy(&mxs_phy->phy);
+
 	platform_set_drvdata(pdev, NULL);
 
 	return 0;
Signature · 2 lines
Best Regards,
Peter Chen
#4 lore raw

PATCH 1/2 USB mxs-phy: Register phy with framework

In reply to Sascha Hauer

Hi,

Quoted 4 lines · Sascha Hauer

We now have usb_add_phy_dev(), so use it to register with the framework to be able to find the phy from the USB driver.

Sascha, are you taking this through your tree or you want me to queue it up ?

If you want to take it:

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130214/3b0a8117/attachment.sig>
author maintainer
#5 lore raw

PATCH 1/2 USB mxs-phy: Register phy with framework

Quoted 10 lines · Felipe Balbi

Hi,

Quoted 4 lines · Sascha Hauer

We now have usb_add_phy_dev(), so use it to register with the framework to be able to find the phy from the USB driver.

Sascha, are you taking this through your tree or you want me to queue it up ?

I would prefer if either you could take it or Alexander Shishkin along with the other patches in:

[PATCH v4] USB: add devicetree helpers for determining dr_mode and phy_type

Could you have a look at them? Alexander is asking for an ack for 1/9, 2/9, 3/9, 8/9. I just realized you are not on Cc for these. I could bounce you the patches in case you don't have them in your mailbox.

Thanks
Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#6 lore raw

PATCH 1/2 USB mxs-phy: Register phy with framework

Hi,

Quoted 12 lines · Sascha Hauer
Quoted 10 lines · Felipe Balbi

Hi,

Quoted 4 lines · Sascha Hauer

We now have usb_add_phy_dev(), so use it to register with the framework to be able to find the phy from the USB driver.

Sascha, are you taking this through your tree or you want me to queue it up ?

Quoted 8 lines

I would prefer if either you could take it or Alexander Shishkin along with the other patches in:

[PATCH v4] USB: add devicetree helpers for determining dr_mode and phy_type

Could you have a look at them? Alexander is asking for an ack for 1/9, 2/9, 3/9, 8/9. I just realized you are not on Cc for these. I could bounce you the patches in case you don't have them in your mailbox.

Ok, I'll look at them, no need to bounce. You _do_ realize, however, that Greg has already closed all his trees for v3.9, right ? So anything from now on will be queued for v3.10.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130214/4b0d1f36/attachment.sig>
author maintainer
#7 lore raw

PATCH 1/2 USB mxs-phy: Register phy with framework

Quoted 20 lines · Felipe Balbi

Hi,

Quoted 17 lines · Sascha Hauer
Quoted 10 lines · Felipe Balbi

Hi,

Quoted 4 lines · Sascha Hauer

We now have usb_add_phy_dev(), so use it to register with the framework to be able to find the phy from the USB driver.

Sascha, are you taking this through your tree or you want me to queue it up ?

I would prefer if either you could take it or Alexander Shishkin along with the other patches in:

[PATCH v4] USB: add devicetree helpers for determining dr_mode and phy_type

Quoted 7 lines
Quoted 3 lines

Could you have a look at them? Alexander is asking for an ack for 1/9, 2/9, 3/9, 8/9. I just realized you are not on Cc for these. I could bounce you the patches in case you don't have them in your mailbox.

Ok, I'll look at them, no need to bounce. You _do_ realize, however, that Greg has already closed all his trees for v3.9, right ? So anything from now on will be queued for v3.10.

I'm fine with that. I'm just a bit insistent because the chipidea patches are floating around for half a year now. Once I have the warm feeling that the patches are handled I have time ;)

Thanks
Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#8 lore raw

PATCH 1/2 USB mxs-phy: Register phy with framework

Quoted 25 lines · Sascha Hauer
Quoted 24 lines · Felipe Balbi

Hi,

Quoted 20 lines · Sascha Hauer
Quoted 10 lines · Felipe Balbi

Hi,

Quoted 4 lines · Sascha Hauer

We now have usb_add_phy_dev(), so use it to register with the framework to be able to find the phy from the USB driver.

Sascha, are you taking this through your tree or you want me to queue it up ?

I would prefer if either you could take it or Alexander Shishkin along with the other patches in:

[PATCH v4] USB: add devicetree helpers for determining dr_mode and phy_type

Could you have a look at them? Alexander is asking for an ack for 1/9, 2/9, 3/9, 8/9. I just realized you are not on Cc for these. I could bounce you the patches in case you don't have them in your mailbox.

Quoted 7 lines
Quoted 3 lines

Ok, I'll look at them, no need to bounce. You _do_ realize, however, that Greg has already closed all his trees for v3.9, right ? So anything from now on will be queued for v3.10.

I'm fine with that. I'm just a bit insistent because the chipidea patches are floating around for half a year now. Once I have the warm feeling that the patches are handled I have time ;)

I'm getting ready to queue patches but, when looking at this thread, it seems like another version should've been sent. I'll skip this and look at the other chipidea threads,

cheers

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130227/7fbb38c0/attachment.sig>
#9 lore raw

PATCH 1/2 USB mxs-phy: Register phy with framework

Quoted 30 lines · Felipe Balbi
Quoted 29 lines · Sascha Hauer
Quoted 27 lines · Felipe Balbi

Hi,

Quoted 12 lines · Sascha Hauer
Quoted 10 lines · Felipe Balbi

Hi,

Quoted 4 lines · Sascha Hauer

We now have usb_add_phy_dev(), so use it to register with the framework to be able to find the phy from the USB driver.

Sascha, are you taking this through your tree or you want me to queue it up ?

Quoted 8 lines

I would prefer if either you could take it or Alexander Shishkin along with the other patches in:

[PATCH v4] USB: add devicetree helpers for determining dr_mode and phy_type

Could you have a look at them? Alexander is asking for an ack for 1/9, 2/9, 3/9, 8/9. I just realized you are not on Cc for these. I could bounce you the patches in case you don't have them in your mailbox.

Ok, I'll look at them, no need to bounce. You _do_ realize, however, that Greg has already closed all his trees for v3.9, right ? So anything from now on will be queued for v3.10.

Quoted 7 lines
Quoted 3 lines

I'm fine with that. I'm just a bit insistent because the chipidea patches are floating around for half a year now. Once I have the warm feeling that the patches are handled I have time ;)

I'm getting ready to queue patches but, when looking at this thread, it seems like another version should've been sent. I'll skip this and look at the other chipidea threads,

I'm currently rebasing Saschas patches to Greg's usb-net.

Marc

---

Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130227/2b8b8b74/attachment.sig>

author maintainer
#10 lore raw

PATCH 2/2 USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy

In reply to Sascha Hauer
---
 drivers/usb/chipidea/ci13xxx_imx.c |   31 ++++++++++---------------------
 1 file changed, 10 insertions(+), 21 deletions(-)
drivers/usb/chipidea/ci13xxx_imx.c +10 -21
index b598bb8f..1df4b41 100644
@@ -30,7 +30,6 @@
 	((struct usb_phy *)platform_get_drvdata(pdev))
 
 struct ci13xxx_imx_data {
-	struct device_node *phy_np;
 	struct usb_phy *phy;
 	struct platform_device *ci_pdev;
 	struct clk *clk;
@@ -90,12 +89,12 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
 {
 	struct ci13xxx_imx_data *data;
 	struct ci13xxx_platform_data *pdata;
-	struct platform_device *plat_ci, *phy_pdev;
-	struct device_node *phy_np;
+	struct platform_device *plat_ci;
 	struct resource *res;
 	struct regulator *reg_vbus;
 	struct pinctrl *pinctrl;
 	int ret;
+	struct usb_phy *phy;
 
 	if (of_find_property(pdev->dev.of_node, "fsl,usbmisc", NULL)
 		&& !usbmisc_ops)
@@ -147,18 +146,12 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	phy_np = of_parse_phandle(pdev->dev.of_node, "fsl,usbphy", 0);
-	if (phy_np) {
-		data->phy_np = phy_np;
-		phy_pdev = of_find_device_by_node(phy_np);
-		if (phy_pdev) {
-			struct usb_phy *phy;
-			phy = pdev_to_phy(phy_pdev);
-			if (phy &&
-			    try_module_get(phy_pdev->dev.driver->owner)) {
-				usb_phy_init(phy);
-				data->phy = phy;
-			}
+	phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0);
+	if (!IS_ERR(phy)) {
+		ret = usb_phy_init(phy);
+		if (ret) {
+			dev_err(&pdev->dev, "unable to init phy: %d\n", ret);
+			goto err_clk;
 		}
 	}
 
@@ -170,7 +163,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev,
 				"Failed to enable vbus regulator, err=%d\n",
 				ret);
-			goto put_np;
+			goto err_clk;
 		}
 		data->reg_vbus = reg_vbus;
 	} else {
@@ -222,9 +215,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
 err:
 	if (reg_vbus)
 		regulator_disable(reg_vbus);
-put_np:
-	if (phy_np)
-		of_node_put(phy_np);
+err_clk:
 	clk_disable_unprepare(data->clk);
 	return ret;
 }
@@ -244,8 +235,6 @@ static int ci13xxx_imx_remove(struct platform_device *pdev)
 		module_put(data->phy->dev->driver->owner);
 	}
 
-	of_node_put(data->phy_np);
-
 	clk_disable_unprepare(data->clk);
 
 	platform_set_drvdata(pdev, NULL);
Signature · 1 line
1.7.10.4
author maintainer
#13 lore raw

PATCH 1/1 USB chipidea i.MX: use framework phy handling

In reply to Sascha Hauer
Quoted 8 lines · Sascha Hauer

This series switches the mxs phy and the i.MX chipidea support from homegrew phy support to use usb_add_phy_dev/devm_usb_get_phy_by_phandle.

Based on

[PATCH v2] Add USB of helpers and use them in the chipidea driver

But I think this could also be applied separately if necessary.

Kishon, Peter,

Thanks for reviewing these, but I'm afraid I must send another iteration for these. These patches do not handle -EPROBE_DEFER correctly.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#14 lore raw

PATCH 1/1 USB chipidea i.MX: use framework phy handling

Quoted 6 lines · Sascha Hauer
Quoted 5 lines · Sascha Hauer

This series switches the mxs phy and the i.MX chipidea support from homegrew phy support to use usb_add_phy_dev/devm_usb_get_phy_by_phandle.

Based on

Quoted 8 lines
Quoted 3 lines

[PATCH v2] Add USB of helpers and use them in the chipidea driver

But I think this could also be applied separately if necessary.

Kishon, Peter,

Thanks for reviewing these, but I'm afraid I must send another iteration for these. These patches do not handle -EPROBE_DEFER correctly.

which patch you have added handle -EPROBE_DEFER at v3?

Quoted 9 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Signature · 2 lines
Best Regards,
Peter Chen