usb: gadget: mv_udc: add iso support
In order to support iso, we need do the following things: 1. fix length for one dtd 2. allow req contains multiple packets for a ISO transfer Signed-off-by: Chao Xie <chao.xie@marvell.com> Signed-off-by: Yu Xu <yuxu@marvell.com> Signed-off-by: Neil Zhang <zhangwm@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
583a7263c7
commit
60326ce377
@ -355,17 +355,24 @@ done:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct mv_dtd *build_dtd(struct mv_req *req, unsigned *length,
|
static struct mv_dtd *build_dtd(struct mv_req *req, unsigned *length,
|
||||||
dma_addr_t *dma, int *is_last)
|
dma_addr_t *dma, int *is_last)
|
||||||
{
|
{
|
||||||
u32 temp;
|
|
||||||
struct mv_dtd *dtd;
|
struct mv_dtd *dtd;
|
||||||
struct mv_udc *udc;
|
struct mv_udc *udc;
|
||||||
|
struct mv_dqh *dqh;
|
||||||
|
u32 temp, mult = 0;
|
||||||
|
|
||||||
/* how big will this transfer be? */
|
/* how big will this transfer be? */
|
||||||
*length = min(req->req.length - req->req.actual,
|
if (usb_endpoint_xfer_isoc(req->ep->ep.desc)) {
|
||||||
(unsigned)EP_MAX_LENGTH_TRANSFER);
|
dqh = req->ep->dqh;
|
||||||
|
mult = (dqh->max_packet_length >> EP_QUEUE_HEAD_MULT_POS)
|
||||||
|
& 0x3;
|
||||||
|
*length = min(req->req.length - req->req.actual,
|
||||||
|
(unsigned)(mult * req->ep->ep.maxpacket));
|
||||||
|
} else
|
||||||
|
*length = min(req->req.length - req->req.actual,
|
||||||
|
(unsigned)EP_MAX_LENGTH_TRANSFER);
|
||||||
|
|
||||||
udc = req->ep->udc;
|
udc = req->ep->udc;
|
||||||
|
|
||||||
@ -407,6 +414,8 @@ static struct mv_dtd *build_dtd(struct mv_req *req, unsigned *length,
|
|||||||
if (*is_last && !req->req.no_interrupt)
|
if (*is_last && !req->req.no_interrupt)
|
||||||
temp |= DTD_IOC;
|
temp |= DTD_IOC;
|
||||||
|
|
||||||
|
temp |= mult << 10;
|
||||||
|
|
||||||
dtd->size_ioc_sts = temp;
|
dtd->size_ioc_sts = temp;
|
||||||
|
|
||||||
mb();
|
mb();
|
||||||
@ -718,10 +727,6 @@ mv_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
|
|||||||
dev_err(&udc->dev->dev, "%s, bad ep", __func__);
|
dev_err(&udc->dev->dev, "%s, bad ep", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (ep->ep.desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
|
|
||||||
if (req->req.length > ep->ep.maxpacket)
|
|
||||||
return -EMSGSIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
udc = ep->udc;
|
udc = ep->udc;
|
||||||
if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN)
|
if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN)
|
||||||
|
Loading…
Reference in New Issue
Block a user