Skip to contentSkip to conversation

Setting processor endianess for USB modules

PATCH New Christian Eggers 2 participants 2 messages May 5, 2008 – May 8, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Setting processor endianess for USB modules

Dear Markus,

Quoted 8 lines

Dear Christian,

Quoted 4 lines · Christian Eggers

I've recognized that a lot of USB code in U-Boot uses the macros swap_16() and swap_32() which are defined in usb.h. The behaviour of the macros is controlled by the define LITTLEENDIAN.

Quoted 8 lines
Quoted 2 lines

Is there a good reason NOT to use the macros provided in asm/byteorder.h (as in the appropriate code in Linux-2.4 )?

Largely not. But be carefull. Besides big and little endian CPUs we also have controllers that operate in big or little endian (see CFG_OHCI_BE_CONTROLLER), and then there are PCI controllers whose registers need to be accessed as little endian (CFG_OHCI_SWAP_REG_ACCESS).

I didn't change much in usb_ohci.c. But I think there has been a small error with byteorder conversion (see patch).

Quoted 11 lines

But your right, there is no real for LITTLEENDIAN.

Quoted 4 lines

I think that switching to these functions might be useful in order to eliminate the need to use the LITTLEENDIAN define for specifying the byteorder. It seems that LITTLEENDIAN is not used outside the USB code.

Right. Patches cleaning this up are more than welcome! Please note that cleaning up USB drivers under the cpu/ directory is a waste of time though. Boards using these drivers should be converted to use the generic infrastructure in drivers/usb/ instead.

The main focus of my patch is on common/usb.c, common/usb_kbd.c and common/usb_storage.c. Unfortunately I couldn't test my changes in usb_kbd.c because I don't have such a device.

Removing the LITTLEENDIAN define seems not to be as easy as I thought first. A bunch of other modules use the swap_16() and swap_32() defines from usb.h so I wasn't able to remove these for now.

regards
Christian Eggers

Signature · 15 lines
Registergericht / Register court: Amtsgericht Traunstein, HRA 460 / local court Traunstein, certificate of registration no. 460 
Gesch?ftsf?hrender pers?nlich haftender Gesellschafter / Personally liable managing partner: Prof. Dr. Dr. h.c. Anton Kathrein, Dipl.-Betriebswirt (MBA-equivalent) 
Erf?llungsort und Gerichtsstand / Place of performance and place of jurisdiction: Rosenheim 

This e-mail is confidential and may contain privileged information. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20080505/6c6b4a47/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: usb-patch
Type: application/octet-stream
Size: 10698 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080505/6c6b4a47/attachment.obj 
#1 lore raw

PATCH 1/1 Setting processor endianess for USB modules

Dear Christian,

Thank you for your contribution. Unfortunately I have problems applying your patch against a top of git tree:

[mk at pollux u-boot-mainline]$ patch -p5 --dry-run < ~/2008-05-05-usb-remove-LITTLE_ENDIAN-define missing header for unified diff at line 4 of patch
patching file common/usb.c
missing header for unified diff at line 130 of patch
patching file common/usb_kbd.c
missing header for unified diff at line 177 of patch
patching file common/usb_storage.c
Hunk #2 succeeded at 475 (offset 3 lines).
Hunk #4 succeeded at 1223 (offset 3 lines).
missing header for unified diff at line 241 of patch
patching file drivers/usb/usb_ohci.c
Reversed (or previously applied) patch detected! Assume -R? [n]

I would suggest you use git for generating and sending patches.

Also please make sure to read the guidelines for submitting patches in the README. Especially:

- provide a changelog entry for the logs
- send patches inline
- if you don't use git for generating patches,@least run diff from the parent directory of U-Boot
- don't send html mails, the makes it impossible to use git-am

Quoted 7 lines

Registergericht / Register court: Amtsgericht Traunstein, HRA 460 / local court Traunstein, certificate of registration no. 460 Gesch?ftsf?hrender pers?nlich haftender Gesellschafter / Personally liable managing partner: Prof. Dr. Dr. h.c. Anton Kathrein, Dipl.-Betriebswirt (MBA-equivalent)
Erf?llungsort und Gerichtsstand / Place of performance and place of
jurisdiction: Rosenheim

Quoted 8 lines

This e-mail is confidential and may contain privileged information. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking.

And if you can, please avoid sending this to public mailings lists.

Please cleanup and resubmit.

Thanks!

Best regards

Markus Klotzbuecher

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de