Skip to contentSkip to conversation

CPM2 USB host driver

DISCUSSION Laurent Pinchart 6 participants 11 messages Nov 30, 2007 – Dec 2, 2007

lore
Share & tools
lore
#0 lore raw

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,

Signature · 9 lines
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
#1 lore raw
Quoted 7 lines · 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.

Quoted 12 lines

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.

Quoted 3 lines

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...

Quoted 2 lines

Best regards,

Signature · 1 line
Sincerely, Vitaly
#2 lore raw
Quoted 5 lines · Vitaly Bordug

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

Quoted 2 lines · Laurent Pinchart

Hi everybody,

Quoted 7 lines
Quoted 4 lines

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.

Quoted 12 lines
Quoted 12 lines

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.

Quoted 4 lines
Quoted 2 lines

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,

Signature · 9 lines
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
#3 lore raw
Quoted 11 lines · Laurent Pinchart
Quoted 10 lines · Vitaly Bordug

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

Quoted 6 lines · Laurent Pinchart

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.

Quoted 6 lines
Quoted 2 lines

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.

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
#4 lore raw
Quoted 14 lines · On Fri, 30 Nov 2007 15:48:01 +0300 Anton Vorontsov wrote:
Quoted 13 lines · Laurent Pinchart
Quoted 12 lines · Vitaly Bordug

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

Quoted 6 lines · Laurent Pinchart

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.

Quoted 8 lines
Quoted 4 lines

=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.

Quoted 3 lines

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

#10 lore raw
In reply to Laurent Pinchart
Quoted 37 lines · On Fri, 30 Nov 2007 13:30:18 +0100 Laurent Pinchart wrote:
Quoted 5 lines · Vitaly Bordug

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

Quoted 2 lines · Laurent Pinchart

Hi everybody,

Quoted 7 lines
Quoted 4 lines

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.

Quoted 12 lines
Quoted 12 lines

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.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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.

Signature · 1 line
Sincerely, Vitaly
#5 lore raw
In reply to Anton Vorontsov
Quoted 15 lines · Anton Vorontsov
Quoted 14 lines · Laurent Pinchart
Quoted 12 lines · Vitaly Bordug

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

Quoted 6 lines · Laurent Pinchart

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.

Quoted 6 lines
Quoted 3 lines

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.

Quoted 2 lines

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,

Signature · 9 lines
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
#6 lore raw

On Fri, Nov 30, 2007 at 04:28:27PM +0100, Laurent Pinchart wrote:
[...]

Quoted 5 lines
Quoted 2 lines

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.

Signature · 4 lines
Anton Vorontsov
email: [email protected]
backup email: [email protected]
irc://irc.freenode.net/bd2
#7 lore raw

(Cc:'ing linux-usb-devel)

Quoted 5 lines · Anton Vorontsov

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.

Quoted 3 lines

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 <><
#8 lore raw
Quoted 2 lines · Arnd Bergmann

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. ;)

Quoted 3 lines

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.

Quoted 2 lines

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

#9 lore raw
In reply to Laurent Pinchart
Quoted 6 lines
Quoted 3 lines

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.

Quoted 6 lines

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,

Signature · 2 lines
Sincerely yours,
Mike.