Subject: Re: USB support for Bamboo/440EP (Yosemite/440EPx)

From: Gerhard Jaeger <[email-masked]>
Date: Tue, 15 May 2007 09:27:29 +0200

On Montag, 14. Mai 2007, Stephen Winiecki wrote:
> Gerhard Jaeger <[email-masked]> wrote on 05/14/2007 10:31:04 AM:
> > Hi Stephen, 
> > 
> > I also played with Bamboo and Yosemite USB and found out, that the OHCI
> > ISR contains an assumption that makes the 440 OHCI implementation sometimes 
> > stop when having a timeout condition. Find the following sequence @function
> > ohci_irq() (in file ohci-hcd.c) and disable the following code:
> > 
> >         if ((ohci->hcca->done_head != 0)
> >                         && ! (hc32_to_cpup (ohci, &ohci->hcca->done_head)
> >                                 & 0x01)) {
> >                 ints =  OHCI_INTR_WDH;
> >    }
> > 
> > This should make the USB host work reliably on the 440s.
> > 
> Thanks Gerhard.  This definitely makes things work better - I have had 
> 100% success in both the kernel and X recognizing the devices and having X 
> boot with this update.
> 
> However, I am occasionally still having an issue after X comes up with the 
> keyboard not working (mouse working fine).  Just to be clear - I only want 
> to comment out the code you indicated above - not also any/either of the 
> else/if clauses, correct?

Yes - the lines mentioned didn't care about irq-status register
and try to figure out from some context, how the irq-status register
should look like - but this in fact does not work correctly for the
440 OHCI implementation... 

> So has this never been formally reported/patched?  

Not that I'm aware of, I discovered that a few days ago.

> Do you know also why  
> the USB support has not been configured in the mainline kernel for these 
> platforms - is it due to known existing issues? 

I don't know why this is not part of the mainline kernel. On the PPC
side there is currently a lot of restructure work going on, so I guess
this is only a question of time, when the necessary patches will go
into the mainline.

Please find the patch for the ohc-hcd.c in the attachment.

Ciao,
Gerhard

-- 
Gerhard Jaeger <[email-masked]>            
SYSGO AG                      Embedded and Real-Time Software
www.sysgo.com | www.elinos.com | www.pikeos.com | www.osek.de 
This patch makes the OHCI code work correctly on AMCC PPC440
cpus with internal USB-host controller. It seems that the
optimization is not allowed for this OHCI implementation.

Signed-off-by: Gerhard Jaeger <[email-masked]>
---

--- linux/drivers/usb/host/ohci-hcd.c.orig	2007-03-09 11:33:39.000000000 +0100
+++ linux/drivers/usb/host/ohci-hcd.c	2007-05-15 09:03:50.000000000 +0200
@@ -646,13 +646,16 @@ static irqreturn_t ohci_irq (struct usb_
 
 	/* we can eliminate a (slow) ohci_readl()
 	   if _only_ WDH caused this irq */
+#if !(defined(CONFIG_USB_OHCI_HCD_PPC_SOC) && (defined(CONFIG_440EP) || defined(CONFIG_440EPX)))
 	if ((ohci->hcca->done_head != 0)
 			&& ! (hc32_to_cpup (ohci, &ohci->hcca->done_head)
 				& 0x01)) {
 		ints =  OHCI_INTR_WDH;
 
 	/* cardbus/... hardware gone before remove() */
-	} else if ((ints = ohci_readl (ohci, &regs->intrstatus)) == ~(u32)0) {
+	} else 
+#endif
+	if ((ints = ohci_readl (ohci, &regs->intrstatus)) == ~(u32)0) {
 		disable (ohci);
 		ohci_dbg (ohci, "device removed!\n");
 		return IRQ_HANDLED;