Subject: Re: CPM2 USB host driver

From: David Brownell <[email-masked]>
Date: Fri, 30 Nov 2007 15:18:42 -0800

On Friday 30 November 2007, Arnd Bergmann wrote:
> 6100 lines means it's still the second-largest hcd driver in the kernel,
> only drivers/usb/host/u132-hcd.c has even more.

~/kernel/g26/drivers/usb/host$ wc -l ohci*[hc] |grep total
  9485 total
~/kernel/g26/drivers/usb/host$ wc -l ehci*[hc] |grep total
  8709 total
~/kernel/g26/drivers/usb/host$ wc -l uhci*[hc] |grep total
  4211 total
~/kernel/g26/drivers/usb/host$ wc -l sl811*[hc] |grep total
 2472 total
~/kernel/g26/drivers/usb/host$ 

Of course a lot of the OHCI stuff is various flavors of bus glue
(with more in the queue).  And for one nyet-merged driver:

~/kernel/omap-2.6/drivers/usb/musb$ wc -l *[hc] |  grep total
 15223 total
~/kernel/omap-2.6/drivers/usb/musb$ 

That's an OTG driver so it includes both host and peripheral
sides, plus currently bus glue for three different chunks of
silicon (DaVinci, OMAP, TUSB6010 ... Blackfin on the way)
with three different DMA engines (sigh).

So it's not that big; larger than UHCI or sl811-hcd though.  ;)

> My experience with other drivers moved into the kernel is that you
> end up rewriting it completely anyway. I can also recommend starting
> from scratch, and taking one of the in-kernel drivers as an example.

Start-from-scratch vs Incremental-rewrite ... there are advantages
to each approach.

> Maybe Greg or David can give you a suggestion which one of them
> serves as the best example for a new host driver.

I don't even know what a CPM2 is, or what kind of host it has.
(Wasn't CPM the predecessor of MS-DOS?)

Suggestions would be futile.

- Dave