Commit 16e78db7 authored by Ido Shayevitz's avatar Ido Shayevitz Committed by Felipe Balbi

usb: dwc3: Update dwc3 udc to use usb_endpoint_descriptor inside the struct usb_ep

Remove redundant pointer to struct usb_endpoint_descriptor.
Signed-off-by: default avatarIdo Shayevitz <idos@codeaurora.org>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 31fb6014
...@@ -361,7 +361,6 @@ struct dwc3_ep { ...@@ -361,7 +361,6 @@ struct dwc3_ep {
dma_addr_t trb_pool_dma; dma_addr_t trb_pool_dma;
u32 free_slot; u32 free_slot;
u32 busy_slot; u32 busy_slot;
const struct usb_endpoint_descriptor *desc;
const struct usb_ss_ep_comp_descriptor *comp_desc; const struct usb_ss_ep_comp_descriptor *comp_desc;
struct dwc3 *dwc; struct dwc3 *dwc;
......
...@@ -179,7 +179,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, ...@@ -179,7 +179,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
int ret; int ret;
spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags);
if (!dep->desc) { if (!dep->endpoint.desc) {
dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n", dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n",
request, dep->name); request, dep->name);
ret = -ESHUTDOWN; ret = -ESHUTDOWN;
......
...@@ -178,8 +178,8 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc) ...@@ -178,8 +178,8 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc)
if (!(dep->flags & DWC3_EP_ENABLED)) if (!(dep->flags & DWC3_EP_ENABLED))
continue; continue;
if (usb_endpoint_xfer_bulk(dep->desc) if (usb_endpoint_xfer_bulk(dep->endpoint.desc)
|| usb_endpoint_xfer_isoc(dep->desc)) || usb_endpoint_xfer_isoc(dep->endpoint.desc))
mult = 3; mult = 3;
/* /*
...@@ -229,7 +229,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, ...@@ -229,7 +229,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
* completed (not the LINK TRB). * completed (not the LINK TRB).
*/ */
if (((dep->busy_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && if (((dep->busy_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) &&
usb_endpoint_xfer_isoc(dep->desc)) usb_endpoint_xfer_isoc(dep->endpoint.desc))
dep->busy_slot++; dep->busy_slot++;
} }
list_del(&req->list); list_del(&req->list);
...@@ -470,7 +470,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, ...@@ -470,7 +470,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep,
if (ret) if (ret)
return ret; return ret;
dep->desc = desc; dep->endpoint.desc = desc;
dep->comp_desc = comp_desc; dep->comp_desc = comp_desc;
dep->type = usb_endpoint_type(desc); dep->type = usb_endpoint_type(desc);
dep->flags |= DWC3_EP_ENABLED; dep->flags |= DWC3_EP_ENABLED;
...@@ -533,7 +533,6 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) ...@@ -533,7 +533,6 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); dwc3_writel(dwc->regs, DWC3_DALEPENA, reg);
dep->stream_capable = false; dep->stream_capable = false;
dep->desc = NULL;
dep->endpoint.desc = NULL; dep->endpoint.desc = NULL;
dep->comp_desc = NULL; dep->comp_desc = NULL;
dep->type = 0; dep->type = 0;
...@@ -694,7 +693,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, ...@@ -694,7 +693,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
/* Skip the LINK-TRB on ISOC */ /* Skip the LINK-TRB on ISOC */
if (((cur_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && if (((cur_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) &&
usb_endpoint_xfer_isoc(dep->desc)) usb_endpoint_xfer_isoc(dep->endpoint.desc))
return; return;
if (!req->trb) { if (!req->trb) {
...@@ -707,7 +706,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, ...@@ -707,7 +706,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
trb->bpl = lower_32_bits(dma); trb->bpl = lower_32_bits(dma);
trb->bph = upper_32_bits(dma); trb->bph = upper_32_bits(dma);
switch (usb_endpoint_type(dep->desc)) { switch (usb_endpoint_type(dep->endpoint.desc)) {
case USB_ENDPOINT_XFER_CONTROL: case USB_ENDPOINT_XFER_CONTROL:
trb->ctrl = DWC3_TRBCTL_CONTROL_SETUP; trb->ctrl = DWC3_TRBCTL_CONTROL_SETUP;
break; break;
...@@ -732,7 +731,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, ...@@ -732,7 +731,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
BUG(); BUG();
} }
if (usb_endpoint_xfer_isoc(dep->desc)) { if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI; trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI;
trb->ctrl |= DWC3_TRB_CTRL_CSP; trb->ctrl |= DWC3_TRB_CTRL_CSP;
} else { } else {
...@@ -743,7 +742,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, ...@@ -743,7 +742,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
trb->ctrl |= DWC3_TRB_CTRL_LST; trb->ctrl |= DWC3_TRB_CTRL_LST;
} }
if (usb_endpoint_xfer_bulk(dep->desc) && dep->stream_capable) if (usb_endpoint_xfer_bulk(dep->endpoint.desc) && dep->stream_capable)
trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(req->request.stream_id); trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(req->request.stream_id);
trb->ctrl |= DWC3_TRB_CTRL_HWO; trb->ctrl |= DWC3_TRB_CTRL_HWO;
...@@ -771,7 +770,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) ...@@ -771,7 +770,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
trbs_left = (dep->busy_slot - dep->free_slot) & DWC3_TRB_MASK; trbs_left = (dep->busy_slot - dep->free_slot) & DWC3_TRB_MASK;
/* Can't wrap around on a non-isoc EP since there's no link TRB */ /* Can't wrap around on a non-isoc EP since there's no link TRB */
if (!usb_endpoint_xfer_isoc(dep->desc)) { if (!usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
max = DWC3_TRB_NUM - (dep->free_slot & DWC3_TRB_MASK); max = DWC3_TRB_NUM - (dep->free_slot & DWC3_TRB_MASK);
if (trbs_left > max) if (trbs_left > max)
trbs_left = max; trbs_left = max;
...@@ -797,7 +796,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) ...@@ -797,7 +796,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
* processed from the first TRB until the last one. Since we * processed from the first TRB until the last one. Since we
* don't wrap around we have to start at the beginning. * don't wrap around we have to start at the beginning.
*/ */
if (usb_endpoint_xfer_isoc(dep->desc)) { if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
dep->busy_slot = 1; dep->busy_slot = 1;
dep->free_slot = 1; dep->free_slot = 1;
} else { } else {
...@@ -807,7 +806,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) ...@@ -807,7 +806,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
} }
/* The last TRB is a link TRB, not used for xfer */ /* The last TRB is a link TRB, not used for xfer */
if ((trbs_left <= 1) && usb_endpoint_xfer_isoc(dep->desc)) if ((trbs_left <= 1) && usb_endpoint_xfer_isoc(dep->endpoint.desc))
return; return;
list_for_each_entry_safe(req, n, &dep->request_list, list) { list_for_each_entry_safe(req, n, &dep->request_list, list) {
...@@ -984,7 +983,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) ...@@ -984,7 +983,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
int start_trans; int start_trans;
start_trans = 1; start_trans = 1;
if (usb_endpoint_xfer_isoc(dep->desc) && if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
(dep->flags & DWC3_EP_BUSY)) (dep->flags & DWC3_EP_BUSY))
start_trans = 0; start_trans = 0;
...@@ -1011,7 +1010,7 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request, ...@@ -1011,7 +1010,7 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
int ret; int ret;
if (!dep->desc) { if (!dep->endpoint.desc) {
dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n", dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n",
request, ep->name); request, ep->name);
return -ESHUTDOWN; return -ESHUTDOWN;
...@@ -1125,7 +1124,7 @@ static int dwc3_gadget_ep_set_halt(struct usb_ep *ep, int value) ...@@ -1125,7 +1124,7 @@ static int dwc3_gadget_ep_set_halt(struct usb_ep *ep, int value)
spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags);
if (usb_endpoint_xfer_isoc(dep->desc)) { if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
dev_err(dwc->dev, "%s is of Isochronous type\n", dep->name); dev_err(dwc->dev, "%s is of Isochronous type\n", dep->name);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
...@@ -1681,7 +1680,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, ...@@ -1681,7 +1680,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
case DWC3_DEPEVT_XFERCOMPLETE: case DWC3_DEPEVT_XFERCOMPLETE:
dep->res_trans_idx = 0; dep->res_trans_idx = 0;
if (usb_endpoint_xfer_isoc(dep->desc)) { if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
dev_dbg(dwc->dev, "%s is an Isochronous endpoint\n", dev_dbg(dwc->dev, "%s is an Isochronous endpoint\n",
dep->name); dep->name);
return; return;
...@@ -1690,7 +1689,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, ...@@ -1690,7 +1689,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
dwc3_endpoint_transfer_complete(dwc, dep, event, 1); dwc3_endpoint_transfer_complete(dwc, dep, event, 1);
break; break;
case DWC3_DEPEVT_XFERINPROGRESS: case DWC3_DEPEVT_XFERINPROGRESS:
if (!usb_endpoint_xfer_isoc(dep->desc)) { if (!usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
dev_dbg(dwc->dev, "%s is not an Isochronous endpoint\n", dev_dbg(dwc->dev, "%s is not an Isochronous endpoint\n",
dep->name); dep->name);
return; return;
...@@ -1699,7 +1698,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, ...@@ -1699,7 +1698,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
dwc3_endpoint_transfer_complete(dwc, dep, event, 0); dwc3_endpoint_transfer_complete(dwc, dep, event, 0);
break; break;
case DWC3_DEPEVT_XFERNOTREADY: case DWC3_DEPEVT_XFERNOTREADY:
if (usb_endpoint_xfer_isoc(dep->desc)) { if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
dwc3_gadget_start_isoc(dwc, dep, event); dwc3_gadget_start_isoc(dwc, dep, event);
} else { } else {
int ret; int ret;
...@@ -1720,7 +1719,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, ...@@ -1720,7 +1719,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
break; break;
case DWC3_DEPEVT_STREAMEVT: case DWC3_DEPEVT_STREAMEVT:
if (!usb_endpoint_xfer_bulk(dep->desc)) { if (!usb_endpoint_xfer_bulk(dep->endpoint.desc)) {
dev_err(dwc->dev, "Stream event for non-Bulk %s\n", dev_err(dwc->dev, "Stream event for non-Bulk %s\n",
dep->name); dep->name);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment