|
@@ -70,7 +70,7 @@ MODULE_LICENSE("GPL");
|
|
* seem to behave quite as expected. Used by default.
|
|
* seem to behave quite as expected. Used by default.
|
|
*
|
|
*
|
|
* OUT dma documents design problems handling the common "short packet"
|
|
* OUT dma documents design problems handling the common "short packet"
|
|
- * transfer termination policy; it couldn't enabled by default, even
|
|
|
|
|
|
+ * transfer termination policy; it couldn't be enabled by default, even
|
|
* if the OUT-dma abort problems had a resolution.
|
|
* if the OUT-dma abort problems had a resolution.
|
|
*/
|
|
*/
|
|
static unsigned use_dma = 1;
|
|
static unsigned use_dma = 1;
|
|
@@ -313,7 +313,7 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req)
|
|
#if defined(CONFIG_X86)
|
|
#if defined(CONFIG_X86)
|
|
#define USE_KMALLOC
|
|
#define USE_KMALLOC
|
|
|
|
|
|
-#elif defined(CONFIG_MIPS) && !defined(CONFIG_NONCOHERENT_IO)
|
|
|
|
|
|
+#elif defined(CONFIG_MIPS) && !defined(CONFIG_DMA_NONCOHERENT)
|
|
#define USE_KMALLOC
|
|
#define USE_KMALLOC
|
|
|
|
|
|
#elif defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
|
|
#elif defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
|
|
@@ -1524,9 +1524,12 @@ static void ep0_setup(struct goku_udc *dev)
|
|
/* read SETUP packet and enter DATA stage */
|
|
/* read SETUP packet and enter DATA stage */
|
|
ctrl.bRequestType = readl(®s->bRequestType);
|
|
ctrl.bRequestType = readl(®s->bRequestType);
|
|
ctrl.bRequest = readl(®s->bRequest);
|
|
ctrl.bRequest = readl(®s->bRequest);
|
|
- ctrl.wValue = (readl(®s->wValueH) << 8) | readl(®s->wValueL);
|
|
|
|
- ctrl.wIndex = (readl(®s->wIndexH) << 8) | readl(®s->wIndexL);
|
|
|
|
- ctrl.wLength = (readl(®s->wLengthH) << 8) | readl(®s->wLengthL);
|
|
|
|
|
|
+ ctrl.wValue = cpu_to_le16((readl(®s->wValueH) << 8)
|
|
|
|
+ | readl(®s->wValueL));
|
|
|
|
+ ctrl.wIndex = cpu_to_le16((readl(®s->wIndexH) << 8)
|
|
|
|
+ | readl(®s->wIndexL));
|
|
|
|
+ ctrl.wLength = cpu_to_le16((readl(®s->wLengthH) << 8)
|
|
|
|
+ | readl(®s->wLengthL));
|
|
writel(0, ®s->SetupRecv);
|
|
writel(0, ®s->SetupRecv);
|
|
|
|
|
|
nuke(&dev->ep[0], 0);
|
|
nuke(&dev->ep[0], 0);
|
|
@@ -1548,18 +1551,20 @@ static void ep0_setup(struct goku_udc *dev)
|
|
case USB_REQ_CLEAR_FEATURE:
|
|
case USB_REQ_CLEAR_FEATURE:
|
|
switch (ctrl.bRequestType) {
|
|
switch (ctrl.bRequestType) {
|
|
case USB_RECIP_ENDPOINT:
|
|
case USB_RECIP_ENDPOINT:
|
|
- tmp = ctrl.wIndex & 0x0f;
|
|
|
|
|
|
+ tmp = le16_to_cpu(ctrl.wIndex) & 0x0f;
|
|
/* active endpoint */
|
|
/* active endpoint */
|
|
if (tmp > 3 || (!dev->ep[tmp].desc && tmp != 0))
|
|
if (tmp > 3 || (!dev->ep[tmp].desc && tmp != 0))
|
|
goto stall;
|
|
goto stall;
|
|
- if (ctrl.wIndex & USB_DIR_IN) {
|
|
|
|
|
|
+ if (ctrl.wIndex & __constant_cpu_to_le16(
|
|
|
|
+ USB_DIR_IN)) {
|
|
if (!dev->ep[tmp].is_in)
|
|
if (!dev->ep[tmp].is_in)
|
|
goto stall;
|
|
goto stall;
|
|
} else {
|
|
} else {
|
|
if (dev->ep[tmp].is_in)
|
|
if (dev->ep[tmp].is_in)
|
|
goto stall;
|
|
goto stall;
|
|
}
|
|
}
|
|
- if (ctrl.wValue != USB_ENDPOINT_HALT)
|
|
|
|
|
|
+ if (ctrl.wValue != __constant_cpu_to_le16(
|
|
|
|
+ USB_ENDPOINT_HALT))
|
|
goto stall;
|
|
goto stall;
|
|
if (tmp)
|
|
if (tmp)
|
|
goku_clear_halt(&dev->ep[tmp]);
|
|
goku_clear_halt(&dev->ep[tmp]);
|
|
@@ -1571,7 +1576,7 @@ succeed:
|
|
return;
|
|
return;
|
|
case USB_RECIP_DEVICE:
|
|
case USB_RECIP_DEVICE:
|
|
/* device remote wakeup: always clear */
|
|
/* device remote wakeup: always clear */
|
|
- if (ctrl.wValue != 1)
|
|
|
|
|
|
+ if (ctrl.wValue != __constant_cpu_to_le16(1))
|
|
goto stall;
|
|
goto stall;
|
|
VDBG(dev, "clear dev remote wakeup\n");
|
|
VDBG(dev, "clear dev remote wakeup\n");
|
|
goto succeed;
|
|
goto succeed;
|
|
@@ -1589,14 +1594,15 @@ succeed:
|
|
#ifdef USB_TRACE
|
|
#ifdef USB_TRACE
|
|
VDBG(dev, "SETUP %02x.%02x v%04x i%04x l%04x\n",
|
|
VDBG(dev, "SETUP %02x.%02x v%04x i%04x l%04x\n",
|
|
ctrl.bRequestType, ctrl.bRequest,
|
|
ctrl.bRequestType, ctrl.bRequest,
|
|
- ctrl.wValue, ctrl.wIndex, ctrl.wLength);
|
|
|
|
|
|
+ le16_to_cpu(ctrl.wValue), le16_to_cpu(ctrl.wIndex),
|
|
|
|
+ le16_to_cpu(ctrl.wLength));
|
|
#endif
|
|
#endif
|
|
|
|
|
|
/* hw wants to know when we're configured (or not) */
|
|
/* hw wants to know when we're configured (or not) */
|
|
dev->req_config = (ctrl.bRequest == USB_REQ_SET_CONFIGURATION
|
|
dev->req_config = (ctrl.bRequest == USB_REQ_SET_CONFIGURATION
|
|
&& ctrl.bRequestType == USB_RECIP_DEVICE);
|
|
&& ctrl.bRequestType == USB_RECIP_DEVICE);
|
|
if (unlikely(dev->req_config))
|
|
if (unlikely(dev->req_config))
|
|
- dev->configured = (ctrl.wValue != 0);
|
|
|
|
|
|
+ dev->configured = (ctrl.wValue != __constant_cpu_to_le16(0));
|
|
|
|
|
|
/* delegate everything to the gadget driver.
|
|
/* delegate everything to the gadget driver.
|
|
* it may respond after this irq handler returns.
|
|
* it may respond after this irq handler returns.
|