summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattijs Korpershoek <[email protected]>2026-07-03 15:29:36 +0200
committerMattijs Korpershoek <[email protected]>2026-07-22 08:54:16 +0200
commit6f9c431a20627db34e0c41ea865c611f0d2c2016 (patch)
tree88935a545a81cc6202c1b7624df4249bd94d60d9
parent3caa8f42e1f657177780be5a445502cbb9181e43 (diff)
usb: gadget: dwc2: Use usb_ep_set_maxpacket_limit() for fifo sizes
More recent versions of usb_ep_autoconfig() use the maxpacket_limit field from struct usb_ep. This field has been introduced in the linux kernel via commit e117e742d310 ("usb: gadget: add "maxpacket_limit" field to struct usb_ep") And has been ported to U-Boot via commit 747a0a5b387f ("usb: dwc3: gadget: make dwc3 gadget build in uboot") However, the dwc2 gadget driver was not converted to use usb_ep_set_maxpacket_limit(). This is harmless for now, but the driver will break once usb_ep_autoconfig() is updated to a more recent version. Set maxpacket_limit via the recommended helper function to prepare for a core gadget update. Acked-by: Ilias Apalodimas <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mattijs Korpershoek <[email protected]>
-rw-r--r--drivers/usb/gadget/dwc2_udc_otg.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index e475b14b9ac..9c85383fd62 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -828,7 +828,6 @@ static struct dwc2_udc memory = {
.ep = {
.name = ep0name,
.ops = &dwc2_ep_ops,
- .maxpacket = EP0_FIFO_SIZE,
},
.dev = &memory,
@@ -843,7 +842,6 @@ static struct dwc2_udc memory = {
.ep = {
.name = "ep1in-bulk",
.ops = &dwc2_ep_ops,
- .maxpacket = EP_FIFO_SIZE,
},
.dev = &memory,
@@ -858,7 +856,6 @@ static struct dwc2_udc memory = {
.ep = {
.name = "ep2out-bulk",
.ops = &dwc2_ep_ops,
- .maxpacket = EP_FIFO_SIZE,
},
.dev = &memory,
@@ -873,7 +870,6 @@ static struct dwc2_udc memory = {
.ep = {
.name = "ep3in-int",
.ops = &dwc2_ep_ops,
- .maxpacket = EP_FIFO_SIZE,
},
.dev = &memory,
@@ -893,6 +889,7 @@ int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata)
{
struct dwc2_udc *dev = &memory;
int retval = 0;
+ int i;
debug("%s: %p\n", __func__, pdata);
@@ -909,6 +906,10 @@ int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata)
the_controller = dev;
+ usb_ep_set_maxpacket_limit(&dev->ep[0].ep, EP0_FIFO_SIZE);
+ for (i = 1; i < DWC2_MAX_ENDPOINTS; i++)
+ usb_ep_set_maxpacket_limit(&dev->ep[i].ep, EP_FIFO_SIZE);
+
usb_ctrl = memalign(CONFIG_SYS_CACHELINE_SIZE,
ROUND(sizeof(struct usb_ctrlrequest),
CONFIG_SYS_CACHELINE_SIZE));