Re: [PATCH] USB: io_ti: fix firmware download on big-endian machines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 25, 2014 at 01:36:25PM +0000, David Laight wrote:
> From: Johan Hovold
> > During firmware download the device expects memory addresses in
> > big-endian byte order. As the wIndex parameter which hold the address is
> > sent in little-endian byte order regardless of host byte order, we need
> > to use swab16 rather than cpu_to_be16.
> 
> That doesn't sound correct.
> If the value needs to be little-endian, shouldn't you be using
> cpu_to_le16() ?

It needs to be *big-endian*, otherwise you got it right.

> If there is a second cpu_to_be16() being done later on then
> the code might be right, but the comments are misleading.

There's a second *cpu_to_le16* in usb_ctrl_msg which makes sure that the
wIndex parameter is sent little-endian.

So in order to transfer a big-endian address using wIndex, we must
use swab16 rather than cpu_to_be16 on the address (as the latter is a
noop on a big-endian system).

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux