linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* CPM2 USB host driver
@ 2007-11-30 10:45 Laurent Pinchart
  2007-11-30 11:16 ` Vitaly Bordug
  0 siblings, 1 reply; 11+ messages in thread
From: Laurent Pinchart @ 2007-11-30 10:45 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mike

[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]

Hi everybody,

Linux USB host support for the CPM, CPM2 and CPM2 pro is far from complete. 
Many people showed interest on this list (and on linuxppc-embedded) in the 
past, but nobody managed to complete a driver and get it merged.

As I need USB host support on my MPC8248 (CPM2), I decided to scratch the itch 
and try to get a working driver that could be merged upstream. This mail 
describes my plans to make sure the code I write will be useful for other 
people.

The driver will be based on the cpm2usb project (http://cpm2usb.sf.net/). As I 
don't own any CPM1-based platform, I will convert the driver to use the CPM2 
transaction-level interface, thus making it incompatible with the CPM1. CPM1 
support could be added back later. There is no planned release date, and more 
urgent projects could put this development on hold.

Comments are welcome (and contributions too, especially in the form of a 
working driver :-)).

Best regards,

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: CPM2 USB host driver
  2007-11-30 10:45 CPM2 USB host driver Laurent Pinchart
@ 2007-11-30 11:16 ` Vitaly Bordug
  2007-11-30 12:30   ` Laurent Pinchart
  0 siblings, 1 reply; 11+ messages in thread
From: Vitaly Bordug @ 2007-11-30 11:16 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linuxppc-dev, mike

On Fri, 30 Nov 2007 11:45:49 +0100
Laurent Pinchart wrote:

> Hi everybody,
> 
> Linux USB host support for the CPM, CPM2 and CPM2 pro is far from
> complete. Many people showed interest on this list (and on
> linuxppc-embedded) in the past, but nobody managed to complete a
> driver and get it merged.
> 
that is mainly because of its semi-software nature. However, any approach
would be helpful I beleive. 

> As I need USB host support on my MPC8248 (CPM2), I decided to scratch
> the itch and try to get a working driver that could be merged
> upstream. This mail describes my plans to make sure the code I write
> will be useful for other people.
> 
> The driver will be based on the cpm2usb project
> (http://cpm2usb.sf.net/). As I don't own any CPM1-based platform, I
> will convert the driver to use the CPM2 transaction-level interface,
> thus making it incompatible with the CPM1. CPM1 support could be
> added back later. There is no planned release date, and more urgent
> projects could put this development on hold.
> 
> Comments are welcome (and contributions too, especially in the form
> of a working driver :-)).
> 

I may have some WIP material left, will try to dig it out...

> Best regards,
> 


-- 
Sincerely, Vitaly

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: CPM2 USB host driver
  2007-11-30 11:16 ` Vitaly Bordug
@ 2007-11-30 12:30   ` Laurent Pinchart
  2007-11-30 12:48     ` Anton Vorontsov
  2007-11-30 13:02     ` Vitaly Bordug
  0 siblings, 2 replies; 11+ messages in thread
From: Laurent Pinchart @ 2007-11-30 12:30 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-dev, mike

[-- Attachment #1: Type: text/plain, Size: 2069 bytes --]

On Friday 30 November 2007 12:16, Vitaly Bordug wrote:
> On Fri, 30 Nov 2007 11:45:49 +0100
>
> Laurent Pinchart wrote:
> > Hi everybody,
> >
> > Linux USB host support for the CPM, CPM2 and CPM2 pro is far from
> > complete. Many people showed interest on this list (and on
> > linuxppc-embedded) in the past, but nobody managed to complete a
> > driver and get it merged.
>
> that is mainly because of its semi-software nature. However, any approach
> would be helpful I beleive.

The CPM/CPM2 USB host controller does indeed put some pressure on the CPU. The 
PowerQuick III family is much better in that respect as its USB host 
controller is EHCI compliant.

We plan to use an external USB host controller when we will redesign the 
hardware. My goal in writting a CPM2 USB host driver is mainly to enable the 
hardware team to perform EMC testing on the USB interface. I don't expect it 
to be shipped to any client, but I'd still like to get it merged (if I 
complete the project) as I don't like throwing away useful code.

> > As I need USB host support on my MPC8248 (CPM2), I decided to scratch
> > the itch and try to get a working driver that could be merged
> > upstream. This mail describes my plans to make sure the code I write
> > will be useful for other people.
> >
> > The driver will be based on the cpm2usb project
> > (http://cpm2usb.sf.net/). As I don't own any CPM1-based platform, I
> > will convert the driver to use the CPM2 transaction-level interface,
> > thus making it incompatible with the CPM1. CPM1 support could be
> > added back later. There is no planned release date, and more urgent
> > projects could put this development on hold.
> >
> > Comments are welcome (and contributions too, especially in the form
> > of a working driver :-)).
>
> I may have some WIP material left, will try to dig it out...

Should I wait ?

Best regards,

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: CPM2 USB host driver
  2007-11-30 12:30   ` Laurent Pinchart
@ 2007-11-30 12:48     ` Anton Vorontsov
  2007-11-30 13:00       ` Vitaly Bordug
  2007-11-30 15:28       ` Laurent Pinchart
  2007-11-30 13:02     ` Vitaly Bordug
  1 sibling, 2 replies; 11+ messages in thread
From: Anton Vorontsov @ 2007-11-30 12:48 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: mike, linuxppc-dev

On Fri, Nov 30, 2007 at 01:30:18PM +0100, Laurent Pinchart wrote:
> On Friday 30 November 2007 12:16, Vitaly Bordug wrote:
> > On Fri, 30 Nov 2007 11:45:49 +0100
> >
> > Laurent Pinchart wrote:
> > > Hi everybody,
> > >
> > > Linux USB host support for the CPM, CPM2 and CPM2 pro is far from
> > > complete. Many people showed interest on this list (and on
> > > linuxppc-embedded) in the past, but nobody managed to complete a
> > > driver and get it merged.
> >
> > that is mainly because of its semi-software nature. However, any approach
> > would be helpful I beleive.
> 
> The CPM/CPM2 USB host controller does indeed put some pressure on the CPU. The 
> PowerQuick III family is much better in that respect as its USB host 
> controller is EHCI compliant.

I didn't yet compare with CPM/CPM2, but I wonder if PQIIPro (MPC8360E)
USB controller is similar to cpms?..

I tried to forward-port FHCI from Freescale 2.6.11 kernels. Twice.
But these efforts always stumbled over more important tasks.

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: CPM2 USB host driver
  2007-11-30 12:48     ` Anton Vorontsov
@ 2007-11-30 13:00       ` Vitaly Bordug
  2007-11-30 15:28       ` Laurent Pinchart
  1 sibling, 0 replies; 11+ messages in thread
From: Vitaly Bordug @ 2007-11-30 13:00 UTC (permalink / raw)
  To: avorontsov; +Cc: linuxppc-dev, mike

On Fri, 30 Nov 2007 15:48:01 +0300
Anton Vorontsov wrote:

> On Fri, Nov 30, 2007 at 01:30:18PM +0100, Laurent Pinchart wrote:
> > On Friday 30 November 2007 12:16, Vitaly Bordug wrote:
> > > On Fri, 30 Nov 2007 11:45:49 +0100
> > >
> > > Laurent Pinchart wrote:
> > > > Hi everybody,
> > > >
> > > > Linux USB host support for the CPM, CPM2 and CPM2 pro is far
> > > > from complete. Many people showed interest on this list (and on
> > > > linuxppc-embedded) in the past, but nobody managed to complete a
> > > > driver and get it merged.
> > >
> > > that is mainly because of its semi-software nature. However, any
> > > approach would be helpful I beleive.
> >=20
> > The CPM/CPM2 USB host controller does indeed put some pressure on
> > the CPU. The PowerQuick III family is much better in that respect
> > as its USB host controller is EHCI compliant.
>=20
> I didn't yet compare with CPM/CPM2, but I wonder if PQIIPro (MPC8360E)
> USB controller is similar to cpms?..
>
=46rom what I recall, it is similar, but ucc usb  should work fine,
at least according to RM it does all the necessary things in hw
so the cpu isn't hogged with say SOF generation.

> I tried to forward-port FHCI from Freescale 2.6.11 kernels. Twice.
> But these efforts always stumbled over more important tasks.
>=20


--=20
Sincerely, Vitaly

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: CPM2 USB host driver
  2007-11-30 12:30   ` Laurent Pinchart
  2007-11-30 12:48     ` Anton Vorontsov
@ 2007-11-30 13:02     ` Vitaly Bordug
  1 sibling, 0 replies; 11+ messages in thread
From: Vitaly Bordug @ 2007-11-30 13:02 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linuxppc-dev, mike

On Fri, 30 Nov 2007 13:30:18 +0100
Laurent Pinchart wrote:

> On Friday 30 November 2007 12:16, Vitaly Bordug wrote:
> > On Fri, 30 Nov 2007 11:45:49 +0100
> >
> > Laurent Pinchart wrote:
> > > Hi everybody,
> > >
> > > Linux USB host support for the CPM, CPM2 and CPM2 pro is far from
> > > complete. Many people showed interest on this list (and on
> > > linuxppc-embedded) in the past, but nobody managed to complete a
> > > driver and get it merged.
> >
> > that is mainly because of its semi-software nature. However, any
> > approach would be helpful I beleive.
> 
> The CPM/CPM2 USB host controller does indeed put some pressure on the
> CPU. The PowerQuick III family is much better in that respect as its
> USB host controller is EHCI compliant.
> 
> We plan to use an external USB host controller when we will redesign
> the hardware. My goal in writting a CPM2 USB host driver is mainly to
> enable the hardware team to perform EMC testing on the USB interface.
> I don't expect it to be shipped to any client, but I'd still like to
> get it merged (if I complete the project) as I don't like throwing
> away useful code.
> 
> > > As I need USB host support on my MPC8248 (CPM2), I decided to
> > > scratch the itch and try to get a working driver that could be
> > > merged upstream. This mail describes my plans to make sure the
> > > code I write will be useful for other people.
> > >
> > > The driver will be based on the cpm2usb project
> > > (http://cpm2usb.sf.net/). As I don't own any CPM1-based platform,
> > > I will convert the driver to use the CPM2 transaction-level
> > > interface, thus making it incompatible with the CPM1. CPM1
> > > support could be added back later. There is no planned release
> > > date, and more urgent projects could put this development on hold.
> > >
> > > Comments are welcome (and contributions too, especially in the
> > > form of a working driver :-)).
> >
> > I may have some WIP material left, will try to dig it out...
> 
> Should I wait ?
>

Dunno. It was about 3 years ago so the chance is small. 


-- 
Sincerely, Vitaly

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: CPM2 USB host driver
  2007-11-30 12:48     ` Anton Vorontsov
  2007-11-30 13:00       ` Vitaly Bordug
@ 2007-11-30 15:28       ` Laurent Pinchart
  2007-11-30 16:11         ` Anton Vorontsov
  2007-12-02  6:31         ` Mike Rapoport
  1 sibling, 2 replies; 11+ messages in thread
From: Laurent Pinchart @ 2007-11-30 15:28 UTC (permalink / raw)
  To: avorontsov; +Cc: mike, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 2865 bytes --]

On Friday 30 November 2007 13:48, Anton Vorontsov wrote:
> On Fri, Nov 30, 2007 at 01:30:18PM +0100, Laurent Pinchart wrote:
> > On Friday 30 November 2007 12:16, Vitaly Bordug wrote:
> > > On Fri, 30 Nov 2007 11:45:49 +0100
> > >
> > > Laurent Pinchart wrote:
> > > > Hi everybody,
> > > >
> > > > Linux USB host support for the CPM, CPM2 and CPM2 pro is far from
> > > > complete. Many people showed interest on this list (and on
> > > > linuxppc-embedded) in the past, but nobody managed to complete a
> > > > driver and get it merged.
> > >
> > > that is mainly because of its semi-software nature. However, any
> > > approach would be helpful I beleive.
> >
> > The CPM/CPM2 USB host controller does indeed put some pressure on the
> > CPU. The PowerQuick III family is much better in that respect as its USB
> > host controller is EHCI compliant.
>
> I didn't yet compare with CPM/CPM2, but I wonder if PQIIPro (MPC8360E)
> USB controller is similar to cpms?..

If I'm not mistaken it is very similar to the CPM2 USB host controller, with 
the added ability to generate SOF packets automatically.

The CPM has a packet-level USB host controller. CPM2 introduced a 
transaction-level mode (it still supports packet-level mode). CPM2 pro fixes 
the SOF packets generation issue that wakes the CPU once per millisecond with 
CPM and CPM2.

Some members of the PQ2 and PQ2 pro families don't have a CPM but include a 
USB EHCI controller. I suppose those processors are less versatile (as the 
communication controllers are hardware-based instead of software-based) but 
offer more communication performance.

If I'm not mistaken, the only processor to support USB in the PQ3 family is 
the MPC8555E. Its USB host controller is similar to the CPM2 as it supports 
both packet-level and transaction-level modes, but doesn't generate SOF 
packets automatically. I assume the PQ3 integrates a CPM2 and not a CPM2 pro.

To summarize the issue (and I'd appreciate if someone could confirm this), a 
packet-level FHCI driver would work with CPM, CPM2 and CPM2 pro based 
processors. A transaction-level FHCI driver would work with the CPM2 and CPM2 
pro based processors. For CPM2 pro based processors, SOF packet generation 
can be handled by the CPM.

> I tried to forward-port FHCI from Freescale 2.6.11 kernels. Twice.
> But these efforts always stumbled over more important tasks.

Do you think I start from the FHCI driver provided by Freescale for 2.6.11, 
from the cpm2usb driver or from scratch ?

Both the cpm2usb and FHCI drivers seem to use the packet-level interface. Is 
there any reason not to use the transaction-level interface ?

Best regards,

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: CPM2 USB host driver
  2007-11-30 15:28       ` Laurent Pinchart
@ 2007-11-30 16:11         ` Anton Vorontsov
  2007-11-30 22:32           ` Arnd Bergmann
  2007-12-02  6:31         ` Mike Rapoport
  1 sibling, 1 reply; 11+ messages in thread
From: Anton Vorontsov @ 2007-11-30 16:11 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: mike, linuxppc-dev

On Fri, Nov 30, 2007 at 04:28:27PM +0100, Laurent Pinchart wrote:
[...]
> > I tried to forward-port FHCI from Freescale 2.6.11 kernels. Twice.
> > But these efforts always stumbled over more important tasks.
> 
> Do you think I start from the FHCI driver provided by Freescale for 2.6.11, 
> from the cpm2usb driver or from scratch ?

Well, the same question I asked myself when I was looking at
FHCI driver back then. USB subsystem changed drastically, powerpc
bits changed too. Forward porting or doing from scratch.. hm.

Unfortunately I didn't look into cpm2usb, thus I can't tell
whether it will be easier to reuse.

As for FHCI driver, it's not that big (6100 lines host patch + 3516
lines usbgadget patch), but since usb subsystem changed: you have to
know all the changes (or to look them up) and blindly follow them. Or
start from scratch with FHCI/cpm2usb as the reference, thus evolve
into Linux USB expert one day.


I've tried first option -- it's boring to death (that is, you're
doing job USB maintainers done years ago for in-tree drivers ;-).

Today, I think I would choose the second option. Definitely more
fun, and most probably quicker to progress. Though, I repeat,
I didn't look into cpm2usb project.

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: CPM2 USB host driver
  2007-11-30 16:11         ` Anton Vorontsov
@ 2007-11-30 22:32           ` Arnd Bergmann
  2007-11-30 23:18             ` David Brownell
  0 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2007-11-30 22:32 UTC (permalink / raw)
  To: avorontsov; +Cc: dbrownell, linux-usb-devel, gregkh, linuxppc-dev, mike

(Cc:'ing linux-usb-devel)

On Friday 30 November 2007, Anton Vorontsov wrote:
> As for FHCI driver, it's not that big (6100 lines host patch + 3516
> lines usbgadget patch), but since usb subsystem changed: you have to
> know all the changes (or to look them up) and blindly follow them. Or
> start from scratch with FHCI/cpm2usb as the reference, thus evolve
> into Linux USB expert one day.

6100 lines means it's still the second-largest hcd driver in the kernel,
only drivers/usb/host/u132-hcd.c has even more.

> Today, I think I would choose the second option. Definitely more
> fun, and most probably quicker to progress. Though, I repeat,
> I didn't look into cpm2usb project.

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.
Maybe Greg or David can give you a suggestion which one of them
serves as the best example for a new host driver.

	Arnd <><

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: CPM2 USB host driver
  2007-11-30 22:32           ` Arnd Bergmann
@ 2007-11-30 23:18             ` David Brownell
  0 siblings, 0 replies; 11+ messages in thread
From: David Brownell @ 2007-11-30 23:18 UTC (permalink / raw)
  To: Arnd Bergmann, avorontsov; +Cc: linuxppc-dev, gregkh, linux-usb-devel, mike

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: CPM2 USB host driver
  2007-11-30 15:28       ` Laurent Pinchart
  2007-11-30 16:11         ` Anton Vorontsov
@ 2007-12-02  6:31         ` Mike Rapoport
  1 sibling, 0 replies; 11+ messages in thread
From: Mike Rapoport @ 2007-12-02  6:31 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linuxppc-dev

> 
>> I tried to forward-port FHCI from Freescale 2.6.11 kernels. Twice.
>> But these efforts always stumbled over more important tasks.
> 
> Do you think I start from the FHCI driver provided by Freescale for 2.6.11, 
> from the cpm2usb driver or from scratch ?

The cmp2usb is old and crappy, and I had no time at all to update it. So if the
choice was to start from cpm2usb or from scratch, I'd choose to start from scratch.

> Both the cpm2usb and FHCI drivers seem to use the packet-level interface. Is 
> there any reason not to use the transaction-level interface ?


> Best regards,
> 

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-12-02  7:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-30 10:45 CPM2 USB host driver Laurent Pinchart
2007-11-30 11:16 ` Vitaly Bordug
2007-11-30 12:30   ` Laurent Pinchart
2007-11-30 12:48     ` Anton Vorontsov
2007-11-30 13:00       ` Vitaly Bordug
2007-11-30 15:28       ` Laurent Pinchart
2007-11-30 16:11         ` Anton Vorontsov
2007-11-30 22:32           ` Arnd Bergmann
2007-11-30 23:18             ` David Brownell
2007-12-02  6:31         ` Mike Rapoport
2007-11-30 13:02     ` Vitaly Bordug

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).