Skip to contentSkip to conversation

OHCI: Fix for regression in 2.6.37-rc1 since commit 3df7169e7

RFC/RFT Larry Finger 2 participants 5 messages Nov 3, 2010 – Dec 11, 2010

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

Following commit 3df7169e73fc1d71a39cffeacc969f6840cdf52b, my logs are spammed with messages of the form "hub 2-0:1.0: unable to enumerate USB device on port 5".

Experimentation has shown that if the functional state bits of the control register are preserved in the fixup, then the messages no longer appear.

---

Pali,

Is it possible for you to test this patch to ensure that it does not interfere with the fix for the shutdown problem.

Thanks,

Larry
---

drivers/usb/host/pci-quirks.c +2 -1
Index: linux-realtek/drivers/usb/host/pci-quirks.c
===================================================================
@@ -35,6 +35,7 @@
 #define OHCI_INTRENABLE		0x10
 #define OHCI_INTRDISABLE	0x14
 #define OHCI_OCR		(1 << 3)	/* ownership change request */
+#define OHCI_CTRL_HCFS		(3 << 6)	/* functional state */
 #define OHCI_CTRL_RWC		(1 << 9)	/* remote wakeup connected */
 #define OHCI_CTRL_IR		(1 << 8)	/* interrupt routing */
 #define OHCI_INTR_OC		(1 << 30)	/* ownership change */
@@ -184,7 +185,7 @@ static void __devinit quirk_usb_handoff_
 #ifdef __hppa__
 #define	OHCI_CTRL_MASK		(OHCI_CTRL_RWC | OHCI_CTRL_IR)
 #else
-#define	OHCI_CTRL_MASK		OHCI_CTRL_RWC
+#define	OHCI_CTRL_MASK		(OHCI_CTRL_RWC | OHCI_CTRL_HCFS)
 
 	if (control & OHCI_CTRL_IR) {
 		int wait_time = 500; /* arbitrary; 5 seconds */
#1 lore raw
Quoted 33 lines · Larry Finger

Following commit 3df7169e73fc1d71a39cffeacc969f6840cdf52b, my logs are spammed with messages of the form "hub 2-0:1.0: unable to enumerate USB device on port 5".

Experimentation has shown that if the functional state bits of the control register are preserved in the fixup, then the messages no longer appear.

---

Pali,

Is it possible for you to test this patch to ensure that it does not interfere with the fix for the shutdown problem.

Thanks,

Larry
---

Index: linux-realtek/drivers/usb/host/pci-quirks.c
===================================================================

drivers/usb/host/pci-quirks.c +1 -0
@@ -35,6 +35,7 @@
 #define OHCI_INTRENABLE		0x10
 #define OHCI_INTRDISABLE	0x14
 #define OHCI_OCR		(1 << 3)	/* ownership change request */
+#define OHCI_CTRL_HCFS		(3 << 6)	/* functional state */
 #define OHCI_CTRL_RWC		(1 << 9)	/* remote wakeup connected */
 #define OHCI_CTRL_IR		(1 << 8)	/* interrupt routing */
 #define OHCI_INTR_OC		(1 << 30)	/* ownership change */

drivers/usb/host/pci-quirks.c static void __devinit quirk_usb_handoff_ · line 191

Quoted 8 lines
drivers/usb/host/pci-quirks.c +1 -1
@@ -184,7 +185,7 @@ static void __devinit quirk_usb_handoff_
 #ifdef __hppa__
 #define	OHCI_CTRL_MASK		(OHCI_CTRL_RWC | OHCI_CTRL_IR)
 #else
-#define	OHCI_CTRL_MASK		OHCI_CTRL_RWC
+#define	OHCI_CTRL_MASK		(OHCI_CTRL_RWC | OHCI_CTRL_HCFS)
 
 	if (control & OHCI_CTRL_IR) {
 		int wait_time = 500; /* arbitrary; 5 seconds */

This patch is definitely wrong -- it defeats the entire purpose of rewriting the control register! That write was added _specifically_ to put the controller into reset, i.e., to change the functional state.

Furthermore, the write does the same thing as ohci_hcd.c does in its ohci_usb_reset() routine. Regardless, ohci_run() does a complete host controller reset, which should override anything done in pci-quirks.c. Perhaps _that_ routine needs some attention.

Alan Stern

#2 lore raw
Quoted 9 lines · Alan Stern

This patch is definitely wrong -- it defeats the entire purpose of rewriting the control register! That write was added _specifically_ to put the controller into reset, i.e., to change the functional state.

Furthermore, the write does the same thing as ohci_hcd.c does in its ohci_usb_reset() routine. Regardless, ohci_run() does a complete host controller reset, which should override anything done in pci-quirks.c. Perhaps _that_ routine needs some attention.

It is looking as if your patch is exposing a different bug. When I disable the write in pci_quirks leaving the controllers in OPER or RESUME mode, then ohci_run() is not called. I'm still trying to find out why.

Larry

#3 lore raw
Quoted 6 lines · Larry Finger
Quoted 5 lines · Alan Stern

This patch is definitely wrong -- it defeats the entire purpose of rewriting the control register! That write was added _specifically_ to put the controller into reset, i.e., to change the functional state.

Quoted 8 lines
Quoted 4 lines

Furthermore, the write does the same thing as ohci_hcd.c does in its ohci_usb_reset() routine. Regardless, ohci_run() does a complete host controller reset, which should override anything done in pci-quirks.c. Perhaps _that_ routine needs some attention.

It is looking as if your patch is exposing a different bug. When I disable the write in pci_quirks leaving the controllers in OPER or RESUME mode, then ohci_run() is not called. I'm still trying to find out why.

Is your OHCI controller attached via PCI? If it is, I don't see how ohci_pci_start() can avoid calling ohci_run().

Alan Stern

#4 lore raw

Alan,

The box with the problem has been repaired, and I am trying to debug it.

What I have learned so far:

The "unable to enumerate" message is triggered because PORT_OWNER is not set in the status register.

So far, I have found that this bit is set in only 4 places:

1. set_owner()
2. store_companion()
3. ehci_hub_control()
4. ehci_relinquish_port()
5. check_reset_complete()

Of these, only #5 is called before the first enumeration message is logged, but it is only called with arguments that never set the PORT_OWNED bit in the status.

At this point I'm at a loss. Could you please give me ideas on where I might look.

The logged data leading up to the first message are:

[    3.002762] hub 4-0:1.0: USB hub found
[    3.002780] hub 4-0:1.0: 5 ports detected
[    3.088286] ehci_hcd 0000:00:02.1: usb: Entered check_reset_complete with
port_status 0x1005
[    3.088433] ehci_hcd 0000:00:02.1: port 4 high speed
[    3.144061] usb 1-4: new high speed USB device using ehci_hcd and address 2
[    3.200286] ehci_hcd 0000:00:02.1: usb: Entered check_reset_complete with
port_status 0x1005
[    3.200437] ehci_hcd 0000:00:02.1: port 4 high speed
[    3.352298] ehci_hcd 0000:00:02.1: usb: Entered check_reset_complete with
port_status 0x1005
[    3.352304] ehci_hcd 0000:00:02.1: port 5 high speed
[    3.408071] usb 1-5: new high speed USB device using ehci_hcd and address 3
[    3.454449] PM: Starting manual resume from disk
[    3.464305] ehci_hcd 0000:00:02.1: usb: Entered check_reset_complete with
port_status 0x1005
[    3.464449] ehci_hcd 0000:00:02.1: port 5 high speed
[    3.600052] ehci_hcd 0000:00:04.1: usb: Entered check_reset_complete with
port_status 0x1001
[    3.600202] ehci_hcd 0000:00:04.1: port 5 full speed --> companion
[    3.600307] ehci_hcd 0000:00:04.1: Wrote 0x3001 to status reg
[    3.656089] hub 2-0:1.0: unable to enumerate USB device on port 5
[    3.656203] ehci_hcd 0000:00:04.1: In ehci_relinquish_port
[    3.656295] ehci_hcd 0000:00:04.1: In set_owner

Thanks,

Larry