These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / usb / gadget / udc / bdc / bdc_ep.c
index b04980c..d619950 100644 (file)
@@ -159,8 +159,10 @@ static int ep_bd_list_alloc(struct bdc_ep *ep)
                bd_table->start_bd = dma_pool_alloc(bdc->bd_table_pool,
                                                        GFP_ATOMIC,
                                                        &dma);
-               if (!bd_table->start_bd)
+               if (!bd_table->start_bd) {
+                       kfree(bd_table);
                        goto fail;
+               }
 
                bd_table->dma = dma;
 
@@ -779,7 +781,7 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req)
        /* The current hw dequeue pointer */
        tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(0));
        deq_ptr_64 = tmp_32;
-       tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(1));
+       tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS1(0));
        deq_ptr_64 |= ((u64)tmp_32 << 32);
 
        /* we have the dma addr of next bd that will be fetched by hardware */
@@ -1952,12 +1954,18 @@ static int init_ep(struct bdc *bdc, u32 epnum, u32 dir)
        ep->bdc = bdc;
        ep->dir = dir;
 
+       if (dir)
+               ep->usb_ep.caps.dir_in = true;
+       else
+               ep->usb_ep.caps.dir_out = true;
+
        /* ep->ep_num is the index inside bdc_ep */
        if (epnum == 1) {
                ep->ep_num = 1;
                bdc->bdc_ep_array[ep->ep_num] = ep;
                snprintf(ep->name, sizeof(ep->name), "ep%d", epnum - 1);
                usb_ep_set_maxpacket_limit(&ep->usb_ep, EP0_MAX_PKT_SIZE);
+               ep->usb_ep.caps.type_control = true;
                ep->comp_desc = NULL;
                bdc->gadget.ep0 = &ep->usb_ep;
        } else {
@@ -1971,6 +1979,9 @@ static int init_ep(struct bdc *bdc, u32 epnum, u32 dir)
                         dir & 1 ? "in" : "out");
 
                usb_ep_set_maxpacket_limit(&ep->usb_ep, 1024);
+               ep->usb_ep.caps.type_iso = true;
+               ep->usb_ep.caps.type_bulk = true;
+               ep->usb_ep.caps.type_int = true;
                ep->usb_ep.max_streams = 0;
                list_add_tail(&ep->usb_ep.ep_list, &bdc->gadget.ep_list);
        }