[U-Boot-Users] USB OHCI drivers unification

Rodolfo Giometti giometti at linux.it
Tue May 30 16:04:05 CEST 2006


Hello,

I'm trying to unify the several USB OHCI drivers. First of all I
created two new files called "common/usb_ohci.c" and
"include/usb_ohci.h".

Latter file is just a copy of several OHCI headers (for instance I
copy the file cpu/mips/au1x00_usb_ohci.h) and the former is an OHCI
driver modified as follow:

Functions "usb_lowlevel_init()" and "usb_lowlevel_stop()" have the
form:

   int usb_lowlevel_init(void)
   {
           /* Specific board OHCI init */
           usb_ohci_lowlevel_init();

           dbg("OHCI board setup complete\n");

           memset (&gohci, 0, sizeof (ohci_t));
           memset (&urb_priv, 0, sizeof (urb_priv_t));

           ... bla bla ...

           dbg("OHCI revision: 0x%08x\nRH: a: 0x%08x b: 0x%08x\n",
                   readl(&gohci.regs->revision),
                   readl(&gohci.regs->roothub.a), readl(&gohci.regs->roothub.b));

           /* enable host controller */
           if (usb_ohci_lowlevel_enable() < 0)
                   goto errout;

           dbg("OHCI clock running\n");

           if (hc_reset (&gohci) < 0)
                   goto errout;

   	... bla	bla ...

   errout:
           err("OHCI initialization error\n");
           hc_release_ohci (&gohci);

           /* Initialization failed */
	   usb_ohci_lowlevel_disable();

           return -1;
   }

   int usb_lowlevel_stop(void)
   {
           /* this gets called really early - before the controller has */
           /* even been initialized! */
           if (!ohci_inited)
                   return 0;

           /* TODO release any interrupts, etc. */
           /* call hc_release_ohci() here ? */
           hc_reset (&gohci);

           /* disable host controller */
           usb_ohci_lowlevel_disable();

           return 0;
   }

Where the new functions "usb_ohci_lowlevel_init()",
"usb_ohci_lowlevel_enable()" and "usb_ohci_lowlevel_disable()" will be
defined per CPUs into their own directories.

I'd like to know if this modification can be acceptable and who can
help me in testing and doing the patch for each platform using USB
OHCI. I can test and patch my board with MIPS au1100.

Also, I'd like to know how I should build my patch since I'm quite
sure that it could be greater than 40KB...

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti at enneenne.com
Linux Device Driver                             giometti at gnudd.com
Embedded Systems                     		giometti at linux.it
UNIX programming                     phone:     +39 349 2432127




More information about the U-Boot mailing list