usb: dwc3: ep0: be careful with endianness on SetSEL command
authorFelipe Balbi <balbi@ti.com>
Thu, 31 May 2012 08:00:28 +0000 (11:00 +0300)
committerFelipe Balbi <balbi@ti.com>
Sun, 3 Jun 2012 20:08:27 +0000 (23:08 +0300)
USB is always little endian, but this driver
could run on non little endian cpus. Let's
be carefull with that.

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/ep0.c

index 83fcf392dda7956ca2dc76e73bdf98e0be1e01f8..3185fe14591bbe652b933c82b4737ba27f869766 100644 (file)
@@ -515,8 +515,8 @@ static void dwc3_ep0_set_sel_cmpl(struct usb_ep *ep, struct usb_request *req)
 
        dwc->u1sel = timing.u1sel;
        dwc->u1pel = timing.u1pel;
-       dwc->u2sel = timing.u2sel;
-       dwc->u2pel = timing.u2pel;
+       dwc->u2sel = le16_to_cpu(timing.u2sel);
+       dwc->u2pel = le16_to_cpu(timing.u2pel);
 
        reg = dwc3_readl(dwc->regs, DWC3_DCTL);
        if (reg & DWC3_DCTL_INITU2ENA)