aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/goku_udc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/goku_udc.c')
-rw-r--r--drivers/usb/gadget/goku_udc.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index 005db7cca292..ed773a9111de 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -70,7 +70,7 @@ MODULE_LICENSE("GPL");
70 * seem to behave quite as expected. Used by default. 70 * seem to behave quite as expected. Used by default.
71 * 71 *
72 * OUT dma documents design problems handling the common "short packet" 72 * OUT dma documents design problems handling the common "short packet"
73 * transfer termination policy; it couldn't enabled by default, even 73 * transfer termination policy; it couldn't be enabled by default, even
74 * if the OUT-dma abort problems had a resolution. 74 * if the OUT-dma abort problems had a resolution.
75 */ 75 */
76static unsigned use_dma = 1; 76static unsigned use_dma = 1;
@@ -313,7 +313,7 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req)
313#if defined(CONFIG_X86) 313#if defined(CONFIG_X86)
314#define USE_KMALLOC 314#define USE_KMALLOC
315 315
316#elif defined(CONFIG_MIPS) && !defined(CONFIG_NONCOHERENT_IO) 316#elif defined(CONFIG_MIPS) && !defined(CONFIG_DMA_NONCOHERENT)
317#define USE_KMALLOC 317#define USE_KMALLOC
318 318
319#elif defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) 319#elif defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
@@ -1524,9 +1524,12 @@ static void ep0_setup(struct goku_udc *dev)
1524 /* read SETUP packet and enter DATA stage */ 1524 /* read SETUP packet and enter DATA stage */
1525 ctrl.bRequestType = readl(&regs->bRequestType); 1525 ctrl.bRequestType = readl(&regs->bRequestType);
1526 ctrl.bRequest = readl(&regs->bRequest); 1526 ctrl.bRequest = readl(&regs->bRequest);
1527 ctrl.wValue = (readl(&regs->wValueH) << 8) | readl(&regs->wValueL); 1527 ctrl.wValue = cpu_to_le16((readl(&regs->wValueH) << 8)
1528 ctrl.wIndex = (readl(&regs->wIndexH) << 8) | readl(&regs->wIndexL); 1528 | readl(&regs->wValueL));
1529 ctrl.wLength = (readl(&regs->wLengthH) << 8) | readl(&regs->wLengthL); 1529 ctrl.wIndex = cpu_to_le16((readl(&regs->wIndexH) << 8)
1530 | readl(&regs->wIndexL));
1531 ctrl.wLength = cpu_to_le16((readl(&regs->wLengthH) << 8)
1532 | readl(&regs->wLengthL));
1530 writel(0, &regs->SetupRecv); 1533 writel(0, &regs->SetupRecv);
1531 1534
1532 nuke(&dev->ep[0], 0); 1535 nuke(&dev->ep[0], 0);
@@ -1548,18 +1551,20 @@ static void ep0_setup(struct goku_udc *dev)
1548 case USB_REQ_CLEAR_FEATURE: 1551 case USB_REQ_CLEAR_FEATURE:
1549 switch (ctrl.bRequestType) { 1552 switch (ctrl.bRequestType) {
1550 case USB_RECIP_ENDPOINT: 1553 case USB_RECIP_ENDPOINT:
1551 tmp = ctrl.wIndex & 0x0f; 1554 tmp = le16_to_cpu(ctrl.wIndex) & 0x0f;
1552 /* active endpoint */ 1555 /* active endpoint */
1553 if (tmp > 3 || (!dev->ep[tmp].desc && tmp != 0)) 1556 if (tmp > 3 || (!dev->ep[tmp].desc && tmp != 0))
1554 goto stall; 1557 goto stall;
1555 if (ctrl.wIndex & USB_DIR_IN) { 1558 if (ctrl.wIndex & __constant_cpu_to_le16(
1559 USB_DIR_IN)) {
1556 if (!dev->ep[tmp].is_in) 1560 if (!dev->ep[tmp].is_in)
1557 goto stall; 1561 goto stall;
1558 } else { 1562 } else {
1559 if (dev->ep[tmp].is_in) 1563 if (dev->ep[tmp].is_in)
1560 goto stall; 1564 goto stall;
1561 } 1565 }
1562 if (ctrl.wValue != USB_ENDPOINT_HALT) 1566 if (ctrl.wValue != __constant_cpu_to_le16(
1567 USB_ENDPOINT_HALT))
1563 goto stall; 1568 goto stall;
1564 if (tmp) 1569 if (tmp)
1565 goku_clear_halt(&dev->ep[tmp]); 1570 goku_clear_halt(&dev->ep[tmp]);
@@ -1571,7 +1576,7 @@ succeed:
1571 return; 1576 return;
1572 case USB_RECIP_DEVICE: 1577 case USB_RECIP_DEVICE:
1573 /* device remote wakeup: always clear */ 1578 /* device remote wakeup: always clear */
1574 if (ctrl.wValue != 1) 1579 if (ctrl.wValue != __constant_cpu_to_le16(1))
1575 goto stall; 1580 goto stall;
1576 VDBG(dev, "clear dev remote wakeup\n"); 1581 VDBG(dev, "clear dev remote wakeup\n");
1577 goto succeed; 1582 goto succeed;
@@ -1589,14 +1594,15 @@ succeed:
1589#ifdef USB_TRACE 1594#ifdef USB_TRACE
1590 VDBG(dev, "SETUP %02x.%02x v%04x i%04x l%04x\n", 1595 VDBG(dev, "SETUP %02x.%02x v%04x i%04x l%04x\n",
1591 ctrl.bRequestType, ctrl.bRequest, 1596 ctrl.bRequestType, ctrl.bRequest,
1592 ctrl.wValue, ctrl.wIndex, ctrl.wLength); 1597 le16_to_cpu(ctrl.wValue), le16_to_cpu(ctrl.wIndex),
1598 le16_to_cpu(ctrl.wLength));
1593#endif 1599#endif
1594 1600
1595 /* hw wants to know when we're configured (or not) */ 1601 /* hw wants to know when we're configured (or not) */
1596 dev->req_config = (ctrl.bRequest == USB_REQ_SET_CONFIGURATION 1602 dev->req_config = (ctrl.bRequest == USB_REQ_SET_CONFIGURATION
1597 && ctrl.bRequestType == USB_RECIP_DEVICE); 1603 && ctrl.bRequestType == USB_RECIP_DEVICE);
1598 if (unlikely(dev->req_config)) 1604 if (unlikely(dev->req_config))
1599 dev->configured = (ctrl.wValue != 0); 1605 dev->configured = (ctrl.wValue != __constant_cpu_to_le16(0));
1600 1606
1601 /* delegate everything to the gadget driver. 1607 /* delegate everything to the gadget driver.
1602 * it may respond after this irq handler returns. 1608 * it may respond after this irq handler returns.