]> Pileus Git - ~andy/linux/blobdiff - drivers/usb/gadget/fsl_udc_core.c
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[~andy/linux] / drivers / usb / gadget / fsl_udc_core.c
index b04712f19f1efa613261c2216b08b31958ec4973..5f94e79cd6b9b3f8856dad2d97d1e74677f62bad 100644 (file)
@@ -43,7 +43,6 @@
 
 #include <asm/byteorder.h>
 #include <asm/io.h>
-#include <asm/system.h>
 #include <asm/unaligned.h>
 #include <asm/dma.h>
 
@@ -659,6 +658,7 @@ static int fsl_ep_disable(struct usb_ep *_ep)
        nuke(ep, -ESHUTDOWN);
 
        ep->desc = NULL;
+       ep->ep.desc = NULL;
        ep->stopped = 1;
        spin_unlock_irqrestore(&udc->lock, flags);
 
@@ -768,7 +768,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
  * @is_last: return flag if it is the last dTD of the request
  * return: pointer to the built dTD */
 static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length,
-               dma_addr_t *dma, int *is_last)
+               dma_addr_t *dma, int *is_last, gfp_t gfp_flags)
 {
        u32 swap_temp;
        struct ep_td_struct *dtd;
@@ -777,7 +777,7 @@ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length,
        *length = min(req->req.length - req->req.actual,
                        (unsigned)EP_MAX_LENGTH_TRANSFER);
 
-       dtd = dma_pool_alloc(udc_controller->td_pool, GFP_KERNEL, dma);
+       dtd = dma_pool_alloc(udc_controller->td_pool, gfp_flags, dma);
        if (dtd == NULL)
                return dtd;
 
@@ -827,7 +827,7 @@ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length,
 }
 
 /* Generate dtd chain for a request */
-static int fsl_req_to_dtd(struct fsl_req *req)
+static int fsl_req_to_dtd(struct fsl_req *req, gfp_t gfp_flags)
 {
        unsigned        count;
        int             is_last;
@@ -836,7 +836,7 @@ static int fsl_req_to_dtd(struct fsl_req *req)
        dma_addr_t dma;
 
        do {
-               dtd = fsl_build_dtd(req, &count, &dma, &is_last);
+               dtd = fsl_build_dtd(req, &count, &dma, &is_last, gfp_flags);
                if (dtd == NULL)
                        return -ENOMEM;
 
@@ -910,13 +910,11 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
        req->req.actual = 0;
        req->dtd_count = 0;
 
-       spin_lock_irqsave(&udc->lock, flags);
-
        /* build dtds and push them to device queue */
-       if (!fsl_req_to_dtd(req)) {
+       if (!fsl_req_to_dtd(req, gfp_flags)) {
+               spin_lock_irqsave(&udc->lock, flags);
                fsl_queue_td(ep, req);
        } else {
-               spin_unlock_irqrestore(&udc->lock, flags);
                return -ENOMEM;
        }
 
@@ -1217,7 +1215,7 @@ static int fsl_vbus_draw(struct usb_gadget *gadget, unsigned mA)
 
        udc = container_of(gadget, struct fsl_udc, gadget);
        if (udc->transceiver)
-               return otg_set_power(udc->transceiver, mA);
+               return usb_phy_set_power(udc->transceiver, mA);
        return -ENOTSUPP;
 }
 
@@ -1295,7 +1293,7 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
                        ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
        req->mapped = 1;
 
-       if (fsl_req_to_dtd(req) == 0)
+       if (fsl_req_to_dtd(req, GFP_ATOMIC) == 0)
                fsl_queue_td(ep, req);
        else
                return -ENOMEM;
@@ -1379,7 +1377,7 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
        req->mapped = 1;
 
        /* prime the data phase */
-       if ((fsl_req_to_dtd(req) == 0))
+       if ((fsl_req_to_dtd(req, GFP_ATOMIC) == 0))
                fsl_queue_td(ep, req);
        else                    /* no mem */
                goto stall;
@@ -1966,7 +1964,8 @@ static int fsl_start(struct usb_gadget_driver *driver,
 
                /* connect to bus through transceiver */
                if (udc_controller->transceiver) {
-                       retval = otg_set_peripheral(udc_controller->transceiver,
+                       retval = otg_set_peripheral(
+                                       udc_controller->transceiver->otg,
                                                    &udc_controller->gadget);
                        if (retval < 0) {
                                ERR("can't bind to transceiver\n");
@@ -2006,7 +2005,7 @@ static int fsl_stop(struct usb_gadget_driver *driver)
                return -EINVAL;
 
        if (udc_controller->transceiver)
-               otg_set_peripheral(udc_controller->transceiver, NULL);
+               otg_set_peripheral(udc_controller->transceiver->otg, NULL);
 
        /* stop DR, disable intr */
        dr_controller_stop(udc_controller);
@@ -2430,7 +2429,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
 
 #ifdef CONFIG_USB_OTG
        if (pdata->operating_mode == FSL_USB2_DR_OTG) {
-               udc_controller->transceiver = otg_get_transceiver();
+               udc_controller->transceiver = usb_get_transceiver();
                if (!udc_controller->transceiver) {
                        ERR("Can't find OTG driver!\n");
                        ret = -ENODEV;