Skip to contentSkip to conversation

add imx usb driver for mx28/6x

PATCH Superseded Richard Zhao 11 participants 91 messages May 21, 2012 – May 24, 2012

Subsystems (8)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 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 V1:
- Merge the work of Marek
- re-implement connect change notify
- imx6q: move part of code to clk
- imx6q: add config-on-boot gpios

Richard Zhao (12):
usb: otg: add notify_connect_change 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 driver binding
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/usb/ci13xxx-imx.txt        |   20 ++
 Documentation/devicetree/bindings/usb/mxs-phy.txt  |   13 ++
 arch/arm/boot/dts/imx28-evk.dts                    |   18 ++
 arch/arm/boot/dts/imx28.dtsi                       |   12 +-
 arch/arm/boot/dts/imx6q-sabrelite.dts              |   25 +++-
 arch/arm/boot/dts/imx6q.dtsi                       |   44 ++++-
 arch/arm/mach-imx/clk-imx6q.c                      |   12 +-
 arch/arm/mach-imx/mach-imx6q.c                     |   60 ++++++
 drivers/clk/mxs/clk-imx28.c                        |    4 +
 drivers/usb/chipidea/Makefile                      |    8 +
 drivers/usb/chipidea/ci.h                          |    2 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  191 +++++++++++++++++++
 drivers/usb/chipidea/core.c                        |    4 +
 drivers/usb/chipidea/host.c                        |    1 +
 drivers/usb/chipidea/udc.c                         |   11 +-
 drivers/usb/host/ehci-hcd.c                        |    9 +
 drivers/usb/otg/Kconfig                            |    8 +
 drivers/usb/otg/Makefile                           |    1 +
 drivers/usb/otg/mxs-phy.c                          |  196 ++++++++++++++++++++
 include/linux/usb/chipidea.h                       |    3 +
 include/linux/usb/otg.h                            |   13 ++
 21 files changed, 644 insertions(+), 11 deletions(-)
 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 v2 1/12 usb: otg: add notify_connect_change callback

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

---
 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +13 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 };
 
 
@@ -252,6 +256,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 }
 
 static inline int
+usb_phy_notify_connect_change(struct usb_phy *x, int port, int connected)
+{
+	if (x->notify_connect_change != NULL)
+		return x->notify_connect_change(x, port, connected);
+	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 v2 1/12 usb: otg: add notify_connect_change callback

Quoted 24 lines · Richard Zhao

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

---
 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 };
 
 

include/linux/usb/otg.h usb_phy_set_suspend(struct usb_phy *x, int suspend) · line 261

Quoted 6 lines
include/linux/usb/otg.h +3 -0
@@ -252,6 +256,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 }
 
 static inline int
+usb_phy_notify_connect_change(struct usb_phy *x, int port, int connected)
+{
+	if (x->notify_connect_change != NULL)

you don't need this != NULL. See that no other wrapper has it. Keep consistency.

Also, this is the kind of stuff that I have been queueing for Greg so I should be in Cc.

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/20120521/8b2dba91/attachment-0001.sig>
#3 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

Quoted 27 lines · Felipe Balbi
Quoted 26 lines · Richard Zhao

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

---
 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 };
 
 
@@ -252,6 +256,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 }
 
Quoted 7 lines

include/linux/usb/otg.h usb_phy_set_suspend(struct usb_phy *x, int suspend) · line 261

Quoted 4 lines
include/linux/usb/otg.h +3 -0
 static inline int
+usb_phy_notify_connect_change(struct usb_phy *x, int port, int connected)
+{
+	if (x->notify_connect_change != NULL)

you don't need this != NULL. See that no other wrapper has it. Keep consistency.

notify_connect_change callback is not a must. I just let the phy driver have a chance to do whatever it needs to do.

Quoted 3 lines

Also, this is the kind of stuff that I have been queueing for Greg so I should be in Cc.

Ah, I'm really sorry. I just find out I used the result of get_maintainer for v1 patchset.

Thanks
Richard

Quoted 3 lines
Signature · 2 lines
-- 
balbi
#4 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

Quoted 35 lines · Richard Zhao
Quoted 27 lines · Felipe Balbi
Quoted 26 lines · Richard Zhao

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

---
 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 };
 
 
@@ -252,6 +256,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 }
 
Quoted 7 lines

include/linux/usb/otg.h usb_phy_set_suspend(struct usb_phy *x, int suspend) · line 261

Quoted 4 lines
include/linux/usb/otg.h +3 -0
 static inline int
+usb_phy_notify_connect_change(struct usb_phy *x, int port, int connected)
+{
+	if (x->notify_connect_change != NULL)

you don't need this != NULL. See that no other wrapper has it. Keep consistency.

Quoted 2 lines

notify_connect_change callback is not a must. I just let the phy driver have a chance to do whatever it needs to do.

what I meant was:

- if (x->notify_connect_change != NULL)
+ if (x->notify_connect_change)

Quoted 4 lines
Quoted 2 lines

Also, this is the kind of stuff that I have been queueing for Greg so I should be in Cc.

Ah, I'm really sorry. I just find out I used the result of get_maintainer for v1 patchset.

hmm... ok, looks like I should patch MAINTAINERS file for that :-p

Greg, is it ok ?

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/20120521/52db93ea/attachment.sig>
#5 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

Quoted 41 lines · Felipe Balbi
Quoted 35 lines · Richard Zhao
Quoted 27 lines · Felipe Balbi
Quoted 26 lines · Richard Zhao

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

---
 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 };
 
 
@@ -252,6 +256,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 }
 
Quoted 7 lines

include/linux/usb/otg.h usb_phy_set_suspend(struct usb_phy *x, int suspend) · line 261

Quoted 4 lines
include/linux/usb/otg.h +3 -0
 static inline int
+usb_phy_notify_connect_change(struct usb_phy *x, int port, int connected)
+{
+	if (x->notify_connect_change != NULL)

you don't need this != NULL. See that no other wrapper has it. Keep consistency.

Quoted 2 lines

notify_connect_change callback is not a must. I just let the phy driver have a chance to do whatever it needs to do.

what I meant was:

Review

Quoted 2 lines
(quoted diff) +1 -1
-	if (x->notify_connect_change != NULL)
+	if (x->notify_connect_change)

Ah, Sure.

Thanks
Richard

Quoted 12 lines
Quoted 5 lines
Quoted 3 lines

Also, this is the kind of stuff that I have been queueing for Greg so I should be in Cc.

Ah, I'm really sorry. I just find out I used the result of get_maintainer for v1 patchset.

hmm... ok, looks like I should patch MAINTAINERS file for that :-p

Greg, is it ok ?

Signature · 1 line
balbi
maintainer
#6 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

In reply to Felipe Balbi
Quoted 44 lines · Felipe Balbi
Quoted 35 lines · Richard Zhao
Quoted 27 lines · Felipe Balbi
Quoted 26 lines · Richard Zhao

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

---
 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 };
 
 
@@ -252,6 +256,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 }
 
Quoted 7 lines

include/linux/usb/otg.h usb_phy_set_suspend(struct usb_phy *x, int suspend) · line 261

Quoted 4 lines
include/linux/usb/otg.h +3 -0
 static inline int
+usb_phy_notify_connect_change(struct usb_phy *x, int port, int connected)
+{
+	if (x->notify_connect_change != NULL)

you don't need this != NULL. See that no other wrapper has it. Keep consistency.

Quoted 2 lines

notify_connect_change callback is not a must. I just let the phy driver have a chance to do whatever it needs to do.

what I meant was:

(quoted diff) +1 -1
-	if (x->notify_connect_change != NULL)
+	if (x->notify_connect_change)
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Also, this is the kind of stuff that I have been queueing for Greg so I should be in Cc.

Ah, I'm really sorry. I just find out I used the result of get_maintainer for v1 patchset.

hmm... ok, looks like I should patch MAINTAINERS file for that :-p

Greg, is it ok ?

Yes, please send me a patch for MAINTAINERS for this.

greg k-h

maintainer
#7 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

In reply to Richard Zhao
Quoted 13 lines · Richard Zhao

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

---
 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +0 -0
index 38ab3f4..385641d 100644

include/linux/usb/otg.h struct usb_phy { · line 124

Quoted 8 lines
include/linux/usb/otg.h +4 -0
@@ -117,6 +117,10 @@ struct usb_phy {
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 };

No, please make this two different callbacks. As you see in your code when you implemented this, you really have:

	if (connected) {
		do this...
	} else {
		do that...
	}

So you there is no consolidation in the driver, so just make it 2 callbacks, especially as someone wanted to make connected -1 just for a tristate, which would be impossible to document properly...

greg k-h

Quoted 26 lines
include/linux/usb/otg.h +9 -0
@@ -252,6 +256,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 }
 
 static inline int
+usb_phy_notify_connect_change(struct usb_phy *x, int port, int connected)
+{
+	if (x->notify_connect_change != NULL)
+		return x->notify_connect_change(x, port, connected);
+	else
+		return 0;
+}
+
+static inline int
 otg_start_srp(struct usb_otg *otg)
 {
 	if (otg && otg->start_srp)
Signature · 7 lines
1.7.5.4


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

Dear Greg KH,

Quoted 35 lines · Richard Zhao
Quoted 24 lines

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

---

 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 
 	int	(*set_suspend)(struct usb_phy *x,
 
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 
Quoted 1 line

};

No, please make this two different callbacks. As you see in your code when you implemented this, you really have:

	if (connected) {
		do this...
	} else {
		do that...
	}
Quoted 3 lines

So you there is no consolidation in the driver, so just make it 2 callbacks, especially as someone wanted to make connected -1 just for a tristate, which would be impossible to document properly...

Or he could make connected an enum maybe ?

Quoted 19 lines

greg k-h

Quoted 16 lines
include/linux/usb/otg.h +8 -0
@@ -252,6 +256,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 
 }
 
 static inline int
 
+usb_phy_notify_connect_change(struct usb_phy *x, int port, int
 connected) +{
+	if (x->notify_connect_change != NULL)
+		return x->notify_connect_change(x, port, connected);
+	else
+		return 0;
+}
+
+static inline int
Quoted 4 lines
Quoted 4 lines

otg_start_srp(struct usb_otg *otg)
{

if (otg && otg->start_srp)

Best regards,
Marek Vasut

maintainer
#9 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

Quoted 37 lines · Marek Vasut

Dear Greg KH,

Quoted 35 lines · Richard Zhao
Quoted 24 lines

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

---

 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 
 	int	(*set_suspend)(struct usb_phy *x,
 
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 
Quoted 1 line

};

No, please make this two different callbacks. As you see in your code when you implemented this, you really have:

	if (connected) {
		do this...
	} else {
		do that...
	}
Quoted 5 lines
Quoted 3 lines

So you there is no consolidation in the driver, so just make it 2 callbacks, especially as someone wanted to make connected -1 just for a tristate, which would be impossible to document properly...

Or he could make connected an enum maybe ?

No, again, that will make nothing easier on the driver end at all.

What's the problem with different functions that people keep resisting?

greg k-h

#10 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

Dear Greg KH,

Quoted 47 lines · Marek Vasut
Quoted 46 lines

Dear Greg KH,

Quoted 43 lines · Richard Zhao
Quoted 24 lines

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

---

 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 
 	int	(*set_suspend)(struct usb_phy *x,
 
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 
Quoted 1 line

};

No, please make this two different callbacks. As you see in your code

when you implemented this, you really have:

	if (connected) {
	
		do this...
	
	} else {
	
		do that...
	
	}

So you there is no consolidation in the driver, so just make it 2 callbacks, especially as someone wanted to make connected -1 just for a tristate, which would be impossible to document properly...

Quoted 5 lines
Quoted 1 line

Or he could make connected an enum maybe ?

No, again, that will make nothing easier on the driver end at all.

What's the problem with different functions that people keep resisting?

The structure grows a few bytes ... so the kernel eats a bit more ram.

Quoted 2 lines

greg k-h

Best regards,
Marek Vasut

maintainer
#11 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

Quoted 49 lines · Marek Vasut

Dear Greg KH,

Quoted 47 lines · Marek Vasut
Quoted 46 lines

Dear Greg KH,

Quoted 43 lines · Richard Zhao
Quoted 24 lines

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

---

 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 
 	int	(*set_suspend)(struct usb_phy *x,
 
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 
Quoted 1 line

};

No, please make this two different callbacks. As you see in your code

when you implemented this, you really have:

	if (connected) {
	
		do this...
	
	} else {
	
		do that...
	
	}

So you there is no consolidation in the driver, so just make it 2 callbacks, especially as someone wanted to make connected -1 just for a tristate, which would be impossible to document properly...

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Or he could make connected an enum maybe ?

No, again, that will make nothing easier on the driver end at all.

What's the problem with different functions that people keep resisting?

The structure grows a few bytes ... so the kernel eats a bit more ram.

The time it took you to write this email just made up for that extra ram, sorry :)

It doesn't matter, have people leaned nothing from our past mistakes?

greg k-h

#12 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

Dear Greg KH,

Quoted 53 lines · Marek Vasut
Quoted 52 lines

Dear Greg KH,

Quoted 50 lines · Marek Vasut
Quoted 48 lines

Dear Greg KH,

Quoted 41 lines · Richard Zhao
Quoted 24 lines

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

---

 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 
 	int	(*set_suspend)(struct usb_phy *x,
 
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 
Quoted 1 line

};

No, please make this two different callbacks. As you see in your code

when you implemented this, you really have:

	if (connected) {
	
		do this...
	
	} else {
	
		do that...
	
	}
Quoted 3 lines

So you there is no consolidation in the driver, so just make it 2 callbacks, especially as someone wanted to make connected -1 just for a tristate, which would be impossible to document properly...

Or he could make connected an enum maybe ?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

No, again, that will make nothing easier on the driver end at all.

What's the problem with different functions that people keep resisting?

The structure grows a few bytes ... so the kernel eats a bit more ram.

The time it took you to write this email just made up for that extra ram, sorry :)

Heh :-) But is this email constantly allocated in your kernel space?

Quoted 1 line

It doesn't matter, have people leaned nothing from our past mistakes?

All right, I won't argue with you. Richard, let's obey.

Quoted 1 line

greg k-h

Best regards,
Marek Vasut

#13 lore raw

PATCH v2 1/12 usb: otg: add notify_connect_change callback

Quoted 61 lines · Marek Vasut

Dear Greg KH,

Quoted 59 lines · Marek Vasut
Quoted 57 lines

Dear Greg KH,

Quoted 48 lines · Marek Vasut
Quoted 47 lines

Dear Greg KH,

Quoted 44 lines · Richard Zhao
Quoted 24 lines

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

---

 include/linux/usb/otg.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/usb/otg.h +4 -0
index 38ab3f4..385641d 100644
@@ -117,6 +117,10 @@ struct usb_phy {
 
 	int	(*set_suspend)(struct usb_phy *x,
 
 				int suspend);
 
+	/* notify phy connect status change */
+	int	(*notify_connect_change)(struct usb_phy *x,
+					 int port,
+					 int connected);
 
Quoted 1 line

};

No, please make this two different callbacks. As you see in your code

when you implemented this, you really have:

	if (connected) {
	
		do this...
	
	} else {
	
		do that...
	
	}

So you there is no consolidation in the driver, so just make it 2 callbacks, especially as someone wanted to make connected -1 just for a tristate, which would be impossible to document properly...

Quoted 5 lines
Quoted 1 line

Or he could make connected an enum maybe ?

No, again, that will make nothing easier on the driver end at all.

What's the problem with different functions that people keep resisting?

The structure grows a few bytes ... so the kernel eats a bit more ram.

Quoted 8 lines
Quoted 2 lines

The time it took you to write this email just made up for that extra ram, sorry :)

Heh :-) But is this email constantly allocated in your kernel space?

Quoted 1 line

It doesn't matter, have people leaned nothing from our past mistakes?

All right, I won't argue with you. Richard, let's obey.

Sure. I'll change it. I think Greq's point here is maintenance. And 4-byte ram consume don't cost to be noticed.

Thanks
Richard

Quoted 6 lines
Quoted 2 lines

greg k-h

Best regards,
Marek Vasut

#14 lore raw

PATCH v2 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 50911f8..71d7080 100644
@@ -160,6 +160,8 @@ struct ci13xxx {
 
 	struct ci13xxx_udc_driver	*udc_driver;
 	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 15e03b3..0492786 100644
@@ -365,6 +365,10 @@ static int __devinit ci_hdrc_probe(struct platform_device *pdev)
 
 	ci->dev = dev;
 	ci->udc_driver = dev->platform_data;
+	if (ci->udc_driver->phy)
+		ci->transceiver = ci->udc_driver->phy;
+	else
+		ci->global_phy = 1;
 
 	ret = hw_device_init(ci, base);
 	if (ret < 0) {
drivers/usb/chipidea/host.c +1 -0
index 9eacd21..7bc11a5 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 51f9694..22139fae 100644
@@ -1687,7 +1687,8 @@ static int udc_start(struct ci13xxx *udc)
 
 	udc->gadget.ep0 = &udc->ep0in->ep;
 
-	udc->transceiver = usb_get_transceiver();
+	if (udc->global_phy) {
+		udc->transceiver = usb_get_transceiver();
 
 	if (udc->udc_driver->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
 		if (udc->transceiver == NULL) {
@@ -1731,7 +1732,8 @@ static int udc_start(struct ci13xxx *udc)
 remove_trans:
 	if (udc->transceiver) {
 		otg_set_peripheral(udc->transceiver->otg, &udc->gadget);
-		usb_put_transceiver(udc->transceiver);
+		if (udc->global_phy)
+			usb_put_transceiver(udc->transceiver);
 	}
 
 	dev_err(dev, "error = %i\n", retval);
@@ -1740,7 +1742,7 @@ remove_dbg:
 unreg_device:
 	device_unregister(&udc->gadget.dev);
 put_transceiver:
-	if (udc->transceiver)
+	if (udc->transceiver && udc->global_phy)
 		usb_put_transceiver(udc->transceiver);
 free_pools:
 	dma_pool_destroy(udc->td_pool);
@@ -1774,7 +1776,8 @@ static void udc_stop(struct ci13xxx *udc)
 
 	if (udc->transceiver) {
 		otg_set_peripheral(udc->transceiver->otg, NULL);
-		usb_put_transceiver(udc->transceiver);
+		if (udc->global_phy)
+			usb_put_transceiver(udc->transceiver);
 	}
 	dbg_remove_files(&udc->gadget.dev);
 	device_unregister(&udc->gadget.dev);
include/linux/usb/chipidea.h +3 -0
index edb90d6..c46c9e9 100644
@@ -5,12 +5,15 @@
 #ifndef __LINUX_USB_CHIPIDEA_H
 #define __LINUX_USB_CHIPIDEA_H
 
+#include <linux/usb/otg.h>
+
 struct ci13xxx;
 struct ci13xxx_udc_driver {
 	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
#15 lore raw

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

Dear Richard Zhao,

Quoted 5 lines

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 102 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 50911f8..71d7080 100644
@@ -160,6 +160,8 @@ struct ci13xxx {
 
 	struct ci13xxx_udc_driver	*udc_driver;
 	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 15e03b3..0492786 100644
@@ -365,6 +365,10 @@ static int __devinit ci_hdrc_probe(struct
 platform_device *pdev)
 
 	ci->dev = dev;
 	ci->udc_driver = dev->platform_data;
+	if (ci->udc_driver->phy)
+		ci->transceiver = ci->udc_driver->phy;
+	else
+		ci->global_phy = 1;
 
 	ret = hw_device_init(ci, base);
drivers/usb/chipidea/core.c +0 -0
 	if (ret < 0) {
drivers/usb/chipidea/host.c +1 -0
index 9eacd21..7bc11a5 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 51f9694..22139fae 100644
@@ -1687,7 +1687,8 @@ static int udc_start(struct ci13xxx *udc)
 
 	udc->gadget.ep0 = &udc->ep0in->ep;
 
-	udc->transceiver = usb_get_transceiver();
+	if (udc->global_phy) {
+		udc->transceiver = usb_get_transceiver();
 
 	if (udc->udc_driver->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
 		if (udc->transceiver == NULL) {
@@ -1731,7 +1732,8 @@ static int udc_start(struct ci13xxx *udc)
 remove_trans:
 	if (udc->transceiver) {
 		otg_set_peripheral(udc->transceiver->otg, &udc->gadget);
-		usb_put_transceiver(udc->transceiver);
+		if (udc->global_phy)
+			usb_put_transceiver(udc->transceiver);
 	}
 
 	dev_err(dev, "error = %i\n", retval);
@@ -1740,7 +1742,7 @@ remove_dbg:
 unreg_device:
 	device_unregister(&udc->gadget.dev);
 put_transceiver:
-	if (udc->transceiver)
+	if (udc->transceiver && udc->global_phy)
 		usb_put_transceiver(udc->transceiver);
 free_pools:
 	dma_pool_destroy(udc->td_pool);
@@ -1774,7 +1776,8 @@ static void udc_stop(struct ci13xxx *udc)
 
 	if (udc->transceiver) {
 		otg_set_peripheral(udc->transceiver->otg, NULL);
-		usb_put_transceiver(udc->transceiver);
+		if (udc->global_phy)
+			usb_put_transceiver(udc->transceiver);
 	}
 	dbg_remove_files(&udc->gadget.dev);
 	device_unregister(&udc->gadget.dev);
include/linux/usb/chipidea.h +2 -0
index edb90d6..c46c9e9 100644
@@ -5,12 +5,15 @@
 #ifndef __LINUX_USB_CHIPIDEA_H
 #define __LINUX_USB_CHIPIDEA_H
 
+#include <linux/usb/otg.h>
+

include/linux/usb/chipidea.h line 19

Quoted 10 lines
include/linux/usb/chipidea.h +1 -0
 struct ci13xxx;
 struct ci13xxx_udc_driver {
 	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)

Best regards,
Marek Vasut

#16 lore raw

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

In reply to Richard Zhao

Richard Zhao <[email protected]> writes:

Hi,

Quoted 3 lines

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.

Some comments below:

[snip]

drivers/usb/chipidea/core.c static int __devinit ci_hdrc_probe(struct platform_device *pdev) · line 371

Quoted 6 lines
drivers/usb/chipidea/core.c +4 -0
 	ci->dev = dev;
 	ci->udc_driver = dev->platform_data;
+	if (ci->udc_driver->phy)
+		ci->transceiver = ci->udc_driver->phy;
+	else
+		ci->global_phy = 1;

Nitpick: since it's a bool, don't you want to use "true" instead?

[snip]

include/linux/usb/chipidea.h line 16

Quoted 9 lines
include/linux/usb/chipidea.h +3 -0
+#include <linux/usb/otg.h>
+
 struct ci13xxx;
 struct ci13xxx_udc_driver {
 	const char	*name;
 	/* offset of the capability registers */
 	uintptr_t	 capoffset;
 	unsigned	 power_budget;
+	struct usb_phy	*phy;

This structure is really platform information, not per-device instance. Consider, for example, situation when you have 2 controllers in one system, they'll be using the same platform structure, but they'll have different phys. Right?

Regards,
--
Alex

#17 lore raw

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

Dear Alexander Shishkin,

Quoted 35 lines

Richard Zhao <[email protected]> writes:

Hi,

Quoted 3 lines

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.

Some comments below:

[snip]

drivers/usb/chipidea/core.c static int __devinit ci_hdrc_probe(struct platform_device *pdev) · line 371

Quoted 7 lines
drivers/usb/chipidea/core.c +4 -0
 	ci->dev = dev;
 	ci->udc_driver = dev->platform_data;
 
+	if (ci->udc_driver->phy)
+		ci->transceiver = ci->udc_driver->phy;
+	else
+		ci->global_phy = 1;

Nitpick: since it's a bool, don't you want to use "true" instead?

[snip]

Quoted 11 lines
include/linux/usb/chipidea.h +2 -0
+#include <linux/usb/otg.h>
+
 
 struct ci13xxx;
 struct ci13xxx_udc_driver {
 
 	const char	*name;
 	/* offset of the capability registers */
 	uintptr_t	 capoffset;
 	unsigned	 power_budget;
Quoted 6 lines

include/linux/usb/chipidea.h line 16

Quoted 1 line
include/linux/usb/chipidea.h +1 -0
+	struct usb_phy	*phy;

This structure is really platform information, not per-device instance. Consider, for example, situation when you have 2 controllers in one system, they'll be using the same platform structure, but they'll have different phys. Right?

Not really, won't you allocate separate structure for them?

Quoted 4 lines

Regards,
--
Alex

Best regards,
Marek Vasut

#18 lore raw

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

Quoted 23 lines · Marek Vasut

Dear Alexander Shishkin,

Quoted 21 lines

Richard Zhao <[email protected]> writes:

Hi,

Quoted 3 lines

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.

Some comments below:

[snip]

drivers/usb/chipidea/core.c static int __devinit ci_hdrc_probe(struct platform_device *pdev) · line 371

Quoted 7 lines
drivers/usb/chipidea/core.c +4 -0
 	ci->dev = dev;
 	ci->udc_driver = dev->platform_data;
 
+	if (ci->udc_driver->phy)
+		ci->transceiver = ci->udc_driver->phy;
+	else
+		ci->global_phy = 1;

Nitpick: since it's a bool, don't you want to use "true" instead?

Yes. Thanks.

Quoted 14 lines
Quoted 14 lines

[snip]

Quoted 11 lines
include/linux/usb/chipidea.h +2 -0
+#include <linux/usb/otg.h>
+
 
 struct ci13xxx;
 struct ci13xxx_udc_driver {
 
 	const char	*name;
 	/* offset of the capability registers */
 	uintptr_t	 capoffset;
 	unsigned	 power_budget;
Quoted 8 lines
Quoted 6 lines

include/linux/usb/chipidea.h line 16

Quoted 1 line
include/linux/usb/chipidea.h +1 -0
+	struct usb_phy	*phy;

This structure is really platform information, not per-device instance. Consider, for example, situation when you have 2 controllers in one system, they'll be using the same platform structure, but they'll have different phys. Right?

Not really, won't you allocate separate structure for them?

Finally, we'll get phy instance from phy lib. But I don't know when it is ready. So I add this code for handy use before phy lib.

For now, it's ok. When I register platform device, it dup the plat data memory.

Thanks
Richard

Quoted 12 lines
Quoted 5 lines

Regards,
--
Alex

Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#19 lore raw

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

Quoted 4 lines

Finally, we'll get phy instance from phy lib. But I don't know when it is ready. So I add this code for handy use before phy lib.

not phy lib, but phy driver. lib is different with driver.

Quoted 17 lines

For now, it's ok. When I register platform device, it dup the plat data memory.

Thanks
Richard

Quoted 12 lines
Quoted 5 lines

Regards,
--
Alex

Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#20 lore raw

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

In reply to Marek Vasut
Quoted 37 lines · Marek Vasut

Dear Alexander Shishkin,

Quoted 35 lines

Richard Zhao <[email protected]> writes:

Hi,

Quoted 3 lines

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.

Some comments below:

[snip]

drivers/usb/chipidea/core.c static int __devinit ci_hdrc_probe(struct platform_device *pdev) · line 371

Quoted 7 lines
drivers/usb/chipidea/core.c +4 -0
 	ci->dev = dev;
 	ci->udc_driver = dev->platform_data;
 
+	if (ci->udc_driver->phy)
+		ci->transceiver = ci->udc_driver->phy;
+	else
+		ci->global_phy = 1;

Nitpick: since it's a bool, don't you want to use "true" instead?

[snip]

Quoted 11 lines
include/linux/usb/chipidea.h +2 -0
+#include <linux/usb/otg.h>
+
 
 struct ci13xxx;
 struct ci13xxx_udc_driver {
 
 	const char	*name;
 	/* offset of the capability registers */
 	uintptr_t	 capoffset;
 	unsigned	 power_budget;
Quoted 8 lines
Quoted 6 lines

include/linux/usb/chipidea.h line 16

Quoted 1 line
include/linux/usb/chipidea.h +1 -0
+	struct usb_phy	*phy;

This structure is really platform information, not per-device instance. Consider, for example, situation when you have 2 controllers in one system, they'll be using the same platform structure, but they'll have different phys. Right?

Not really, won't you allocate separate structure for them?

Currently, it's a static structure, see 05/12 and my comment there.

Regards,
--
Alex

#21 lore raw

PATCH v2 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 |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hcd.c +9 -0
index 5597e60..389252e 100644
@@ -928,6 +928,15 @@ 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)
+				usb_phy_notify_connect_change(ehci->transceiver,
+						i, pstatus & PORT_CONNECT);
+
 			if (pstatus & PORT_OWNER)
 				continue;
 			if (!(test_bit(i, &ehci->suspended_ports) &&
Signature · 1 line
1.7.5.4
#22 lore raw

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

Dear Richard Zhao,

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

Now, you'll laugh as this would be an obviously stupid question -- but where exactly does the debounce happen in the code?

Quoted 16 lines
---
 drivers/usb/host/ehci-hcd.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hcd.c +2 -0
index 5597e60..389252e 100644
@@ -928,6 +928,15 @@ 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

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

Quoted 10 lines
drivers/usb/host/ehci-hcd.c +7 -0
+			 * - the best place is after debounce, but I can't get
+			 *   phy there
+			 */
+			if ((pstatus & PORT_CSC) && ehci->transceiver)
+				usb_phy_notify_connect_change(ehci->transceiver,
+						i, pstatus & PORT_CONNECT);
+
 			if (pstatus & PORT_OWNER)
 				continue;
 			if (!(test_bit(i, &ehci->suspended_ports) &&

Best regards,
Marek Vasut

#23 lore raw

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

Hi Marek,

Quoted 9 lines · Marek Vasut

Dear Richard Zhao,

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

Now, you'll laugh as this would be an obviously stupid question -- but where exactly does the debounce happen in the code?

I meant hub_port_debounce function at drivers/usb/core/hub.c.

Thanks
Richard

#24 lore raw

PATCH v2 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                         |  196 +++++++++++++++++++++
 4 files changed, 218 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 +196 -0

196 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#25 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

In reply to Richard Zhao

Just add host support.

Cc Peter Chen <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 drivers/usb/chipidea/Makefile                      |    8 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  191 ++++++++++++++++++++
 3 files changed, 219 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 +8 -0
index cc34937..ffa2f63 100644
@@ -12,3 +12,11 @@ endif
 ifneq ($(CONFIG_ARCH_MSM),)
 	obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_msm.o
 endif
+
+ifneq ($(CONFIG_ARCH_MXC),)
+	obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_imx.o
+else
+  ifneq ($(CONFIG_ARCH_MXS),)
+	  obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_imx.o
+  endif
+endif
drivers/usb/chipidea/ci13xxx_imx.c new file +191 -0

191 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#26 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Dear Richard Zhao,

Quoted 1 line

Just add host support.

Maybe rephrase it to something like "This patch supports only the host-mode functionality so far."

Quoted 46 lines
Cc Peter Chen <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 drivers/usb/chipidea/Makefile                      |    8 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  191
++++++++++++++++++++ 3 files changed, 219 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
 create mode 100644 drivers/usb/chipidea/ci13xxx_imx.c
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt new file mode 100644
index 0000000..beb75d6

Documentation/devicetree/bindings/usb/ci13xxx-imx.txt new file +20 -0
@@ -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 +0 -0
index cc34937..ffa2f63 100644
@@ -12,3 +12,11 @@ endif
 ifneq ($(CONFIG_ARCH_MSM),)

drivers/usb/chipidea/Makefile endif · line 22

Quoted 10 lines
drivers/usb/chipidea/Makefile +8 -0
 	obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_msm.o
 endif
+
+ifneq ($(CONFIG_ARCH_MXC),)
+	obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_imx.o
+else
+  ifneq ($(CONFIG_ARCH_MXS),)
+	  obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_imx.o
+  endif
+endif

I think someone commented on these patches (my previous set of patches actually), that this should be fixed in a way that you can actually select which bindings you want to compile in (and not limit it via Makefile like it's now).

Quoted 63 lines
(quoted diff) +0 -0

b/drivers/usb/chipidea/ci13xxx_imx.c new file mode 100644 index 0000000..9f64b3c

drivers/usb/chipidea/ci13xxx_imx.c new file +57 -0
@@ -0,0 +1,191 @@
+/*
+ * 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/of_platform.h>
+#include <linux/of_gpio.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/usb/chipidea.h>
+#include <linux/usb/ehci_def.h>
+#include <linux/usb/gadget.h>
+#include <linux/usb/chipidea.h>
+#include <linux/usb/otg.h>
+#include <linux/dma-mapping.h>
+#include <linux/clk.h>
+#include <linux/string.h>
+
+#include "ci.h"
+
+#define PORT0_STATUS	0x184
+
+#define pdev_to_phy(pdev) \
+	((struct usb_phy *)platform_get_drvdata(pdev))
+
+struct ci13xxx_imx_data {
+	struct device_node *phy_np;
+	struct usb_phy *phy;
+	struct platform_device *ci_pdev;
+	struct clk *clk;
+	int gpio_hub_rst, gpio_vbus_pwr;
+};
+
+static struct ci13xxx_udc_driver ci13xxx_imx_udc_driver __devinitdata  = {
+	.name			= "ci13xxx_imx",
+	.flags			= CI13XXX_REQUIRE_TRANSCEIVER |
+				  CI13XXX_PULLUP_ON_VBUS |
+				  CI13XXX_DISABLE_STREAMING,
+	.capoffset		= DEF_CAPOFFSET,
+};
+
+static int __devinit ci13xxx_imx_probe(struct platform_device *pdev)
+{
+	struct ci13xxx_imx_data *data;
+	struct platform_device *plat_ci, *phy_pdev;
+	struct platform_device_info ci_pdevinfo;
+	struct device_node *phy_np;
+	struct resource *res;

drivers/usb/chipidea/ci13xxx_imx.c line 67

Quoted 10 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +10 -0
+	int vbus_pwr;
+	int ret;
+
+	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+	if (!data) {
+		dev_err(&pdev->dev, "Failed to allocate CI13xxx-IMX data!\n");
+		return -ENOMEM;
+	}
+	data->gpio_hub_rst = -1;
+	data->gpio_vbus_pwr = -1;

This really freaks me out. Maybe we should have some kind of a regulator that manages the VBUS and let this driver toggle the regulator when fitting? That'd solve the problem to some extent, as other people would be able to supply NOP regulator.

drivers/usb/chipidea/ci13xxx_imx.c line 71

Quoted 3 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +3 -0
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "can't get device resources!\n");

Can't ... capital "C" ;-)

Quoted 11 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +11 -0
+		return -ENOENT;
+	}
+
+	data->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(data->clk)) {
+		dev_err(&pdev->dev, "Failed to get clock!\n");
+		return PTR_ERR(data->clk);
+	}
+
+	ret = clk_prepare_enable(data->clk);
+	if (ret) {

drivers/usb/chipidea/ci13xxx_imx.c line 92

Quoted 10 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +10 -0
+		dev_err(&pdev->dev, "Failed to prepare or enable clock!\n");
+		return ret;
+	}
+
+	phy_np = of_parse_phandle(pdev->dev.of_node, "fsl,usbphy", 0);
+	if (phy_np) {
+		data->phy_np = phy_np;
+		phy_pdev = of_find_device_by_node(phy_np);
+		if (phy_pdev) {
+			struct usb_phy *phy;

Do we really want to define new variables in the middle of a code?

drivers/usb/chipidea/ci13xxx_imx.c line 104

Quoted 12 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +12 -0
+			phy = pdev_to_phy(phy_pdev);
+			if (phy &&
+			    try_module_get(phy_pdev->dev.driver->owner)) {
+				usb_phy_init(phy);
+				data->phy = phy;
+			}
+		}
+	}
+
+	/* we only support host now, so enable vbus here */
+	vbus_pwr = of_get_named_gpio(pdev->dev.of_node,
+					"fsl,vbus-power-gpios", 0);

(This one is for my personal enlightment) Why is the property called "gpios" (plural) if it's only one GPIO?

Quoted 57 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +57 -0
+	if (gpio_is_valid(vbus_pwr) &&
+	    !devm_gpio_request(&pdev->dev, vbus_pwr, "vbus-pwr")) {
+		gpio_direction_output(vbus_pwr, 1);
+		data->gpio_hub_rst = vbus_pwr;
+	}
+
+	ci13xxx_imx_udc_driver.phy = data->phy;
+	memset(&ci_pdevinfo, 0, sizeof(ci_pdevinfo));
+	ci_pdevinfo.parent = &pdev->dev;
+	ci_pdevinfo.name = "ci_hdrc";
+	ci_pdevinfo.id = (int)res->start;
+	ci_pdevinfo.res = pdev->resource;
+	ci_pdevinfo.num_res = pdev->num_resources;
+	ci_pdevinfo.data = &ci13xxx_imx_udc_driver;
+	ci_pdevinfo.size_data = sizeof(ci13xxx_imx_udc_driver);
+	ci_pdevinfo.dma_mask = DMA_BIT_MASK(32);
+
+	plat_ci = platform_device_register_full(&ci_pdevinfo);
+	if (IS_ERR(plat_ci)) {
+		dev_err(&pdev->dev, "can't register ci_hdrc platform device\n");
+		ret = PTR_ERR(plat_ci);
+		goto put_np;
+	}
+
+	data->ci_pdev = plat_ci;
+	platform_set_drvdata(pdev, data);
+
+	pm_runtime_no_callbacks(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
+	return 0;
+
+put_np:
+	if (phy_np)
+		of_node_put(phy_np);
+	return ret;
+}
+
+static int __devexit ci13xxx_imx_remove(struct platform_device *pdev)
+{
+	struct ci13xxx_imx_data *data = platform_get_drvdata(pdev);
+
+	kfree(data->ci_pdev->dev.dma_mask);
+	data->ci_pdev->dev.dma_mask = NULL;
+	platform_device_unregister(data->ci_pdev);
+
+	if (data->gpio_vbus_pwr != -1)
+		gpio_direction_output(data->gpio_vbus_pwr, 0);
+	if (data->gpio_hub_rst != -1)
+		gpio_direction_output(data->gpio_hub_rst, 0);
+
+	if (data->phy) {
+		usb_phy_shutdown(data->phy);
+		module_put(data->phy->dev->driver->owner);
+	}
+
+	of_node_put(data->phy_np);

drivers/usb/chipidea/ci13xxx_imx.c line 171

Quoted 10 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +10 -0
+
+	clk_disable_unprepare(data->clk);
+
+	platform_set_drvdata(pdev, NULL);
+
+	return 0;
+}
+
+static const struct of_device_id ci13xxx_imx_dt_ids[] = {
+	{ .compatible = "fsl,imx31-usb", },

Wow, now it's imx31-usb ?

Quoted 5 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +5 -0
+	{ /* sentinel */ }
+};
+
+static struct platform_driver ci13xxx_imx_driver = {
+	.probe = ci13xxx_imx_probe,

drivers/usb/chipidea/ci13xxx_imx.c line 186

Quoted 10 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +10 -0
+	.remove = __devexit_p(ci13xxx_imx_remove),
+	.driver = {
+		.name = "imx_usb",
+		.owner = THIS_MODULE,
+		.of_match_table = ci13xxx_imx_dt_ids,
+	 },
+};
+
+module_platform_driver(ci13xxx_imx_driver);
+

Richard, thanks for your work on these patches so far. Sorry for taking so long with reviewing these.

#27 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 6 lines · Marek Vasut

Dear Richard Zhao,

Quoted 1 line

Just add host support.

Maybe rephrase it to something like "This patch supports only the host-mode functionality so far."

Thanks.

Quoted 53 lines
Quoted 53 lines
Cc Peter Chen <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 drivers/usb/chipidea/Makefile                      |    8 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  191
++++++++++++++++++++ 3 files changed, 219 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
 create mode 100644 drivers/usb/chipidea/ci13xxx_imx.c
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt new file mode 100644
index 0000000..beb75d6

Documentation/devicetree/bindings/usb/ci13xxx-imx.txt new file +20 -0
@@ -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 +4 -0
index cc34937..ffa2f63 100644
@@ -12,3 +12,11 @@ endif
 ifneq ($(CONFIG_ARCH_MSM),)
 	obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_msm.o
 endif
+
+ifneq ($(CONFIG_ARCH_MXC),)
+	obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_imx.o
+else
Quoted 8 lines

drivers/usb/chipidea/Makefile endif · line 22

Quoted 4 lines
drivers/usb/chipidea/Makefile +4 -0
+  ifneq ($(CONFIG_ARCH_MXS),)
+	  obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_imx.o
+  endif
+endif

I think someone commented on these patches (my previous set of patches actually), that this should be fixed in a way that you can actually select which bindings you want to compile in (and not limit it via Makefile like it's now).

Yes. I think you're right.

Alexander,

Do you think it's a good idea to let user select binding driver directly and the binding driver config depends on chipidea config?

Quoted 65 lines
Quoted 65 lines
(quoted diff) +0 -0

b/drivers/usb/chipidea/ci13xxx_imx.c new file mode 100644 index 0000000..9f64b3c

drivers/usb/chipidea/ci13xxx_imx.c new file +58 -0
@@ -0,0 +1,191 @@
+/*
+ * 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/of_platform.h>
+#include <linux/of_gpio.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/usb/chipidea.h>
+#include <linux/usb/ehci_def.h>
+#include <linux/usb/gadget.h>
+#include <linux/usb/chipidea.h>
+#include <linux/usb/otg.h>
+#include <linux/dma-mapping.h>
+#include <linux/clk.h>
+#include <linux/string.h>
+
+#include "ci.h"
+
+#define PORT0_STATUS	0x184
+
+#define pdev_to_phy(pdev) \
+	((struct usb_phy *)platform_get_drvdata(pdev))
+
+struct ci13xxx_imx_data {
+	struct device_node *phy_np;
+	struct usb_phy *phy;
+	struct platform_device *ci_pdev;
+	struct clk *clk;
+	int gpio_hub_rst, gpio_vbus_pwr;
+};
+
+static struct ci13xxx_udc_driver ci13xxx_imx_udc_driver __devinitdata  = {
+	.name			= "ci13xxx_imx",
+	.flags			= CI13XXX_REQUIRE_TRANSCEIVER |
+				  CI13XXX_PULLUP_ON_VBUS |
+				  CI13XXX_DISABLE_STREAMING,
+	.capoffset		= DEF_CAPOFFSET,
+};
+
+static int __devinit ci13xxx_imx_probe(struct platform_device *pdev)
+{
+	struct ci13xxx_imx_data *data;
+	struct platform_device *plat_ci, *phy_pdev;
+	struct platform_device_info ci_pdevinfo;
+	struct device_node *phy_np;
+	struct resource *res;
+	int vbus_pwr;
Quoted 8 lines

drivers/usb/chipidea/ci13xxx_imx.c line 66

Quoted 8 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +8 -0
+	int ret;
+
+	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+	if (!data) {
+		dev_err(&pdev->dev, "Failed to allocate CI13xxx-IMX data!\n");
+		return -ENOMEM;
+	}
+	data->gpio_hub_rst = -1;

ah, I should remove hub reset here.

Quoted 6 lines

drivers/usb/chipidea/ci13xxx_imx.c line 67

Quoted 1 line
drivers/usb/chipidea/ci13xxx_imx.c new file +1 -0
+	data->gpio_vbus_pwr = -1;

This really freaks me out. Maybe we should have some kind of a regulator that manages the VBUS and let this driver toggle the regulator when fitting? That'd solve the problem to some extent, as other people would be able to supply NOP regulator.

Good point. It looks like we still lack gpio controlled fixed regulator driver.

Quoted 6 lines

drivers/usb/chipidea/ci13xxx_imx.c line 71

Quoted 4 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +3 -0
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "can't get device resources!\n");

Can't ... capital "C" ;-)

thanks.

Quoted 16 lines
Quoted 16 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +15 -0
+		return -ENOENT;
+	}
+
+	data->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(data->clk)) {
+		dev_err(&pdev->dev, "Failed to get clock!\n");
+		return PTR_ERR(data->clk);
+	}
+
+	ret = clk_prepare_enable(data->clk);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to prepare or enable clock!\n");
+		return ret;
+	}
+
Quoted 8 lines

drivers/usb/chipidea/ci13xxx_imx.c line 92

Quoted 6 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +6 -0
+	phy_np = of_parse_phandle(pdev->dev.of_node, "fsl,usbphy", 0);
+	if (phy_np) {
+		data->phy_np = phy_np;
+		phy_pdev = of_find_device_by_node(phy_np);
+		if (phy_pdev) {
+			struct usb_phy *phy;

Do we really want to define new variables in the middle of a code?

It's not a problem in kernel using gcc. You can find the style though the kernel.

Quoted 16 lines

drivers/usb/chipidea/ci13xxx_imx.c line 104

Quoted 13 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +12 -0
+			phy = pdev_to_phy(phy_pdev);
+			if (phy &&
+			    try_module_get(phy_pdev->dev.driver->owner)) {
+				usb_phy_init(phy);
+				data->phy = phy;
+			}
+		}
+	}
+
+	/* we only support host now, so enable vbus here */
+	vbus_pwr = of_get_named_gpio(pdev->dev.of_node,
+					"fsl,vbus-power-gpios", 0);

(This one is for my personal enlightment) Why is the property called "gpios" (plural) if it's only one GPIO?

It's just DT naming method. It can follow a gpio array.

Quoted 62 lines
Quoted 62 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +61 -0
+	if (gpio_is_valid(vbus_pwr) &&
+	    !devm_gpio_request(&pdev->dev, vbus_pwr, "vbus-pwr")) {
+		gpio_direction_output(vbus_pwr, 1);
+		data->gpio_hub_rst = vbus_pwr;
+	}
+
+	ci13xxx_imx_udc_driver.phy = data->phy;
+	memset(&ci_pdevinfo, 0, sizeof(ci_pdevinfo));
+	ci_pdevinfo.parent = &pdev->dev;
+	ci_pdevinfo.name = "ci_hdrc";
+	ci_pdevinfo.id = (int)res->start;
+	ci_pdevinfo.res = pdev->resource;
+	ci_pdevinfo.num_res = pdev->num_resources;
+	ci_pdevinfo.data = &ci13xxx_imx_udc_driver;
+	ci_pdevinfo.size_data = sizeof(ci13xxx_imx_udc_driver);
+	ci_pdevinfo.dma_mask = DMA_BIT_MASK(32);
+
+	plat_ci = platform_device_register_full(&ci_pdevinfo);
+	if (IS_ERR(plat_ci)) {
+		dev_err(&pdev->dev, "can't register ci_hdrc platform device\n");
+		ret = PTR_ERR(plat_ci);
+		goto put_np;
+	}
+
+	data->ci_pdev = plat_ci;
+	platform_set_drvdata(pdev, data);
+
+	pm_runtime_no_callbacks(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
+	return 0;
+
+put_np:
+	if (phy_np)
+		of_node_put(phy_np);
+	return ret;
+}
+
+static int __devexit ci13xxx_imx_remove(struct platform_device *pdev)
+{
+	struct ci13xxx_imx_data *data = platform_get_drvdata(pdev);
+
+	kfree(data->ci_pdev->dev.dma_mask);
+	data->ci_pdev->dev.dma_mask = NULL;
+	platform_device_unregister(data->ci_pdev);
+
+	if (data->gpio_vbus_pwr != -1)
+		gpio_direction_output(data->gpio_vbus_pwr, 0);
+	if (data->gpio_hub_rst != -1)
+		gpio_direction_output(data->gpio_hub_rst, 0);
+
+	if (data->phy) {
+		usb_phy_shutdown(data->phy);
+		module_put(data->phy->dev->driver->owner);
+	}
+
+	of_node_put(data->phy_np);
+
+	clk_disable_unprepare(data->clk);
+
+	platform_set_drvdata(pdev, NULL);
Quoted 8 lines

drivers/usb/chipidea/ci13xxx_imx.c line 171

Quoted 6 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +6 -0
+
+	return 0;
+}
+
+static const struct of_device_id ci13xxx_imx_dt_ids[] = {
+	{ .compatible = "fsl,imx31-usb", },

Wow, now it's imx31-usb ?

Yes. we discussed that imx31 is the first SoC that use this IP.

Quoted 11 lines
Quoted 11 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +10 -0
+	{ /* sentinel */ }
+};
+
+static struct platform_driver ci13xxx_imx_driver = {
+	.probe = ci13xxx_imx_probe,
+	.remove = __devexit_p(ci13xxx_imx_remove),
+	.driver = {
+		.name = "imx_usb",
+		.owner = THIS_MODULE,
+		.of_match_table = ci13xxx_imx_dt_ids,
Quoted 8 lines

drivers/usb/chipidea/ci13xxx_imx.c line 186

Quoted 5 lines
drivers/usb/chipidea/ci13xxx_imx.c new file +5 -0
+	 },
+};
+
+module_platform_driver(ci13xxx_imx_driver);
+

Richard, thanks for your work on these patches so far. Sorry for taking so long with reviewing these.

My pleasure! Thanks for your review too!

Richard

Quoted 1 line
#28 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 69 lines · Richard Zhao
Quoted 6 lines · Marek Vasut

Dear Richard Zhao,

Quoted 1 line

Just add host support.

Maybe rephrase it to something like "This patch supports only the host-mode functionality so far."

Thanks.

Quoted 53 lines
Quoted 53 lines
Cc Peter Chen <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt        |   20 ++
 drivers/usb/chipidea/Makefile                      |    8 +
 drivers/usb/chipidea/ci13xxx_imx.c                 |  191
++++++++++++++++++++ 3 files changed, 219 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
 create mode 100644 drivers/usb/chipidea/ci13xxx_imx.c
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt new file mode 100644
index 0000000..beb75d6

Documentation/devicetree/bindings/usb/ci13xxx-imx.txt new file +20 -0
@@ -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 +4 -0
index cc34937..ffa2f63 100644
@@ -12,3 +12,11 @@ endif
 ifneq ($(CONFIG_ARCH_MSM),)
 	obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_msm.o
 endif
+
+ifneq ($(CONFIG_ARCH_MXC),)
+	obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_imx.o
+else
Quoted 8 lines

drivers/usb/chipidea/Makefile endif · line 22

Quoted 4 lines
drivers/usb/chipidea/Makefile +4 -0
+  ifneq ($(CONFIG_ARCH_MXS),)
+	  obj-$(CONFIG_USB_CHIPIDEA)	+= ci13xxx_imx.o
+  endif
+endif

I think someone commented on these patches (my previous set of patches actually), that this should be fixed in a way that you can actually select which bindings you want to compile in (and not limit it via Makefile like it's now).

Quoted 6 lines

Yes. I think you're right.

Alexander,

Do you think it's a good idea to let user select binding driver directly and the binding driver config depends on chipidea config?

I don't have a strong opinion on this, although I prefer it the way it is now, because, imo:

* in case of =m (and that's the only sane way of compiling it anyway), these all are compiled as modules, which you simply don't install if you don't want them;
* all of them get compile-tested every time you change something in

    the driver, which is a good thing;

* the fewer kconfig options the better.

Regards,
--
Alex

#29 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Hi,

Quoted 11 lines · Alexander Shishkin
Quoted 2 lines

Do you think it's a good idea to let user select binding driver directly and the binding driver config depends on chipidea config?

I don't have a strong opinion on this, although I prefer it the way it is now, because, imo:

* in case of =m (and that's the only sane way of compiling it anyway), these all are compiled as modules, which you simply don't install if you don't want them;
* all of them get compile-tested every time you change something in

    the driver, which is a good thing;

only true for $(ARCH) builds. I would like to see these drivers being compile tested on linux-next on all arches. Thus the patches I just sent.

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/20120522/d1046287/attachment.sig>
#30 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 15 lines · Felipe Balbi

Hi,

Quoted 11 lines · Alexander Shishkin
Quoted 2 lines

Do you think it's a good idea to let user select binding driver directly and the binding driver config depends on chipidea config?

I don't have a strong opinion on this, although I prefer it the way it is now, because, imo:

* in case of =m (and that's the only sane way of compiling it anyway), these all are compiled as modules, which you simply don't install if you don't want them;
* all of them get compile-tested every time you change something in

    the driver, which is a good thing;
Quoted 3 lines

only true for $(ARCH) builds. I would like to see these drivers being compile tested on linux-next on all arches. Thus the patches I just sent.

The idea is great. But
- how can I make sure it pass for all arch? There' 27 folder in arch/.
- it's hard to predict one driver depends on what.
- for embedded kernel, people like built-in drivers, and people will have things they don't need at all.

Thanks
Richard

Quoted 3 lines
Signature · 2 lines
-- 
balbi
#31 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 16 lines · Richard Zhao
Quoted 15 lines · Felipe Balbi

Hi,

Quoted 11 lines · Alexander Shishkin
Quoted 2 lines

Do you think it's a good idea to let user select binding driver directly and the binding driver config depends on chipidea config?

I don't have a strong opinion on this, although I prefer it the way it is now, because, imo:

* in case of =m (and that's the only sane way of compiling it anyway), these all are compiled as modules, which you simply don't install if you don't want them;
* all of them get compile-tested every time you change something in

    the driver, which is a good thing;
Quoted 8 lines
Quoted 3 lines

only true for $(ARCH) builds. I would like to see these drivers being compile tested on linux-next on all arches. Thus the patches I just sent.

The idea is great. But
- how can I make sure it pass for all arch? There' 27 folder in arch/.
- it's hard to predict one driver depends on what.
- for embedded kernel, people like built-in drivers, and people will have things they don't need at all.

that's true to some extent, but until we know for sure that all of that is compiling fine and all dependencies are properly handled, I wouldn't like to see Kconfig or Makefile being abused. That has happened before and will happen again if we allow it.

My suggestion to Alex is to remove all dependencies for at least a couple of merge windows and only add dependencies for stuff which actually matters; like only building the PCI glue layer when CONFIG_PCI is defined instead of when ARCH_X86 is defined and so on.

When it gets to a product, that can be easily optimized and when we have decided what's the best way to place the choices, we will do so. Until then, we like to use linux-next for compile testing everything.

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/20120522/433f4274/attachment-0001.sig>
#32 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 31 lines · Felipe Balbi
Quoted 16 lines · Richard Zhao
Quoted 15 lines · Felipe Balbi

Hi,

Quoted 11 lines · Alexander Shishkin
Quoted 2 lines

Do you think it's a good idea to let user select binding driver directly and the binding driver config depends on chipidea config?

I don't have a strong opinion on this, although I prefer it the way it is now, because, imo:

* in case of =m (and that's the only sane way of compiling it anyway), these all are compiled as modules, which you simply don't install if you don't want them;
* all of them get compile-tested every time you change something in

    the driver, which is a good thing;
Quoted 8 lines
Quoted 3 lines

only true for $(ARCH) builds. I would like to see these drivers being compile tested on linux-next on all arches. Thus the patches I just sent.

The idea is great. But
- how can I make sure it pass for all arch? There' 27 folder in arch/.
- it's hard to predict one driver depends on what.
- for embedded kernel, people like built-in drivers, and people will have things they don't need at all.

that's true to some extent, but until we know for sure that all of that is compiling fine and all dependencies are properly handled, I wouldn't like to see Kconfig or Makefile being abused. That has happened before and will happen again if we allow it.

Quoted 4 lines

My suggestion to Alex is to remove all dependencies for at least a couple of merge windows and only add dependencies for stuff which actually matters; like only building the PCI glue layer when CONFIG_PCI is defined instead of when ARCH_X86 is defined and so on.

That's what I mean to do as well. I wouldn't dream of making something like this x86 specific. :)

Quoted 3 lines

When it gets to a product, that can be easily optimized and when we have decided what's the best way to place the choices, we will do so. Until then, we like to use linux-next for compile testing everything.

Seconded.

Regards,
--
Alex

#33 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 33 lines · Alexander Shishkin
Quoted 31 lines · Felipe Balbi
Quoted 16 lines · Richard Zhao
Quoted 15 lines · Felipe Balbi

Hi,

Quoted 11 lines · Alexander Shishkin
Quoted 2 lines

Do you think it's a good idea to let user select binding driver directly and the binding driver config depends on chipidea config?

I don't have a strong opinion on this, although I prefer it the way it is now, because, imo:

* in case of =m (and that's the only sane way of compiling it anyway), these all are compiled as modules, which you simply don't install if you don't want them;
* all of them get compile-tested every time you change something in

    the driver, which is a good thing;
Quoted 8 lines
Quoted 3 lines

only true for $(ARCH) builds. I would like to see these drivers being compile tested on linux-next on all arches. Thus the patches I just sent.

The idea is great. But
- how can I make sure it pass for all arch? There' 27 folder in arch/.
- it's hard to predict one driver depends on what.
- for embedded kernel, people like built-in drivers, and people will have things they don't need at all.

that's true to some extent, but until we know for sure that all of that is compiling fine and all dependencies are properly handled, I wouldn't like to see Kconfig or Makefile being abused. That has happened before and will happen again if we allow it.

Quoted 7 lines
Quoted 4 lines

My suggestion to Alex is to remove all dependencies for at least a couple of merge windows and only add dependencies for stuff which actually matters; like only building the PCI glue layer when CONFIG_PCI is defined instead of when ARCH_X86 is defined and so on.

That's what I mean to do as well. I wouldn't dream of making something like this x86 specific. :)

Alex, Have you made the decision that remove all dependencies and leave only ones that has to be there? If yes, I'll try the way, though I don't feel good about that.

Thanks
Richard

Quoted 14 lines
Quoted 4 lines

When it gets to a product, that can be easily optimized and when we have decided what's the best way to place the choices, we will do so. Until then, we like to use linux-next for compile testing everything.

Seconded.

Regards,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#34 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 39 lines · Richard Zhao
Quoted 38 lines · Alexander Shishkin
Quoted 35 lines · Felipe Balbi
Quoted 16 lines · Richard Zhao
Quoted 15 lines · Felipe Balbi

Hi,

Quoted 11 lines · Alexander Shishkin
Quoted 2 lines

Do you think it's a good idea to let user select binding driver directly and the binding driver config depends on chipidea config?

I don't have a strong opinion on this, although I prefer it the way it is now, because, imo:

* in case of =m (and that's the only sane way of compiling it anyway), these all are compiled as modules, which you simply don't install if you don't want them;
* all of them get compile-tested every time you change something in

    the driver, which is a good thing;
Quoted 8 lines
Quoted 3 lines

only true for $(ARCH) builds. I would like to see these drivers being compile tested on linux-next on all arches. Thus the patches I just sent.

The idea is great. But
- how can I make sure it pass for all arch? There' 27 folder in arch/.
- it's hard to predict one driver depends on what.
- for embedded kernel, people like built-in drivers, and people will have things they don't need at all.

that's true to some extent, but until we know for sure that all of that is compiling fine and all dependencies are properly handled, I wouldn't like to see Kconfig or Makefile being abused. That has happened before and will happen again if we allow it.

My suggestion to Alex is to remove all dependencies for at least a couple of merge windows and only add dependencies for stuff which actually matters; like only building the PCI glue layer when CONFIG_PCI is defined instead of when ARCH_X86 is defined and so on.

Quoted 5 lines
Quoted 2 lines

That's what I mean to do as well. I wouldn't dream of making something like this x86 specific. :)

Alex, Have you made the decision that remove all dependencies and leave only ones that has to be there? If yes, I'll try the way, though I don't feel good about that.

Yes, I like Felipe's suggestion. Currently (with Felipe's patches from yesterday), there is only one dependency (PCI for ci13xxx_pci, which is ok). So let's try to keep it that way.

I'll push the patches to my tree on github [1] soon, which I propose to use for all chipidea-related patches.

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

Regards,
--
Alex

#35 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 47 lines · Alexander Shishkin
Quoted 39 lines · Richard Zhao
Quoted 38 lines · Alexander Shishkin
Quoted 35 lines · Felipe Balbi
Quoted 16 lines · Richard Zhao
Quoted 15 lines · Felipe Balbi

Hi,

Quoted 11 lines · Alexander Shishkin
Quoted 2 lines

Do you think it's a good idea to let user select binding driver directly and the binding driver config depends on chipidea config?

I don't have a strong opinion on this, although I prefer it the way it is now, because, imo:

* in case of =m (and that's the only sane way of compiling it anyway), these all are compiled as modules, which you simply don't install if you don't want them;
* all of them get compile-tested every time you change something in

    the driver, which is a good thing;
Quoted 8 lines
Quoted 3 lines

only true for $(ARCH) builds. I would like to see these drivers being compile tested on linux-next on all arches. Thus the patches I just sent.

The idea is great. But
- how can I make sure it pass for all arch? There' 27 folder in arch/.
- it's hard to predict one driver depends on what.
- for embedded kernel, people like built-in drivers, and people will have things they don't need at all.

that's true to some extent, but until we know for sure that all of that is compiling fine and all dependencies are properly handled, I wouldn't like to see Kconfig or Makefile being abused. That has happened before and will happen again if we allow it.

My suggestion to Alex is to remove all dependencies for at least a couple of merge windows and only add dependencies for stuff which actually matters; like only building the PCI glue layer when CONFIG_PCI is defined instead of when ARCH_X86 is defined and so on.

Quoted 5 lines
Quoted 2 lines

That's what I mean to do as well. I wouldn't dream of making something like this x86 specific. :)

Alex, Have you made the decision that remove all dependencies and leave only ones that has to be there? If yes, I'll try the way, though I don't feel good about that.

Quoted 8 lines

Yes, I like Felipe's suggestion. Currently (with Felipe's patches from yesterday), there is only one dependency (PCI for ci13xxx_pci, which is ok). So let's try to keep it that way.

I'll push the patches to my tree on github [1] soon, which I propose to use for all chipidea-related patches.

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

you should add it to MAINTAINERS file.

T: git git://github.com/virtuoso/linux-ci.git

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/20120523/12f81d7e/attachment.sig>
#36 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 52 lines · Felipe Balbi
Quoted 51 lines · Alexander Shishkin
Quoted 39 lines · Richard Zhao
Quoted 38 lines · Alexander Shishkin
Quoted 35 lines · Felipe Balbi
Quoted 16 lines · Richard Zhao
Quoted 15 lines · Felipe Balbi

Hi,

Quoted 11 lines · Alexander Shishkin
Quoted 2 lines

Do you think it's a good idea to let user select binding driver directly and the binding driver config depends on chipidea config?

I don't have a strong opinion on this, although I prefer it the way it is now, because, imo:

* in case of =m (and that's the only sane way of compiling it anyway), these all are compiled as modules, which you simply don't install if you don't want them;
* all of them get compile-tested every time you change something in

    the driver, which is a good thing;
Quoted 8 lines
Quoted 3 lines

only true for $(ARCH) builds. I would like to see these drivers being compile tested on linux-next on all arches. Thus the patches I just sent.

The idea is great. But
- how can I make sure it pass for all arch? There' 27 folder in arch/.
- it's hard to predict one driver depends on what.
- for embedded kernel, people like built-in drivers, and people will have things they don't need at all.

that's true to some extent, but until we know for sure that all of that is compiling fine and all dependencies are properly handled, I wouldn't like to see Kconfig or Makefile being abused. That has happened before and will happen again if we allow it.

My suggestion to Alex is to remove all dependencies for at least a couple of merge windows and only add dependencies for stuff which actually matters; like only building the PCI glue layer when CONFIG_PCI is defined instead of when ARCH_X86 is defined and so on.

Quoted 5 lines
Quoted 2 lines

That's what I mean to do as well. I wouldn't dream of making something like this x86 specific. :)

Alex, Have you made the decision that remove all dependencies and leave only ones that has to be there? If yes, I'll try the way, though I don't feel good about that.

Yes, I like Felipe's suggestion. Currently (with Felipe's patches from yesterday), there is only one dependency (PCI for ci13xxx_pci, which is ok). So let's try to keep it that way.

Quoted 8 lines
Quoted 4 lines

I'll push the patches to my tree on github [1] soon, which I propose to use for all chipidea-related patches.

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

you should add it to MAINTAINERS file.

T: git git://github.com/virtuoso/linux-ci.git

Sure.

Regrards,
--
Alex

#37 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

In reply to Felipe Balbi
Quoted 5 lines · Felipe Balbi

My suggestion to Alex is to remove all dependencies for at least a couple of merge windows and only add dependencies for stuff which actually matters; like only building the PCI glue layer when CONFIG_PCI is defined instead of when ARCH_X86 is defined and so on.

As ci13xxx_imx is a DT only driver, it needs to depend on CONFIG_OF.

Signature · 2 lines
Regards,
Shawn
#38 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 7 lines · Shawn Guo
Quoted 5 lines · Felipe Balbi

My suggestion to Alex is to remove all dependencies for at least a couple of merge windows and only add dependencies for stuff which actually matters; like only building the PCI glue layer when CONFIG_PCI is defined instead of when ARCH_X86 is defined and so on.

As ci13xxx_imx is a DT only driver, it needs to depend on CONFIG_OF.

yes, and I have said that it should depend on CONFIG_OF, rather then ARCH_IMX... that's fine.

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/20120522/9be189fa/attachment-0001.sig>
#39 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

In reply to Richard Zhao

drivers/usb/chipidea/ci13xxx_imx.c line 30

Quoted 3 lines · Richard Zhao
drivers/usb/chipidea/ci13xxx_imx.c new file +3 -0
+#include "ci.h"
+
+#define PORT0_STATUS	0x184

This doesn't seem to be used anywhere.

[snip]

drivers/usb/chipidea/ci13xxx_imx.c line 111

Quoted 1 line
drivers/usb/chipidea/ci13xxx_imx.c new file +1 -0
+	ci13xxx_imx_udc_driver.phy = data->phy;

See my comment to the other patch about phy pointer being a per-device thing rather then per-platform driver. Now, (at the risk of being flamed) I think it could work if you allocated the ci13xxx_imx_udc_driver dynamically in every probe, but that's not what you want to do for the actual platform data. So, I suggest we come up with a better way of passing phy to the driver. I also think that it's really about time we renamed "struct ci13xxx_udc_driver" to something that emphasizes the "platform" in it. What do you think?

Regards,
--
Alex

#40 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 7 lines · Alexander Shishkin

drivers/usb/chipidea/ci13xxx_imx.c line 30

Quoted 3 lines · Richard Zhao
drivers/usb/chipidea/ci13xxx_imx.c new file +3 -0
+#include "ci.h"
+
+#define PORT0_STATUS	0x184

This doesn't seem to be used anywhere.

Please disregard this one.

Regards,
--
Alex

#41 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

Quoted 11 lines · Alexander Shishkin
Quoted 7 lines · Alexander Shishkin

drivers/usb/chipidea/ci13xxx_imx.c line 30

Quoted 3 lines · Richard Zhao
drivers/usb/chipidea/ci13xxx_imx.c new file +3 -0
+#include "ci.h"
+
+#define PORT0_STATUS	0x184

This doesn't seem to be used anywhere.

Please disregard this one.

Thanks.

Richard

Quoted 8 lines

Regards,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#42 lore raw

PATCH v2 5/12 usb: chipidea: add imx driver binding

In reply to Alexander Shishkin
Quoted 8 lines · Alexander Shishkin

drivers/usb/chipidea/ci13xxx_imx.c line 30

Quoted 3 lines · Richard Zhao
drivers/usb/chipidea/ci13xxx_imx.c new file +3 -0
+#include "ci.h"
+
+#define PORT0_STATUS	0x184

This doesn't seem to be used anywhere.

Quoted 8 lines

[snip]

drivers/usb/chipidea/ci13xxx_imx.c line 111

Quoted 1 line
drivers/usb/chipidea/ci13xxx_imx.c new file +1 -0
+	ci13xxx_imx_udc_driver.phy = data->phy;

See my comment to the other patch about phy pointer being a per-device thing rather then per-platform driver. Now, (at the risk of being flamed) I think it could work if you allocated the ci13xxx_imx_udc_driver dynamically in every probe, but that's not what you want to do for the actual platform data.

At least for imx, most platfrom data memory is duplicated when add device. arch/arm/plat-mxc/devices/

Quoted 4 lines

So, I suggest we come up
with a better way of passing phy to the driver. I also think that it's really about time we renamed "struct ci13xxx_udc_driver" to something that emphasizes the "platform" in it. What do you think?

struct ci13xxx_plat_data ?

Thanks
Richard

Quoted 8 lines

Regards,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#43 lore raw

PATCH v2 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
#44 lore raw

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

Dear Richard Zhao,

We will need similar patch for mx28 I think?

Otherwise

Quoted 11 lines
---
 arch/arm/mach-imx/clk-imx6q.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-imx/clk-imx6q.c +0 -0
index 96e9edd..f99509a 100644
@@ -391,7 +391,10 @@ int __init mx6q_clocks_init(void)
 	clk_register_clkdev(clk[gpt_ipg], "ipg", "imx-gpt.0");

arch/arm/mach-imx/clk-imx6q.c int __init mx6q_clocks_init(void) · line 400

Quoted 10 lines
arch/arm/mach-imx/clk-imx6q.c +4 -1
 	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");

Best regards,
Marek Vasut

#45 lore raw

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

Quoted 3 lines · Marek Vasut

Dear Richard Zhao,

We will need similar patch for mx28 I think?

It has mx28 clk patch. hmm..., something is wrong. I'll fix the name.

Thanks
Richard

Quoted 29 lines

Otherwise

Quoted 11 lines
---
 arch/arm/mach-imx/clk-imx6q.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-imx/clk-imx6q.c +0 -0
index 96e9edd..f99509a 100644
@@ -391,7 +391,10 @@ int __init mx6q_clocks_init(void)
 	clk_register_clkdev(clk[gpt_ipg], "ipg", "imx-gpt.0");

arch/arm/mach-imx/clk-imx6q.c int __init mx6q_clocks_init(void) · line 400

Quoted 10 lines
arch/arm/mach-imx/clk-imx6q.c +4 -1
 	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");

Best regards,
Marek Vasut

#46 lore raw

PATCH v2 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]>
---
 arch/arm/boot/dts/imx6q-sabrelite.dts |    7 ++++++
 arch/arm/mach-imx/mach-imx6q.c        |   35 +++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)
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
#47 lore raw

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

Apart from my comments below, we really need to know Rob and Grant's opinion on this.

Quoted 19 lines · 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]>
---
 arch/arm/boot/dts/imx6q-sabrelite.dts |    7 ++++++
 arch/arm/mach-imx/mach-imx6q.c        |   35 +++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)
arch/arm/boot/dts/imx6q-sabrelite.dts +0 -0
index e0ec929..1dd2261 100644

arch/arm/boot/dts/imx6q-sabrelite.dts line 26

Quoted 10 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +7 -0
@@ -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 */
+	};
+

So it looks like something not specific to imx board but generic to other boards. If so, we may need to come up with a generic binding document for this.

Is this only used to configure output pin? Will there be any pin that needs to be configured as input but not owned by any driver? Hopefully not.

Quoted 16 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +0 -0
 	memory {
 		reg = <0x10000000 0x40000000>;
 	};
arch/arm/mach-imx/mach-imx6q.c +1 -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>

arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_sabrelite_init(void) · line 117

Quoted 4 lines
arch/arm/mach-imx/mach-imx6q.c +1 -0
@@ -113,6 +114,38 @@ static void __init imx6q_sabrelite_init(void)
 	imx6q_sabrelite_cko1_setup();
 }
 
+static void __init imx6q_config_on_boot(void)

Do you intend to make this function non-gpio-config only. Otherwise, we may need to have "gpio" in the function name, as well as the "config-on-boot" node name.

Also, if we define the binding as generic one, we may need to find a common place to implement the function.

Quoted 11 lines
arch/arm/mach-imx/mach-imx6q.c +11 -0
+{
+	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);

arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_sabrelite_init(void) · line 138

Quoted 10 lines
arch/arm/mach-imx/mach-imx6q.c +10 -0
+	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");

So all the gpios will use the same name.

And doesn't the reset generally need a pulse or edge signal, e.g. pull down for a msec and pull up?

Regards,
Shawn

Quoted 26 lines
arch/arm/mach-imx/mach-imx6q.c +12 -0
+	}
+
+	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
#48 lore raw

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

Dear Shawn Guo,

Quoted 2 lines

Apart from my comments below, we really need to know Rob and Grant's opinion on this.

Hm ... so why don't you actually write per-board driver ? :-) That'd handle every single board very well, you'd configure the GPIOs there, every single additional necessary thing that has to be configured would sink there too etc.

Quoted 127 lines · Richard Zhao
Quoted 22 lines

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

---

 arch/arm/boot/dts/imx6q-sabrelite.dts |    7 ++++++
 arch/arm/mach-imx/mach-imx6q.c        |   35

+++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 0 deletions(-)

(quoted diff) +0 -0

b/arch/arm/boot/dts/imx6q-sabrelite.dts index e0ec929..1dd2261 100644

arch/arm/boot/dts/imx6q-sabrelite.dts +0 -0
@@ -17,6 +17,13 @@
 

arch/arm/boot/dts/imx6q-sabrelite.dts line 27

Quoted 10 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +7 -0
 	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 */
+	};
+

So it looks like something not specific to imx board but generic to other boards. If so, we may need to come up with a generic binding document for this.

Is this only used to configure output pin? Will there be any pin that needs to be configured as input but not owned by any driver? Hopefully not.

Quoted 23 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +0 -0
 	memory {
 
arch/arm/boot/dts/imx6q-sabrelite.dts +0 -0
 		reg = <0x10000000 0x40000000>;
 
 	};
(quoted diff) +0 -0

b/arch/arm/mach-imx/mach-imx6q.c index b47e98b..577cf19 100644

arch/arm/mach-imx/mach-imx6q.c +1 -0
@@ -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>

arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_sabrelite_init(void) · line 119

Quoted 6 lines
arch/arm/mach-imx/mach-imx6q.c +1 -0
@@ -113,6 +114,38 @@ static void __init imx6q_sabrelite_init(void)
 
 	imx6q_sabrelite_cko1_setup();
 
 }
 
+static void __init imx6q_config_on_boot(void)

Do you intend to make this function non-gpio-config only. Otherwise, we may need to have "gpio" in the function name, as well as the "config-on-boot" node name.

Also, if we define the binding as generic one, we may need to find a common place to implement the function.

Quoted 11 lines
arch/arm/mach-imx/mach-imx6q.c +11 -0
+{
+	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);

arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_sabrelite_init(void) · line 138

Quoted 10 lines
arch/arm/mach-imx/mach-imx6q.c +10 -0
+	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");

So all the gpios will use the same name.

And doesn't the reset generally need a pulse or edge signal, e.g. pull down for a msec and pull up?

Regards,
Shawn

Quoted 18 lines
arch/arm/mach-imx/mach-imx6q.c +10 -0
+	}
+
+	of_node_put(np);
+}
+
+static void __init imx6q_post_populate(void)
+{
+	imx6q_config_on_boot();
+}
+
 

static void __init imx6q_init_machine(void)
{

arch/arm/mach-imx/mach-imx6q.c +0 -0
 	/*
@@ -126,6 +159,8 @@ static void __init imx6q_init_machine(void)
 
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-imx/mach-imx6q.c +2 -0
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
+	imx6q_post_populate();
+
 
 	imx6q_pm_init();
 

}

Best regards,
Marek Vasut

#49 lore raw

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

Quoted 9 lines · Marek Vasut

Dear Shawn Guo,

Quoted 2 lines

Apart from my comments below, we really need to know Rob and Grant's opinion on this.

Hm ... so why don't you actually write per-board driver ? :-) That'd handle every single board very well, you'd configure the GPIOs there, every single additional necessary thing that has to be configured would sink there too etc.

I'm not completely sure about how the per-board driver looks like exactly. Can you have some code demonstrating it?

Regards,
Shawn

#50 lore raw

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

Dear Shawn Guo,

Quoted 6 lines · Marek Vasut
Quoted 5 lines

Dear Shawn Guo,

Quoted 2 lines

Apart from my comments below, we really need to know Rob and Grant's opinion on this.

Quoted 7 lines
Quoted 4 lines

Hm ... so why don't you actually write per-board driver ? :-) That'd handle every single board very well, you'd configure the GPIOs there, every single additional necessary thing that has to be configured would sink there too etc.

I'm not completely sure about how the per-board driver looks like exactly. Can you have some code demonstrating it?

Well such per-board driver would handle the board-specific init, like configuring the hub GPIO (as Richard has to do so on mx6q) or flick some other GPIOs, configure registers etc.

You can not depend on a bootloader to do such init for you, even though the bootloader should do it and should do it right.

Quoted 3 lines

Regards,
Shawn

Best regards,
Marek Vasut

#51 lore raw

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

Quoted 13 lines · Marek Vasut

Dear Shawn Guo,

Quoted 11 lines · Marek Vasut
Quoted 9 lines

Dear Shawn Guo,

Quoted 2 lines

Apart from my comments below, we really need to know Rob and Grant's opinion on this.

Hm ... so why don't you actually write per-board driver ? :-) That'd handle every single board very well, you'd configure the GPIOs there, every single additional necessary thing that has to be configured would sink there too etc.

Quoted 7 lines
Quoted 2 lines

I'm not completely sure about how the per-board driver looks like exactly. Can you have some code demonstrating it?

Well such per-board driver would handle the board-specific init, like configuring the hub GPIO (as Richard has to do so on mx6q) or flick some other GPIOs, configure registers etc.

So when you say driver, you just meant a C file like imx6q-sabrelite.c containing a number of init functions to be called by mach-imx6q.c?

Signature · 2 lines
Regards,
Shawn
#52 lore raw

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

Dear Shawn Guo,

Quoted 17 lines · Marek Vasut
Quoted 16 lines

Dear Shawn Guo,

Quoted 13 lines · Marek Vasut
Quoted 9 lines

Dear Shawn Guo,

Quoted 2 lines

Apart from my comments below, we really need to know Rob and Grant's opinion on this.

Hm ... so why don't you actually write per-board driver ? :-) That'd handle every single board very well, you'd configure the GPIOs there, every single additional necessary thing that has to be configured would sink there too etc.

I'm not completely sure about how the per-board driver looks like exactly. Can you have some code demonstrating it?

Quoted 6 lines
Quoted 3 lines

Well such per-board driver would handle the board-specific init, like configuring the hub GPIO (as Richard has to do so on mx6q) or flick some other GPIOs, configure registers etc.

So when you say driver, you just meant a C file like imx6q-sabrelite.c containing a number of init functions to be called by mach-imx6q.c?

Something like that ... but didn't Linus complain that we have too many files in arch/arm/ ?

Best regards,
Marek Vasut

#53 lore raw

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

Quoted 2 lines · Marek Vasut

Something like that ... but didn't Linus complain that we have too many files in arch/arm/ ?

So what do you exactly mean by per-board driver?

Regards,
Shawn

#54 lore raw

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

Dear Shawn Guo,

Quoted 5 lines · Marek Vasut
Quoted 2 lines

Something like that ... but didn't Linus complain that we have too many files in arch/arm/ ?

So what do you exactly mean by per-board driver?

Exactly such fixup as there's for mx6q-sabrelite. But then, if you have too broken bootloader, you'll need such a fixup for every such board. Or do you want to let mach-imx6q.c grow in size with each broken board?

Quoted 2 lines

Regards,
Shawn

Best regards,
Marek Vasut

#55 lore raw

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

Quoted 11 lines · Marek Vasut

Dear Shawn Guo,

Quoted 5 lines · Marek Vasut
Quoted 2 lines

Something like that ... but didn't Linus complain that we have too many files in arch/arm/ ?

So what do you exactly mean by per-board driver?

Exactly such fixup as there's for mx6q-sabrelite. But then, if you have too broken bootloader, you'll need such a fixup for every such board. Or do you want to let mach-imx6q.c grow in size with each broken board?

As Shawn said, this patch is trying to abstract common things. We don't need to repeat the code that interpret output-gpios.

Generally discuss often draw no conclusion. So let's talk about code.

Thanks
Richard

Quoted 7 lines
Quoted 3 lines

Regards,
Shawn

Best regards,
Marek Vasut

#56 lore raw

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

In reply to Shawn Guo
Quoted 2 lines · Shawn Guo

Apart from my comments below, we really need to know Rob and Grant's opinion on this.

Exactly. I cced them to draw their attention.

Quoted 24 lines · Richard Zhao
Quoted 22 lines

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]>
---
 arch/arm/boot/dts/imx6q-sabrelite.dts |    7 ++++++
 arch/arm/mach-imx/mach-imx6q.c        |   35 +++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)
arch/arm/boot/dts/imx6q-sabrelite.dts +0 -0
index e0ec929..1dd2261 100644
@@ -17,6 +17,13 @@
 	model = "Freescale i.MX6 Quad SABRE Lite Board";
 	compatible = "fsl,imx6q-sabrelite", "fsl,imx6q";
 
Quoted 11 lines

arch/arm/boot/dts/imx6q-sabrelite.dts line 26

Quoted 7 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +7 -0
+	config-on-boot {
+		output-gpios = <
+				&gpio3 22 0>;	/* vbus reset */
+		output-gpio-values = <
+				1>;		/* vbus reset */
+	};
+

So it looks like something not specific to imx board but generic to other boards. If so, we may need to come up with a generic binding document for this.

Yes.

Quoted 4 lines

Is this only used to configure output pin? Will there be any pin that needs to be configured as input but not owned by any driver? Hopefully not.

I didn't see the case yet. Input pin normally has a corresponding driver.

Quoted 20 lines
Quoted 20 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +0 -0
 	memory {
 		reg = <0x10000000 0x40000000>;
 	};
arch/arm/mach-imx/mach-imx6q.c +1 -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();
 }
 
Quoted 5 lines

arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_sabrelite_init(void) · line 117

Quoted 1 line
arch/arm/mach-imx/mach-imx6q.c +1 -0
+static void __init imx6q_config_on_boot(void)

Do you intend to make this function non-gpio-config only. Otherwise, we may need to have "gpio" in the function name, as well as the "config-on-boot" node name.

config-on-boot is not specific for gpio, but may be for others. For example, regulators. For now, it only has output gpios.

Quoted 3 lines

Also, if we define the binding as generic one, we may need to find a common place to implement the function.

Yes. But it's better be called at machine init after populate devices.

Quoted 16 lines
Quoted 16 lines
arch/arm/mach-imx/mach-imx6q.c +15 -0
+{
+	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;
Quoted 8 lines

arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_sabrelite_init(void) · line 138

Quoted 6 lines
arch/arm/mach-imx/mach-imx6q.c +6 -0
+	}
+	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");

So all the gpios will use the same name.

Yes.

Quoted 3 lines

And doesn't the reset generally need a pulse or edge signal, e.g. pull down for a msec and pull up?

strict reset is too complicated for config-on-boot. It may need delay some time case by case. I don't have the case yet. But someone may add it if it really needed, probably with addon properties.

Thanks
Richard

Quoted 31 lines

Regards,
Shawn

Quoted 26 lines
arch/arm/mach-imx/mach-imx6q.c +12 -0
+	}
+
+	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
#57 lore raw

PATCH v2 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..0d003aa 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_gate, usbphy2_gate, 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_gate] = imx_clk_gate("usbphy1_gate", "pll3_usb_otg", base + 0x10, 6);
+	clk[usbphy2_gate] = imx_clk_gate("usbphy2_gate", "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_gate], NULL, "20c9000.usbphy");
+	clk_register_clkdev(clk[usbphy2_gate], 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
#58 lore raw

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

Dear Richard Zhao,

Maybe reorder this so it's in before the PHY driver?

Quoted 19 lines
---
 arch/arm/mach-imx/clk-imx6q.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/mach-imx/clk-imx6q.c +1 -1
index f99509a..0d003aa 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_gate, usbphy2_gate, clk_max
 };
 
 static struct clk *clk[clk_max];

arch/arm/mach-imx/clk-imx6q.c int __init mx6q_clocks_init(void) · line 197

Quoted 1 line
arch/arm/mach-imx/clk-imx6q.c +0 -0
@@ -197,6 +197,9 @@ int __init mx6q_clocks_init(void)
 	clk[pll7_usb_host] = imx_clk_pllv3(IMX_PLLV3_USB,	

"pll7_usb_host","osc",

Quoted 12 lines

base + 0x20, 0x2000, 0x3); clk[pll8_enet] =
imx_clk_pllv3(IMX_PLLV3_ENET, "pll8_enet", "osc", base + 0xe0, 0x182000,
0x3);

arch/arm/mach-imx/clk-imx6q.c +1 -0
+	clk[usbphy1_gate] = imx_clk_gate("usbphy1_gate", "pll3_usb_otg", base +

0x10, 6); + clk[usbphy2_gate] = imx_clk_gate("usbphy2_gate",
"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)

arch/arm/mach-imx/clk-imx6q.c int __init mx6q_clocks_init(void) · line 405

Quoted 8 lines
arch/arm/mach-imx/clk-imx6q.c +2 -0
 	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_gate], NULL, "20c9000.usbphy");
+	clk_register_clkdev(clk[usbphy2_gate], 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");

Best regards,
Marek Vasut

#59 lore raw

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

Quoted 4 lines · Marek Vasut

Dear Richard Zhao,

Maybe reorder this so it's in before the PHY driver?

It should not matter, as I suppose all those "usb: ..." patches will go via usb tree, while all those "ARM: ..." will go via arm-soc tree.

Signature · 2 lines
Regards,
Shawn
#60 lore raw

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

Dear Shawn Guo,

Quoted 7 lines · Marek Vasut
Quoted 3 lines

Dear Richard Zhao,

Maybe reorder this so it's in before the PHY driver?

It should not matter, as I suppose all those "usb: ..." patches will go via usb tree, while all those "ARM: ..." will go via arm-soc tree.

It's easier to bisect, but ok.

Best regards,
Marek Vasut

#61 lore raw

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

In reply to Marek Vasut
Quoted 3 lines · Marek Vasut

Dear Richard Zhao,

Maybe reorder this so it's in before the PHY driver?

Patch series always driver come first.

Quoted 20 lines
Quoted 17 lines
---
 arch/arm/mach-imx/clk-imx6q.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/mach-imx/clk-imx6q.c +1 -1
index f99509a..0d003aa 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_gate, usbphy2_gate, clk_max
 };
 
Quoted 4 lines

arch/arm/mach-imx/clk-imx6q.c int __init mx6q_clocks_init(void) · line 197

Quoted 3 lines
arch/arm/mach-imx/clk-imx6q.c +0 -0
 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",

could you disable auto-wrap?

Thanks
Richard

Quoted 24 lines
Quoted 12 lines

base + 0x20, 0x2000, 0x3); clk[pll8_enet] =
imx_clk_pllv3(IMX_PLLV3_ENET, "pll8_enet", "osc", base + 0xe0, 0x182000,
0x3);

arch/arm/mach-imx/clk-imx6q.c +1 -0
+	clk[usbphy1_gate] = imx_clk_gate("usbphy1_gate", "pll3_usb_otg", base +

0x10, 6); + clk[usbphy2_gate] = imx_clk_gate("usbphy2_gate",
"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)

arch/arm/mach-imx/clk-imx6q.c int __init mx6q_clocks_init(void) · line 405

Quoted 8 lines
arch/arm/mach-imx/clk-imx6q.c +2 -0
 	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_gate], NULL, "20c9000.usbphy");
+	clk_register_clkdev(clk[usbphy2_gate], 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");

Best regards,
Marek Vasut

#62 lore raw

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

In reply to Richard Zhao
Quoted 10 lines · Richard Zhao
---
 arch/arm/mach-imx/clk-imx6q.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/mach-imx/clk-imx6q.c +0 -0
index f99509a..0d003aa 100644

arch/arm/mach-imx/clk-imx6q.c enum mx6q_clks { · line 155

Quoted 5 lines
arch/arm/mach-imx/clk-imx6q.c +1 -1
@@ -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_gate, usbphy2_gate, clk_max

Can you drop the "_gate" suffix? We do not have such suffix for leaf clock in imx6q clock file.

Regards,
Shawn

Quoted 26 lines
arch/arm/mach-imx/clk-imx6q.c +5 -0
 };
 
 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_gate] = imx_clk_gate("usbphy1_gate", "pll3_usb_otg", base + 0x10, 6);
+	clk[usbphy2_gate] = imx_clk_gate("usbphy2_gate", "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_gate], NULL, "20c9000.usbphy");
+	clk_register_clkdev(clk[usbphy2_gate], 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
#63 lore raw

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

Quoted 6 lines · Shawn Guo
Quoted 5 lines · Richard Zhao
---
 arch/arm/mach-imx/clk-imx6q.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
Quoted 13 lines

arch/arm/mach-imx/clk-imx6q.c enum mx6q_clks { · line 155

Quoted 10 lines
arch/arm/mach-imx/clk-imx6q.c +1 -1
index f99509a..0d003aa 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_gate, usbphy2_gate, clk_max

Can you drop the "_gate" suffix? We do not have such suffix for leaf clock in imx6q clock file.

ok

Thanks
Richard

#64 lore raw

PATCH v2 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 |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/mach-imx/mach-imx6q.c +25 -0
index 577cf19..0bfd8c7 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,33 @@ 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
#65 lore raw

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

arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_config_on_boot(void) · line 157

Quoted 13 lines · Richard Zhao
arch/arm/mach-imx/mach-imx6q.c +13 -0
+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
+	 */
+

Nit: drop this unnecessary new line.

Regards,
Shawn

Quoted 10 lines
arch/arm/mach-imx/mach-imx6q.c +10 -0
+	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);
+}
+
#66 lore raw

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

Quoted 15 lines · Shawn Guo

arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_config_on_boot(void) · line 157

Quoted 13 lines · Richard Zhao
arch/arm/mach-imx/mach-imx6q.c +13 -0
+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
+	 */
+

Nit: drop this unnecessary new line.

OK.

Thanks
Richard

Quoted 15 lines

Regards,
Shawn

Quoted 10 lines
arch/arm/mach-imx/mach-imx6q.c +10 -0
+	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);
+}
+
#67 lore raw

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

In reply to Richard Zhao
---
 arch/arm/boot/dts/imx6q-sabrelite.dts |   18 ++++++++++++-
 arch/arm/boot/dts/imx6q.dtsi          |   44 +++++++++++++++++++++++++++++++-
 2 files changed, 59 insertions(+), 3 deletions(-)
arch/arm/boot/dts/imx6q-sabrelite.dts +17 -1
index 1dd2261..1d28957 100644
@@ -48,10 +48,26 @@
 					status = "okay";
 				};
 			};
-
+			iomuxc at 020e0000 {
+				gpios {
+					pinctrl_gpio_hog: gpiohog {
+						fsl,pins = <1044 0x80000000
+							   144  0x80000000>;	/* MX6Q_PAD_GPIO_17__GPIO_7_12 */
+					};
+				};
+			};
 		};
 
 		aips-bus at 02100000 { /* AIPS2 */
+			usb at 02184000 { /* USB OTG */
+				fsl,vbus-power-gpios = <&gpio3 22 0>;
+				status = "okay";
+			};
+
+			usb at 02184200 { /* USB1 */
+				status = "okay";
+			};
+
 			ethernet at 02188000 {
 				phy-mode = "rgmii";
 				phy-reset-gpios = <&gpio3 23 0>;
arch/arm/boot/dts/imx6q.dtsi +42 -2

72 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#68 lore raw

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

Quoted 11 lines · Richard Zhao
---
 arch/arm/boot/dts/imx6q-sabrelite.dts |   18 ++++++++++++-
 arch/arm/boot/dts/imx6q.dtsi          |   44 +++++++++++++++++++++++++++++++-
 2 files changed, 59 insertions(+), 3 deletions(-)
arch/arm/boot/dts/imx6q-sabrelite.dts +0 -0
index 1dd2261..1d28957 100644

arch/arm/boot/dts/imx6q-sabrelite.dts line 53

Quoted 7 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +3 -1
@@ -48,10 +48,26 @@
 					status = "okay";
 				};
 			};
-
+			iomuxc at 020e0000 {
+				gpios {
+					pinctrl_gpio_hog: gpiohog {

This isn't really welcomed, and should really be removed after we have gpio_request() be able to call pinctrl to set the mux.

arch/arm/boot/dts/imx6q-sabrelite.dts line 55

Quoted 2 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +2 -0
+						fsl,pins = <1044 0x80000000
+							   144  0x80000000>;	/* MX6Q_PAD_GPIO_17__GPIO_7_12 */

Here are what I get from fsl,imx6q-pinctrl.txt. The comment was put on the wrong line?

MX6Q_PAD_EIM_D22__GPIO_3_22 144
MX6Q_PAD_GPIO_17__GPIO_7_12 1044

Quoted 5 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +3 -0
+					};
+				};
+			};
 		};
 

...

arch/arm/boot/dts/imx6q-sabrelite.dts line 507

Quoted 9 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +5 -0
@@ -495,6 +500,11 @@
 					};
 				};
 
+				gpios {
+					pinctrl_gpio_hog: gpiohog {
+					};
+				};
+

Why the empty nodes?

Signature · 2 lines
Regards,
Shawn
#69 lore raw

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

Quoted 7 lines · Shawn Guo
Quoted 6 lines · Richard Zhao
---
 arch/arm/boot/dts/imx6q-sabrelite.dts |   18 ++++++++++++-
 arch/arm/boot/dts/imx6q.dtsi          |   44 +++++++++++++++++++++++++++++++-
 2 files changed, 59 insertions(+), 3 deletions(-)
Quoted 15 lines

arch/arm/boot/dts/imx6q-sabrelite.dts line 53

Quoted 12 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +3 -1
index 1dd2261..1d28957 100644
@@ -48,10 +48,26 @@
 					status = "okay";
 				};
 			};
-
+			iomuxc at 020e0000 {
+				gpios {
+					pinctrl_gpio_hog: gpiohog {

This isn't really welcomed, and should really be removed after we have gpio_request() be able to call pinctrl to set the mux.

Yes, but we don't have now. If I add dependency which don't even hit next tree, I experienced people refuse pick my patch.
Of course, If you're ok to pick other patches, I can leave the code locally for test.

Quoted 9 lines

arch/arm/boot/dts/imx6q-sabrelite.dts line 55

Quoted 3 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +2 -0
+						fsl,pins = <1044 0x80000000
+							   144  0x80000000>;	/* MX6Q_PAD_GPIO_17__GPIO_7_12 */

Here are what I get from fsl,imx6q-pinctrl.txt. The comment was put on the wrong line?

MX6Q_PAD_EIM_D22__GPIO_3_22 144
MX6Q_PAD_GPIO_17__GPIO_7_12 1044

Good catch.

Quoted 12 lines
Quoted 6 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +3 -0
+					};
+				};
+			};
 		};
 

...

Quoted 4 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +0 -0
@@ -495,6 +500,11 @@
 					};
 				};
 
Quoted 6 lines

arch/arm/boot/dts/imx6q-sabrelite.dts line 66

Quoted 5 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +5 -0
+				gpios {
+					pinctrl_gpio_hog: gpiohog {
+					};
+				};
+

Why the empty nodes?

It's place holder that let use know to add gpio hog-on-boot in board dts.

Thanks
Richard

Quoted 5 lines
Signature · 3 lines
-- 
Regards,
Shawn
#70 lore raw

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

Quoted 4 lines · Richard Zhao

Yes, but we don't have now. If I add dependency which don't even hit next tree, I experienced people refuse pick my patch.
Of course, If you're ok to pick other patches, I can leave the code locally for test.

I'm fine for now.

Quoted 8 lines
Quoted 6 lines

arch/arm/boot/dts/imx6q-sabrelite.dts line 66

Quoted 5 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +5 -0
+				gpios {
+					pinctrl_gpio_hog: gpiohog {
+					};
+				};
+

Why the empty nodes?

It's place holder that let use know to add gpio hog-on-boot in board dts.

It's meaningless. Please remove it.

Signature · 2 lines
Regards,
Shawn
#71 lore raw

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

Quoted 14 lines · Shawn Guo
Quoted 4 lines · Richard Zhao

Yes, but we don't have now. If I add dependency which don't even hit next tree, I experienced people refuse pick my patch.
Of course, If you're ok to pick other patches, I can leave the code locally for test.

I'm fine for now.

Quoted 6 lines
Quoted 6 lines

arch/arm/boot/dts/imx6q-sabrelite.dts line 66

Quoted 5 lines
arch/arm/boot/dts/imx6q-sabrelite.dts +5 -0
+				gpios {
+					pinctrl_gpio_hog: gpiohog {
+					};
+				};
+

Why the empty nodes?

Quoted 3 lines
Quoted 2 lines

It's place holder that let use know to add gpio hog-on-boot in board dts.

It's meaningless. Please remove it.

Ok.

Thanks
Richard

Quoted 5 lines
Signature · 3 lines
-- 
Regards,
Shawn
#72 lore raw

PATCH v2 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..5330b27 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.usbctrl");
+	clk_register_clkdev(clks[usb1], NULL, "80090000.usbctrl");
 
 	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
#73 lore raw

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

Quoted 10 lines · Richard Zhao
---
 drivers/clk/mxs/clk-imx28.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/clk/mxs/clk-imx28.c +0 -0
index 2826a26..5330b27 100644

drivers/clk/mxs/clk-imx28.c int __init mx28_clocks_init(void) · line 335

Quoted 8 lines
drivers/clk/mxs/clk-imx28.c +4 -0
@@ -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.usbctrl");
+	clk_register_clkdev(clks[usb1], NULL, "80090000.usbctrl");
 

You changed usb node name from "usbctrl" to "usb". The clk lookup needs to be updated correspondingly.

Signature · 2 lines
Regards,
Shawn
#74 lore raw

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

Quoted 6 lines · Shawn Guo
Quoted 5 lines · Richard Zhao
---
 drivers/clk/mxs/clk-imx28.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Quoted 15 lines

drivers/clk/mxs/clk-imx28.c int __init mx28_clocks_init(void) · line 335

Quoted 13 lines
drivers/clk/mxs/clk-imx28.c +4 -0
index 2826a26..5330b27 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.usbctrl");
+	clk_register_clkdev(clks[usb1], NULL, "80090000.usbctrl");
 

You changed usb node name from "usbctrl" to "usb". The clk lookup needs to be updated correspondingly.

Yes, I just noticed it too.

Thanks
Richard

Quoted 5 lines
Signature · 3 lines
-- 
Regards,
Shawn
#75 lore raw

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

In reply to Richard Zhao
---
 arch/arm/boot/dts/imx28-evk.dts |   18 ++++++++++++++++++
 arch/arm/boot/dts/imx28.dtsi    |   12 ++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx28-evk.dts +18 -0
index ee520a5..ca6fe30 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 {
+			fsl,vbus-power = <&gpio3 9 0>;
+			status = "okay";
+		};
+
+		usb1: usb at 80090000 {
+			fsl,vbus-power = <&gpio3 8 0>;
+			status = "okay";
+		};
+
 		mac0: ethernet at 800f0000 {
 			phy-mode = "rmii";
 			pinctrl-names = "default";
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
#76 lore raw

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

arch/arm/boot/dts/imx28-evk.dts line 89

Quoted 3 lines · Richard Zhao
arch/arm/boot/dts/imx28-evk.dts +2 -0
 	ahb at 80080000 {
+		usb0: usb at 80080000 {
+			fsl,vbus-power = <&gpio3 9 0>;

fsl,vbus-power-gpios

arch/arm/boot/dts/imx28-evk.dts line 94

Quoted 5 lines
arch/arm/boot/dts/imx28-evk.dts +5 -0
+			status = "okay";
+		};
+
+		usb1: usb at 80090000 {
+			fsl,vbus-power = <&gpio3 8 0>;

Ditto

Quoted 3 lines
arch/arm/boot/dts/imx28-evk.dts +3 -0
+			status = "okay";
+		};
+
Signature · 2 lines
Regards,
Shawn
#77 lore raw

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

Quoted 6 lines · Shawn Guo

arch/arm/boot/dts/imx28-evk.dts line 89

Quoted 3 lines · Richard Zhao
arch/arm/boot/dts/imx28-evk.dts +2 -0
 	ahb at 80080000 {
+		usb0: usb at 80080000 {
+			fsl,vbus-power = <&gpio3 9 0>;

fsl,vbus-power-gpios

Yes.

Quoted 8 lines

arch/arm/boot/dts/imx28-evk.dts line 94

Quoted 6 lines
arch/arm/boot/dts/imx28-evk.dts +5 -0
+			status = "okay";
+		};
+
+		usb1: usb at 80090000 {
+			fsl,vbus-power = <&gpio3 8 0>;

Ditto

Yes.

I'll test mx28 too next time before send out patch. Maybe need your help :)

Thanks
Richard

Quoted 9 lines
Quoted 4 lines
arch/arm/boot/dts/imx28-evk.dts +3 -0
+			status = "okay";
+		};
+
Signature · 2 lines
Regards,
Shawn
#78 lore raw

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

Dear Richard Zhao,

Quoted 19 lines · Shawn Guo
Quoted 7 lines · Richard Zhao

arch/arm/boot/dts/imx28-evk.dts line 89

Quoted 4 lines
arch/arm/boot/dts/imx28-evk.dts +2 -0
 	ahb at 80080000 {
 
+		usb0: usb at 80080000 {
+			fsl,vbus-power = <&gpio3 9 0>;

fsl,vbus-power-gpios

Yes.

Quoted 7 lines

arch/arm/boot/dts/imx28-evk.dts line 94

Quoted 5 lines
arch/arm/boot/dts/imx28-evk.dts +5 -0
+			status = "okay";
+		};
+
+		usb1: usb at 80090000 {
+			fsl,vbus-power = <&gpio3 8 0>;

Ditto

Quoted 4 lines

Yes.

I'll test mx28 too next time before send out patch. Maybe need your help :)

I'm still stuck a bit with the DT conversion :-( I'll start testing ASAP.

Quoted 6 lines

Thanks
Richard

Quoted 3 lines

arch/arm/boot/dts/imx28-evk.dts line 80

Quoted 3 lines
arch/arm/boot/dts/imx28-evk.dts +3 -0
+			status = "okay";
+		};
+

Best regards,
Marek Vasut

reviewer
#79 lore raw

v2 cover add imx usb driver for mx28/6x

In reply to Richard Zhao

Hi Richard,

Quoted 11 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 V1:
?- Merge the work of Marek
?- re-implement connect change notify
?- imx6q: move part of code to clk
?- imx6q: add config-on-boot gpios

Can you please also add the driver into the defconfig files?

What about the existing USB host drivers for mx27/mx31/mx35/mx25/mx35?

Is the idea to switch to drivers/usb/chipidea/host.c too?

Regards,

Fabio Estevam

#80 lore raw

v2 cover add imx usb driver for mx28/6x

Dear Fabio Estevam,

Quoted 17 lines

Hi Richard,

On Mon, May 21, 2012 at 6:23 AM, Richard Zhao

Quoted 11 lines · <[email protected]> wrote:

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 V1:
- Merge the work of Marek
- re-implement connect change notify
- imx6q: move part of code to clk
- imx6q: add config-on-boot gpios

Quoted 5 lines

Can you please also add the driver into the defconfig files?

What about the existing USB host drivers for mx27/mx31/mx35/mx25/mx35?

Is the idea to switch to drivers/usb/chipidea/host.c too?

I think the core is the same, it's just the ci13xxx-imx driver that'd need to be written differently for these

Quoted 4 lines

Regards,

Fabio Estevam

Best regards,
Marek Vasut

#81 lore raw

v2 cover add imx usb driver for mx28/6x

Quoted 18 lines · Marek Vasut

Dear Fabio Estevam,

Quoted 16 lines

Hi Richard,

On Mon, May 21, 2012 at 6:23 AM, Richard Zhao

Quoted 11 lines · <[email protected]> wrote:

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 V1:
- Merge the work of Marek
- re-implement connect change notify
- imx6q: move part of code to clk
- imx6q: add config-on-boot gpios

Quoted 7 lines
Quoted 5 lines

Can you please also add the driver into the defconfig files?

What about the existing USB host drivers for mx27/mx31/mx35/mx25/mx35?

Is the idea to switch to drivers/usb/chipidea/host.c too?

I think the core is the same, it's just the ci13xxx-imx driver that'd need to be written differently for these

So that means driver that you did are not going to be up streamed for mx28/mxs? And those interested should be tracking this patch set?

-Subodh

#82 lore raw

v2 cover add imx usb driver for mx28/6x

Dear Subodh Nijsure,

Quoted 24 lines · Marek Vasut
Quoted 23 lines

Dear Fabio Estevam,

Quoted 21 lines

Hi Richard,

On Mon, May 21, 2012 at 6:23 AM, Richard Zhao

Quoted 11 lines · <[email protected]> wrote:

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 V1:
- Merge the work of Marek
- re-implement connect change notify
- imx6q: move part of code to clk
- imx6q: add config-on-boot gpios

Can you please also add the driver into the defconfig files?

What about the existing USB host drivers for mx27/mx31/mx35/mx25/mx35?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Is the idea to switch to drivers/usb/chipidea/host.c too?

I think the core is the same, it's just the ci13xxx-imx driver that'd need to be written differently for these

So that means driver that you did are not going to be up streamed for mx28/mxs? And those interested should be tracking this patch set?

This here is definitelly going to support mx28 and I'm slowly working through the DT stuff to test this, all right?

We were talking about imx.{xz|x,y is [0-9a-z]} \ imx.{23,28,6q}

Quoted 2 lines

-Subodh

Best regards,
Marek Vasut

#83 lore raw

v2 cover add imx usb driver for mx28/6x

Quoted 29 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

Hi Richard,

On Mon, May 21, 2012 at 6:23 AM, Richard Zhao

Quoted 11 lines · <[email protected]> wrote:

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 V1:
- Merge the work of Marek
- re-implement connect change notify
- imx6q: move part of code to clk
- imx6q: add config-on-boot gpios

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Can you please also add the driver into the defconfig files?

What about the existing USB host drivers for

mx27/mx31/mx35/mx25/mx35?

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Is the idea to switch to drivers/usb/chipidea/host.c too?

I think the core is the same, it's just the ci13xxx-imx driver that'd need to be written differently for these

Quoted 9 lines
Quoted 2 lines

So that means driver that you did are not going to be up streamed for mx28/mxs? And those interested should be tracking this patch set?

This here is definitelly going to support mx28 and I'm slowly working through
the DT stuff to test this, all right?

We were talking about imx.{xz|x,y is [0-9a-z]} \ imx.{23,28,6q}

This driver needs to work on both DT and non-DT support.
Let's do it after next version when we need to add it for old mxc platform.

Quoted 5 lines
Quoted 2 lines

-Subodh

Best regards,
Marek Vasut

#84 lore raw

v2 cover add imx usb driver for mx28/6x

Quoted 32 lines · On Tue, May 22, 2012 at 09:38:33AM +0800, Chen Peter-B29397 wrote:
Quoted 32 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

Hi Richard,

On Mon, May 21, 2012 at 6:23 AM, Richard Zhao

Quoted 11 lines · <[email protected]> wrote:

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 V1:
- Merge the work of Marek
- re-implement connect change notify
- imx6q: move part of code to clk
- imx6q: add config-on-boot gpios

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Can you please also add the driver into the defconfig files?

What about the existing USB host drivers for

mx27/mx31/mx35/mx25/mx35?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is the idea to switch to drivers/usb/chipidea/host.c too?

I think the core is the same, it's just the ci13xxx-imx driver that'd need to be written differently for these

So that means driver that you did are not going to be up streamed for mx28/mxs? And those interested should be tracking this patch set?

Quoted 8 lines
Quoted 6 lines

This here is definitelly going to support mx28 and I'm slowly working through
the DT stuff to test this, all right?

We were talking about imx.{xz|x,y is [0-9a-z]} \ imx.{23,28,6q}

This driver needs to work on both DT and non-DT support.
Let's do it after next version when we need to add it for old mxc platform.

I don't think so. We only need to go right direction and don't do extra work for what is going to be abandoned.

Thanks
Richard

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

-Subodh

Best regards,
Marek Vasut

#85 lore raw

v2 cover add imx usb driver for mx28/6x

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This here is definitelly going to support mx28 and I'm slowly working through
the DT stuff to test this, all right?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

We were talking about imx.{xz|x,y is [0-9a-z]} \ imx.{23,28,6q}

This driver needs to work on both DT and non-DT support. Let's do it after next version when we need to add it for old mxc

platform.
I don't think so. We only need to go right direction and don't do extra work for what is going to be abandoned.

Are you sure all i.mx platform will support DT in future?

Quoted 11 lines

Thanks
Richard

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

-Subodh

Best regards,
Marek Vasut

#86 lore raw

v2 cover add imx usb driver for mx28/6x

Quoted 6 lines · On Tue, May 22, 2012 at 09:44:14AM +0800, Chen Peter-B29397 wrote:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

This here is definitelly going to support mx28 and I'm slowly working through
the DT stuff to test this, all right?

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

We were talking about imx.{xz|x,y is [0-9a-z]} \ imx.{23,28,6q}

This driver needs to work on both DT and non-DT support. Let's do it after next version when we need to add it for old mxc

platform.
I don't think so. We only need to go right direction and don't do extra work for what is going to be abandoned.

Are you sure all i.mx platform will support DT in future?

Finally, yes.

Quoted 12 lines
Quoted 12 lines

Thanks
Richard

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

-Subodh

Best regards,
Marek Vasut

#87 lore raw

v2 cover add imx usb driver for mx28/6x

In reply to Chen Peter-B29397
Quoted 7 lines · On 22 May 2012 09:44, Chen Peter-B29397 <[email protected]> wrote:
Quoted 5 lines
Quoted 2 lines

This driver needs to work on both DT and non-DT support. Let's do it after next version when we need to add it for old mxc

platform.
I don't think so. We only need to go right direction and don't do extra work for what is going to be abandoned.

Are you sure all i.mx platform will support DT in future?

I'm with Richard on this. With all new drivers support DT only, we can attract people to convert their platform to DT, if they want to use the new driver. Otherwise, people lose motivation to move to DT.

Regards,
Shawn

#88 lore raw

v2 cover add imx usb driver for mx28/6x

In reply to Fabio Estevam
Quoted 10 lines · Fabio Estevam

Hi Richard,

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

Quoted 7 lines
Quoted 5 lines

Changes since V1:
?- Merge the work of Marek
?- re-implement connect change notify
?- imx6q: move part of code to clk
?- imx6q: add config-on-boot gpios

Can you please also add the driver into the defconfig files?

Thanks for you reminder.

Quoted 4 lines

What about the existing USB host drivers for mx27/mx31/mx35/mx25/mx35?

Is the idea to switch to drivers/usb/chipidea/host.c too?

Yes. but I'm now just focusing on imx6q and imx28.

Thanks
Richard

Quoted 5 lines

Regards,

Fabio Estevam

#89 lore raw

v2 cover add imx usb driver for mx28/6x

Quoted 11 lines · Richard Zhao
Quoted 10 lines · Fabio Estevam

Hi Richard,

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

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines

Changes since V1:
- Merge the work of Marek
- re-implement connect change notify
- imx6q: move part of code to clk
- imx6q: add config-on-boot gpios

Can you please also add the driver into the defconfig files?

Thanks for you reminder.

For i.MX6 I use something like [1].

Best regards

Dirk

[1]

From: Dirk Behme <[email protected]>
Subject: [PATCH] ARM: imx_v6_v7_defconfig: Enable chipidea USB host driver

---
  arch/arm/configs/imx_v6_v7_defconfig |    8 ++++++--
  1 files changed, 6 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/configs/imx_v6_v7_defconfig
index c3a828e..45001ef 100644

arch/arm/configs/imx_v6_v7_defconfig +6 -2
@@ -130,6 +130,7 @@ CONFIG_GPIO_SYSFS=y
  CONFIG_WATCHDOG=y
  CONFIG_IMX2_WDT=y
  CONFIG_MFD_MC13XXX=y
+CONFIG_MFD_ANATOP=y
  CONFIG_REGULATOR=y
  CONFIG_REGULATOR_FIXED_VOLTAGE=y
  CONFIG_REGULATOR_MC13783=y
@@ -166,9 +167,12 @@ CONFIG_LOGO_LINUX_MONO=y
  CONFIG_LOGO_LINUX_VGA16=y
  CONFIG_LOGO_LINUX_CLUT224=y
  CONFIG_USB=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_EHCI_MXC=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+CONFIG_USB_CHIPIDEA=y
+CONFIG_USB_CHIPIDEA_HOST=y
+CONFIG_USB_CHIPIDEA_DEBUG=y
  CONFIG_USB_STORAGE=y
+CONFIG_USB_MXS_PHY=y
  CONFIG_MMC=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_PLTFM=y
#90 lore raw

v2 cover add imx usb driver for mx28/6x

In reply to Richard Zhao
Quoted 11 lines · Richard Zhao
Quoted 10 lines · Fabio Estevam

Hi Richard,

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

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Changes since V1:
?- Merge the work of Marek
?- re-implement connect change notify
?- imx6q: move part of code to clk
?- imx6q: add config-on-boot gpios

Can you please also add the driver into the defconfig files?

Thanks for you reminder.

I'll not put it in defconfig until we can get ride of mxc usb driver. It cannot be in one image.

Thanks
Richard

Quoted 19 lines
Quoted 4 lines

What about the existing USB host drivers for mx27/mx31/mx35/mx25/mx35?

Is the idea to switch to drivers/usb/chipidea/host.c too?

Yes. but I'm now just focusing on imx6q and imx28.

Thanks
Richard

Quoted 5 lines

Regards,

Fabio Estevam

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html