aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/chipidea/udc.c4
-rw-r--r--drivers/usb/dwc3/gadget.c4
-rw-r--r--drivers/usb/gadget/amd5536udc.c15
-rw-r--r--drivers/usb/gadget/at91_udc.c16
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c5
-rw-r--r--drivers/usb/gadget/bcm63xx_udc.c4
-rw-r--r--drivers/usb/gadget/dummy_hcd.c2
-rw-r--r--drivers/usb/gadget/epautoconf.c6
-rw-r--r--drivers/usb/gadget/fotg210-udc.c3
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c2
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c5
-rw-r--r--drivers/usb/gadget/fusb300_udc.c4
-rw-r--r--drivers/usb/gadget/goku_udc.c4
-rw-r--r--drivers/usb/gadget/lpc32xx_udc.c2
-rw-r--r--drivers/usb/gadget/m66592-udc.c4
-rw-r--r--drivers/usb/gadget/mv_u3d_core.c4
-rw-r--r--drivers/usb/gadget/mv_udc_core.c4
-rw-r--r--drivers/usb/gadget/net2272.c4
-rw-r--r--drivers/usb/gadget/net2280.c8
-rw-r--r--drivers/usb/gadget/omap_udc.c3
-rw-r--r--drivers/usb/gadget/pch_udc.c6
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c1
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c5
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c4
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c2
-rw-r--r--drivers/usb/gadget/s3c-hsudc.c2
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c1
-rw-r--r--drivers/usb/musb/musb_gadget.c6
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c4
-rw-r--r--include/linux/usb/gadget.h19
30 files changed, 92 insertions, 61 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index b34c81969cba..77e4a17cfb44 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1566,7 +1566,7 @@ static int init_eps(struct ci_hdrc *ci)
1566 * eps, maxP is set by epautoconfig() called 1566 * eps, maxP is set by epautoconfig() called
1567 * by gadget layer 1567 * by gadget layer
1568 */ 1568 */
1569 hwep->ep.maxpacket = (unsigned short)~0; 1569 usb_ep_set_maxpacket_limit(&hwep->ep, (unsigned short)~0);
1570 1570
1571 INIT_LIST_HEAD(&hwep->qh.queue); 1571 INIT_LIST_HEAD(&hwep->qh.queue);
1572 hwep->qh.ptr = dma_pool_alloc(ci->qh_pool, GFP_KERNEL, 1572 hwep->qh.ptr = dma_pool_alloc(ci->qh_pool, GFP_KERNEL,
@@ -1586,7 +1586,7 @@ static int init_eps(struct ci_hdrc *ci)
1586 else 1586 else
1587 ci->ep0in = hwep; 1587 ci->ep0in = hwep;
1588 1588
1589 hwep->ep.maxpacket = CTRL_PAYLOAD_MAX; 1589 usb_ep_set_maxpacket_limit(&hwep->ep, CTRL_PAYLOAD_MAX);
1590 continue; 1590 continue;
1591 } 1591 }
1592 1592
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index b85ec110d6a0..5401b2b573d5 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1653,7 +1653,7 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc,
1653 dev_vdbg(dwc->dev, "initializing %s\n", dep->name); 1653 dev_vdbg(dwc->dev, "initializing %s\n", dep->name);
1654 1654
1655 if (epnum == 0 || epnum == 1) { 1655 if (epnum == 0 || epnum == 1) {
1656 dep->endpoint.maxpacket = 512; 1656 usb_ep_set_maxpacket_limit(&dep->endpoint, 512);
1657 dep->endpoint.maxburst = 1; 1657 dep->endpoint.maxburst = 1;
1658 dep->endpoint.ops = &dwc3_gadget_ep0_ops; 1658 dep->endpoint.ops = &dwc3_gadget_ep0_ops;
1659 if (!epnum) 1659 if (!epnum)
@@ -1661,7 +1661,7 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc,
1661 } else { 1661 } else {
1662 int ret; 1662 int ret;
1663 1663
1664 dep->endpoint.maxpacket = 1024; 1664 usb_ep_set_maxpacket_limit(&dep->endpoint, 1024);
1665 dep->endpoint.max_streams = 15; 1665 dep->endpoint.max_streams = 15;
1666 dep->endpoint.ops = &dwc3_gadget_ep_ops; 1666 dep->endpoint.ops = &dwc3_gadget_ep_ops;
1667 list_add_tail(&dep->endpoint.ep_list, 1667 list_add_tail(&dep->endpoint.ep_list,
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index f0ff4a675e9d..a04aa8b64472 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -446,7 +446,7 @@ static void ep_init(struct udc_regs __iomem *regs, struct udc_ep *ep)
446 ep->ep.ops = &udc_ep_ops; 446 ep->ep.ops = &udc_ep_ops;
447 INIT_LIST_HEAD(&ep->queue); 447 INIT_LIST_HEAD(&ep->queue);
448 448
449 ep->ep.maxpacket = (u16) ~0; 449 usb_ep_set_maxpacket_limit(&ep->ep,(u16) ~0);
450 /* set NAK */ 450 /* set NAK */
451 tmp = readl(&ep->regs->ctl); 451 tmp = readl(&ep->regs->ctl);
452 tmp |= AMD_BIT(UDC_EPCTL_SNAK); 452 tmp |= AMD_BIT(UDC_EPCTL_SNAK);
@@ -1564,12 +1564,15 @@ static void udc_setup_endpoints(struct udc *dev)
1564 } 1564 }
1565 /* EP0 max packet */ 1565 /* EP0 max packet */
1566 if (dev->gadget.speed == USB_SPEED_FULL) { 1566 if (dev->gadget.speed == USB_SPEED_FULL) {
1567 dev->ep[UDC_EP0IN_IX].ep.maxpacket = UDC_FS_EP0IN_MAX_PKT_SIZE; 1567 usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0IN_IX].ep,
1568 dev->ep[UDC_EP0OUT_IX].ep.maxpacket = 1568 UDC_FS_EP0IN_MAX_PKT_SIZE);
1569 UDC_FS_EP0OUT_MAX_PKT_SIZE; 1569 usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0OUT_IX].ep,
1570 UDC_FS_EP0OUT_MAX_PKT_SIZE);
1570 } else if (dev->gadget.speed == USB_SPEED_HIGH) { 1571 } else if (dev->gadget.speed == USB_SPEED_HIGH) {
1571 dev->ep[UDC_EP0IN_IX].ep.maxpacket = UDC_EP0IN_MAX_PKT_SIZE; 1572 usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0IN_IX].ep,
1572 dev->ep[UDC_EP0OUT_IX].ep.maxpacket = UDC_EP0OUT_MAX_PKT_SIZE; 1573 UDC_EP0IN_MAX_PKT_SIZE);
1574 usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0OUT_IX].ep,
1575 UDC_EP0OUT_MAX_PKT_SIZE);
1573 } 1576 }
1574 1577
1575 /* 1578 /*
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 4cc4fd6d1473..0353b6471bde 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -834,7 +834,7 @@ static void udc_reinit(struct at91_udc *udc)
834 ep->ep.desc = NULL; 834 ep->ep.desc = NULL;
835 ep->stopped = 0; 835 ep->stopped = 0;
836 ep->fifo_bank = 0; 836 ep->fifo_bank = 0;
837 ep->ep.maxpacket = ep->maxpacket; 837 usb_ep_set_maxpacket_limit(&ep->ep, ep->maxpacket);
838 ep->creg = (void __iomem *) udc->udp_baseaddr + AT91_UDP_CSR(i); 838 ep->creg = (void __iomem *) udc->udp_baseaddr + AT91_UDP_CSR(i);
839 /* initialize one queue per endpoint */ 839 /* initialize one queue per endpoint */
840 INIT_LIST_HEAD(&ep->queue); 840 INIT_LIST_HEAD(&ep->queue);
@@ -1759,15 +1759,15 @@ static int at91udc_probe(struct platform_device *pdev)
1759 1759
1760 /* newer chips have more FIFO memory than rm9200 */ 1760 /* newer chips have more FIFO memory than rm9200 */
1761 if (cpu_is_at91sam9260() || cpu_is_at91sam9g20()) { 1761 if (cpu_is_at91sam9260() || cpu_is_at91sam9g20()) {
1762 udc->ep[0].maxpacket = 64; 1762 usb_ep_set_maxpacket_limit(&udc->ep[0], 64);
1763 udc->ep[3].maxpacket = 64; 1763 usb_ep_set_maxpacket_limit(&udc->ep[3], 64);
1764 udc->ep[4].maxpacket = 512; 1764 usb_ep_set_maxpacket_limit(&udc->ep[4], 512);
1765 udc->ep[5].maxpacket = 512; 1765 usb_ep_set_maxpacket_limit(&udc->ep[5], 512);
1766 } else if (cpu_is_at91sam9261() || cpu_is_at91sam9g10()) { 1766 } else if (cpu_is_at91sam9261() || cpu_is_at91sam9g10()) {
1767 udc->ep[3].maxpacket = 64; 1767 usb_ep_set_maxpacket_limit(&udc->ep[3], 64);
1768 } else if (cpu_is_at91sam9263()) { 1768 } else if (cpu_is_at91sam9263()) {
1769 udc->ep[0].maxpacket = 64; 1769 usb_ep_set_maxpacket_limit(&udc->ep[0], 64);
1770 udc->ep[3].maxpacket = 64; 1770 usb_ep_set_maxpacket_limit(&udc->ep[3], 64);
1771 } 1771 }
1772 1772
1773 udc->udp_baseaddr = ioremap(res->start, resource_size(res)); 1773 udc->udp_baseaddr = ioremap(res->start, resource_size(res));
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 2cb52e0438df..68cf3a40f98e 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1904,7 +1904,7 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
1904 ep->dma_regs = udc->regs + USBA_DMA_BASE(i); 1904 ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
1905 ep->fifo = udc->fifo + USBA_FIFO_BASE(i); 1905 ep->fifo = udc->fifo + USBA_FIFO_BASE(i);
1906 ep->ep.ops = &usba_ep_ops; 1906 ep->ep.ops = &usba_ep_ops;
1907 ep->ep.maxpacket = ep->fifo_size; 1907 usb_ep_set_maxpacket_limit(&ep->ep, ep->fifo_size);
1908 ep->udc = udc; 1908 ep->udc = udc;
1909 INIT_LIST_HEAD(&ep->queue); 1909 INIT_LIST_HEAD(&ep->queue);
1910 1910
@@ -1957,7 +1957,8 @@ static struct usba_ep * usba_udc_pdata(struct platform_device *pdev,
1957 ep->fifo = udc->fifo + USBA_FIFO_BASE(i); 1957 ep->fifo = udc->fifo + USBA_FIFO_BASE(i);
1958 ep->ep.ops = &usba_ep_ops; 1958 ep->ep.ops = &usba_ep_ops;
1959 ep->ep.name = pdata->ep[i].name; 1959 ep->ep.name = pdata->ep[i].name;
1960 ep->fifo_size = ep->ep.maxpacket = pdata->ep[i].fifo_size; 1960 ep->fifo_size = pdata->ep[i].fifo_size;
1961 usb_ep_set_maxpacket_limit(&ep->ep, ep->fifo_size);
1961 ep->udc = udc; 1962 ep->udc = udc;
1962 INIT_LIST_HEAD(&ep->queue); 1963 INIT_LIST_HEAD(&ep->queue);
1963 ep->nr_banks = pdata->ep[i].nr_banks; 1964 ep->nr_banks = pdata->ep[i].nr_banks;
diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
index c58fcf1ebe41..2ac7a8f4bfff 100644
--- a/drivers/usb/gadget/bcm63xx_udc.c
+++ b/drivers/usb/gadget/bcm63xx_udc.c
@@ -549,7 +549,7 @@ static void bcm63xx_ep_setup(struct bcm63xx_udc *udc)
549 549
550 if (idx < 0) 550 if (idx < 0)
551 continue; 551 continue;
552 udc->bep[idx].ep.maxpacket = max_pkt; 552 usb_ep_set_maxpacket_limit(&udc->bep[idx].ep, max_pkt);
553 553
554 val = (idx << USBD_CSR_EP_LOG_SHIFT) | 554 val = (idx << USBD_CSR_EP_LOG_SHIFT) |
555 (cfg->dir << USBD_CSR_EP_DIR_SHIFT) | 555 (cfg->dir << USBD_CSR_EP_DIR_SHIFT) |
@@ -943,7 +943,7 @@ static int bcm63xx_init_udc_hw(struct bcm63xx_udc *udc)
943 bep->ep.ops = &bcm63xx_udc_ep_ops; 943 bep->ep.ops = &bcm63xx_udc_ep_ops;
944 list_add_tail(&bep->ep.ep_list, &udc->gadget.ep_list); 944 list_add_tail(&bep->ep.ep_list, &udc->gadget.ep_list);
945 bep->halted = 0; 945 bep->halted = 0;
946 bep->ep.maxpacket = BCM63XX_MAX_CTRL_PKT; 946 usb_ep_set_maxpacket_limit(&bep->ep, BCM63XX_MAX_CTRL_PKT);
947 bep->udc = udc; 947 bep->udc = udc;
948 bep->ep.desc = NULL; 948 bep->ep.desc = NULL;
949 INIT_LIST_HEAD(&bep->queue); 949 INIT_LIST_HEAD(&bep->queue);
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 8f4dae310923..8c06430dcc47 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -951,7 +951,7 @@ static void init_dummy_udc_hw(struct dummy *dum)
951 list_add_tail(&ep->ep.ep_list, &dum->gadget.ep_list); 951 list_add_tail(&ep->ep.ep_list, &dum->gadget.ep_list);
952 ep->halted = ep->wedged = ep->already_seen = 952 ep->halted = ep->wedged = ep->already_seen =
953 ep->setup_stage = 0; 953 ep->setup_stage = 0;
954 ep->ep.maxpacket = ~0; 954 usb_ep_set_maxpacket_limit(&ep->ep, ~0);
955 ep->ep.max_streams = 16; 955 ep->ep.max_streams = 16;
956 ep->last_io = jiffies; 956 ep->last_io = jiffies;
957 ep->gadget = &dum->gadget; 957 ep->gadget = &dum->gadget;
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index feaaa7b72ee3..358de320afb0 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -129,7 +129,7 @@ ep_matches (
129 * and wants to know the maximum possible, provide the info. 129 * and wants to know the maximum possible, provide the info.
130 */ 130 */
131 if (desc->wMaxPacketSize == 0) 131 if (desc->wMaxPacketSize == 0)
132 desc->wMaxPacketSize = cpu_to_le16(ep->maxpacket); 132 desc->wMaxPacketSize = cpu_to_le16(ep->maxpacket_limit);
133 133
134 /* endpoint maxpacket size is an input parameter, except for bulk 134 /* endpoint maxpacket size is an input parameter, except for bulk
135 * where it's an output parameter representing the full speed limit. 135 * where it's an output parameter representing the full speed limit.
@@ -145,7 +145,7 @@ ep_matches (
145 145
146 case USB_ENDPOINT_XFER_ISOC: 146 case USB_ENDPOINT_XFER_ISOC:
147 /* ISO: limit 1023 bytes full speed, 1024 high/super speed */ 147 /* ISO: limit 1023 bytes full speed, 1024 high/super speed */
148 if (ep->maxpacket < max) 148 if (ep->maxpacket_limit < max)
149 return 0; 149 return 0;
150 if (!gadget_is_dualspeed(gadget) && max > 1023) 150 if (!gadget_is_dualspeed(gadget) && max > 1023)
151 return 0; 151 return 0;
@@ -178,7 +178,7 @@ ep_matches (
178 178
179 /* report (variable) full speed bulk maxpacket */ 179 /* report (variable) full speed bulk maxpacket */
180 if ((USB_ENDPOINT_XFER_BULK == type) && !ep_comp) { 180 if ((USB_ENDPOINT_XFER_BULK == type) && !ep_comp) {
181 int size = ep->maxpacket; 181 int size = ep->maxpacket_limit;
182 182
183 /* min() doesn't work on bitfields with gcc-3.5 */ 183 /* min() doesn't work on bitfields with gcc-3.5 */
184 if (size > 64) 184 if (size > 64)
diff --git a/drivers/usb/gadget/fotg210-udc.c b/drivers/usb/gadget/fotg210-udc.c
index bbbfd1948778..2d0305280e8c 100644
--- a/drivers/usb/gadget/fotg210-udc.c
+++ b/drivers/usb/gadget/fotg210-udc.c
@@ -1157,8 +1157,9 @@ static int fotg210_udc_probe(struct platform_device *pdev)
1157 INIT_LIST_HEAD(&ep->queue); 1157 INIT_LIST_HEAD(&ep->queue);
1158 ep->ep.name = fotg210_ep_name[i]; 1158 ep->ep.name = fotg210_ep_name[i];
1159 ep->ep.ops = &fotg210_ep_ops; 1159 ep->ep.ops = &fotg210_ep_ops;
1160 usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
1160 } 1161 }
1161 fotg210->ep[0]->ep.maxpacket = 0x40; 1162 usb_ep_set_maxpacket_limit(&fotg210->ep[0]->ep, 0x40);
1162 fotg210->gadget.ep0 = &fotg210->ep[0]->ep; 1163 fotg210->gadget.ep0 = &fotg210->ep[0]->ep;
1163 INIT_LIST_HEAD(&fotg210->gadget.ep0->ep_list); 1164 INIT_LIST_HEAD(&fotg210->gadget.ep0->ep_list);
1164 1165
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index 6315ee698d4d..f60d4da8f2c0 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -2429,7 +2429,7 @@ static int qe_ep_config(struct qe_udc *udc, unsigned char pipe_num)
2429 2429
2430 ep->ep.ops = &qe_ep_ops; 2430 ep->ep.ops = &qe_ep_ops;
2431 ep->stopped = 1; 2431 ep->stopped = 1;
2432 ep->ep.maxpacket = (unsigned short) ~0; 2432 usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
2433 ep->ep.desc = NULL; 2433 ep->ep.desc = NULL;
2434 ep->dir = 0xff; 2434 ep->dir = 0xff;
2435 ep->epnum = (u8)pipe_num; 2435 ep->epnum = (u8)pipe_num;
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index b7dea4eec32c..15960af0f67e 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2311,7 +2311,7 @@ static int __init struct_ep_setup(struct fsl_udc *udc, unsigned char index,
2311 /* for ep0: maxP defined in desc 2311 /* for ep0: maxP defined in desc
2312 * for other eps, maxP is set by epautoconfig() called by gadget layer 2312 * for other eps, maxP is set by epautoconfig() called by gadget layer
2313 */ 2313 */
2314 ep->ep.maxpacket = (unsigned short) ~0; 2314 usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
2315 2315
2316 /* the queue lists any req for this ep */ 2316 /* the queue lists any req for this ep */
2317 INIT_LIST_HEAD(&ep->queue); 2317 INIT_LIST_HEAD(&ep->queue);
@@ -2469,7 +2469,8 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
2469 * for other eps, gadget layer called ep_enable with defined desc 2469 * for other eps, gadget layer called ep_enable with defined desc
2470 */ 2470 */
2471 udc_controller->eps[0].ep.desc = &fsl_ep0_desc; 2471 udc_controller->eps[0].ep.desc = &fsl_ep0_desc;
2472 udc_controller->eps[0].ep.maxpacket = USB_MAX_CTRL_PAYLOAD; 2472 usb_ep_set_maxpacket_limit(&udc_controller->eps[0].ep,
2473 USB_MAX_CTRL_PAYLOAD);
2473 2474
2474 /* setup the udc->eps[] for non-control endpoints and link 2475 /* setup the udc->eps[] for non-control endpoints and link
2475 * to gadget.ep_list */ 2476 * to gadget.ep_list */
diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c
index b278abe52453..6423f1840ed9 100644
--- a/drivers/usb/gadget/fusb300_udc.c
+++ b/drivers/usb/gadget/fusb300_udc.c
@@ -1452,9 +1452,9 @@ static int __init fusb300_probe(struct platform_device *pdev)
1452 INIT_LIST_HEAD(&ep->queue); 1452 INIT_LIST_HEAD(&ep->queue);
1453 ep->ep.name = fusb300_ep_name[i]; 1453 ep->ep.name = fusb300_ep_name[i];
1454 ep->ep.ops = &fusb300_ep_ops; 1454 ep->ep.ops = &fusb300_ep_ops;
1455 ep->ep.maxpacket = HS_BULK_MAX_PACKET_SIZE; 1455 usb_ep_set_maxpacket_limit(&ep->ep, HS_BULK_MAX_PACKET_SIZE);
1456 } 1456 }
1457 fusb300->ep[0]->ep.maxpacket = HS_CTL_MAX_PACKET_SIZE; 1457 usb_ep_set_maxpacket_limit(&fusb300->ep[0]->ep, HS_CTL_MAX_PACKET_SIZE);
1458 fusb300->ep[0]->epnum = 0; 1458 fusb300->ep[0]->epnum = 0;
1459 fusb300->gadget.ep0 = &fusb300->ep[0]->ep; 1459 fusb300->gadget.ep0 = &fusb300->ep[0]->ep;
1460 INIT_LIST_HEAD(&fusb300->gadget.ep0->ep_list); 1460 INIT_LIST_HEAD(&fusb300->gadget.ep0->ep_list);
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index 7eda9fd6528e..f66f3a7a35ef 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -231,7 +231,7 @@ static void ep_reset(struct goku_udc_regs __iomem *regs, struct goku_ep *ep)
231 } 231 }
232 } 232 }
233 233
234 ep->ep.maxpacket = MAX_FIFO_SIZE; 234 usb_ep_set_maxpacket_limit(&ep->ep, MAX_FIFO_SIZE);
235 ep->ep.desc = NULL; 235 ep->ep.desc = NULL;
236 ep->stopped = 1; 236 ep->stopped = 1;
237 ep->irqs = 0; 237 ep->irqs = 0;
@@ -1251,7 +1251,7 @@ static void udc_reinit (struct goku_udc *dev)
1251 } 1251 }
1252 1252
1253 dev->ep[0].reg_mode = NULL; 1253 dev->ep[0].reg_mode = NULL;
1254 dev->ep[0].ep.maxpacket = MAX_EP0_SIZE; 1254 usb_ep_set_maxpacket_limit(&dev->ep[0].ep, MAX_EP0_SIZE);
1255 list_del_init (&dev->ep[0].ep.ep_list); 1255 list_del_init (&dev->ep[0].ep.ep_list);
1256} 1256}
1257 1257
diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index 6a2a65aa0057..049ebab0d360 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -1449,7 +1449,7 @@ static void udc_reinit(struct lpc32xx_udc *udc)
1449 1449
1450 if (i != 0) 1450 if (i != 0)
1451 list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); 1451 list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
1452 ep->ep.maxpacket = ep->maxpacket; 1452 usb_ep_set_maxpacket_limit(&ep->ep, ep->maxpacket);
1453 INIT_LIST_HEAD(&ep->queue); 1453 INIT_LIST_HEAD(&ep->queue);
1454 ep->req_pending = 0; 1454 ep->req_pending = 0;
1455 } 1455 }
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index d5f050d30edf..8cae01d88597 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1647,9 +1647,9 @@ static int __init m66592_probe(struct platform_device *pdev)
1647 INIT_LIST_HEAD(&ep->queue); 1647 INIT_LIST_HEAD(&ep->queue);
1648 ep->ep.name = m66592_ep_name[i]; 1648 ep->ep.name = m66592_ep_name[i];
1649 ep->ep.ops = &m66592_ep_ops; 1649 ep->ep.ops = &m66592_ep_ops;
1650 ep->ep.maxpacket = 512; 1650 usb_ep_set_maxpacket_limit(&ep->ep, 512);
1651 } 1651 }
1652 m66592->ep[0].ep.maxpacket = 64; 1652 usb_ep_set_maxpacket_limit(&m66592->ep[0].ep, 64);
1653 m66592->ep[0].pipenum = 0; 1653 m66592->ep[0].pipenum = 0;
1654 m66592->ep[0].fifoaddr = M66592_CFIFO; 1654 m66592->ep[0].fifoaddr = M66592_CFIFO;
1655 m66592->ep[0].fifosel = M66592_CFIFOSEL; 1655 m66592->ep[0].fifosel = M66592_CFIFOSEL;
diff --git a/drivers/usb/gadget/mv_u3d_core.c b/drivers/usb/gadget/mv_u3d_core.c
index 234711eabea1..9fe31d7dded6 100644
--- a/drivers/usb/gadget/mv_u3d_core.c
+++ b/drivers/usb/gadget/mv_u3d_core.c
@@ -1336,7 +1336,7 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d)
1336 ep->ep.name = ep->name; 1336 ep->ep.name = ep->name;
1337 ep->ep.ops = &mv_u3d_ep_ops; 1337 ep->ep.ops = &mv_u3d_ep_ops;
1338 ep->wedge = 0; 1338 ep->wedge = 0;
1339 ep->ep.maxpacket = MV_U3D_EP0_MAX_PKT_SIZE; 1339 usb_ep_set_maxpacket_limit(&ep->ep, MV_U3D_EP0_MAX_PKT_SIZE);
1340 ep->ep_num = 0; 1340 ep->ep_num = 0;
1341 ep->ep.desc = &mv_u3d_ep0_desc; 1341 ep->ep.desc = &mv_u3d_ep0_desc;
1342 INIT_LIST_HEAD(&ep->queue); 1342 INIT_LIST_HEAD(&ep->queue);
@@ -1361,7 +1361,7 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d)
1361 ep->ep.name = ep->name; 1361 ep->ep.name = ep->name;
1362 1362
1363 ep->ep.ops = &mv_u3d_ep_ops; 1363 ep->ep.ops = &mv_u3d_ep_ops;
1364 ep->ep.maxpacket = (unsigned short) ~0; 1364 usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
1365 ep->ep_num = i / 2; 1365 ep->ep_num = i / 2;
1366 1366
1367 INIT_LIST_HEAD(&ep->queue); 1367 INIT_LIST_HEAD(&ep->queue);
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index 104cdbea635a..d43ce95fc4bd 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -1261,7 +1261,7 @@ static int eps_init(struct mv_udc *udc)
1261 ep->ep.ops = &mv_ep_ops; 1261 ep->ep.ops = &mv_ep_ops;
1262 ep->wedge = 0; 1262 ep->wedge = 0;
1263 ep->stopped = 0; 1263 ep->stopped = 0;
1264 ep->ep.maxpacket = EP0_MAX_PKT_SIZE; 1264 usb_ep_set_maxpacket_limit(&ep->ep, EP0_MAX_PKT_SIZE);
1265 ep->ep_num = 0; 1265 ep->ep_num = 0;
1266 ep->ep.desc = &mv_ep0_desc; 1266 ep->ep.desc = &mv_ep0_desc;
1267 INIT_LIST_HEAD(&ep->queue); 1267 INIT_LIST_HEAD(&ep->queue);
@@ -1284,7 +1284,7 @@ static int eps_init(struct mv_udc *udc)
1284 1284
1285 ep->ep.ops = &mv_ep_ops; 1285 ep->ep.ops = &mv_ep_ops;
1286 ep->stopped = 0; 1286 ep->stopped = 0;
1287 ep->ep.maxpacket = (unsigned short) ~0; 1287 usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
1288 ep->ep_num = i / 2; 1288 ep->ep_num = i / 2;
1289 1289
1290 INIT_LIST_HEAD(&ep->queue); 1290 INIT_LIST_HEAD(&ep->queue);
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c
index bf2bb39f35a2..ca15405583e2 100644
--- a/drivers/usb/gadget/net2272.c
+++ b/drivers/usb/gadget/net2272.c
@@ -266,7 +266,7 @@ static void net2272_ep_reset(struct net2272_ep *ep)
266 ep->desc = NULL; 266 ep->desc = NULL;
267 INIT_LIST_HEAD(&ep->queue); 267 INIT_LIST_HEAD(&ep->queue);
268 268
269 ep->ep.maxpacket = ~0; 269 usb_ep_set_maxpacket_limit(&ep->ep, ~0);
270 ep->ep.ops = &net2272_ep_ops; 270 ep->ep.ops = &net2272_ep_ops;
271 271
272 /* disable irqs, endpoint */ 272 /* disable irqs, endpoint */
@@ -1409,7 +1409,7 @@ net2272_usb_reinit(struct net2272 *dev)
1409 ep->fifo_size = 64; 1409 ep->fifo_size = 64;
1410 net2272_ep_reset(ep); 1410 net2272_ep_reset(ep);
1411 } 1411 }
1412 dev->ep[0].ep.maxpacket = 64; 1412 usb_ep_set_maxpacket_limit(&dev->ep[0].ep, 64);
1413 1413
1414 dev->gadget.ep0 = &dev->ep[0].ep; 1414 dev->gadget.ep0 = &dev->ep[0].ep;
1415 dev->ep[0].stopped = 0; 1415 dev->ep[0].stopped = 0;
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index fc852177c087..43e5e2f9888f 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -293,7 +293,7 @@ static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep)
293 ep->desc = NULL; 293 ep->desc = NULL;
294 INIT_LIST_HEAD (&ep->queue); 294 INIT_LIST_HEAD (&ep->queue);
295 295
296 ep->ep.maxpacket = ~0; 296 usb_ep_set_maxpacket_limit(&ep->ep, ~0);
297 ep->ep.ops = &net2280_ep_ops; 297 ep->ep.ops = &net2280_ep_ops;
298 298
299 /* disable the dma, irqs, endpoint... */ 299 /* disable the dma, irqs, endpoint... */
@@ -1805,9 +1805,9 @@ static void usb_reinit (struct net2280 *dev)
1805 ep->regs = &dev->epregs [tmp]; 1805 ep->regs = &dev->epregs [tmp];
1806 ep_reset (dev->regs, ep); 1806 ep_reset (dev->regs, ep);
1807 } 1807 }
1808 dev->ep [0].ep.maxpacket = 64; 1808 usb_ep_set_maxpacket_limit(&dev->ep [0].ep, 64);
1809 dev->ep [5].ep.maxpacket = 64; 1809 usb_ep_set_maxpacket_limit(&dev->ep [5].ep, 64);
1810 dev->ep [6].ep.maxpacket = 64; 1810 usb_ep_set_maxpacket_limit(&dev->ep [6].ep, 64);
1811 1811
1812 dev->gadget.ep0 = &dev->ep [0].ep; 1812 dev->gadget.ep0 = &dev->ep [0].ep;
1813 dev->ep [0].stopped = 0; 1813 dev->ep [0].stopped = 0;
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 83957cc225d9..34bd713065c5 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2586,7 +2586,8 @@ omap_ep_setup(char *name, u8 addr, u8 type,
2586 2586
2587 ep->ep.name = ep->name; 2587 ep->ep.name = ep->name;
2588 ep->ep.ops = &omap_ep_ops; 2588 ep->ep.ops = &omap_ep_ops;
2589 ep->ep.maxpacket = ep->maxpacket = maxp; 2589 ep->maxpacket = maxp;
2590 usb_ep_set_maxpacket_limit(&ep->ep, ep->maxpacket);
2590 list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); 2591 list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
2591 2592
2592 return buf; 2593 return buf;
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
index 78a3d9289816..eb8c3bedb57a 100644
--- a/drivers/usb/gadget/pch_udc.c
+++ b/drivers/usb/gadget/pch_udc.c
@@ -2896,12 +2896,12 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev)
2896 ep->offset_addr = (UDC_EPINT_OUT_SHIFT + ep->num) * 2896 ep->offset_addr = (UDC_EPINT_OUT_SHIFT + ep->num) *
2897 UDC_EP_REG_SHIFT; 2897 UDC_EP_REG_SHIFT;
2898 /* need to set ep->ep.maxpacket and set Default Configuration?*/ 2898 /* need to set ep->ep.maxpacket and set Default Configuration?*/
2899 ep->ep.maxpacket = UDC_BULK_MAX_PKT_SIZE; 2899 usb_ep_set_maxpacket_limit(&ep->ep, UDC_BULK_MAX_PKT_SIZE);
2900 list_add_tail(&ep->ep.ep_list, &dev->gadget.ep_list); 2900 list_add_tail(&ep->ep.ep_list, &dev->gadget.ep_list);
2901 INIT_LIST_HEAD(&ep->queue); 2901 INIT_LIST_HEAD(&ep->queue);
2902 } 2902 }
2903 dev->ep[UDC_EP0IN_IDX].ep.maxpacket = UDC_EP0IN_MAX_PKT_SIZE; 2903 usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0IN_IDX].ep, UDC_EP0IN_MAX_PKT_SIZE);
2904 dev->ep[UDC_EP0OUT_IDX].ep.maxpacket = UDC_EP0OUT_MAX_PKT_SIZE; 2904 usb_ep_set_maxpacket_limit(&dev->ep[UDC_EP0OUT_IDX].ep, UDC_EP0OUT_MAX_PKT_SIZE);
2905 2905
2906 /* remove ep0 in and out from the list. They have own pointer */ 2906 /* remove ep0 in and out from the list. They have own pointer */
2907 list_del_init(&dev->ep[UDC_EP0IN_IDX].ep.ep_list); 2907 list_del_init(&dev->ep[UDC_EP0IN_IDX].ep.ep_list);
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 0ac6064aa3b8..5b4f43730d8b 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -1193,6 +1193,7 @@ static void udc_reinit(struct pxa25x_udc *dev)
1193 ep->stopped = 0; 1193 ep->stopped = 0;
1194 INIT_LIST_HEAD (&ep->queue); 1194 INIT_LIST_HEAD (&ep->queue);
1195 ep->pio_irqs = 0; 1195 ep->pio_irqs = 0;
1196 usb_ep_set_maxpacket_limit(&ep->ep, ep->ep.maxpacket);
1196 } 1197 }
1197 1198
1198 /* the rest was statically initialized, and is read-only */ 1199 /* the rest was statically initialized, and is read-only */
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 3c97da7760da..cdf4d678be96 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1737,9 +1737,12 @@ static void udc_init_data(struct pxa_udc *dev)
1737 } 1737 }
1738 1738
1739 /* USB endpoints init */ 1739 /* USB endpoints init */
1740 for (i = 1; i < NR_USB_ENDPOINTS; i++) 1740 for (i = 1; i < NR_USB_ENDPOINTS; i++) {
1741 list_add_tail(&dev->udc_usb_ep[i].usb_ep.ep_list, 1741 list_add_tail(&dev->udc_usb_ep[i].usb_ep.ep_list,
1742 &dev->gadget.ep_list); 1742 &dev->gadget.ep_list);
1743 usb_ep_set_maxpacket_limit(&dev->udc_usb_ep[i].usb_ep,
1744 dev->udc_usb_ep[i].usb_ep.maxpacket);
1745 }
1743} 1746}
1744 1747
1745/** 1748/**
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 47287518bff3..aff0a6718bc6 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1964,9 +1964,9 @@ static int __init r8a66597_probe(struct platform_device *pdev)
1964 INIT_LIST_HEAD(&ep->queue); 1964 INIT_LIST_HEAD(&ep->queue);
1965 ep->ep.name = r8a66597_ep_name[i]; 1965 ep->ep.name = r8a66597_ep_name[i];
1966 ep->ep.ops = &r8a66597_ep_ops; 1966 ep->ep.ops = &r8a66597_ep_ops;
1967 ep->ep.maxpacket = 512; 1967 usb_ep_set_maxpacket_limit(&ep->ep, 512);
1968 } 1968 }
1969 r8a66597->ep[0].ep.maxpacket = 64; 1969 usb_ep_set_maxpacket_limit(&r8a66597->ep[0].ep, 64);
1970 r8a66597->ep[0].pipenum = 0; 1970 r8a66597->ep[0].pipenum = 0;
1971 r8a66597->ep[0].fifoaddr = CFIFO; 1971 r8a66597->ep[0].fifoaddr = CFIFO;
1972 r8a66597->ep[0].fifosel = CFIFOSEL; 1972 r8a66597->ep[0].fifosel = CFIFOSEL;
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 6c80bfcefa87..50df18d1f1cf 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -3150,7 +3150,7 @@ static void s3c_hsotg_initep(struct s3c_hsotg *hsotg,
3150 3150
3151 hs_ep->parent = hsotg; 3151 hs_ep->parent = hsotg;
3152 hs_ep->ep.name = hs_ep->name; 3152 hs_ep->ep.name = hs_ep->name;
3153 hs_ep->ep.maxpacket = epnum ? 1024 : EP0_MPS_LIMIT; 3153 usb_ep_set_maxpacket_limit(&hs_ep->ep, epnum ? 1024 : EP0_MPS_LIMIT);
3154 hs_ep->ep.ops = &s3c_hsotg_ep_ops; 3154 hs_ep->ep.ops = &s3c_hsotg_ep_ops;
3155 3155
3156 /* 3156 /*
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c
index 1a1a41498db2..ea4bbfe72ec0 100644
--- a/drivers/usb/gadget/s3c-hsudc.c
+++ b/drivers/usb/gadget/s3c-hsudc.c
@@ -999,7 +999,7 @@ static void s3c_hsudc_initep(struct s3c_hsudc *hsudc,
999 999
1000 hsep->dev = hsudc; 1000 hsep->dev = hsudc;
1001 hsep->ep.name = hsep->name; 1001 hsep->ep.name = hsep->name;
1002 hsep->ep.maxpacket = epnum ? 512 : 64; 1002 usb_ep_set_maxpacket_limit(&hsep->ep, epnum ? 512 : 64);
1003 hsep->ep.ops = &s3c_hsudc_ep_ops; 1003 hsep->ep.ops = &s3c_hsudc_ep_ops;
1004 hsep->fifo = hsudc->regs + S3C_BR(epnum); 1004 hsep->fifo = hsudc->regs + S3C_BR(epnum);
1005 hsep->ep.desc = NULL; 1005 hsep->ep.desc = NULL;
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index c72d810e6b36..f04b2c3154de 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -1629,6 +1629,7 @@ static void s3c2410_udc_reinit(struct s3c2410_udc *dev)
1629 ep->ep.desc = NULL; 1629 ep->ep.desc = NULL;
1630 ep->halted = 0; 1630 ep->halted = 0;
1631 INIT_LIST_HEAD(&ep->queue); 1631 INIT_LIST_HEAD(&ep->queue);
1632 usb_ep_set_maxpacket_limit(&ep->ep, &ep->ep.maxpacket);
1632 } 1633 }
1633} 1634}
1634 1635
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index d2d3a173b315..76f007654821 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1727,14 +1727,14 @@ init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in)
1727 ep->end_point.name = ep->name; 1727 ep->end_point.name = ep->name;
1728 INIT_LIST_HEAD(&ep->end_point.ep_list); 1728 INIT_LIST_HEAD(&ep->end_point.ep_list);
1729 if (!epnum) { 1729 if (!epnum) {
1730 ep->end_point.maxpacket = 64; 1730 usb_ep_set_maxpacket_limit(&ep->end_point, 64);
1731 ep->end_point.ops = &musb_g_ep0_ops; 1731 ep->end_point.ops = &musb_g_ep0_ops;
1732 musb->g.ep0 = &ep->end_point; 1732 musb->g.ep0 = &ep->end_point;
1733 } else { 1733 } else {
1734 if (is_in) 1734 if (is_in)
1735 ep->end_point.maxpacket = hw_ep->max_packet_sz_tx; 1735 usb_ep_set_maxpacket_limit(&ep->end_point, hw_ep->max_packet_sz_tx);
1736 else 1736 else
1737 ep->end_point.maxpacket = hw_ep->max_packet_sz_rx; 1737 usb_ep_set_maxpacket_limit(&ep->end_point, hw_ep->max_packet_sz_rx);
1738 ep->end_point.ops = &musb_ep_ops; 1738 ep->end_point.ops = &musb_ep_ops;
1739 list_add_tail(&ep->end_point.ep_list, &musb->g.ep_list); 1739 list_add_tail(&ep->end_point.ep_list, &musb->g.ep_list);
1740 } 1740 }
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 3385aeb5a364..458f3766bef1 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -987,11 +987,11 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
987 /* init DCP */ 987 /* init DCP */
988 if (usbhsg_is_dcp(uep)) { 988 if (usbhsg_is_dcp(uep)) {
989 gpriv->gadget.ep0 = &uep->ep; 989 gpriv->gadget.ep0 = &uep->ep;
990 uep->ep.maxpacket = 64; 990 usb_ep_set_maxpacket_limit(&uep->ep, 64);
991 } 991 }
992 /* init normal pipe */ 992 /* init normal pipe */
993 else { 993 else {
994 uep->ep.maxpacket = 512; 994 usb_ep_set_maxpacket_limit(&uep->ep, 512);
995 list_add_tail(&uep->ep.ep_list, &gpriv->gadget.ep_list); 995 list_add_tail(&uep->ep.ep_list, &gpriv->gadget.ep_list);
996 } 996 }
997 } 997 }
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index cae8a6216551..c3a61853cd13 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -148,6 +148,9 @@ struct usb_ep_ops {
148 * @maxpacket:The maximum packet size used on this endpoint. The initial 148 * @maxpacket:The maximum packet size used on this endpoint. The initial
149 * value can sometimes be reduced (hardware allowing), according to 149 * value can sometimes be reduced (hardware allowing), according to
150 * the endpoint descriptor used to configure the endpoint. 150 * the endpoint descriptor used to configure the endpoint.
151 * @maxpacket_limit:The maximum packet size value which can be handled by this
152 * endpoint. It's set once by UDC driver when endpoint is initialized, and
153 * should not be changed. Should not be confused with maxpacket.
151 * @max_streams: The maximum number of streams supported 154 * @max_streams: The maximum number of streams supported
152 * by this EP (0 - 16, actual number is 2^n) 155 * by this EP (0 - 16, actual number is 2^n)
153 * @mult: multiplier, 'mult' value for SS Isoc EPs 156 * @mult: multiplier, 'mult' value for SS Isoc EPs
@@ -171,6 +174,7 @@ struct usb_ep {
171 const struct usb_ep_ops *ops; 174 const struct usb_ep_ops *ops;
172 struct list_head ep_list; 175 struct list_head ep_list;
173 unsigned maxpacket:16; 176 unsigned maxpacket:16;
177 unsigned maxpacket_limit:16;
174 unsigned max_streams:16; 178 unsigned max_streams:16;
175 unsigned mult:2; 179 unsigned mult:2;
176 unsigned maxburst:5; 180 unsigned maxburst:5;
@@ -182,6 +186,21 @@ struct usb_ep {
182/*-------------------------------------------------------------------------*/ 186/*-------------------------------------------------------------------------*/
183 187
184/** 188/**
189 * usb_ep_set_maxpacket_limit - set maximum packet size limit for endpoint
190 * @ep:the endpoint being configured
191 * @maxpacket_limit:value of maximum packet size limit
192 *
193 * This function shoud be used only in UDC drivers to initialize endpoint
194 * (usually in probe function).
195 */
196static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep,
197 unsigned maxpacket_limit)
198{
199 ep->maxpacket_limit = maxpacket_limit;
200 ep->maxpacket = maxpacket_limit;
201}
202
203/**
185 * usb_ep_enable - configure endpoint, making it usable 204 * usb_ep_enable - configure endpoint, making it usable
186 * @ep:the endpoint being configured. may not be the endpoint named "ep0". 205 * @ep:the endpoint being configured. may not be the endpoint named "ep0".
187 * drivers discover endpoints through the ep_list of a usb_gadget. 206 * drivers discover endpoints through the ep_list of a usb_gadget.