usb: gadget: add "maxpacket_limit" field to struct usb_ep
This patch adds "maxpacket_limit" to struct usb_ep. This field contains maximum value of maxpacket supported by driver, and is set in driver probe. This value should be used by autoconfig() function, because value of field "maxpacket" is set to value from endpoint descriptor when endpoint becomes enabled. So when autoconfig() function will be called again for this endpoint, "maxpacket" value will contain wMaxPacketSize from descriptior instead of maximum packet size for this endpoint. For this reason this patch adds new field "maxpacket_limit" which contains value of maximum packet size (which defines maximum endpoint capabilities). This value is used in ep_matches() function used by autoconfig(). Value of "maxpacket_limit" should be set in UDC driver probe function, using usb_ep_set_maxpacket_limit() function, defined in gadget.h. This function set choosen value to both "maxpacket_limit" and "maxpacket" fields. This patch modifies UDC drivers by adding support for maxpacket_limit. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
f8800d47bc
commit
e117e742d3
@ -1566,7 +1566,7 @@ static int init_eps(struct ci_hdrc *ci)
|
||||
* eps, maxP is set by epautoconfig() called
|
||||
* by gadget layer
|
||||
*/
|
||||
hwep->ep.maxpacket = (unsigned short)~0;
|
||||
usb_ep_set_maxpacket_limit(&hwep->ep, (unsigned short)~0);
|
||||
|
||||
INIT_LIST_HEAD(&hwep->qh.queue);
|
||||
hwep->qh.ptr = dma_pool_alloc(ci->qh_pool, GFP_KERNEL,
|
||||
@ -1586,7 +1586,7 @@ static int init_eps(struct ci_hdrc *ci)
|
||||
else
|
||||
ci->ep0in = hwep;
|
||||
|
||||
hwep->ep.maxpacket = CTRL_PAYLOAD_MAX;
|
||||
usb_ep_set_maxpacket_limit(&hwep->ep, CTRL_PAYLOAD_MAX);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1653,7 +1653,7 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc,
|
||||
dev_vdbg(dwc->dev, "initializing %s\n", dep->name);
|
||||
|
||||
if (epnum == 0 || epnum == 1) {
|
||||
dep->endpoint.maxpacket = 512;
|
||||
usb_ep_set_maxpacket_limit(&dep->endpoint, 512);
|
||||
dep->endpoint.maxburst = 1;
|
||||
dep->endpoint.ops = &dwc3_gadget_ep0_ops;
|
||||
if (!epnum)
|
||||
@ -1661,7 +1661,7 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc,
|
||||
} else {
|
||||
int ret;
|
||||
|
||||
dep->endpoint.maxpacket = 1024;
|
||||
usb_ep_set_maxpacket_limit(&dep->endpoint, 1024);
|
||||
dep->endpoint.max_streams = 15;
|
||||
dep->endpoint.ops = &dwc3_gadget_ep_ops;
|
||||
list_add_tail(&dep->endpoint.ep_list,
|
||||
|
@ -446,7 +446,7 @@ static void ep_init(struct udc_regs __iomem *regs, struct udc_ep *ep)
|
||||
ep->ep.ops = &udc_ep_ops;
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
|
||||
ep->ep.maxpacket = (u16) ~0;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep,(u16) ~0);
|
||||
/* set NAK */
|
||||
tmp = readl(&ep->regs->ctl);
|
||||
tmp |= AMD_BIT(UDC_EPCTL_SNAK);
|
||||
@ -1564,12 +1564,15 @@ static void udc_setup_endpoints(struct udc *dev)
|
||||
}
|
||||
/* EP0 max packet */
|
||||
if (dev->gadget.speed == USB_SPEED_FULL) {
|
||||
dev->ep[UDC_EP0IN_IX].ep.maxpacket = UDC_FS_EP0IN_MAX_PKT_SIZE;
|
||||
dev->ep[UDC_EP0OUT_IX].ep.maxpacket =
|
||||
UDC_FS_EP0OUT_MAX_PKT_SIZE;
|
||||
usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0IN_IX].ep,
|
||||
UDC_FS_EP0IN_MAX_PKT_SIZE);
|
||||
usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0OUT_IX].ep,
|
||||
UDC_FS_EP0OUT_MAX_PKT_SIZE);
|
||||
} else if (dev->gadget.speed == USB_SPEED_HIGH) {
|
||||
dev->ep[UDC_EP0IN_IX].ep.maxpacket = UDC_EP0IN_MAX_PKT_SIZE;
|
||||
dev->ep[UDC_EP0OUT_IX].ep.maxpacket = UDC_EP0OUT_MAX_PKT_SIZE;
|
||||
usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0IN_IX].ep,
|
||||
UDC_EP0IN_MAX_PKT_SIZE);
|
||||
usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0OUT_IX].ep,
|
||||
UDC_EP0OUT_MAX_PKT_SIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -834,7 +834,7 @@ static void udc_reinit(struct at91_udc *udc)
|
||||
ep->ep.desc = NULL;
|
||||
ep->stopped = 0;
|
||||
ep->fifo_bank = 0;
|
||||
ep->ep.maxpacket = ep->maxpacket;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, ep->maxpacket);
|
||||
ep->creg = (void __iomem *) udc->udp_baseaddr + AT91_UDP_CSR(i);
|
||||
/* initialize one queue per endpoint */
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
@ -1759,15 +1759,15 @@ static int at91udc_probe(struct platform_device *pdev)
|
||||
|
||||
/* newer chips have more FIFO memory than rm9200 */
|
||||
if (cpu_is_at91sam9260() || cpu_is_at91sam9g20()) {
|
||||
udc->ep[0].maxpacket = 64;
|
||||
udc->ep[3].maxpacket = 64;
|
||||
udc->ep[4].maxpacket = 512;
|
||||
udc->ep[5].maxpacket = 512;
|
||||
usb_ep_set_maxpacket_limit(&udc->ep[0], 64);
|
||||
usb_ep_set_maxpacket_limit(&udc->ep[3], 64);
|
||||
usb_ep_set_maxpacket_limit(&udc->ep[4], 512);
|
||||
usb_ep_set_maxpacket_limit(&udc->ep[5], 512);
|
||||
} else if (cpu_is_at91sam9261() || cpu_is_at91sam9g10()) {
|
||||
udc->ep[3].maxpacket = 64;
|
||||
usb_ep_set_maxpacket_limit(&udc->ep[3], 64);
|
||||
} else if (cpu_is_at91sam9263()) {
|
||||
udc->ep[0].maxpacket = 64;
|
||||
udc->ep[3].maxpacket = 64;
|
||||
usb_ep_set_maxpacket_limit(&udc->ep[0], 64);
|
||||
usb_ep_set_maxpacket_limit(&udc->ep[3], 64);
|
||||
}
|
||||
|
||||
udc->udp_baseaddr = ioremap(res->start, resource_size(res));
|
||||
|
@ -1904,7 +1904,7 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
|
||||
ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
|
||||
ep->fifo = udc->fifo + USBA_FIFO_BASE(i);
|
||||
ep->ep.ops = &usba_ep_ops;
|
||||
ep->ep.maxpacket = ep->fifo_size;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, ep->fifo_size);
|
||||
ep->udc = udc;
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
|
||||
@ -1957,7 +1957,8 @@ static struct usba_ep * usba_udc_pdata(struct platform_device *pdev,
|
||||
ep->fifo = udc->fifo + USBA_FIFO_BASE(i);
|
||||
ep->ep.ops = &usba_ep_ops;
|
||||
ep->ep.name = pdata->ep[i].name;
|
||||
ep->fifo_size = ep->ep.maxpacket = pdata->ep[i].fifo_size;
|
||||
ep->fifo_size = pdata->ep[i].fifo_size;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, ep->fifo_size);
|
||||
ep->udc = udc;
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
ep->nr_banks = pdata->ep[i].nr_banks;
|
||||
|
@ -549,7 +549,7 @@ static void bcm63xx_ep_setup(struct bcm63xx_udc *udc)
|
||||
|
||||
if (idx < 0)
|
||||
continue;
|
||||
udc->bep[idx].ep.maxpacket = max_pkt;
|
||||
usb_ep_set_maxpacket_limit(&udc->bep[idx].ep, max_pkt);
|
||||
|
||||
val = (idx << USBD_CSR_EP_LOG_SHIFT) |
|
||||
(cfg->dir << USBD_CSR_EP_DIR_SHIFT) |
|
||||
@ -943,7 +943,7 @@ static int bcm63xx_init_udc_hw(struct bcm63xx_udc *udc)
|
||||
bep->ep.ops = &bcm63xx_udc_ep_ops;
|
||||
list_add_tail(&bep->ep.ep_list, &udc->gadget.ep_list);
|
||||
bep->halted = 0;
|
||||
bep->ep.maxpacket = BCM63XX_MAX_CTRL_PKT;
|
||||
usb_ep_set_maxpacket_limit(&bep->ep, BCM63XX_MAX_CTRL_PKT);
|
||||
bep->udc = udc;
|
||||
bep->ep.desc = NULL;
|
||||
INIT_LIST_HEAD(&bep->queue);
|
||||
|
@ -951,7 +951,7 @@ static void init_dummy_udc_hw(struct dummy *dum)
|
||||
list_add_tail(&ep->ep.ep_list, &dum->gadget.ep_list);
|
||||
ep->halted = ep->wedged = ep->already_seen =
|
||||
ep->setup_stage = 0;
|
||||
ep->ep.maxpacket = ~0;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, ~0);
|
||||
ep->ep.max_streams = 16;
|
||||
ep->last_io = jiffies;
|
||||
ep->gadget = &dum->gadget;
|
||||
|
@ -129,7 +129,7 @@ ep_matches (
|
||||
* and wants to know the maximum possible, provide the info.
|
||||
*/
|
||||
if (desc->wMaxPacketSize == 0)
|
||||
desc->wMaxPacketSize = cpu_to_le16(ep->maxpacket);
|
||||
desc->wMaxPacketSize = cpu_to_le16(ep->maxpacket_limit);
|
||||
|
||||
/* endpoint maxpacket size is an input parameter, except for bulk
|
||||
* where it's an output parameter representing the full speed limit.
|
||||
@ -145,7 +145,7 @@ ep_matches (
|
||||
|
||||
case USB_ENDPOINT_XFER_ISOC:
|
||||
/* ISO: limit 1023 bytes full speed, 1024 high/super speed */
|
||||
if (ep->maxpacket < max)
|
||||
if (ep->maxpacket_limit < max)
|
||||
return 0;
|
||||
if (!gadget_is_dualspeed(gadget) && max > 1023)
|
||||
return 0;
|
||||
@ -178,7 +178,7 @@ ep_matches (
|
||||
|
||||
/* report (variable) full speed bulk maxpacket */
|
||||
if ((USB_ENDPOINT_XFER_BULK == type) && !ep_comp) {
|
||||
int size = ep->maxpacket;
|
||||
int size = ep->maxpacket_limit;
|
||||
|
||||
/* min() doesn't work on bitfields with gcc-3.5 */
|
||||
if (size > 64)
|
||||
|
@ -1157,8 +1157,9 @@ static int fotg210_udc_probe(struct platform_device *pdev)
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
ep->ep.name = fotg210_ep_name[i];
|
||||
ep->ep.ops = &fotg210_ep_ops;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
|
||||
}
|
||||
fotg210->ep[0]->ep.maxpacket = 0x40;
|
||||
usb_ep_set_maxpacket_limit(&fotg210->ep[0]->ep, 0x40);
|
||||
fotg210->gadget.ep0 = &fotg210->ep[0]->ep;
|
||||
INIT_LIST_HEAD(&fotg210->gadget.ep0->ep_list);
|
||||
|
||||
|
@ -2429,7 +2429,7 @@ static int qe_ep_config(struct qe_udc *udc, unsigned char pipe_num)
|
||||
|
||||
ep->ep.ops = &qe_ep_ops;
|
||||
ep->stopped = 1;
|
||||
ep->ep.maxpacket = (unsigned short) ~0;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
|
||||
ep->ep.desc = NULL;
|
||||
ep->dir = 0xff;
|
||||
ep->epnum = (u8)pipe_num;
|
||||
|
@ -2311,7 +2311,7 @@ static int __init struct_ep_setup(struct fsl_udc *udc, unsigned char index,
|
||||
/* for ep0: maxP defined in desc
|
||||
* for other eps, maxP is set by epautoconfig() called by gadget layer
|
||||
*/
|
||||
ep->ep.maxpacket = (unsigned short) ~0;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
|
||||
|
||||
/* the queue lists any req for this ep */
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
@ -2469,7 +2469,8 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
|
||||
* for other eps, gadget layer called ep_enable with defined desc
|
||||
*/
|
||||
udc_controller->eps[0].ep.desc = &fsl_ep0_desc;
|
||||
udc_controller->eps[0].ep.maxpacket = USB_MAX_CTRL_PAYLOAD;
|
||||
usb_ep_set_maxpacket_limit(&udc_controller->eps[0].ep,
|
||||
USB_MAX_CTRL_PAYLOAD);
|
||||
|
||||
/* setup the udc->eps[] for non-control endpoints and link
|
||||
* to gadget.ep_list */
|
||||
|
@ -1452,9 +1452,9 @@ static int __init fusb300_probe(struct platform_device *pdev)
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
ep->ep.name = fusb300_ep_name[i];
|
||||
ep->ep.ops = &fusb300_ep_ops;
|
||||
ep->ep.maxpacket = HS_BULK_MAX_PACKET_SIZE;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, HS_BULK_MAX_PACKET_SIZE);
|
||||
}
|
||||
fusb300->ep[0]->ep.maxpacket = HS_CTL_MAX_PACKET_SIZE;
|
||||
usb_ep_set_maxpacket_limit(&fusb300->ep[0]->ep, HS_CTL_MAX_PACKET_SIZE);
|
||||
fusb300->ep[0]->epnum = 0;
|
||||
fusb300->gadget.ep0 = &fusb300->ep[0]->ep;
|
||||
INIT_LIST_HEAD(&fusb300->gadget.ep0->ep_list);
|
||||
|
@ -231,7 +231,7 @@ static void ep_reset(struct goku_udc_regs __iomem *regs, struct goku_ep *ep)
|
||||
}
|
||||
}
|
||||
|
||||
ep->ep.maxpacket = MAX_FIFO_SIZE;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, MAX_FIFO_SIZE);
|
||||
ep->ep.desc = NULL;
|
||||
ep->stopped = 1;
|
||||
ep->irqs = 0;
|
||||
@ -1251,7 +1251,7 @@ static void udc_reinit (struct goku_udc *dev)
|
||||
}
|
||||
|
||||
dev->ep[0].reg_mode = NULL;
|
||||
dev->ep[0].ep.maxpacket = MAX_EP0_SIZE;
|
||||
usb_ep_set_maxpacket_limit(&dev->ep[0].ep, MAX_EP0_SIZE);
|
||||
list_del_init (&dev->ep[0].ep.ep_list);
|
||||
}
|
||||
|
||||
|
@ -1449,7 +1449,7 @@ static void udc_reinit(struct lpc32xx_udc *udc)
|
||||
|
||||
if (i != 0)
|
||||
list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
|
||||
ep->ep.maxpacket = ep->maxpacket;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, ep->maxpacket);
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
ep->req_pending = 0;
|
||||
}
|
||||
|
@ -1647,9 +1647,9 @@ static int __init m66592_probe(struct platform_device *pdev)
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
ep->ep.name = m66592_ep_name[i];
|
||||
ep->ep.ops = &m66592_ep_ops;
|
||||
ep->ep.maxpacket = 512;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, 512);
|
||||
}
|
||||
m66592->ep[0].ep.maxpacket = 64;
|
||||
usb_ep_set_maxpacket_limit(&m66592->ep[0].ep, 64);
|
||||
m66592->ep[0].pipenum = 0;
|
||||
m66592->ep[0].fifoaddr = M66592_CFIFO;
|
||||
m66592->ep[0].fifosel = M66592_CFIFOSEL;
|
||||
|
@ -1336,7 +1336,7 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d)
|
||||
ep->ep.name = ep->name;
|
||||
ep->ep.ops = &mv_u3d_ep_ops;
|
||||
ep->wedge = 0;
|
||||
ep->ep.maxpacket = MV_U3D_EP0_MAX_PKT_SIZE;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, MV_U3D_EP0_MAX_PKT_SIZE);
|
||||
ep->ep_num = 0;
|
||||
ep->ep.desc = &mv_u3d_ep0_desc;
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
@ -1361,7 +1361,7 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d)
|
||||
ep->ep.name = ep->name;
|
||||
|
||||
ep->ep.ops = &mv_u3d_ep_ops;
|
||||
ep->ep.maxpacket = (unsigned short) ~0;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
|
||||
ep->ep_num = i / 2;
|
||||
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
|
@ -1261,7 +1261,7 @@ static int eps_init(struct mv_udc *udc)
|
||||
ep->ep.ops = &mv_ep_ops;
|
||||
ep->wedge = 0;
|
||||
ep->stopped = 0;
|
||||
ep->ep.maxpacket = EP0_MAX_PKT_SIZE;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, EP0_MAX_PKT_SIZE);
|
||||
ep->ep_num = 0;
|
||||
ep->ep.desc = &mv_ep0_desc;
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
@ -1284,7 +1284,7 @@ static int eps_init(struct mv_udc *udc)
|
||||
|
||||
ep->ep.ops = &mv_ep_ops;
|
||||
ep->stopped = 0;
|
||||
ep->ep.maxpacket = (unsigned short) ~0;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
|
||||
ep->ep_num = i / 2;
|
||||
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
|
@ -266,7 +266,7 @@ static void net2272_ep_reset(struct net2272_ep *ep)
|
||||
ep->desc = NULL;
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
|
||||
ep->ep.maxpacket = ~0;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, ~0);
|
||||
ep->ep.ops = &net2272_ep_ops;
|
||||
|
||||
/* disable irqs, endpoint */
|
||||
@ -1409,7 +1409,7 @@ net2272_usb_reinit(struct net2272 *dev)
|
||||
ep->fifo_size = 64;
|
||||
net2272_ep_reset(ep);
|
||||
}
|
||||
dev->ep[0].ep.maxpacket = 64;
|
||||
usb_ep_set_maxpacket_limit(&dev->ep[0].ep, 64);
|
||||
|
||||
dev->gadget.ep0 = &dev->ep[0].ep;
|
||||
dev->ep[0].stopped = 0;
|
||||
|
@ -293,7 +293,7 @@ static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep)
|
||||
ep->desc = NULL;
|
||||
INIT_LIST_HEAD (&ep->queue);
|
||||
|
||||
ep->ep.maxpacket = ~0;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, ~0);
|
||||
ep->ep.ops = &net2280_ep_ops;
|
||||
|
||||
/* disable the dma, irqs, endpoint... */
|
||||
@ -1805,9 +1805,9 @@ static void usb_reinit (struct net2280 *dev)
|
||||
ep->regs = &dev->epregs [tmp];
|
||||
ep_reset (dev->regs, ep);
|
||||
}
|
||||
dev->ep [0].ep.maxpacket = 64;
|
||||
dev->ep [5].ep.maxpacket = 64;
|
||||
dev->ep [6].ep.maxpacket = 64;
|
||||
usb_ep_set_maxpacket_limit(&dev->ep [0].ep, 64);
|
||||
usb_ep_set_maxpacket_limit(&dev->ep [5].ep, 64);
|
||||
usb_ep_set_maxpacket_limit(&dev->ep [6].ep, 64);
|
||||
|
||||
dev->gadget.ep0 = &dev->ep [0].ep;
|
||||
dev->ep [0].stopped = 0;
|
||||
|
@ -2586,7 +2586,8 @@ omap_ep_setup(char *name, u8 addr, u8 type,
|
||||
|
||||
ep->ep.name = ep->name;
|
||||
ep->ep.ops = &omap_ep_ops;
|
||||
ep->ep.maxpacket = ep->maxpacket = maxp;
|
||||
ep->maxpacket = maxp;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, ep->maxpacket);
|
||||
list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
|
||||
|
||||
return buf;
|
||||
|
@ -2896,12 +2896,12 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev)
|
||||
ep->offset_addr = (UDC_EPINT_OUT_SHIFT + ep->num) *
|
||||
UDC_EP_REG_SHIFT;
|
||||
/* need to set ep->ep.maxpacket and set Default Configuration?*/
|
||||
ep->ep.maxpacket = UDC_BULK_MAX_PKT_SIZE;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, UDC_BULK_MAX_PKT_SIZE);
|
||||
list_add_tail(&ep->ep.ep_list, &dev->gadget.ep_list);
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
}
|
||||
dev->ep[UDC_EP0IN_IDX].ep.maxpacket = UDC_EP0IN_MAX_PKT_SIZE;
|
||||
dev->ep[UDC_EP0OUT_IDX].ep.maxpacket = UDC_EP0OUT_MAX_PKT_SIZE;
|
||||
usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0IN_IDX].ep, UDC_EP0IN_MAX_PKT_SIZE);
|
||||
usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0OUT_IDX].ep, UDC_EP0OUT_MAX_PKT_SIZE);
|
||||
|
||||
/* remove ep0 in and out from the list. They have own pointer */
|
||||
list_del_init(&dev->ep[UDC_EP0IN_IDX].ep.ep_list);
|
||||
|
@ -1193,6 +1193,7 @@ static void udc_reinit(struct pxa25x_udc *dev)
|
||||
ep->stopped = 0;
|
||||
INIT_LIST_HEAD (&ep->queue);
|
||||
ep->pio_irqs = 0;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, ep->ep.maxpacket);
|
||||
}
|
||||
|
||||
/* the rest was statically initialized, and is read-only */
|
||||
|
@ -1737,9 +1737,12 @@ static void udc_init_data(struct pxa_udc *dev)
|
||||
}
|
||||
|
||||
/* USB endpoints init */
|
||||
for (i = 1; i < NR_USB_ENDPOINTS; i++)
|
||||
for (i = 1; i < NR_USB_ENDPOINTS; i++) {
|
||||
list_add_tail(&dev->udc_usb_ep[i].usb_ep.ep_list,
|
||||
&dev->gadget.ep_list);
|
||||
usb_ep_set_maxpacket_limit(&dev->udc_usb_ep[i].usb_ep,
|
||||
dev->udc_usb_ep[i].usb_ep.maxpacket);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1964,9 +1964,9 @@ static int __init r8a66597_probe(struct platform_device *pdev)
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
ep->ep.name = r8a66597_ep_name[i];
|
||||
ep->ep.ops = &r8a66597_ep_ops;
|
||||
ep->ep.maxpacket = 512;
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, 512);
|
||||
}
|
||||
r8a66597->ep[0].ep.maxpacket = 64;
|
||||
usb_ep_set_maxpacket_limit(&r8a66597->ep[0].ep, 64);
|
||||
r8a66597->ep[0].pipenum = 0;
|
||||
r8a66597->ep[0].fifoaddr = CFIFO;
|
||||
r8a66597->ep[0].fifosel = CFIFOSEL;
|
||||
|
@ -3150,7 +3150,7 @@ static void s3c_hsotg_initep(struct s3c_hsotg *hsotg,
|
||||
|
||||
hs_ep->parent = hsotg;
|
||||
hs_ep->ep.name = hs_ep->name;
|
||||
hs_ep->ep.maxpacket = epnum ? 1024 : EP0_MPS_LIMIT;
|
||||
usb_ep_set_maxpacket_limit(&hs_ep->ep, epnum ? 1024 : EP0_MPS_LIMIT);
|
||||
hs_ep->ep.ops = &s3c_hsotg_ep_ops;
|
||||
|
||||
/*
|
||||
|
@ -999,7 +999,7 @@ static void s3c_hsudc_initep(struct s3c_hsudc *hsudc,
|
||||
|
||||
hsep->dev = hsudc;
|
||||
hsep->ep.name = hsep->name;
|
||||
hsep->ep.maxpacket = epnum ? 512 : 64;
|
||||
usb_ep_set_maxpacket_limit(&hsep->ep, epnum ? 512 : 64);
|
||||
hsep->ep.ops = &s3c_hsudc_ep_ops;
|
||||
hsep->fifo = hsudc->regs + S3C_BR(epnum);
|
||||
hsep->ep.desc = NULL;
|
||||
|
@ -1629,6 +1629,7 @@ static void s3c2410_udc_reinit(struct s3c2410_udc *dev)
|
||||
ep->ep.desc = NULL;
|
||||
ep->halted = 0;
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
usb_ep_set_maxpacket_limit(&ep->ep, &ep->ep.maxpacket);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1727,14 +1727,14 @@ init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in)
|
||||
ep->end_point.name = ep->name;
|
||||
INIT_LIST_HEAD(&ep->end_point.ep_list);
|
||||
if (!epnum) {
|
||||
ep->end_point.maxpacket = 64;
|
||||
usb_ep_set_maxpacket_limit(&ep->end_point, 64);
|
||||
ep->end_point.ops = &musb_g_ep0_ops;
|
||||
musb->g.ep0 = &ep->end_point;
|
||||
} else {
|
||||
if (is_in)
|
||||
ep->end_point.maxpacket = hw_ep->max_packet_sz_tx;
|
||||
usb_ep_set_maxpacket_limit(&ep->end_point, hw_ep->max_packet_sz_tx);
|
||||
else
|
||||
ep->end_point.maxpacket = hw_ep->max_packet_sz_rx;
|
||||
usb_ep_set_maxpacket_limit(&ep->end_point, hw_ep->max_packet_sz_rx);
|
||||
ep->end_point.ops = &musb_ep_ops;
|
||||
list_add_tail(&ep->end_point.ep_list, &musb->g.ep_list);
|
||||
}
|
||||
|
@ -987,11 +987,11 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
|
||||
/* init DCP */
|
||||
if (usbhsg_is_dcp(uep)) {
|
||||
gpriv->gadget.ep0 = &uep->ep;
|
||||
uep->ep.maxpacket = 64;
|
||||
usb_ep_set_maxpacket_limit(&uep->ep, 64);
|
||||
}
|
||||
/* init normal pipe */
|
||||
else {
|
||||
uep->ep.maxpacket = 512;
|
||||
usb_ep_set_maxpacket_limit(&uep->ep, 512);
|
||||
list_add_tail(&uep->ep.ep_list, &gpriv->gadget.ep_list);
|
||||
}
|
||||
}
|
||||
|
@ -148,6 +148,9 @@ struct usb_ep_ops {
|
||||
* @maxpacket:The maximum packet size used on this endpoint. The initial
|
||||
* value can sometimes be reduced (hardware allowing), according to
|
||||
* the endpoint descriptor used to configure the endpoint.
|
||||
* @maxpacket_limit:The maximum packet size value which can be handled by this
|
||||
* endpoint. It's set once by UDC driver when endpoint is initialized, and
|
||||
* should not be changed. Should not be confused with maxpacket.
|
||||
* @max_streams: The maximum number of streams supported
|
||||
* by this EP (0 - 16, actual number is 2^n)
|
||||
* @mult: multiplier, 'mult' value for SS Isoc EPs
|
||||
@ -171,6 +174,7 @@ struct usb_ep {
|
||||
const struct usb_ep_ops *ops;
|
||||
struct list_head ep_list;
|
||||
unsigned maxpacket:16;
|
||||
unsigned maxpacket_limit:16;
|
||||
unsigned max_streams:16;
|
||||
unsigned mult:2;
|
||||
unsigned maxburst:5;
|
||||
@ -181,6 +185,21 @@ struct usb_ep {
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* usb_ep_set_maxpacket_limit - set maximum packet size limit for endpoint
|
||||
* @ep:the endpoint being configured
|
||||
* @maxpacket_limit:value of maximum packet size limit
|
||||
*
|
||||
* This function shoud be used only in UDC drivers to initialize endpoint
|
||||
* (usually in probe function).
|
||||
*/
|
||||
static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep,
|
||||
unsigned maxpacket_limit)
|
||||
{
|
||||
ep->maxpacket_limit = maxpacket_limit;
|
||||
ep->maxpacket = maxpacket_limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* usb_ep_enable - configure endpoint, making it usable
|
||||
* @ep:the endpoint being configured. may not be the endpoint named "ep0".
|
||||
|
Loading…
Reference in New Issue
Block a user