Skip to contentSkip to conversation

add imx usb driver for mx28/6x

PATCH Superseded Richard Zhao 9 participants 60 messages May 25, 2012 – Jun 21, 2012

Subsystems (10)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover add imx usb driver for mx28/6x

The work is based on ci13xxx rework done by Alexander Shishkin.

Status:
- this version only support host
- usbotg controler works at host role

Changes since V2:
- Rebase to Alex's tree
- Use regulator to control vbus power
- Remove ARCH check in Kconfig, but add OF_DEV check.
- Other changes according laster version comments.

Richard Zhao (12):
usb: otg: add notify_connect/notify_disconnect callback
usb: chipidea: permit driver bindings pass phy pointer
usb: ehci-hcd: notify phy when connect change
usb: otg: add basic mxs phy driver support
usb: chipidea: add imx platform driver
ARM: imx6q: correct device name of usbphy and usb controller clock
export
ARM: imx6q: add config-on-boot gpios
ARM: imx6q: add usbphy clocks
ARM: imx6q: disable usb charger detector
ARM: dts: imx6q-sabrelite: add usb devices
ARM: mxs: clk_register_clkdev mx28 usb clocks
ARM: dts: imx28-evk: add usb devices

 .../devicetree/bindings/arm/config-on-boot.txt     |   12 ++
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 Documentation/devicetree/bindings/usb/mxs-phy.txt  |   13 ++
 arch/arm/boot/dts/imx28-evk.dts                    |   36 ++++
 arch/arm/boot/dts/imx28.dtsi                       |   12 +-
 arch/arm/boot/dts/imx6q-sabrelite.dts              |   35 ++++
 arch/arm/boot/dts/imx6q.dtsi                       |   36 ++++-
 arch/arm/mach-imx/clk-imx6q.c                      |   12 +-
 arch/arm/mach-imx/mach-imx6q.c                     |   59 ++++++
 drivers/clk/mxs/clk-imx28.c                        |    4 +
 drivers/usb/chipidea/Makefile                      |    3 +
 drivers/usb/chipidea/ci.h                          |    2 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  189 ++++++++++++++++++
 drivers/usb/chipidea/core.c                        |    4 +
 drivers/usb/chipidea/host.c                        |    1 +
 drivers/usb/chipidea/udc.c                         |   11 +-
 drivers/usb/host/ehci-hcd.c                        |   14 ++
 drivers/usb/otg/Kconfig                            |    8 +
 drivers/usb/otg/Makefile                           |    1 +
 drivers/usb/otg/mxs-phy.c                          |  204 ++++++++++++++++++++
 include/linux/usb/chipidea.h                       |    3 +
 include/linux/usb/otg.h                            |   21 ++
 22 files changed, 690 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/config-on-boot.txt
 create mode 100644 Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
 create mode 100644 Documentation/devicetree/bindings/usb/mxs-phy.txt
 create mode 100644 drivers/usb/chipidea/ci13xxx_imx.c
 create mode 100644 drivers/usb/otg/mxs-phy.c
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH v3 1/12 usb: otg: add notify_connect/notify_disconnect callback

This let usb phy driver has a chance to change hw settings when connect status change.

---
 include/linux/usb/otg.h |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +21 -0
index 38ab3f4..6dfdc8d 100644
@@ -117,6 +117,9 @@ struct usb_phy {
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect)(struct usb_phy *x, int port);
+	int	(*notify_disconnect)(struct usb_phy *x, int port);
 };
 
 
@@ -252,6 +255,24 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 }
 
 static inline int
+usb_phy_notify_connect(struct usb_phy *x, int port)
+{
+	if (x->notify_connect)
+		return x->notify_connect(x, port);
+	else
+		return 0;
+}
+
+static inline int
+usb_phy_notify_disconnect(struct usb_phy *x, int port)
+{
+	if (x->notify_disconnect)
+		return x->notify_disconnect(x, port);
+	else
+		return 0;
+}
+
+static inline int
 otg_start_srp(struct usb_otg *otg)
 {
 	if (otg && otg->start_srp)
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH v3 1/12 usb: otg: add notify_connect/notify_disconnect callback

Hi,

Quoted 4 lines · Richard Zhao

This let usb phy driver has a chance to change hw settings when connect status change.

Quoted 47 lines
---
 include/linux/usb/otg.h |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +21 -0
index 38ab3f4..6dfdc8d 100644
@@ -117,6 +117,9 @@ struct usb_phy {
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect)(struct usb_phy *x, int port);
+	int	(*notify_disconnect)(struct usb_phy *x, int port);
 };
 
 
@@ -252,6 +255,24 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 }
 
 static inline int
+usb_phy_notify_connect(struct usb_phy *x, int port)
+{
+	if (x->notify_connect)
+		return x->notify_connect(x, port);
+	else
+		return 0;
+}
+
+static inline int
+usb_phy_notify_disconnect(struct usb_phy *x, int port)
+{
+	if (x->notify_disconnect)
+		return x->notify_disconnect(x, port);
+	else
+		return 0;
+}
+
+static inline int
 otg_start_srp(struct usb_otg *otg)
 {
 	if (otg && otg->start_srp)
Signature · 1 line
1.7.5.4
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/20120606/50633fde/attachment.sig>
#3 lore raw

PATCH v3 2/12 usb: chipidea: permit driver bindings pass phy pointer

In reply to Richard Zhao

Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy.

---
 drivers/usb/chipidea/ci.h    |    2 ++
 drivers/usb/chipidea/core.c  |    4 ++++
 drivers/usb/chipidea/host.c  |    1 +
 drivers/usb/chipidea/udc.c   |   11 +++++++----
 include/linux/usb/chipidea.h |    3 +++
 5 files changed, 17 insertions(+), 4 deletions(-)
drivers/usb/chipidea/ci.h +2 -0
index 9655e35..d738603 100644
@@ -160,6 +160,8 @@ struct ci13xxx {
 
 	struct ci13xxx_platform_data	*platdata;
 	int				vbus_active;
+	/* FIXME: some day, we'll not use global phy */
+	bool				global_phy;
 	struct usb_phy			*transceiver;
 	struct usb_hcd			*hcd;
 };
drivers/usb/chipidea/core.c +4 -0
index c14ce2b..21407e7 100644
@@ -419,6 +419,10 @@ static int __devinit ci_hdrc_probe(struct platform_device *pdev)
 
 	ci->dev = dev;
 	ci->platdata = dev->platform_data;
+	if (ci->platdata->phy)
+		ci->transceiver = ci->platdata->phy;
+	else
+		ci->global_phy = true;
 
 	ret = hw_device_init(ci, base);
 	if (ret < 0) {
drivers/usb/chipidea/host.c +1 -0
index 4a4fdb8..4479f5a 100644
@@ -121,6 +121,7 @@ static int host_start(struct ci13xxx *ci)
 	ehci = hcd_to_ehci(hcd);
 	ehci->caps = ci->hw_bank.cap;
 	ehci->has_hostpc = ci->hw_bank.lpm;
+	ehci->transceiver = ci->transceiver;
 
 	ret = usb_add_hcd(hcd, 0, 0);
 	if (ret)
drivers/usb/chipidea/udc.c +7 -4
index ca9b387..b43b29c 100644
@@ -1684,7 +1684,8 @@ static int udc_start(struct ci13xxx *ci)
 
 	ci->gadget.ep0 = &ci->ep0in->ep;
 
-	ci->transceiver = usb_get_transceiver();
+	if (ci->global_phy) {
+		ci->transceiver = usb_get_transceiver();
 
 	if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
 		if (ci->transceiver == NULL) {
@@ -1728,7 +1729,8 @@ static int udc_start(struct ci13xxx *ci)
 remove_trans:
 	if (ci->transceiver) {
 		otg_set_peripheral(ci->transceiver->otg, &ci->gadget);
-		usb_put_transceiver(ci->transceiver);
+		if (ci->global_phy)
+			usb_put_transceiver(ci->transceiver);
 	}
 
 	dev_err(dev, "error = %i\n", retval);
@@ -1737,7 +1739,7 @@ remove_dbg:
 unreg_device:
 	device_unregister(&ci->gadget.dev);
 put_transceiver:
-	if (ci->transceiver)
+	if (ci->transceiver && ci->global_phy)
 		usb_put_transceiver(ci->transceiver);
 free_pools:
 	dma_pool_destroy(ci->td_pool);
@@ -1771,7 +1773,8 @@ static void udc_stop(struct ci13xxx *ci)
 
 	if (ci->transceiver) {
 		otg_set_peripheral(ci->transceiver->otg, NULL);
-		usb_put_transceiver(ci->transceiver);
+		if (ci->global_phy)
+			usb_put_transceiver(ci->transceiver);
 	}
 	dbg_remove_files(&ci->gadget.dev);
 	device_unregister(&ci->gadget.dev);
include/linux/usb/chipidea.h +3 -0
index be078f0..544825d 100644
@@ -5,12 +5,15 @@
 #ifndef __LINUX_USB_CHIPIDEA_H
 #define __LINUX_USB_CHIPIDEA_H
 
+#include <linux/usb/otg.h>
+
 struct ci13xxx;
 struct ci13xxx_platform_data {
 	const char	*name;
 	/* offset of the capability registers */
 	uintptr_t	 capoffset;
 	unsigned	 power_budget;
+	struct usb_phy	*phy;
 	unsigned long	 flags;
 #define CI13XXX_REGS_SHARED		BIT(0)
 #define CI13XXX_REQUIRE_TRANSCEIVER	BIT(1)
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH v3 2/12 usb: chipidea: permit driver bindings pass phy pointer

Quoted 6 lines · Richard Zhao

Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy.

Quoted 115 lines
---
 drivers/usb/chipidea/ci.h    |    2 ++
 drivers/usb/chipidea/core.c  |    4 ++++
 drivers/usb/chipidea/host.c  |    1 +
 drivers/usb/chipidea/udc.c   |   11 +++++++----
 include/linux/usb/chipidea.h |    3 +++
 5 files changed, 17 insertions(+), 4 deletions(-)
drivers/usb/chipidea/ci.h +2 -0
index 9655e35..d738603 100644
@@ -160,6 +160,8 @@ struct ci13xxx {
 
 	struct ci13xxx_platform_data	*platdata;
 	int				vbus_active;
+	/* FIXME: some day, we'll not use global phy */
+	bool				global_phy;
 	struct usb_phy			*transceiver;
 	struct usb_hcd			*hcd;
 };
drivers/usb/chipidea/core.c +4 -0
index c14ce2b..21407e7 100644
@@ -419,6 +419,10 @@ static int __devinit ci_hdrc_probe(struct platform_device *pdev)
 
 	ci->dev = dev;
 	ci->platdata = dev->platform_data;
+	if (ci->platdata->phy)
+		ci->transceiver = ci->platdata->phy;
+	else
+		ci->global_phy = true;
 
 	ret = hw_device_init(ci, base);
 	if (ret < 0) {
drivers/usb/chipidea/host.c +1 -0
index 4a4fdb8..4479f5a 100644
@@ -121,6 +121,7 @@ static int host_start(struct ci13xxx *ci)
 	ehci = hcd_to_ehci(hcd);
 	ehci->caps = ci->hw_bank.cap;
 	ehci->has_hostpc = ci->hw_bank.lpm;
+	ehci->transceiver = ci->transceiver;
 
 	ret = usb_add_hcd(hcd, 0, 0);
 	if (ret)
drivers/usb/chipidea/udc.c +7 -4
index ca9b387..b43b29c 100644
@@ -1684,7 +1684,8 @@ static int udc_start(struct ci13xxx *ci)
 
 	ci->gadget.ep0 = &ci->ep0in->ep;
 
-	ci->transceiver = usb_get_transceiver();
+	if (ci->global_phy) {
+		ci->transceiver = usb_get_transceiver();
 
 	if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
 		if (ci->transceiver == NULL) {
@@ -1728,7 +1729,8 @@ static int udc_start(struct ci13xxx *ci)
 remove_trans:
 	if (ci->transceiver) {
 		otg_set_peripheral(ci->transceiver->otg, &ci->gadget);
-		usb_put_transceiver(ci->transceiver);
+		if (ci->global_phy)
+			usb_put_transceiver(ci->transceiver);
 	}
 
 	dev_err(dev, "error = %i\n", retval);
@@ -1737,7 +1739,7 @@ remove_dbg:
 unreg_device:
 	device_unregister(&ci->gadget.dev);
 put_transceiver:
-	if (ci->transceiver)
+	if (ci->transceiver && ci->global_phy)
 		usb_put_transceiver(ci->transceiver);
 free_pools:
 	dma_pool_destroy(ci->td_pool);
@@ -1771,7 +1773,8 @@ static void udc_stop(struct ci13xxx *ci)
 
 	if (ci->transceiver) {
 		otg_set_peripheral(ci->transceiver->otg, NULL);
-		usb_put_transceiver(ci->transceiver);
+		if (ci->global_phy)
+			usb_put_transceiver(ci->transceiver);
 	}
 	dbg_remove_files(&ci->gadget.dev);
 	device_unregister(&ci->gadget.dev);
include/linux/usb/chipidea.h +3 -0
index be078f0..544825d 100644
@@ -5,12 +5,15 @@
 #ifndef __LINUX_USB_CHIPIDEA_H
 #define __LINUX_USB_CHIPIDEA_H
 
+#include <linux/usb/otg.h>
+
 struct ci13xxx;
 struct ci13xxx_platform_data {
 	const char	*name;
 	/* offset of the capability registers */
 	uintptr_t	 capoffset;
 	unsigned	 power_budget;
+	struct usb_phy	*phy;
 	unsigned long	 flags;
 #define CI13XXX_REGS_SHARED		BIT(0)
 #define CI13XXX_REQUIRE_TRANSCEIVER	BIT(1)
Signature · 1 line
1.7.5.4
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/20120606/4cebb060/attachment.sig>
#5 lore raw

PATCH v4 1/1 usb: chipidea: permit driver bindings pass phy pointer

In reply to Richard Zhao

Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy.

---
Changes since laster version:
- hcd transceiver renamed to phy

 drivers/usb/chipidea/ci.h    |    2 ++
 drivers/usb/chipidea/core.c  |    4 ++++
 drivers/usb/chipidea/host.c  |    1 +
 drivers/usb/chipidea/udc.c   |   11 +++++++----
 include/linux/usb/chipidea.h |    3 +++
 5 files changed, 17 insertions(+), 4 deletions(-)
drivers/usb/chipidea/ci.h +2 -0
index 9655e35..d738603 100644
@@ -160,6 +160,8 @@ struct ci13xxx {
 
 	struct ci13xxx_platform_data	*platdata;
 	int				vbus_active;
+	/* FIXME: some day, we'll not use global phy */
+	bool				global_phy;
 	struct usb_phy			*transceiver;
 	struct usb_hcd			*hcd;
 };
drivers/usb/chipidea/core.c +4 -0
index c14ce2b..21407e7 100644
@@ -419,6 +419,10 @@ static int __devinit ci_hdrc_probe(struct platform_device *pdev)
 
 	ci->dev = dev;
 	ci->platdata = dev->platform_data;
+	if (ci->platdata->phy)
+		ci->transceiver = ci->platdata->phy;
+	else
+		ci->global_phy = true;
 
 	ret = hw_device_init(ci, base);
 	if (ret < 0) {
drivers/usb/chipidea/host.c +1 -0
index 4a4fdb8..ebff9f4 100644
@@ -117,6 +117,7 @@ static int host_start(struct ci13xxx *ci)
 	hcd->has_tt = 1;
 
 	hcd->power_budget = ci->platdata->power_budget;
+	hcd->phy = ci->transceiver;
 
 	ehci = hcd_to_ehci(hcd);
 	ehci->caps = ci->hw_bank.cap;
drivers/usb/chipidea/udc.c +7 -4
index ca9b387..b43b29c 100644
@@ -1684,7 +1684,8 @@ static int udc_start(struct ci13xxx *ci)
 
 	ci->gadget.ep0 = &ci->ep0in->ep;
 
-	ci->transceiver = usb_get_transceiver();
+	if (ci->global_phy) {
+		ci->transceiver = usb_get_transceiver();
 
 	if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
 		if (ci->transceiver == NULL) {
@@ -1728,7 +1729,8 @@ static int udc_start(struct ci13xxx *ci)
 remove_trans:
 	if (ci->transceiver) {
 		otg_set_peripheral(ci->transceiver->otg, &ci->gadget);
-		usb_put_transceiver(ci->transceiver);
+		if (ci->global_phy)
+			usb_put_transceiver(ci->transceiver);
 	}
 
 	dev_err(dev, "error = %i\n", retval);
@@ -1737,7 +1739,7 @@ remove_dbg:
 unreg_device:
 	device_unregister(&ci->gadget.dev);
 put_transceiver:
-	if (ci->transceiver)
+	if (ci->transceiver && ci->global_phy)
 		usb_put_transceiver(ci->transceiver);
 free_pools:
 	dma_pool_destroy(ci->td_pool);
@@ -1771,7 +1773,8 @@ static void udc_stop(struct ci13xxx *ci)
 
 	if (ci->transceiver) {
 		otg_set_peripheral(ci->transceiver->otg, NULL);
-		usb_put_transceiver(ci->transceiver);
+		if (ci->global_phy)
+			usb_put_transceiver(ci->transceiver);
 	}
 	dbg_remove_files(&ci->gadget.dev);
 	device_unregister(&ci->gadget.dev);
include/linux/usb/chipidea.h +3 -0
index be078f0..544825d 100644
@@ -5,12 +5,15 @@
 #ifndef __LINUX_USB_CHIPIDEA_H
 #define __LINUX_USB_CHIPIDEA_H
 
+#include <linux/usb/otg.h>
+
 struct ci13xxx;
 struct ci13xxx_platform_data {
 	const char	*name;
 	/* offset of the capability registers */
 	uintptr_t	 capoffset;
 	unsigned	 power_budget;
+	struct usb_phy	*phy;
 	unsigned long	 flags;
 #define CI13XXX_REGS_SHARED		BIT(0)
 #define CI13XXX_REQUIRE_TRANSCEIVER	BIT(1)
Signature · 1 line
1.7.9.5
maintainer
#6 lore raw

PATCH v4 1/1 usb: chipidea: permit driver bindings pass phy pointer

Quoted 10 lines · Richard Zhao

Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy.

---
Changes since laster version:
- hcd transceiver renamed to phy

Ick, I see patches all over this thread, and other threads, and I have no idea what to apply anywhere...

So, consider all chipidea patches dropped from my queue now, can you please resend them to me, with the accumulated acks and reviewed-by line, so that I can queue them up?

thanks,

greg k-h

#7 lore raw

PATCH v4 1/1 usb: chipidea: permit driver bindings pass phy pointer

Quoted 12 lines · Greg KH
Quoted 10 lines · Richard Zhao

Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy.

---
Changes since laster version:
- hcd transceiver renamed to phy

Quoted 2 lines

Ick, I see patches all over this thread, and other threads, and I have no idea what to apply anywhere...

I thought it only need small fix, but the fix became bigger and bigger.

Quoted 4 lines

So, consider all chipidea patches dropped from my queue now, can you please resend them to me, with the accumulated acks and reviewed-by line, so that I can queue them up?

I'll send out a new version series.

Thanks for review.
Richard

Quoted 5 lines

thanks,

greg k-h

#8 lore raw

PATCH v4 1/1 usb: chipidea: permit driver bindings pass phy pointer

In reply to Greg KH
Quoted 12 lines · Greg KH
Quoted 10 lines · Richard Zhao

Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy.

---
Changes since laster version:
- hcd transceiver renamed to phy

Quoted 6 lines

Ick, I see patches all over this thread, and other threads, and I have no idea what to apply anywhere...

So, consider all chipidea patches dropped from my queue now, can you please resend them to me, with the accumulated acks and reviewed-by line, so that I can queue them up?

So will you pick these patches to your tree or should I apply them to mine or what is the plan? I kind of have a tree [1] for chipidea stuff where I have been collecting patches, to send a pull request to you for 3.6.

[1] git://github.com/virtuoso/linux-ci.git ci

Regards,
--
Alex

maintainer
#9 lore raw

PATCH v4 1/1 usb: chipidea: permit driver bindings pass phy pointer

Quoted 17 lines · Alexander Shishkin
Quoted 15 lines · Greg KH
Quoted 10 lines · Richard Zhao

Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy.

---
Changes since laster version:
- hcd transceiver renamed to phy

Ick, I see patches all over this thread, and other threads, and I have no idea what to apply anywhere...

Quoted 8 lines
Quoted 3 lines

So, consider all chipidea patches dropped from my queue now, can you please resend them to me, with the accumulated acks and reviewed-by line, so that I can queue them up?

So will you pick these patches to your tree or should I apply them to mine or what is the plan? I kind of have a tree [1] for chipidea stuff where I have been collecting patches, to send a pull request to you for 3.6.

I do not accept pull requests for this code, sorry, I need patches in email. You and Richard work it out how you are going to handle this and then, send me patches that you both agree on.

thanks,

greg k-h

#10 lore raw

PATCH v4 1/1 usb: chipidea: permit driver bindings pass phy pointer

Quoted 22 lines · Greg KH
Quoted 21 lines · Alexander Shishkin
Quoted 18 lines · Greg KH
Quoted 10 lines · Richard Zhao

Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy.

---
Changes since laster version:
- hcd transceiver renamed to phy

Ick, I see patches all over this thread, and other threads, and I have no idea what to apply anywhere...

So, consider all chipidea patches dropped from my queue now, can you please resend them to me, with the accumulated acks and reviewed-by line, so that I can queue them up?

Quoted 8 lines
Quoted 4 lines

So will you pick these patches to your tree or should I apply them to mine or what is the plan? I kind of have a tree [1] for chipidea stuff where I have been collecting patches, to send a pull request to you for 3.6.

I do not accept pull requests for this code, sorry, I need patches in email. You and Richard work it out how you are going to handle this and then, send me patches that you both agree on.

So, Alex, Could you send out patch you queued? And I'll send out v6 patch series which depends on that. Is it ok for driver part?

For arm platform part, it may need further discussion.

Thanks
Richard

Quoted 5 lines

thanks,

greg k-h

#11 lore raw

PATCH v4 1/1 usb: chipidea: permit driver bindings pass phy pointer

Quoted 28 lines · Richard Zhao
Quoted 27 lines · Greg KH
Quoted 25 lines · Alexander Shishkin
Quoted 12 lines · Greg KH
Quoted 10 lines · Richard Zhao

Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy.

---
Changes since laster version:
- hcd transceiver renamed to phy

Quoted 6 lines

Ick, I see patches all over this thread, and other threads, and I have no idea what to apply anywhere...

So, consider all chipidea patches dropped from my queue now, can you please resend them to me, with the accumulated acks and reviewed-by line, so that I can queue them up?

So will you pick these patches to your tree or should I apply them to mine or what is the plan? I kind of have a tree [1] for chipidea stuff where I have been collecting patches, to send a pull request to you for 3.6.

Quoted 5 lines
Quoted 3 lines

I do not accept pull requests for this code, sorry, I need patches in email. You and Richard work it out how you are going to handle this and then, send me patches that you both agree on.

So, Alex, Could you send out patch you queued? And I'll send out v6 patch series which depends on that. Is it ok for driver part?

All right, I'll send out all.

Thanks
Richard

Quoted 9 lines

For arm platform part, it may need further discussion.

Thanks
Richard

Quoted 4 lines

thanks,

greg k-h

#12 lore raw

PATCH v4 1/1 usb: chipidea: permit driver bindings pass phy pointer

Quoted 29 lines · Richard Zhao
Quoted 28 lines · Richard Zhao
Quoted 27 lines · Greg KH
Quoted 25 lines · Alexander Shishkin
Quoted 12 lines · Greg KH
Quoted 10 lines · Richard Zhao

Sometimes, the driver bindings may know what phy they use. For example, when using device tree, the usb controller may have a phandler pointing to usb phy.

---
Changes since laster version:
- hcd transceiver renamed to phy

Quoted 6 lines

Ick, I see patches all over this thread, and other threads, and I have no idea what to apply anywhere...

So, consider all chipidea patches dropped from my queue now, can you please resend them to me, with the accumulated acks and reviewed-by line, so that I can queue them up?

So will you pick these patches to your tree or should I apply them to mine or what is the plan? I kind of have a tree [1] for chipidea stuff where I have been collecting patches, to send a pull request to you for 3.6.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

I do not accept pull requests for this code, sorry, I need patches in email. You and Richard work it out how you are going to handle this and then, send me patches that you both agree on.

So, Alex, Could you send out patch you queued? And I'll send out v6 patch series which depends on that. Is it ok for driver part?

All right, I'll send out all.

Yes, I think it's easiest if you send everything this time. Please make sure to rebase it on usb-next first, though.

Regards,
--
Alex

#13 lore raw

PATCH v3 3/12 usb: ehci-hcd: notify phy when connect change

In reply to Richard Zhao

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get phy there

---
 drivers/usb/host/ehci-hcd.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hcd.c +14 -0
index b100f5f..8c39a7a 100644
@@ -928,6 +928,20 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
 			pstatus = ehci_readl(ehci,
 					 &ehci->regs->port_status[i]);
 
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if ((pstatus & PORT_CSC) && ehci->transceiver) {
+				if (pstatus & PORT_CONNECT)
+					usb_phy_notify_connect(
+						ehci->transceiver, i);
+				else
+					usb_phy_notify_disconnect(
+						ehci->transceiver, i);
+			}
+
 			if (pstatus & PORT_OWNER)
 				continue;
 			if (!(test_bit(i, &ehci->suspended_ports) &&
Signature · 1 line
1.7.5.4
#14 lore raw

PATCH v3 3/12 usb: ehci-hcd: notify phy when connect change

Quoted 6 lines · Richard Zhao

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get phy there

Alan, are you ok with this?

Quoted 31 lines
---
 drivers/usb/host/ehci-hcd.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hcd.c +14 -0
index b100f5f..8c39a7a 100644
@@ -928,6 +928,20 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
 			pstatus = ehci_readl(ehci,
 					 &ehci->regs->port_status[i]);
 
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if ((pstatus & PORT_CSC) && ehci->transceiver) {
+				if (pstatus & PORT_CONNECT)
+					usb_phy_notify_connect(
+						ehci->transceiver, i);
+				else
+					usb_phy_notify_disconnect(
+						ehci->transceiver, i);
+			}
+
 			if (pstatus & PORT_OWNER)
 				continue;
 			if (!(test_bit(i, &ehci->suspended_ports) &&
Signature · 1 line
1.7.5.4

Regards,
--
Alex

maintainer
#15 lore raw

PATCH v3 3/12 usb: ehci-hcd: notify phy when connect change

Quoted 23 lines · Alexander Shishkin
Quoted 6 lines · Richard Zhao

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get phy there

Alan, are you ok with this?

Quoted 12 lines
---
 drivers/usb/host/ehci-hcd.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hcd.c +0 -0
index b100f5f..8c39a7a 100644
@@ -928,6 +928,20 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
 			pstatus = ehci_readl(ehci,
 					 &ehci->regs->port_status[i]);
 
Quoted 6 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 936

Quoted 6 lines
drivers/usb/host/ehci-hcd.c +6 -0
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if ((pstatus & PORT_CSC) && ehci->transceiver) {

Do the tests in the opposite order and add "unlikely":

			if (unlikely(ehci->transceiver &&
					(pstatus & PORT_CSC)) {

That way it will fail more quickly on systems where it doesn't apply or for unaffected ports.

Quoted 11 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 947

Quoted 11 lines
drivers/usb/host/ehci-hcd.c +8 -0
+				if (pstatus & PORT_CONNECT)
+					usb_phy_notify_connect(
+						ehci->transceiver, i);
+				else
+					usb_phy_notify_disconnect(
+						ehci->transceiver, i);
+			}
+
 			if (pstatus & PORT_OWNER)
 				continue;
 			if (!(test_bit(i, &ehci->suspended_ports) &&

Otherwise it's okay.

Alan Stern

#16 lore raw

PATCH v3 3/12 usb: ehci-hcd: notify phy when connect change

Dear Alan Stern,

Quoted 36 lines · Alexander Shishkin
Quoted 24 lines
Quoted 7 lines · Richard Zhao

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get

phy there

Alan, are you ok with this?

Quoted 13 lines

---

 drivers/usb/host/ehci-hcd.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hcd.c +0 -0
index b100f5f..8c39a7a 100644
@@ -928,6 +928,20 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
 
 			pstatus = ehci_readl(ehci,
 
Quoted 8 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 936

Quoted 8 lines
drivers/usb/host/ehci-hcd.c +6 -0
 					 &ehci->regs->port_status[i]);
 
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if ((pstatus & PORT_CSC) && ehci->transceiver) {

Do the tests in the opposite order and add "unlikely":

Quoted 5 lines
			if (unlikely(ehci->transceiver &&
					(pstatus & PORT_CSC)) {

That way it will fail more quickly on systems where it doesn't apply or for unaffected ports.

Does this unlikely() have any effect on ARM/MIPS/PPC, where this chipidea IP is used ? Or is there some x86 device sporting this IP too?

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/usb/host/ehci-hcd.c +8 -0
+				if (pstatus & PORT_CONNECT)
+					usb_phy_notify_connect(
+						ehci->transceiver, i);
+				else
+					usb_phy_notify_disconnect(
+						ehci->transceiver, i);
+			}
+
 

if (pstatus & PORT_OWNER)

Quoted 7 lines
Quoted 3 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 947

Quoted 3 lines
drivers/usb/host/ehci-hcd.c +0 -0
 				continue;
 
 			if (!(test_bit(i, &ehci->suspended_ports) &&

Otherwise it's okay.

Alan Stern

Best regards,
Marek Vasut

maintainer
#17 lore raw

PATCH v3 3/12 usb: ehci-hcd: notify phy when connect change

Quoted 9 lines · Marek Vasut
Quoted 9 lines
Quoted 6 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 936

Quoted 6 lines
drivers/usb/host/ehci-hcd.c +6 -0
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if ((pstatus & PORT_CSC) && ehci->transceiver) {

Do the tests in the opposite order and add "unlikely":

Quoted 8 lines
Quoted 5 lines
			if (unlikely(ehci->transceiver &&
					(pstatus & PORT_CSC)) {

That way it will fail more quickly on systems where it doesn't apply or for unaffected ports.

Does this unlikely() have any effect on ARM/MIPS/PPC, where this chipidea IP is used ? Or is there some x86 device sporting this IP too?

I don't know what unlikely() does on architectures other than x86. And I haven't heard of any x86 systems that would need to use this code.

On the other hand, port-status changes don't occur very frequently. A little time penalty one way or the other won't make much difference.

Alan Stern

#18 lore raw

PATCH v3 3/12 usb: ehci-hcd: notify phy when connect change

Dear Alan Stern,

Quoted 4 lines · Marek Vasut
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd)

Quoted 3 lines
drivers/usb/host/ehci-hcd.c +3 -0
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I 

can't get

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 936

Quoted 3 lines
drivers/usb/host/ehci-hcd.c +3 -0
+			 *   phy there
+			 */
+			if ((pstatus & PORT_CSC) && ehci->transceiver) {

Do the tests in the opposite order and add "unlikely":

			if (unlikely(ehci->transceiver &&
			
					(pstatus & PORT_CSC)) {
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

That way it will fail more quickly on systems where it doesn't apply or for unaffected ports.

Does this unlikely() have any effect on ARM/MIPS/PPC, where this chipidea IP is used ? Or is there some x86 device sporting this IP too?

I don't know what unlikely() does on architectures other than x86.

It should be optimized out to nothing on anything else but x86. On x86 it is a hint for the branch predictor. Or that's what I believe it is.

Quoted 5 lines

And
I haven't heard of any x86 systems that would need to use this code.

On the other hand, port-status changes don't occur very frequently. A little time penalty one way or the other won't make much difference.

I'm not opposed, just curious :)

Quoted 1 line

Alan Stern

Best regards,
Marek Vasut

maintainer
#19 lore raw

PATCH v3 3/12 usb: ehci-hcd: notify phy when connect change

Quoted 8 lines · Marek Vasut
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Do the tests in the opposite order and add "unlikely":

			if (unlikely(ehci->transceiver &&
			
					(pstatus & PORT_CSC)) {

That way it will fail more quickly on systems where it doesn't apply or for unaffected ports.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Does this unlikely() have any effect on ARM/MIPS/PPC, where this chipidea IP is used ? Or is there some x86 device sporting this IP too?

I don't know what unlikely() does on architectures other than x86.

It should be optimized out to nothing on anything else but x86. On x86 it is a hint for the branch predictor. Or that's what I believe it is.

That's right. Then it should have no effect on ARM/MIPS/PPC.

Quoted 7 lines
Quoted 5 lines

And
I haven't heard of any x86 systems that would need to use this code.

On the other hand, port-status changes don't occur very frequently. A little time penalty one way or the other won't make much difference.

I'm not opposed, just curious :)

No big deal either way. But the order of the tests should be switched, because on most systems, ehci->transceiver will be NULL.

Alan Stern

#20 lore raw

PATCH v3 3/12 usb: ehci-hcd: notify phy when connect change

Quoted 13 lines · Alan Stern
Quoted 11 lines · Marek Vasut
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines

Do the tests in the opposite order and add "unlikely":

			if (unlikely(ehci->transceiver &&
			
					(pstatus & PORT_CSC)) {

That way it will fail more quickly on systems where it doesn't apply or for unaffected ports.

Does this unlikely() have any effect on ARM/MIPS/PPC, where this chipidea IP is used ? Or is there some x86 device sporting this IP too?

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I don't know what unlikely() does on architectures other than x86.

It should be optimized out to nothing on anything else but x86. On x86 it is a hint for the branch predictor. Or that's what I believe it is.

That's right. Then it should have no effect on ARM/MIPS/PPC.

I prefer add the unlikely, we don't need to care about the arch implementation. Maybe it'll be implemented some day if it don't. and at least the code tell the reader the condition is unlikely.

I'll post a update to this series.

Thanks
Richard

Quoted 15 lines
Quoted 8 lines
Quoted 6 lines

And
I haven't heard of any x86 systems that would need to use this code.

On the other hand, port-status changes don't occur very frequently. A little time penalty one way or the other won't make much difference.

I'm not opposed, just curious :)

No big deal either way. But the order of the tests should be switched, because on most systems, ehci->transceiver will be NULL.

Alan Stern

#21 lore raw

PATCH v3 3/12 usb: ehci-hcd: notify phy when connect change

In reply to Marek Vasut
Quoted 2 lines · Marek Vasut

Does this unlikely() have any effect on ARM/MIPS/PPC, where this chipidea IP is used ? Or is there some x86 device sporting this IP too?

Of course there is. :)

Regards,
--
Alex

#22 lore raw

PATCH v4 1/1 usb: ehci-hcd: notify phy when connect change

In reply to Richard Zhao

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get phy there

---
 drivers/usb/host/ehci-hcd.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hcd.c +15 -0
index b100f5f..724ac471 100644
@@ -928,6 +928,21 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
 			pstatus = ehci_readl(ehci,
 					 &ehci->regs->port_status[i]);
 
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if (unlikely(ehci->transceiver &&
+					(pstatus & PORT_CSC))) {
+				if (pstatus & PORT_CONNECT)
+					usb_phy_notify_connect(
+						ehci->transceiver, i);
+				else
+					usb_phy_notify_disconnect(
+						ehci->transceiver, i);
+			}
+
 			if (pstatus & PORT_OWNER)
 				continue;
 			if (!(test_bit(i, &ehci->suspended_ports) &&
Signature · 1 line
1.7.5.4
#23 lore raw

PATCH v4 1/1 usb: ehci-hcd: notify phy when connect change

Quoted 15 lines · Richard Zhao

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get phy there

---
 drivers/usb/host/ehci-hcd.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hcd.c +0 -0
index b100f5f..724ac471 100644

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 937

Quoted 10 lines
drivers/usb/host/ehci-hcd.c +7 -0
@@ -928,6 +928,21 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
 			pstatus = ehci_readl(ehci,
 					 &ehci->regs->port_status[i]);
 
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if (unlikely(ehci->transceiver &&
+					(pstatus & PORT_CSC))) {

I don't think you need parens around (pstatus & PORT_CSC), since it should already have higher precedence.

Quoted 13 lines
drivers/usb/host/ehci-hcd.c +8 -0
+				if (pstatus & PORT_CONNECT)
+					usb_phy_notify_connect(
+						ehci->transceiver, i);
+				else
+					usb_phy_notify_disconnect(
+						ehci->transceiver, i);
+			}
+
 			if (pstatus & PORT_OWNER)
 				continue;
 			if (!(test_bit(i, &ehci->suspended_ports) &&
Signature · 1 line
1.7.5.4
#24 lore raw

PATCH v4 1/1 usb: ehci-hcd: notify phy when connect change

Quoted 20 lines · Alexander Shishkin
Quoted 18 lines · Richard Zhao

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get phy there

---
 drivers/usb/host/ehci-hcd.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hcd.c +0 -0
index b100f5f..724ac471 100644
@@ -928,6 +928,21 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
 			pstatus = ehci_readl(ehci,
 					 &ehci->regs->port_status[i]);
 
Quoted 10 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 937

Quoted 7 lines
drivers/usb/host/ehci-hcd.c +7 -0
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if (unlikely(ehci->transceiver &&
+					(pstatus & PORT_CSC))) {

I don't think you need parens around (pstatus & PORT_CSC), since it should already have higher precedence.

But it's more readable. Isn't it?

Thanks
Richard

#25 lore raw

PATCH v4 1/1 usb: ehci-hcd: notify phy when connect change

Quoted 31 lines · Richard Zhao
Quoted 20 lines · Alexander Shishkin
Quoted 18 lines · Richard Zhao

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get phy there

---
 drivers/usb/host/ehci-hcd.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hcd.c +0 -0
index b100f5f..724ac471 100644
@@ -928,6 +928,21 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
 			pstatus = ehci_readl(ehci,
 					 &ehci->regs->port_status[i]);
 
Quoted 10 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 937

Quoted 7 lines
drivers/usb/host/ehci-hcd.c +7 -0
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if (unlikely(ehci->transceiver &&
+					(pstatus & PORT_CSC))) {

I don't think you need parens around (pstatus & PORT_CSC), since it should already have higher precedence.

Quoted 1 line

But it's more readable. Isn't it?

I guess it is.

Regards,
--
Alex

maintainer
#26 lore raw

PATCH v4 1/1 usb: ehci-hcd: notify phy when connect change

In reply to Richard Zhao

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 937

Quoted 12 lines · Richard Zhao

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get phy there

drivers/usb/host/ehci-hcd.c +7 -0
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if (unlikely(ehci->transceiver &&
+					(pstatus & PORT_CSC))) {

A new thought... If you move the transceiver pointer from struct ehci_hcd to struct usb_hcd, then you _will_ be able to get at it from within the debouncing routine.

Or if you prefer, leave the pointer where it is and add a method to struct hc_driver for retrieving the pointer.

Alan Stern

#27 lore raw

PATCH v4 1/1 usb: ehci-hcd: notify phy when connect change

Quoted 7 lines
Quoted 6 lines

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get phy there

Quoted 12 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 937

Quoted 7 lines
drivers/usb/host/ehci-hcd.c +7 -0
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if (unlikely(ehci->transceiver &&
+					(pstatus & PORT_CSC))) {

A new thought... If you move the transceiver pointer from struct ehci_hcd to struct usb_hcd, then you _will_ be able to get at it from within the debouncing routine.

Good suggestion, after that the driver can add PHY operation(quirk or not) during the whole usb host life periods.

Quoted 5 lines

Or if you prefer, leave the pointer where it is and add a method to struct hc_driver for retrieving the pointer.

Alan Stern

#28 lore raw

PATCH v4 1/1 usb: ehci-hcd: notify phy when connect change

Quoted 19 lines · On Thu, Jun 07, 2012 at 10:04:00AM +0800, Chen Peter-B29397 wrote:
Quoted 7 lines
Quoted 6 lines

It still has below limitations:
- it does not work for multi-phy ehci
- the best place is after debounce, but I can't get phy there

Quoted 12 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 937

Quoted 7 lines
drivers/usb/host/ehci-hcd.c +7 -0
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if (unlikely(ehci->transceiver &&
+					(pstatus & PORT_CSC))) {

A new thought... If you move the transceiver pointer from struct ehci_hcd to struct usb_hcd, then you _will_ be able to get at it from within the debouncing routine.

Quoted 2 lines

Good suggestion, after that the driver can add PHY operation(quirk or not) during the whole usb host life periods.

Since it makes it more generic, I'm considering:
- change variable name from transceiver to phy
- Do we need considering phy on hub? I prefer HCD phy only.
- Do we need supporting multi-phy for one hcd? I don't know multi-phy case, so I prefer one phy one hcd.

Thanks
Richard

Quoted 7 lines
Quoted 6 lines

Or if you prefer, leave the pointer where it is and add a method to struct hc_driver for retrieving the pointer.

Alan Stern

#29 lore raw

PATCH v4 1/1 usb: ehci-hcd: notify phy when connect change

Quoted 14 lines
Quoted 4 lines
Quoted 4 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd)

Quoted 4 lines
drivers/usb/host/ehci-hcd.c +3 -0
+			/* FIXME:
+			 * - it does not work for multi-phy ehci
+			 * - the best place is after debounce, but I

can't get

Quoted 9 lines
Quoted 9 lines

drivers/usb/host/ehci-hcd.c static irqreturn_t ehci_irq (struct usb_hcd *hcd) · line 937

Quoted 4 lines
drivers/usb/host/ehci-hcd.c +4 -0
+			 *   phy there
+			 */
+			if (unlikely(ehci->transceiver &&
+					(pstatus & PORT_CSC))) {

A new thought... If you move the transceiver pointer from struct ehci_hcd to struct usb_hcd, then you _will_ be able to get at it from within the debouncing routine.

Quoted 9 lines
Quoted 1 line

Good suggestion, after that the driver can add PHY operation(quirk or

not)

Quoted 1 line

during the whole usb host life periods.

Since it makes it more generic, I'm considering:
- change variable name from transceiver to phy
- Do we need considering phy on hub? I prefer HCD phy only.
- Do we need supporting multi-phy for one hcd? I don't know multi-phy case, so I prefer one phy one hcd.

I suggest that you can do it at next patchset.
This patchset is just add phy notify to ehci hcd interrupt handler. At next patchset, you can refine and improve PHY operation at the whole hcd.

I am not sure Alan's suggestion.

#30 lore raw

PATCH 1/2 USB: move transceiver from ehci_hcd and ohci_hcd to hcd and rename it as phy

In reply to Richard Zhao

- to decrease redundant since both ehci_hcd and ohci_hcd have the same variable
- it helps access phy in usb core code
- phy is more meaningful than transceiver

---
 drivers/usb/host/ehci-fsl.c  |   21 ++++++++++-----------
 drivers/usb/host/ehci-hub.c  |    2 +-
 drivers/usb/host/ehci.h      |    4 ----
 drivers/usb/host/ohci-omap.c |   27 ++++++++++++++-------------
 drivers/usb/host/ohci.h      |    5 -----
 include/linux/usb/hcd.h      |    6 ++++++
 6 files changed, 31 insertions(+), 34 deletions(-)
drivers/usb/host/ehci-fsl.c +10 -11
index 4336257..3379945 100644
@@ -142,19 +142,19 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
 	if (pdata->operating_mode == FSL_USB2_DR_OTG) {
 		struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 
-		ehci->transceiver = usb_get_transceiver();
-		dev_dbg(&pdev->dev, "hcd=0x%p  ehci=0x%p, transceiver=0x%p\n",
-			hcd, ehci, ehci->transceiver);
+		hcd->phy = usb_get_transceiver();
+		dev_dbg(&pdev->dev, "hcd=0x%p  ehci=0x%p, phy=0x%p\n",
+			hcd, ehci, hcd->phy);
 
-		if (ehci->transceiver) {
-			retval = otg_set_host(ehci->transceiver->otg,
+		if (hcd->phy) {
+			retval = otg_set_host(hcd->phy->otg,
 					      &ehci_to_hcd(ehci)->self);
 			if (retval) {
-				usb_put_transceiver(ehci->transceiver);
+				usb_put_transceiver(hcd->phy);
 				goto err4;
 			}
 		} else {
-			dev_err(&pdev->dev, "can't find transceiver\n");
+			dev_err(&pdev->dev, "can't find phy\n");
 			retval = -ENODEV;
 			goto err4;
 		}
@@ -190,11 +190,10 @@ static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
 			       struct platform_device *pdev)
 {
 	struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
-	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 
-	if (ehci->transceiver) {
-		otg_set_host(ehci->transceiver->otg, NULL);
-		usb_put_transceiver(ehci->transceiver);
+	if (hcd->phy) {
+		otg_set_host(hcd->phy->otg, NULL);
+		usb_put_transceiver(hcd->phy);
 	}
 
 	usb_remove_hcd(hcd);
drivers/usb/host/ehci-hub.c +1 -1
index fc9e7cc..dd5eef6 100644
@@ -724,7 +724,7 @@ static int ehci_hub_control (
 #ifdef CONFIG_USB_OTG
 			if ((hcd->self.otg_port == (wIndex + 1))
 			    && hcd->self.b_hnp_enable) {
-				otg_start_hnp(ehci->transceiver->otg);
+				otg_start_hnp(hcd->phy->otg);
 				break;
 			}
 #endif
drivers/usb/host/ehci.h +0 -4
index 2694ed6..85c3572 100644
@@ -175,10 +175,6 @@ struct ehci_hcd {			/* one per controller */
 #ifdef DEBUG
 	struct dentry		*debug_dir;
 #endif
-	/*
-	 * OTG controllers and transceivers need software interaction
-	 */
-	struct usb_phy	*transceiver;
 };
 
 /* convert between an HCD pointer and the corresponding EHCI_HCD */
drivers/usb/host/ohci-omap.c +14 -13
index 9ce35d0..eccddb4 100644
@@ -167,14 +167,15 @@ static int omap_1510_local_bus_init(void)
 
 static void start_hnp(struct ohci_hcd *ohci)
 {
-	const unsigned	port = ohci_to_hcd(ohci)->self.otg_port - 1;
+	struct usb_hcd *hcd = ohci_to_hcd(ohci);
+	const unsigned	port = hcd->self.otg_port - 1;
 	unsigned long	flags;
 	u32 l;
 
-	otg_start_hnp(ohci->transceiver->otg);
+	otg_start_hnp(hcd->phy->otg);
 
 	local_irq_save(flags);
-	ohci->transceiver->state = OTG_STATE_A_SUSPEND;
+	hcd->phy->state = OTG_STATE_A_SUSPEND;
 	writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]);
 	l = omap_readl(OTG_CTRL);
 	l &= ~OTG_A_BUSREQ;
@@ -211,18 +212,18 @@ static int ohci_omap_init(struct usb_hcd *hcd)
 
 #ifdef	CONFIG_USB_OTG
 	if (need_transceiver) {
-		ohci->transceiver = usb_get_transceiver();
-		if (ohci->transceiver) {
-			int	status = otg_set_host(ohci->transceiver->otg,
+		hcd->phy = usb_get_transceiver();
+		if (hcd->phy) {
+			int	status = otg_set_host(hcd->phy->otg,
 						&ohci_to_hcd(ohci)->self);
-			dev_dbg(hcd->self.controller, "init %s transceiver, status %d\n",
-					ohci->transceiver->label, status);
+			dev_dbg(hcd->self.controller, "init %s phy, status %d\n",
+					hcd->phy->label, status);
 			if (status) {
-				usb_put_transceiver(ohci->transceiver);
+				usb_put_transceiver(hcd->phy);
 				return status;
 			}
 		} else {
-			dev_err(hcd->self.controller, "can't find transceiver\n");
+			dev_err(hcd->self.controller, "can't find phy\n");
 			return -ENODEV;
 		}
 		ohci->start_hnp = start_hnp;
@@ -403,9 +404,9 @@ usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev)
 	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
 
 	usb_remove_hcd(hcd);
-	if (ohci->transceiver) {
-		(void) otg_set_host(ohci->transceiver->otg, 0);
-		usb_put_transceiver(ohci->transceiver);
+	if (hcd->phy) {
+		(void) otg_set_host(hcd->phy->otg, 0);
+		usb_put_transceiver(hcd->phy);
 	}
 	if (machine_is_omap_osk())
 		gpio_free(9);
drivers/usb/host/ohci.h +0 -5
index 1b19aea..d329914 100644
@@ -372,11 +372,6 @@ struct ohci_hcd {
 	struct ed		*ed_controltail;	/* last in ctrl list */
 	struct ed		*periodic [NUM_INTS];	/* shadow int_table */
 
-	/*
-	 * OTG controllers and transceivers need software interaction;
-	 * other external transceivers should be software-transparent
-	 */
-	struct usb_phy	*transceiver;
 	void (*start_hnp)(struct ohci_hcd *ohci);
 
 	/*
include/linux/usb/hcd.h +6 -0
index 7f855d5..c532cbe 100644
@@ -93,6 +93,12 @@ struct usb_hcd {
 	 */
 	const struct hc_driver	*driver;	/* hw-specific hooks */
 
+	/*
+	 * OTG and some Host controllers need software interaction with phys;
+	 * other external phys should be software-transparent
+	 */
+	struct usb_phy	*phy;
+
 	/* Flags that need to be manipulated atomically because they can
 	 * change while the host controller is running.  Always use
 	 * set_bit() or clear_bit() to change their values.
Signature · 1 line
1.7.9.5
#31 lore raw

PATCH v5 2/2 USB: notify phy when root hub port connect change

Phy may need to change settings when port connect change.

---
 drivers/usb/core/hub.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/usb/core/hub.c +8 -0
index 04fb834..e1a6d31 100644
@@ -20,6 +20,7 @@
 #include <linux/usb.h>
 #include <linux/usbdevice_fs.h>
 #include <linux/usb/hcd.h>
+#include <linux/usb/otg.h>
 #include <linux/usb/quirks.h>
 #include <linux/kthread.h>
 #include <linux/mutex.h>
@@ -4034,6 +4035,13 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 		}
 	}
 
+	if (unlikely(hcd->phy && !hdev->level)) {
+		if (portstatus & USB_PORT_STAT_CONNECTION)
+			usb_phy_notify_connect(hcd->phy, port1);
+		else
+			usb_phy_notify_disconnect(hcd->phy, port1);
+	}
+
 	/* Return now if debouncing failed or nothing is connected or
 	 * the device was "removed".
 	 */
Signature · 1 line
1.7.9.5
#32 lore raw

PATCH v3 4/12 usb: otg: add basic mxs phy driver support

In reply to Richard Zhao

mxs phy is used in Freescale i.MX SoCs, for example imx23, imx28, imx6Q. This patch adds the basic host support.

---
 Documentation/devicetree/bindings/usb/mxs-phy.txt |   13 ++
 drivers/usb/otg/Kconfig                           |    8 +
 drivers/usb/otg/Makefile                          |    1 +
 drivers/usb/otg/mxs-phy.c                         |  204 +++++++++++++++++++++
 4 files changed, 226 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/mxs-phy.txt
 create mode 100644 drivers/usb/otg/mxs-phy.c
Documentation/devicetree/bindings/usb/mxs-phy.txt new file +13 -0
new file mode 100644
index 0000000..5835b27
@@ -0,0 +1,13 @@
+* Freescale MXS USB Phy Device
+
+Required properties:
+- compatible: Should be "fsl,imx23-usbphy"
+- reg: Should contain registers location and length
+- interrupts: Should contain phy interrupt
+
+Example:
+usbphy1: usbphy at 020c9000 {
+	compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy";
+	reg = <0x020c9000 0x1000>;
+	interrupts = <0 44 0x04>;
+};
drivers/usb/otg/Kconfig +8 -0
index 5c87db0..3a9bc44 100644
@@ -116,6 +116,14 @@ config FSL_USB2_OTG
 	help
 	  Enable this to support Freescale USB OTG transceiver.
 
+config USB_MXS_PHY
+	tristate "Freescale MXS USB PHY support"
+	select USB_OTG_UTILS
+	help
+	  Enable this to support the Freescale MXS USB PHY.
+
+	  MXS Phy is used by some of the i.MX SoCs, for example imx23/28/6x.
+
 config USB_MV_OTG
 	tristate "Marvell USB OTG support"
 	depends on USB_EHCI_MV && USB_MV_UDC && USB_SUSPEND
drivers/usb/otg/Makefile +1 -0
index 41aa509..a844b8d 100644
@@ -20,4 +20,5 @@ obj-$(CONFIG_USB_MSM_OTG)	+= msm_otg.o
 obj-$(CONFIG_AB8500_USB)	+= ab8500-usb.o
 fsl_usb2_otg-objs		:= fsl_otg.o otg_fsm.o
 obj-$(CONFIG_FSL_USB2_OTG)	+= fsl_usb2_otg.o
+obj-$(CONFIG_USB_MXS_PHY)	+= mxs-phy.o
 obj-$(CONFIG_USB_MV_OTG)	+= mv_otg.o
drivers/usb/otg/mxs-phy.c new file +204 -0

204 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#33 lore raw

PATCH v3 4/12 usb: otg: add basic mxs phy driver support

Quoted 7 lines · Richard Zhao

mxs phy is used in Freescale i.MX SoCs, for example imx23, imx28, imx6Q. This patch adds the basic host support.

Quoted 271 lines
---
 Documentation/devicetree/bindings/usb/mxs-phy.txt |   13 ++
 drivers/usb/otg/Kconfig                           |    8 +
 drivers/usb/otg/Makefile                          |    1 +
 drivers/usb/otg/mxs-phy.c                         |  204 +++++++++++++++++++++
 4 files changed, 226 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/mxs-phy.txt
 create mode 100644 drivers/usb/otg/mxs-phy.c
Documentation/devicetree/bindings/usb/mxs-phy.txt new file +13 -0
new file mode 100644
index 0000000..5835b27
@@ -0,0 +1,13 @@
+* Freescale MXS USB Phy Device
+
+Required properties:
+- compatible: Should be "fsl,imx23-usbphy"
+- reg: Should contain registers location and length
+- interrupts: Should contain phy interrupt
+
+Example:
+usbphy1: usbphy at 020c9000 {
+	compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy";
+	reg = <0x020c9000 0x1000>;
+	interrupts = <0 44 0x04>;
+};
drivers/usb/otg/Kconfig +8 -0
index 5c87db0..3a9bc44 100644
@@ -116,6 +116,14 @@ config FSL_USB2_OTG
 	help
 	  Enable this to support Freescale USB OTG transceiver.
 
+config USB_MXS_PHY
+	tristate "Freescale MXS USB PHY support"
+	select USB_OTG_UTILS
+	help
+	  Enable this to support the Freescale MXS USB PHY.
+
+	  MXS Phy is used by some of the i.MX SoCs, for example imx23/28/6x.
+
 config USB_MV_OTG
 	tristate "Marvell USB OTG support"
 	depends on USB_EHCI_MV && USB_MV_UDC && USB_SUSPEND
drivers/usb/otg/Makefile +1 -0
index 41aa509..a844b8d 100644
@@ -20,4 +20,5 @@ obj-$(CONFIG_USB_MSM_OTG)	+= msm_otg.o
 obj-$(CONFIG_AB8500_USB)	+= ab8500-usb.o
 fsl_usb2_otg-objs		:= fsl_otg.o otg_fsm.o
 obj-$(CONFIG_FSL_USB2_OTG)	+= fsl_usb2_otg.o
+obj-$(CONFIG_USB_MXS_PHY)	+= mxs-phy.o
 obj-$(CONFIG_USB_MV_OTG)	+= mv_otg.o
drivers/usb/otg/mxs-phy.c new file +204 -0
new file mode 100644
index 0000000..a55aaed
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ * Copyright (C) 2012 Marek Vasut <[email protected]>
+ * on behalf of DENX Software Engineering GmbH
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/usb/otg.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#define DRIVER_NAME "mxs_phy"
+
+#define HW_USBPHY_PWD				0x00
+#define HW_USBPHY_CTRL				0x30
+#define HW_USBPHY_CTRL_SET			0x34
+#define HW_USBPHY_CTRL_CLR			0x38
+
+#define BM_USBPHY_CTRL_SFTRST			BIT(31)
+#define BM_USBPHY_CTRL_CLKGATE			BIT(30)
+#define BM_USBPHY_CTRL_ENUTMILEVEL3		BIT(15)
+#define BM_USBPHY_CTRL_ENUTMILEVEL2		BIT(14)
+#define BM_USBPHY_CTRL_ENHOSTDISCONDETECT	BIT(1)
+
+struct mxs_phy {
+	struct usb_phy phy;
+	struct clk *clk;
+	int connected:1;
+};
+
+#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy)
+
+static void mxs_phy_hw_init(struct mxs_phy *mxs_phy)
+{
+	void __iomem *base = mxs_phy->phy.io_priv;
+
+	writel_relaxed(BM_USBPHY_CTRL_CLKGATE, base + HW_USBPHY_CTRL_CLR);
+
+	/* Reset USBPHY module */
+	writel_relaxed(BM_USBPHY_CTRL_SFTRST, base + HW_USBPHY_CTRL_SET);
+	udelay(10);
+
+	/* Remove CLKGATE and SFTRST */
+	writel_relaxed(BM_USBPHY_CTRL_CLKGATE | BM_USBPHY_CTRL_SFTRST,
+			base + HW_USBPHY_CTRL_CLR);
+	udelay(10);
+
+	/* Power up the PHY */
+	writel_relaxed(0, base + HW_USBPHY_PWD);
+
+	/* enable FS/LS device */
+	writel_relaxed(BM_USBPHY_CTRL_ENUTMILEVEL2 |
+			BM_USBPHY_CTRL_ENUTMILEVEL3,
+			base + HW_USBPHY_CTRL_SET);
+
+}
+
+static int mxs_phy_init(struct usb_phy *phy)
+{
+	struct mxs_phy *mxs_phy = to_mxs_phy(phy);
+
+	clk_prepare_enable(mxs_phy->clk);
+	mxs_phy_hw_init(mxs_phy);
+
+	return 0;
+}
+
+static void mxs_phy_shutdown(struct usb_phy *phy)
+{
+	struct mxs_phy *mxs_phy = to_mxs_phy(phy);
+
+	writel_relaxed(BM_USBPHY_CTRL_CLKGATE,
+			phy->io_priv + HW_USBPHY_CTRL_SET);
+
+	clk_disable_unprepare(mxs_phy->clk);
+}
+
+static int mxs_phy_on_connect(struct usb_phy *phy, int port)
+{
+	struct mxs_phy *mxs_phy = to_mxs_phy(phy);
+
+	dev_dbg(phy->dev, "Connect on port %d\n", port);
+
+	if (mxs_phy->connected)
+		return 0;
+	mxs_phy_hw_init(to_mxs_phy(phy));
+	writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
+			phy->io_priv + HW_USBPHY_CTRL_SET);
+	mxs_phy->connected = 1;
+
+	return 0;
+}
+
+static int mxs_phy_on_disconnect(struct usb_phy *phy, int port)
+{
+	struct mxs_phy *mxs_phy = to_mxs_phy(phy);
+
+	dev_dbg(phy->dev, "Disconnect on port %d\n", port);
+
+	if (!mxs_phy->connected)
+		return 0;
+	writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
+			phy->io_priv + HW_USBPHY_CTRL_CLR);
+	mxs_phy->connected = 0;
+
+	return 0;
+}
+
+static int mxs_phy_probe(struct platform_device *pdev)
+{
+	struct resource *res;
+	void __iomem *base;
+	struct clk *clk;
+	struct mxs_phy *mxs_phy;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "can't get device resources\n");
+		return -ENOENT;
+	}
+
+	base = devm_request_and_ioremap(&pdev->dev, res);
+	if (!base)
+		return -EBUSY;
+
+	clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(clk)) {
+		dev_err(&pdev->dev, "can't get the clock!");
+		return PTR_ERR(clk);
+	}
+
+	mxs_phy = devm_kzalloc(&pdev->dev, sizeof(*mxs_phy), GFP_KERNEL);
+	if (!mxs_phy) {
+		dev_err(&pdev->dev, "Failed to allocate USB PHY structure!\n");
+		return -ENOMEM;
+	}
+
+	mxs_phy->phy.io_priv		= base;
+	mxs_phy->phy.dev		= &pdev->dev;
+	mxs_phy->phy.label		= DRIVER_NAME;
+	mxs_phy->phy.init		= mxs_phy_init;
+	mxs_phy->phy.shutdown		= mxs_phy_shutdown;
+	mxs_phy->phy.notify_connect	= mxs_phy_on_connect;
+	mxs_phy->phy.notify_disconnect	= mxs_phy_on_disconnect;
+
+	ATOMIC_INIT_NOTIFIER_HEAD(&mxs_phy->phy.notifier);
+
+	mxs_phy->clk = clk;
+
+	platform_set_drvdata(pdev, &mxs_phy->phy);
+
+	return 0;
+}
+
+static int __devexit mxs_phy_remove(struct platform_device *pdev)
+{
+	platform_set_drvdata(pdev, NULL);
+
+	return 0;
+}
+
+static const struct of_device_id mxs_phy_dt_ids[] = {
+	{ .compatible = "fsl,imx23-usbphy", },
+	{ /* sentinel */ }
+};
+
+static struct platform_driver mxs_phy_driver = {
+	.probe = mxs_phy_probe,
+	.remove = __devexit_p(mxs_phy_remove),
+	.driver = {
+		.name = DRIVER_NAME,
+		.owner	= THIS_MODULE,
+		.of_match_table = mxs_phy_dt_ids,
+	 },
+};
+
+static int __init mxs_phy_module_init(void)
+{
+	return platform_driver_register(&mxs_phy_driver);
+}
+postcore_initcall(mxs_phy_module_init);
+
+static void __exit mxs_phy_module_exit(void)
+{
+	platform_driver_unregister(&mxs_phy_driver);
+}
+module_exit(mxs_phy_module_exit);
+
+MODULE_ALIAS("platform:mxs-usb-phy");
+MODULE_AUTHOR("Marek Vasut <[email protected]>");
+MODULE_AUTHOR("Richard Zhao <[email protected]>");
+MODULE_DESCRIPTION("Freescale MXS USB PHY driver");
+MODULE_LICENSE("GPL");
Signature · 1 line
1.7.5.4
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/20120606/3eaf6c4e/attachment.sig>
#34 lore raw

PATCH v3 5/12 usb: chipidea: add imx platform driver

In reply to Richard Zhao

This patch supports only the host-mode functionality so far.

Cc Peter Chen <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 drivers/usb/chipidea/Makefile                      |    3 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  189 ++++++++++++++++++++
 3 files changed, 212 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
 create mode 100644 drivers/usb/chipidea/ci13xxx_imx.c
Documentation/devicetree/bindings/usb/ci13xxx-imx.txt new file +20 -0
new file mode 100644
index 0000000..beb75d6
@@ -0,0 +1,20 @@
+* Freescale i.MX ci13xxx usb controllers
+
+Required properties:
+- compatible: Should be "fsl,imx31-usb"
+- reg: Should contain registers location and length
+- interrupts: Should contain controller interrupt
+
+Optional properties:
+- fsl,usbphy: phandler of usb phy that connects to the only one port
+- fsl,hub-reset-gpios: gpio used to reset on-board usb hub
+- fsl,vbus-power-gpios: gpio used to set vbus power of the only one port
+
+Examples:
+usb at 02184000 { /* USB OTG */
+	compatible = "fsl,imx6q-usb", "fsl,imx31-usb";
+	reg = <0x02184000 0x200>;
+	interrupts = <0 43 0x04>;
+	fsl,usbphy = <&usbphy1>;
+	fsl,vbus-power-gpios = <&gpio3 22 0>;
+};
drivers/usb/chipidea/Makefile +3 -0
index b69900a..5c66d9c 100644
@@ -14,3 +14,6 @@ ifneq ($(CONFIG_PCI),)
 	obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_pci.o
 endif
 
+ifneq ($(CONFIG_OF_DEVICE),)
+	obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_imx.o
+endif
drivers/usb/chipidea/ci13xxx_imx.c new file +189 -0

189 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#35 lore raw

PATCH v3 5/12 usb: chipidea: add imx platform driver

Quoted 8 lines · Richard Zhao

This patch supports only the host-mode functionality so far.

Cc Peter Chen <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 4 lines
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 drivers/usb/chipidea/Makefile                      |    3 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  189 ++++++++++++++++++++

One comment: I was going to suggest dropping "13xxx" suffix from everywhere in the driver, maybe module names too, since it doesn't really add any value and people often mistype it, so maybe for the new code it makes sense to avoid it? ci-imx looks better than ci13xxx-imx anyway and same goes for ci_imx_probe() vs ci13xxx_imx_probe(). Does this make sense to you?

Regards,
--
Alex

#36 lore raw

PATCH v3 5/12 usb: chipidea: add imx platform driver

Quoted 15 lines · Alexander Shishkin
Quoted 8 lines · Richard Zhao

This patch supports only the host-mode functionality so far.

Cc Peter Chen <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 4 lines
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 drivers/usb/chipidea/Makefile                      |    3 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  189 ++++++++++++++++++++
Quoted 6 lines

One comment: I was going to suggest dropping "13xxx" suffix from everywhere in the driver, maybe module names too, since it doesn't really add any value and people often mistype it, so maybe for the new code it makes sense to avoid it? ci-imx looks better than ci13xxx-imx anyway and same goes for ci_imx_probe() vs ci13xxx_imx_probe(). Does this make sense to you?

I'm not clear with the history. Does Chipidea only have one IP?

Thanks
Richard

Quoted 5 lines

Regards,
--
Alex

#37 lore raw

PATCH v3 5/12 usb: chipidea: add imx platform driver

Quoted 16 lines · Richard Zhao
Quoted 15 lines · Alexander Shishkin
Quoted 12 lines · Richard Zhao

This patch supports only the host-mode functionality so far.

Cc Peter Chen <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 drivers/usb/chipidea/Makefile                      |    3 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  189 ++++++++++++++++++++
Quoted 7 lines
Quoted 6 lines

One comment: I was going to suggest dropping "13xxx" suffix from everywhere in the driver, maybe module names too, since it doesn't really add any value and people often mistype it, so maybe for the new code it makes sense to avoid it? ci-imx looks better than ci13xxx-imx anyway and same goes for ci_imx_probe() vs ci13xxx_imx_probe(). Does this make sense to you?

I'm not clear with the history. Does Chipidea only have one IP?

As far as their USB controllers go, there are several versions with different features and register layouts, but essentially similar. I want to support all of them with this driver. As for the other IPs designed by chipidea -- I have no idea about those, but I don't think we should care.

Regards,
--
Alex

#38 lore raw

PATCH v3 5/12 usb: chipidea: add imx platform driver

Hi Alex,

Quoted 24 lines · Alexander Shishkin
Quoted 22 lines · Richard Zhao
Quoted 21 lines · Alexander Shishkin
Quoted 8 lines · Richard Zhao

This patch supports only the host-mode functionality so far.

Cc Peter Chen <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 4 lines
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 drivers/usb/chipidea/Makefile                      |    3 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  189 ++++++++++++++++++++

One comment: I was going to suggest dropping "13xxx" suffix from everywhere in the driver, maybe module names too, since it doesn't really add any value and people often mistype it, so maybe for the new code it makes sense to avoid it? ci-imx looks better than ci13xxx-imx anyway and same goes for ci_imx_probe() vs ci13xxx_imx_probe(). Does this make sense to you?

Quoted 7 lines
Quoted 1 line

I'm not clear with the history. Does Chipidea only have one IP?

As far as their USB controllers go, there are several versions with different features and register layouts, but essentially similar. I want to support all of them with this driver. As for the other IPs designed by chipidea -- I have no idea about those, but I don't think we should care.

Cleaning up ci13xxx will touch almost every chipidea driver files. Do you want me to do it or ?

Thanks
Richard

Quoted 5 lines

Regards,
--
Alex

#39 lore raw

PATCH v3 5/12 usb: chipidea: add imx platform driver

Quoted 1 line · Richard Zhao

Hi Alex,

Hi,

(overlooked this email somehow)

Quoted 27 lines · Alexander Shishkin
Quoted 26 lines
Quoted 23 lines · Richard Zhao
Quoted 15 lines · Alexander Shishkin
Quoted 8 lines · Richard Zhao

This patch supports only the host-mode functionality so far.

Cc Peter Chen <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 4 lines
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 drivers/usb/chipidea/Makefile                      |    3 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  189 ++++++++++++++++++++
Quoted 6 lines

One comment: I was going to suggest dropping "13xxx" suffix from everywhere in the driver, maybe module names too, since it doesn't really add any value and people often mistype it, so maybe for the new code it makes sense to avoid it? ci-imx looks better than ci13xxx-imx anyway and same goes for ci_imx_probe() vs ci13xxx_imx_probe(). Does this make sense to you?

I'm not clear with the history. Does Chipidea only have one IP?

Quoted 7 lines
Quoted 5 lines

As far as their USB controllers go, there are several versions with different features and register layouts, but essentially similar. I want to support all of them with this driver. As for the other IPs designed by chipidea -- I have no idea about those, but I don't think we should care.

Cleaning up ci13xxx will touch almost every chipidea driver files. Do you want me to do it or ?

If you have more patches for chipidea driver, you can include the 13xxx removal there, otherwise I'll do it as a part of my patchset that I'll send after we sort out this one.

Regards,
--
Alex

#40 lore raw

PATCH v3 6/12 ARM: imx6q: correct device name of usbphy and usb controller clock export

In reply to Richard Zhao
---
 arch/arm/mach-imx/clk-imx6q.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-imx/clk-imx6q.c +4 -1
index 96e9edd..f99509a 100644
@@ -391,7 +391,10 @@ int __init mx6q_clocks_init(void)
 	clk_register_clkdev(clk[gpt_ipg], "ipg", "imx-gpt.0");
 	clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
 	clk_register_clkdev(clk[twd], NULL, "smp_twd");
-	clk_register_clkdev(clk[usboh3], NULL, "usboh3");
+	clk_register_clkdev(clk[usboh3], NULL, "2184000.usb");
+	clk_register_clkdev(clk[usboh3], NULL, "2184200.usb");
+	clk_register_clkdev(clk[usboh3], NULL, "2184400.usb");
+	clk_register_clkdev(clk[usboh3], NULL, "2184600.usb");
 	clk_register_clkdev(clk[uart_serial], "per", "2020000.serial");
 	clk_register_clkdev(clk[uart_ipg], "ipg", "2020000.serial");
 	clk_register_clkdev(clk[uart_serial], "per", "21e8000.serial");
Signature · 1 line
1.7.5.4
#41 lore raw

PATCH v3 7/12 ARM: imx6q: add config-on-boot gpios

In reply to Richard Zhao

Sometimes, boards have gpios that don't own by any driver or owner by a generic driver that don't like hacks. Such gpios is normally output and need setup once on boot. So I introduce the config-on-boot gpios.

Cc Shawn Guo <[email protected]>
Cc Rob Herring <[email protected]>
Cc Grant Likely <[email protected]>
---
 .../devicetree/bindings/arm/config-on-boot.txt     |   12 +++++++
 arch/arm/boot/dts/imx6q-sabrelite.dts              |    7 ++++
 arch/arm/mach-imx/mach-imx6q.c                     |   35 ++++++++++++++++++++
 3 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/config-on-boot.txt
Documentation/devicetree/bindings/arm/config-on-boot.txt new file +12 -0
new file mode 100644
index 0000000..f98ed74
@@ -0,0 +1,12 @@
+* Configure on Boot
+
+Node name: config-on-boot
+  It must be in root node. config-on-boot means to describe settings that needs
+  to be set one time on boot but aren't owned by any driver, or the owned driver
+  is too generic to handle such settings. For example, usb hub uses generic
+  driver in usb core code, a on-board usb may need deassert reset pin.
+
+Optional properties:
+- output-gpios: Output gpio array that needs to set.
+- output-gpio-values: This property is required if output-gpios is set.
+  The value is a array of 0 or 1. Total count eaquals the number of gpios.
arch/arm/boot/dts/imx6q-sabrelite.dts +7 -0
index e0ec929..1dd2261 100644
@@ -17,6 +17,13 @@
 	model = "Freescale i.MX6 Quad SABRE Lite Board";
 	compatible = "fsl,imx6q-sabrelite", "fsl,imx6q";
 
+	config-on-boot {
+		output-gpios = <
+				&gpio3 22 0>;	/* vbus reset */
+		output-gpio-values = <
+				1>;		/* vbus reset */
+	};
+
 	memory {
 		reg = <0x10000000 0x40000000>;
 	};
arch/arm/mach-imx/mach-imx6q.c +35 -0
index b47e98b..577cf19 100644
@@ -19,6 +19,7 @@
 #include <linux/irqdomain.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/of_gpio.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/pinctrl/machine.h>
@@ -113,6 +114,38 @@ static void __init imx6q_sabrelite_init(void)
 	imx6q_sabrelite_cko1_setup();
 }
 
+static void __init imx6q_config_on_boot(void)
+{
+	struct device_node *np;
+	struct property *pp;
+	int cnt, len, i;
+	int gpio;
+
+	np = of_find_node_by_path("/config-on-boot");
+	if (!np)
+		return;
+	cnt = of_gpio_named_count(np, "output-gpios");
+	pp = of_find_property(np, "output-gpio-values", &len);
+	if (!pp || cnt != len / sizeof(u32)) {
+		pr_err("Invalid config-on-boot gpios!\n");
+		of_node_put(np);
+		return;
+	}
+	for (i = 0; i < cnt; i++) {
+		gpio = of_get_named_gpio(np, "output-gpios", i);
+		if (gpio_is_valid(gpio))
+			gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH,
+					"config-on-boot");
+	}
+
+	of_node_put(np);
+}
+
+static void __init imx6q_post_populate(void)
+{
+	imx6q_config_on_boot();
+}
+
 static void __init imx6q_init_machine(void)
 {
 	/*
@@ -126,6 +159,8 @@ static void __init imx6q_init_machine(void)
 
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
+	imx6q_post_populate();
+
 	imx6q_pm_init();
 }
 
Signature · 1 line
1.7.5.4
#42 lore raw

PATCH v3 8/12 ARM: imx6q: add usbphy clocks

In reply to Richard Zhao
---
 arch/arm/mach-imx/clk-imx6q.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/mach-imx/clk-imx6q.c +6 -1
index f99509a..8c4166a 100644
@@ -152,7 +152,7 @@ enum mx6q_clks {
 	ssi2, ssi3, uart_ipg, uart_serial, usboh3, usdhc1, usdhc2, usdhc3,
 	usdhc4, vdo_axi, vpu_axi, cko1, pll1_sys, pll2_bus, pll3_usb_otg,
 	pll4_audio, pll5_video, pll6_mlb, pll7_usb_host, pll8_enet, ssi1_ipg,
-	ssi2_ipg, ssi3_ipg, clk_max
+	ssi2_ipg, ssi3_ipg, usbphy1, usbphy2, clk_max
 };
 
 static struct clk *clk[clk_max];
@@ -197,6 +197,9 @@ int __init mx6q_clocks_init(void)
 	clk[pll7_usb_host] = imx_clk_pllv3(IMX_PLLV3_USB,	"pll7_usb_host","osc", base + 0x20, 0x2000,   0x3);
 	clk[pll8_enet]     = imx_clk_pllv3(IMX_PLLV3_ENET,	"pll8_enet",	"osc", base + 0xe0, 0x182000, 0x3);
 
+	clk[usbphy1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 6);
+	clk[usbphy2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 6);
+
 	/*                                name              parent_name        reg       idx */
 	clk[pll2_pfd0_352m] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus",     base + 0x100, 0);
 	clk[pll2_pfd1_594m] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus",     base + 0x100, 1);
@@ -395,6 +398,8 @@ int __init mx6q_clocks_init(void)
 	clk_register_clkdev(clk[usboh3], NULL, "2184200.usb");
 	clk_register_clkdev(clk[usboh3], NULL, "2184400.usb");
 	clk_register_clkdev(clk[usboh3], NULL, "2184600.usb");
+	clk_register_clkdev(clk[usbphy1], NULL, "20c9000.usbphy");
+	clk_register_clkdev(clk[usbphy2], NULL, "20ca000.usbphy");
 	clk_register_clkdev(clk[uart_serial], "per", "2020000.serial");
 	clk_register_clkdev(clk[uart_ipg], "ipg", "2020000.serial");
 	clk_register_clkdev(clk[uart_serial], "per", "21e8000.serial");
Signature · 1 line
1.7.5.4
#43 lore raw

PATCH v3 9/12 ARM: imx6q: disable usb charger detector

In reply to Richard Zhao

The external charger detector needs to be disabled, or the signal at DP will be poor

---
 arch/arm/mach-imx/mach-imx6q.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
arch/arm/mach-imx/mach-imx6q.c +24 -0
index 577cf19..c4f9b82 100644
@@ -25,6 +25,7 @@
 #include <linux/pinctrl/machine.h>
 #include <linux/phy.h>
 #include <linux/micrel_phy.h>
+#include <linux/mfd/anatop.h>
 #include <asm/smp_twd.h>
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/hardware/gic.h>
@@ -141,9 +142,32 @@ static void __init imx6q_config_on_boot(void)
 	of_node_put(np);
 }
 
+static void __init imx6q_usb_init(void)
+{
+#define HW_ANADIG_USB1_CHRG_DETECT		0x000001b0
+#define HW_ANADIG_USB2_CHRG_DETECT		0x00000210
+
+#define BM_ANADIG_USB_CHRG_DETECT_EN_B		0x00100000
+#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B	0x00080000
+
+	/*
+	 * The external charger detector needs to be disabled,
+	 * or the signal at DP will be poor
+	 */
+	anatop_write_reg(NULL, HW_ANADIG_USB1_CHRG_DETECT,
+			BM_ANADIG_USB_CHRG_DETECT_EN_B
+			| BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B,
+			~0);
+	anatop_write_reg(NULL, HW_ANADIG_USB2_CHRG_DETECT,
+			BM_ANADIG_USB_CHRG_DETECT_EN_B |
+			BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B,
+			~0);
+}
+
 static void __init imx6q_post_populate(void)
 {
 	imx6q_config_on_boot();
+	imx6q_usb_init();
 }
 
 static void __init imx6q_init_machine(void)
Signature · 1 line
1.7.5.4
#44 lore raw

PATCH v3 10/12 ARM: dts: imx6q-sabrelite: add usb devices

In reply to Richard Zhao

- add usbphy devices
- add usb host controller and otg devices
- add on-board hub reset gpio pinctrl
- add usb h1 vbus regulator

---
 arch/arm/boot/dts/imx6q-sabrelite.dts |   28 +++++++++++++++++++++++++
 arch/arm/boot/dts/imx6q.dtsi          |   36 +++++++++++++++++++++++++++++++-
 2 files changed, 62 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx6q-sabrelite.dts +28 -0
index 1dd2261..06a5d00 100644
@@ -48,10 +48,29 @@
 					status = "okay";
 				};
 			};
+			iomuxc at 020e0000 {
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_gpio_hog>;
 
+				gpios {
+					pinctrl_gpio_hog: gpiohog {
+						fsl,pins = <1044 0x80000000	/* MX6Q_PAD_GPIO_17__GPIO_7_12 */
+							   144  0x80000000>;	/* MX6Q_PAD_EIM_D22__GPIO_3_22 */
+					};
+				};
+			};
 		};
 
 		aips-bus at 02100000 { /* AIPS2 */
+			usb at 02184000 { /* USB OTG */
+				vbus-supply = <&reg_usb_otg_vbus>;
+				status = "okay";
+			};
+
+			usb at 02184200 { /* USB1 */
+				status = "okay";
+			};
+
 			ethernet at 02188000 {
 				phy-mode = "rgmii";
 				phy-reset-gpios = <&gpio3 23 0>;
@@ -118,6 +137,15 @@
 			regulator-max-microvolt = <3300000>;
 			regulator-always-on;
 		};
+
+		reg_usb_otg_vbus: usb_otg_vbus {
+			compatible = "regulator-fixed";
+			regulator-name = "usb_otg_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&gpio3 22 0>;
+			enable-active-high;
+		};
 	};
 
 	sound {
arch/arm/boot/dts/imx6q.dtsi +34 -2
index 8c90cba..ccc8a5f 100644
@@ -444,12 +444,14 @@
 				};
 			};
 
-			usbphy at 020c9000 { /* USBPHY1 */
+			usbphy1: usbphy at 020c9000 {
+				compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy";
 				reg = <0x020c9000 0x1000>;
 				interrupts = <0 44 0x04>;
 			};
 
-			usbphy at 020ca000 { /* USBPHY2 */
+			usbphy2: usbphy at 020ca000 {
+				compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy";
 				reg = <0x020ca000 0x1000>;
 				interrupts = <0 45 0x04>;
 			};
@@ -573,6 +575,36 @@
 				reg = <0x0217c000 0x4000>;
 			};
 
+			usb at 02184000 { /* USB OTG */
+				compatible = "fsl,imx6q-usb", "fsl,imx31-usb";
+				reg = <0x02184000 0x200>;
+				interrupts = <0 43 0x04>;
+				fsl,usbphy = <&usbphy1>;
+				status = "disabled";
+			};
+
+			usb at 02184200 { /* USB1 */
+				compatible = "fsl,imx6q-usb", "fsl,imx31-usb";
+				reg = <0x02184200 0x200>;
+				interrupts = <0 40 0x04>;
+				fsl,usbphy = <&usbphy2>;
+				status = "disabled";
+			};
+
+			usb at 02184400 { /* USB2 */
+				compatible = "fsl,imx6q-usb", "fsl,imx31-usb";
+				reg = <0x02184400 0x200>;
+				interrupts = <0 41 0x04>;
+				status = "disabled";
+			};
+
+			usb at 02184600 { /* USB3 */
+				compatible = "fsl,imx6q-usb", "fsl,imx31-usb";
+				reg = <0x02184600 0x200>;
+				interrupts = <0 42 0x04>;
+				status = "disabled";
+			};
+
 			ethernet at 02188000 {
 				compatible = "fsl,imx6q-fec";
 				reg = <0x02188000 0x4000>;
Signature · 1 line
1.7.5.4
#45 lore raw

PATCH v3 11/12 ARM: mxs: clk_register_clkdev mx28 usb clocks

In reply to Richard Zhao
---
 drivers/clk/mxs/clk-imx28.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/clk/mxs/clk-imx28.c +4 -0
index 2826a26..0201a0f 100644
@@ -328,6 +328,10 @@ int __init mx28_clocks_init(void)
 	clk_register_clkdevs(clks[fec], fec_lookups, ARRAY_SIZE(fec_lookups));
 	clk_register_clkdevs(clks[can0], can0_lookups, ARRAY_SIZE(can0_lookups));
 	clk_register_clkdevs(clks[can1], can1_lookups, ARRAY_SIZE(can1_lookups));
+	clk_register_clkdev(clks[usb0_pwr], NULL, "8007c000.usbphy");
+	clk_register_clkdev(clks[usb1_pwr], NULL, "8007e000.usbphy");
+	clk_register_clkdev(clks[usb0], NULL, "80080000.usb");
+	clk_register_clkdev(clks[usb1], NULL, "80090000.usb");
 
 	for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
 		clk_prepare_enable(clks[clks_init_on[i]]);
Signature · 1 line
1.7.5.4
#46 lore raw

PATCH v3 12/12 ARM: dts: imx28-evk: add usb devices

In reply to Richard Zhao

- add usb phy devices
- add usb controller devices
- add usb vbus regulators

---
 arch/arm/boot/dts/imx28-evk.dts |   36 ++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/imx28.dtsi    |   12 ++++++++++--
 2 files changed, 46 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx28-evk.dts +36 -0
index ee520a5..a06d86a 100644
@@ -73,10 +73,28 @@
 				pinctrl-0 = <&duart_pins_a>;
 				status = "okay";
 			};
+
+			usbphy0: usbphy at 8007c000 {
+				status = "okay";
+			};
+
+			usbphy1: usbphy at 8007e000 {
+				status = "okay";
+			};
 		};
 	};
 
 	ahb at 80080000 {
+		usb0: usb at 80080000 {
+			vbus-supply = <&reg_usb0_vbus>;
+			status = "okay";
+		};
+
+		usb1: usb at 80090000 {
+			vbus-supply = <&reg_usb1_vbus>;
+			status = "okay";
+		};
+
 		mac0: ethernet at 800f0000 {
 			phy-mode = "rmii";
 			pinctrl-names = "default";
@@ -102,6 +120,24 @@
 			regulator-max-microvolt = <3300000>;
 			regulator-always-on;
 		};
+
+		reg_usb0_vbus: usb0_vbus {
+			compatible = "regulator-fixed";
+			regulator-name = "usb0_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&gpio3 9 0>;
+			enable-active-high;
+		};
+
+		reg_usb1_vbus: usb1_vbus {
+			compatible = "regulator-fixed";
+			regulator-name = "usb1_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&gpio3 8 0>;
+			enable-active-high;
+		};
 	};
 
 	sound {
arch/arm/boot/dts/imx28.dtsi +10 -2
index 4634cb8..502ad05 100644
@@ -441,11 +441,13 @@
 			};
 
 			usbphy0: usbphy at 8007c000 {
+				compatible = "fsl,imx28-usbphy", "fsl,imx23-usbphy";
 				reg = <0x8007c000 0x2000>;
 				status = "disabled";
 			};
 
 			usbphy1: usbphy at 8007e000 {
+				compatible = "fsl,imx28-usbphy", "fsl,imx23-usbphy";
 				reg = <0x8007e000 0x2000>;
 				status = "disabled";
 			};
@@ -459,13 +461,19 @@
 		reg = <0x80080000 0x80000>;
 		ranges;
 
-		usbctrl0: usbctrl at 80080000 {
+		usb0: usb at 80080000 {
+			compatible = "fsl,imx28-usb", "fsl,imx31-usb";
 			reg = <0x80080000 0x10000>;
+			interrupts = <93>;
+			fsl,usbphy = <&usbphy0>;
 			status = "disabled";
 		};
 
-		usbctrl1: usbctrl at 80090000 {
+		usb1: usb at 80090000 {
+			compatible = "fsl,imx28-usb", "fsl,imx31-usb";
 			reg = <0x80090000 0x10000>;
+			interrupts = <92>;
+			fsl,usbphy = <&usbphy1>;
 			status = "disabled";
 		};
 
Signature · 1 line
1.7.5.4
#47 lore raw

v3 cover add imx usb driver for mx28/6x

In reply to Richard Zhao

Dear Richard Zhao,

Quoted 11 lines

The work is based on ci13xxx rework done by Alexander Shishkin.

Status:
- this version only support host
- usbotg controler works at host role

Changes since V2:
- Rebase to Alex's tree
- Use regulator to control vbus power
- Remove ARCH check in Kconfig, but add OF_DEV check.
- Other changes according laster version comments.

Is there any git tree with these patches? Also, on top of what tree are these based on please?

Thanks!

Best regards,
Marek Vasut

#48 lore raw

v3 cover add imx usb driver for mx28/6x

Hi Marek,

Quoted 8 lines · Marek Vasut

Dear Richard Zhao,

Quoted 6 lines

The work is based on ?ci13xxx rework done by Alexander Shishkin.

Status:
? - this version only support host
? - usbotg controler works at host role

Quoted 7 lines
Quoted 5 lines

Changes since V2:
? - Rebase to Alex's tree
? - Use regulator to control vbus power
? - Remove ARCH check in Kconfig, but add OF_DEV check. ? - Other changes according laster version comments.

Is there any git tree with these patches?

https://github.com/riczhao/kernel-imx/commits/topics/usb

Quoted 2 lines

Also, on top of what tree are these
based on please?

They're based on Alex's tree.

Quoted 5 lines

Thanks!

Best regards,
Marek Vasut

#49 lore raw

v3 cover add imx usb driver for mx28/6x

In reply to Richard Zhao

Hi Guys,

The merge window was closed. Do you have time to check whether the patch series is ok to pick up?

Thanks
Richard

#50 lore raw

v3 cover add imx usb driver for mx28/6x

Quoted 4 lines · Richard Zhao

Hi Guys,

The merge window was closed. Do you have time to check whether the patch series is ok to pick up?

The drivers/ part looks fine to me.

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/20120604/e184f49c/attachment.sig>
#51 lore raw

v3 cover add imx usb driver for mx28/6x

Dear Felipe Balbi,

Quoted 7 lines · Richard Zhao
Quoted 4 lines

Hi Guys,

The merge window was closed. Do you have time to check whether the patch series is ok to pick up?

The drivers/ part looks fine to me.

Shitty me, I'm stuck with an exam until 20th. If it's not in by then, I'll have time to poke into it. Sorry guys :-(

Best regards,
Marek Vasut

#52 lore raw

v3 cover add imx usb driver for mx28/6x

In reply to Richard Zhao
Quoted 1 line · Richard Zhao

Hi Guys,

Hi,

Quoted 2 lines

The merge window was closed. Do you have time to check whether the patch series is ok to pick up?

I'll try to pick the chipidea relevant bits tomorrow morning.

Thanks,
--
Alex

#53 lore raw

v3 cover add imx usb driver for mx28/6x

In reply to Richard Zhao

Hi,

Quoted 12 lines · Richard Zhao

The work is based on ci13xxx rework done by Alexander Shishkin.

Status:
- this version only support host
- usbotg controler works at host role

Changes since V2:
- Rebase to Alex's tree
- Use regulator to control vbus power
- Remove ARCH check in Kconfig, but add OF_DEV check.
- Other changes according laster version comments.

Quoted 14 lines

Richard Zhao (12):
usb: otg: add notify_connect/notify_disconnect callback
usb: chipidea: permit driver bindings pass phy pointer
usb: ehci-hcd: notify phy when connect change
usb: otg: add basic mxs phy driver support
usb: chipidea: add imx platform driver
ARM: imx6q: correct device name of usbphy and usb controller clock
export
ARM: imx6q: add config-on-boot gpios
ARM: imx6q: add usbphy clocks
ARM: imx6q: disable usb charger detector
ARM: dts: imx6q-sabrelite: add usb devices
ARM: mxs: clk_register_clkdev mx28 usb clocks
ARM: dts: imx28-evk: add usb devices

how are we going to handle these series ? drivers/usb/otg/* parts are mostly ok (I need to look deeper) but if I take drivers/usb/otg/* we will have to delay drivers/usb/chipidea I guess...

So someone would have to take the whole series ? Who will be that person? Alex, will it be you ?

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/20120605/044017be/attachment-0001.sig>
#54 lore raw

v3 cover add imx usb driver for mx28/6x

Quoted 30 lines · Felipe Balbi

Hi,

Quoted 12 lines · Richard Zhao

The work is based on ci13xxx rework done by Alexander Shishkin.

Status:
- this version only support host
- usbotg controler works at host role

Changes since V2:
- Rebase to Alex's tree
- Use regulator to control vbus power
- Remove ARCH check in Kconfig, but add OF_DEV check.
- Other changes according laster version comments.

Quoted 14 lines

Richard Zhao (12):
usb: otg: add notify_connect/notify_disconnect callback
usb: chipidea: permit driver bindings pass phy pointer
usb: ehci-hcd: notify phy when connect change
usb: otg: add basic mxs phy driver support
usb: chipidea: add imx platform driver
ARM: imx6q: correct device name of usbphy and usb controller clock
export
ARM: imx6q: add config-on-boot gpios
ARM: imx6q: add usbphy clocks
ARM: imx6q: disable usb charger detector
ARM: dts: imx6q-sabrelite: add usb devices
ARM: mxs: clk_register_clkdev mx28 usb clocks
ARM: dts: imx28-evk: add usb devices

Quoted 7 lines

how are we going to handle these series ? drivers/usb/otg/* parts are mostly ok (I need to look deeper) but if I take drivers/usb/otg/* we will have to delay drivers/usb/chipidea I guess...

So someone would have to take the whole series ? Who will be that person? Alex, will it be you ?

I'm unsure about drivers/usb part, but arch/arm part should go via arm-soc tree.

Signature · 2 lines
Regards,
Shawn
#55 lore raw

v3 cover add imx usb driver for mx28/6x

Quoted 35 lines · Shawn Guo
Quoted 34 lines · Felipe Balbi

Hi,

Quoted 12 lines · Richard Zhao

The work is based on ci13xxx rework done by Alexander Shishkin.

Status:
- this version only support host
- usbotg controler works at host role

Changes since V2:
- Rebase to Alex's tree
- Use regulator to control vbus power
- Remove ARCH check in Kconfig, but add OF_DEV check.
- Other changes according laster version comments.

Quoted 14 lines

Richard Zhao (12):
usb: otg: add notify_connect/notify_disconnect callback
usb: chipidea: permit driver bindings pass phy pointer
usb: ehci-hcd: notify phy when connect change
usb: otg: add basic mxs phy driver support
usb: chipidea: add imx platform driver
ARM: imx6q: correct device name of usbphy and usb controller clock
export
ARM: imx6q: add config-on-boot gpios
ARM: imx6q: add usbphy clocks
ARM: imx6q: disable usb charger detector
ARM: dts: imx6q-sabrelite: add usb devices
ARM: mxs: clk_register_clkdev mx28 usb clocks
ARM: dts: imx28-evk: add usb devices

how are we going to handle these series ? drivers/usb/otg/* parts are mostly ok (I need to look deeper) but if I take drivers/usb/otg/* we will have to delay drivers/usb/chipidea I guess...

Quoted 5 lines
Quoted 3 lines

So someone would have to take the whole series ? Who will be that person? Alex, will it be you ?

I'm unsure about drivers/usb part, but arch/arm part should go via arm-soc tree.

Yes, sure but the whole series is very "coupled" together... Maybe Richard could try to split this series into things that can go through arm-soc with no dependency on the other part and things that depend on drivers/usb/*

Richard, can you do that ?

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/20120606/649ec1a6/attachment.sig>
#56 lore raw

v3 cover add imx usb driver for mx28/6x

Quoted 5 lines · Felipe Balbi

Yes, sure but the whole series is very "coupled" together... Maybe Richard could try to split this series into things that can go through arm-soc with no dependency on the other part and things that depend on drivers/usb/*

As far as arch/arm patches applying concerned, I haven't seen any dependency on drivers/usb part. If those patches can be applied on arm-soc tree and do not break anything, that's good enough. For usb to actually function, we will need to wait usb and arm-soc trees get together somewhere, firstly linux-next, eventually mainline.

Regards,
Shawn

#57 lore raw

v3 cover add imx usb driver for mx28/6x

In reply to Felipe Balbi
Quoted 39 lines · Felipe Balbi
Quoted 38 lines · Shawn Guo
Quoted 37 lines · Felipe Balbi

Hi,

Quoted 12 lines · Richard Zhao

The work is based on ci13xxx rework done by Alexander Shishkin.

Status:
- this version only support host
- usbotg controler works at host role

Changes since V2:
- Rebase to Alex's tree
- Use regulator to control vbus power
- Remove ARCH check in Kconfig, but add OF_DEV check.
- Other changes according laster version comments.

Quoted 14 lines

Richard Zhao (12):
usb: otg: add notify_connect/notify_disconnect callback
usb: chipidea: permit driver bindings pass phy pointer
usb: ehci-hcd: notify phy when connect change
usb: otg: add basic mxs phy driver support
usb: chipidea: add imx platform driver
ARM: imx6q: correct device name of usbphy and usb controller clock
export
ARM: imx6q: add config-on-boot gpios
ARM: imx6q: add usbphy clocks
ARM: imx6q: disable usb charger detector
ARM: dts: imx6q-sabrelite: add usb devices
ARM: mxs: clk_register_clkdev mx28 usb clocks
ARM: dts: imx28-evk: add usb devices

how are we going to handle these series ? drivers/usb/otg/* parts are mostly ok (I need to look deeper) but if I take drivers/usb/otg/* we will have to delay drivers/usb/chipidea I guess...

So someone would have to take the whole series ? Who will be that person? Alex, will it be you ?

Quoted 7 lines
Quoted 2 lines

I'm unsure about drivers/usb part, but arch/arm part should go via arm-soc tree.

Yes, sure but the whole series is very "coupled" together... Maybe Richard could try to split this series into things that can go through arm-soc with no dependency on the other part and things that depend on drivers/usb/*

I'm not clear. How does the ARM part depend on drivers/usb? Shawn maybe could pick the ARM platform part. But the usb driver part is divided into three maintainer, Balbi for otg, Alan for ehci-hcd, Alex for Chipidea. Chipidea part depends on ehci-hcd and otg. So I guess Greg could pick up all the driver part and Balbi, Alan and Alex merge them back. Hope it could avoid loop dependency.

Thanks
Richard

Quoted 5 lines

Richard, can you do that ?

Signature · 1 line
balbi
#58 lore raw

v3 cover add imx usb driver for mx28/6x

Quoted 47 lines · Richard Zhao
Quoted 39 lines · Felipe Balbi
Quoted 38 lines · Shawn Guo
Quoted 37 lines · Felipe Balbi

Hi,

Quoted 12 lines · Richard Zhao

The work is based on ci13xxx rework done by Alexander Shishkin.

Status:
- this version only support host
- usbotg controler works at host role

Changes since V2:
- Rebase to Alex's tree
- Use regulator to control vbus power
- Remove ARCH check in Kconfig, but add OF_DEV check.
- Other changes according laster version comments.

Quoted 14 lines

Richard Zhao (12):
usb: otg: add notify_connect/notify_disconnect callback
usb: chipidea: permit driver bindings pass phy pointer
usb: ehci-hcd: notify phy when connect change
usb: otg: add basic mxs phy driver support
usb: chipidea: add imx platform driver
ARM: imx6q: correct device name of usbphy and usb controller clock
export
ARM: imx6q: add config-on-boot gpios
ARM: imx6q: add usbphy clocks
ARM: imx6q: disable usb charger detector
ARM: dts: imx6q-sabrelite: add usb devices
ARM: mxs: clk_register_clkdev mx28 usb clocks
ARM: dts: imx28-evk: add usb devices

how are we going to handle these series ? drivers/usb/otg/* parts are mostly ok (I need to look deeper) but if I take drivers/usb/otg/* we will have to delay drivers/usb/chipidea I guess...

So someone would have to take the whole series ? Who will be that person? Alex, will it be you ?

Quoted 7 lines
Quoted 2 lines

I'm unsure about drivers/usb part, but arch/arm part should go via arm-soc tree.

Yes, sure but the whole series is very "coupled" together... Maybe Richard could try to split this series into things that can go through arm-soc with no dependency on the other part and things that depend on drivers/usb/*

Quoted 6 lines

I'm not clear. How does the ARM part depend on drivers/usb? Shawn maybe could pick the ARM platform part. But the usb driver part is divided into three maintainer, Balbi for otg, Alan for ehci-hcd, Alex for Chipidea. Chipidea part depends on ehci-hcd and otg. So I guess Greg could pick up all the driver part and Balbi, Alan and Alex merge them back. Hope it could avoid loop dependency.

As long as Felipe and Alan give their acks and it's ok with everybody else, I can pick up the whole drivers/usb part (patches 01-05).

Regards,
--
Alex

#59 lore raw

v3 cover add imx usb driver for mx28/6x

In reply to Richard Zhao
Quoted 47 lines · Richard Zhao
Quoted 39 lines · Felipe Balbi
Quoted 38 lines · Shawn Guo
Quoted 37 lines · Felipe Balbi

Hi,

Quoted 12 lines · Richard Zhao

The work is based on ci13xxx rework done by Alexander Shishkin.

Status:
- this version only support host
- usbotg controler works at host role

Changes since V2:
- Rebase to Alex's tree
- Use regulator to control vbus power
- Remove ARCH check in Kconfig, but add OF_DEV check.
- Other changes according laster version comments.

Quoted 14 lines

Richard Zhao (12):
usb: otg: add notify_connect/notify_disconnect callback
usb: chipidea: permit driver bindings pass phy pointer
usb: ehci-hcd: notify phy when connect change
usb: otg: add basic mxs phy driver support
usb: chipidea: add imx platform driver
ARM: imx6q: correct device name of usbphy and usb controller clock
export
ARM: imx6q: add config-on-boot gpios
ARM: imx6q: add usbphy clocks
ARM: imx6q: disable usb charger detector
ARM: dts: imx6q-sabrelite: add usb devices
ARM: mxs: clk_register_clkdev mx28 usb clocks
ARM: dts: imx28-evk: add usb devices

how are we going to handle these series ? drivers/usb/otg/* parts are mostly ok (I need to look deeper) but if I take drivers/usb/otg/* we will have to delay drivers/usb/chipidea I guess...

So someone would have to take the whole series ? Who will be that person? Alex, will it be you ?

Quoted 7 lines
Quoted 2 lines

I'm unsure about drivers/usb part, but arch/arm part should go via arm-soc tree.

Yes, sure but the whole series is very "coupled" together... Maybe Richard could try to split this series into things that can go through arm-soc with no dependency on the other part and things that depend on drivers/usb/*

Quoted 6 lines

I'm not clear. How does the ARM part depend on drivers/usb? Shawn maybe could pick the ARM platform part. But the usb driver part is divided into three maintainer, Balbi for otg, Alan for ehci-hcd, Alex for Chipidea. Chipidea part depends on ehci-hcd and otg. So I guess Greg could pick up all the driver part and Balbi, Alan and Alex merge them back. Hope it could avoid loop dependency.

I will apply this stuff to my tree as soon as we have an explicit ack from Alan on the notifiers patch [1].

[1] http://marc.info/?l=linux-arm-kernel&m=133894640106323&w=2

Regards,
--
Alex