[S390] appldata/extmem/kvm: add missing GFP_KERNEL flag
[safe/jmp/linux-2.6] / drivers / usb / musb / musb_gadget.c
index cbcf14a..6fca870 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/moduleparam.h>
 #include <linux/stat.h>
 #include <linux/dma-mapping.h>
+#include <linux/slab.h>
 
 #include "musb_core.h"
 
@@ -895,7 +896,14 @@ static int musb_gadget_enable(struct usb_ep *ep,
                /* REVISIT if can_bulk_split(), use by updating "tmp";
                 * likewise high bandwidth periodic tx
                 */
-               musb_writew(regs, MUSB_TXMAXP, tmp);
+               /* Set TXMAXP with the FIFO size of the endpoint
+                * to disable double buffering mode. Currently, It seems that double
+                * buffering has problem if musb RTL revision number < 2.0.
+                */
+               if (musb->hwvers < MUSB_HWVERS_2000)
+                       musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx);
+               else
+                       musb_writew(regs, MUSB_TXMAXP, tmp);
 
                csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG;
                if (musb_readw(regs, MUSB_TXCSR)
@@ -925,7 +933,13 @@ static int musb_gadget_enable(struct usb_ep *ep,
                /* REVISIT if can_bulk_combine() use by updating "tmp"
                 * likewise high bandwidth periodic rx
                 */
-               musb_writew(regs, MUSB_RXMAXP, tmp);
+               /* Set RXMAXP with the FIFO size of the endpoint
+                * to disable double buffering mode.
+                */
+               if (musb->hwvers < MUSB_HWVERS_2000)
+                       musb_writew(regs, MUSB_RXMAXP, hw_ep->max_packet_sz_rx);
+               else
+                       musb_writew(regs, MUSB_RXMAXP, tmp);
 
                /* force shared fifo to OUT-only mode */
                if (hw_ep->is_shared_fifo) {
@@ -1697,8 +1711,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
                return -EINVAL;
 
        /* driver must be initialized to support peripheral mode */
-       if (!musb || !(musb->board_mode == MUSB_OTG
-                               || musb->board_mode != MUSB_OTG)) {
+       if (!musb) {
                DBG(1, "%s, no dev??\n", __func__);
                return -ENODEV;
        }