summaryrefslogtreecommitdiff
path: root/common/usb_storage.c
diff options
context:
space:
mode:
authorBen Warren <biggerbadderben@gmail.com>2008-06-02 22:55:42 -0700
committerBen Warren <biggerbadderben@gmail.com>2008-06-02 22:55:42 -0700
commitea183432e79fe01781abbda411968b33580a3497 (patch)
tree4ee68f7f9d4a13e248f88b113c7a7519f2026f70 /common/usb_storage.c
parentaa3b8bf9c30065bb2ea852799d32db5020598495 (diff)
parent1f1554841a4c8e069d331176f0c3059fb2bb8280 (diff)
downloadu-boot-imx-ea183432e79fe01781abbda411968b33580a3497.zip
u-boot-imx-ea183432e79fe01781abbda411968b33580a3497.tar.gz
u-boot-imx-ea183432e79fe01781abbda411968b33580a3497.tar.bz2
Merge branch 'master' of git://www.denx.de/git/u-boot
Diffstat (limited to 'common/usb_storage.c')
-rw-r--r--common/usb_storage.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 7c08f95..3e113b4 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -52,6 +52,7 @@
#include <common.h>
#include <command.h>
+#include <asm/byteorder.h>
#include <asm/processor.h>
@@ -474,9 +475,9 @@ int usb_stor_BBB_comdat(ccb *srb, struct us_data *us)
/* always OUT to the ep */
pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
- cbw.dCBWSignature = swap_32(CBWSIGNATURE);
- cbw.dCBWTag = swap_32(CBWTag++);
- cbw.dCBWDataTransferLength = swap_32(srb->datalen);
+ cbw.dCBWSignature = cpu_to_le32(CBWSIGNATURE);
+ cbw.dCBWTag = cpu_to_le32(CBWTag++);
+ cbw.dCBWDataTransferLength = cpu_to_le32(srb->datalen);
cbw.bCBWFlags = (dir_in? CBWFLAGS_IN : CBWFLAGS_OUT);
cbw.bCBWLUN = srb->lun;
cbw.bCDBLength = srb->cmdlen;
@@ -692,14 +693,14 @@ int usb_stor_BBB_transport(ccb *srb, struct us_data *us)
printf("\n");
#endif
/* misuse pipe to get the residue */
- pipe = swap_32(csw.dCSWDataResidue);
+ pipe = le32_to_cpu(csw.dCSWDataResidue);
if (pipe == 0 && srb->datalen != 0 && srb->datalen - data_actlen != 0)
pipe = srb->datalen - data_actlen;
- if (CSWSIGNATURE != swap_32(csw.dCSWSignature)) {
+ if (CSWSIGNATURE != le32_to_cpu(csw.dCSWSignature)) {
USB_STOR_PRINTF("!CSWSIGNATURE\n");
usb_stor_BBB_reset(us);
return USB_STOR_TRANSPORT_FAILED;
- } else if ((CBWTag - 1) != swap_32(csw.dCSWTag)) {
+ } else if ((CBWTag - 1) != le32_to_cpu(csw.dCSWTag)) {
USB_STOR_PRINTF("!Tag\n");
usb_stor_BBB_reset(us);
return USB_STOR_TRANSPORT_FAILED;
@@ -1222,18 +1223,9 @@ int usb_stor_get_info(struct usb_device *dev,struct us_data *ss,block_dev_desc_t
if(cap[0]>(0x200000 * 10)) /* greater than 10 GByte */
cap[0]>>=16;
#endif
-#ifdef LITTLEENDIAN
- cap[0] = ((unsigned long)(
- (((unsigned long)(cap[0]) & (unsigned long)0x000000ffUL) << 24) |
- (((unsigned long)(cap[0]) & (unsigned long)0x0000ff00UL) << 8) |
- (((unsigned long)(cap[0]) & (unsigned long)0x00ff0000UL) >> 8) |
- (((unsigned long)(cap[0]) & (unsigned long)0xff000000UL) >> 24) ));
- cap[1] = ((unsigned long)(
- (((unsigned long)(cap[1]) & (unsigned long)0x000000ffUL) << 24) |
- (((unsigned long)(cap[1]) & (unsigned long)0x0000ff00UL) << 8) |
- (((unsigned long)(cap[1]) & (unsigned long)0x00ff0000UL) >> 8) |
- (((unsigned long)(cap[1]) & (unsigned long)0xff000000UL) >> 24) ));
-#endif
+ cap[0] = cpu_to_be32(cap[0]);
+ cap[1] = cpu_to_be32(cap[1]);
+
/* this assumes bigendian! */
cap[0] += 1;
capacity = &cap[0];