Skip to content

Commit

Permalink
Merge tag 'fixes-for-v4.3-rc3' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/balbi/usb into usb-linus

Felipe writes:

usb: fixes for v4.3-rc3

Here's the second pull request for current -rc cycle.

A few fixes on dummy_hcd which have been around for
longer than they should be.

MUSB got a couple fixes, the most important of which
is a fix to DMA channel teardown on AM335x devices.

And DWC3 got a minor fix for when using RT-enabled
kernels.
  • Loading branch information
Greg Kroah-Hartman committed Sep 22, 2015
2 parents ea93465 + a66c275 commit 01f4fd2
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 30 deletions.
4 changes: 0 additions & 4 deletions drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -2665,8 +2665,6 @@ static irqreturn_t dwc3_interrupt(int irq, void *_dwc)
int i;
irqreturn_t ret = IRQ_NONE;

spin_lock(&dwc->lock);

for (i = 0; i < dwc->num_event_buffers; i++) {
irqreturn_t status;

Expand All @@ -2675,8 +2673,6 @@ static irqreturn_t dwc3_interrupt(int irq, void *_dwc)
ret = status;
}

spin_unlock(&dwc->lock);

return ret;
}

Expand Down
11 changes: 11 additions & 0 deletions drivers/usb/gadget/udc/atmel_usba_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2002,6 +2002,17 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
ep->udc = udc;
INIT_LIST_HEAD(&ep->queue);

if (ep->index == 0) {
ep->ep.caps.type_control = true;
} else {
ep->ep.caps.type_iso = ep->can_isoc;
ep->ep.caps.type_bulk = true;
ep->ep.caps.type_int = true;
}

ep->ep.caps.dir_in = true;
ep->ep.caps.dir_out = true;

if (i)
list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);

Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/gadget/udc/bdc/bdc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ static void bdc_mem_free(struct bdc *bdc)
bdc->scratchpad.buff, bdc->scratchpad.sp_dma);

/* Destroy the dma pools */
if (bdc->bd_table_pool)
dma_pool_destroy(bdc->bd_table_pool);
dma_pool_destroy(bdc->bd_table_pool);

/* Free the bdc_ep array */
kfree(bdc->bdc_ep_array);
Expand Down
46 changes: 30 additions & 16 deletions drivers/usb/gadget/udc/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,7 @@ static int transfer(struct dummy_hcd *dum_hcd, struct urb *urb,
{
struct dummy *dum = dum_hcd->dum;
struct dummy_request *req;
int sent = 0;

top:
/* if there's no request queued, the device is NAKing; return */
Expand Down Expand Up @@ -1385,12 +1386,15 @@ static int transfer(struct dummy_hcd *dum_hcd, struct urb *urb,
if (len == 0)
break;

/* use an extra pass for the final short packet */
if (len > ep->ep.maxpacket) {
rescan = 1;
len -= (len % ep->ep.maxpacket);
/* send multiple of maxpacket first, then remainder */
if (len >= ep->ep.maxpacket) {
is_short = 0;
if (len % ep->ep.maxpacket)
rescan = 1;
len -= len % ep->ep.maxpacket;
} else {
is_short = 1;
}
is_short = (len % ep->ep.maxpacket) != 0;

len = dummy_perform_transfer(urb, req, len);

Expand All @@ -1399,6 +1403,7 @@ static int transfer(struct dummy_hcd *dum_hcd, struct urb *urb,
req->req.status = len;
} else {
limit -= len;
sent += len;
urb->actual_length += len;
req->req.actual += len;
}
Expand All @@ -1421,23 +1426,32 @@ static int transfer(struct dummy_hcd *dum_hcd, struct urb *urb,
*status = -EOVERFLOW;
else
*status = 0;
} else if (!to_host) {
} else {
*status = 0;
if (host_len > dev_len)
req->req.status = -EOVERFLOW;
else
req->req.status = 0;
}

/* many requests terminate without a short packet */
/*
* many requests terminate without a short packet.
* send a zlp if demanded by flags.
*/
} else {
if (req->req.length == req->req.actual
&& !req->req.zero)
req->req.status = 0;
if (urb->transfer_buffer_length == urb->actual_length
&& !(urb->transfer_flags
& URB_ZERO_PACKET))
*status = 0;
if (req->req.length == req->req.actual) {
if (req->req.zero && to_host)
rescan = 1;
else
req->req.status = 0;
}
if (urb->transfer_buffer_length == urb->actual_length) {
if (urb->transfer_flags & URB_ZERO_PACKET &&
!to_host)
rescan = 1;
else
*status = 0;
}
}

/* device side completion --> continuable */
Expand All @@ -1460,7 +1474,7 @@ static int transfer(struct dummy_hcd *dum_hcd, struct urb *urb,
if (rescan)
goto top;
}
return limit;
return sent;
}

static int periodic_bytes(struct dummy *dum, struct dummy_ep *ep)
Expand Down Expand Up @@ -1890,7 +1904,7 @@ static void dummy_timer(unsigned long _dum_hcd)
default:
treat_control_like_bulk:
ep->last_io = jiffies;
total = transfer(dum_hcd, urb, ep, limit, &status);
total -= transfer(dum_hcd, urb, ep, limit, &status);
break;
}

Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/gadget/udc/gr_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2117,8 +2117,7 @@ static int gr_remove(struct platform_device *pdev)
return -EBUSY;

gr_dfs_delete(dev);
if (dev->desc_pool)
dma_pool_destroy(dev->desc_pool);
dma_pool_destroy(dev->desc_pool);
platform_set_drvdata(pdev, NULL);

gr_free_request(&dev->epi[0].ep, &dev->ep0reqi->req);
Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/gadget/udc/mv_u3d_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1767,8 +1767,7 @@ static int mv_u3d_remove(struct platform_device *dev)
usb_del_gadget_udc(&u3d->gadget);

/* free memory allocated in probe */
if (u3d->trb_pool)
dma_pool_destroy(u3d->trb_pool);
dma_pool_destroy(u3d->trb_pool);

if (u3d->ep_context)
dma_free_coherent(&dev->dev, u3d->ep_context_size,
Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/gadget/udc/mv_udc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2100,8 +2100,7 @@ static int mv_udc_remove(struct platform_device *pdev)
}

/* free memory allocated in probe */
if (udc->dtd_pool)
dma_pool_destroy(udc->dtd_pool);
dma_pool_destroy(udc->dtd_pool);

if (udc->ep_dqh)
dma_free_coherent(&pdev->dev, udc->ep_dqh_size,
Expand Down
3 changes: 3 additions & 0 deletions drivers/usb/musb/musb_cppi41.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,9 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel)
} else {
cppi41_set_autoreq_mode(cppi41_channel, EP_MODE_AUTOREQ_NONE);

/* delay to drain to cppi dma pipeline for isoch */
udelay(250);

csr = musb_readw(epio, MUSB_RXCSR);
csr &= ~(MUSB_RXCSR_H_REQPKT | MUSB_RXCSR_DMAENAB);
musb_writew(epio, MUSB_RXCSR, csr);
Expand Down
7 changes: 5 additions & 2 deletions drivers/usb/musb/musb_dsps.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,11 @@ static void dsps_musb_enable(struct musb *musb)

dsps_writel(reg_base, wrp->epintr_set, epmask);
dsps_writel(reg_base, wrp->coreintr_set, coremask);
/* start polling for ID change. */
mod_timer(&glue->timer, jiffies + msecs_to_jiffies(wrp->poll_timeout));
/* start polling for ID change in dual-role idle mode */
if (musb->xceiv->otg->state == OTG_STATE_B_IDLE &&
musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE)
mod_timer(&glue->timer, jiffies +
msecs_to_jiffies(wrp->poll_timeout));
dsps_musb_try_idle(musb, 0);
}

Expand Down
1 change: 1 addition & 0 deletions drivers/usb/phy/phy-isp1301.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ static const struct i2c_device_id isp1301_id[] = {
{ "isp1301", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, isp1301_id);

static struct i2c_client *isp1301_i2c_client;

Expand Down

0 comments on commit 01f4fd2

Please sign in to comment.