From: David Brownell <[EMAIL PROTECTED]> To: fengwei yin <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [linux-usb-devel] get hub port status on big endian board Date: Thu, 13 May 2004 13:27:19 -0700
What data does that swap though? OHCI should be reading and writing all its data in little endian format; and its registers, accessed through PCI BAR 0 by word reads, will always appear in host byte order.
The controller register description is "dma transmit/receive ending control".
So I think it just swap data transmitted/received by dma between ohci and usb devices.
There is no more info about this ohci controller.
Yes,ohci controller register is big endian.
That's a fine question.
I think so either now.
Do you know for a fact that the controller
is only writing the fields (in TD and ED) that the OHCI spec says
it's allowed to write?
No,I don't know.I am a newbie of linux-usb.
And that DMA into those structures is cache-coherent? It might need to use uncached memory ...
It used function pci_alloc_consistent to alloc DMA memory.
I think it is cache-coherent.The memory is get by __get_free_pages in function pci_alloc_consistent.How can I modify it to use uncached?
IMHO,this question maybe have nothing with cache because when I enable ohci controller endian swapping,everything is ok(I can use usb devices directly connect to 2-port hub).
A 2.4.17 kernel IS quite old.
Yes,It is.
I will give it a look.You might even just try grabbing the usb-ohci code from 2.4.27-pre ... it's had bugfixes since then, though none that I think should affect that. There's a backport of the ohci-hcd driver available too, but it won't run on anything that old.
Thank for noticing my quesiton.I give specification of my problem.
In our kernel,
1.enable ohci endian swapping. 2.And hub.h was changed
diff -rNu usb/hub.h usbok/hub.h --- usb/hub.h 2004-05-13 14:06:17.000000000 +0800 +++ usbok/hub.h 2004-05-13 14:01:20.000000000 +0800 @@ -42,8 +42,8 @@ * See USB 2.0 spec Table 11-19 and Table 11-20 */ struct usb_port_status { + __u16 wPortChange; __u16 wPortStatus; - __u16 wPortChange; } __attribute__ ((packed));
/* @@ -85,8 +85,8 @@
#define HUB_CHAR_PORTIND 0x0080 /* D7 */
struct usb_hub_status { - __u16 wHubStatus; __u16 wHubChange; + __u16 wHubStatus; } __attribute__ ((packed));
Just change word byte of hub_status & port_status.because such swap was performed by ohci controller.
3.The status of port used be16_to_cpu func.because such swap was performed by ohci controller either.
- le16_to_cpus(&hubstatus.wHubStatus);
+ be16_to_cpus(&hubstatus.wHubStatus);
There are main difference between my kernel & standard kernel of usb code.
The usb devices connectted directly to 2-port hub all ok.If I use external
4-port hub,external hub can be found correctly.But usb devices connectted
to 4-port hub cann't be found because read wrong port status of 4-port hub
.I am confused why port status of 2-port hub can be read correctly & port status of external 4-port hub CANN'T be read correctly(they used the same function usb_control_msg to get status in hub.c).
Doesn't anyone use external hub on big endian arch successfully?
Best regards yfw
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel