Commit 0fb57599 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Greg Kroah-Hartman

usb: gadget: dummy_hcd: move ep initialisation HW setup

This is only required to be done once. There is no counter part to this
in ->stop() so there is no need to re-do it next time. While here also
init the max_stream size to 0 on SS speed.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 765f5b83
...@@ -887,25 +887,6 @@ static int dummy_udc_start(struct usb_gadget_driver *driver, ...@@ -887,25 +887,6 @@ static int dummy_udc_start(struct usb_gadget_driver *driver,
dum->devstatus = 0; dum->devstatus = 0;
INIT_LIST_HEAD (&dum->gadget.ep_list);
for (i = 0; i < DUMMY_ENDPOINTS; i++) {
struct dummy_ep *ep = &dum->ep [i];
if (!ep_name [i])
break;
ep->ep.name = ep_name [i];
ep->ep.ops = &dummy_ep_ops;
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;
ep->last_io = jiffies;
ep->gadget = &dum->gadget;
ep->desc = NULL;
INIT_LIST_HEAD (&ep->queue);
}
dum->gadget.ep0 = &dum->ep [0].ep;
if (mod_data.is_super_speed) if (mod_data.is_super_speed)
dum->gadget.speed = driver->speed; dum->gadget.speed = driver->speed;
else if (mod_data.is_high_speed) else if (mod_data.is_high_speed)
...@@ -922,8 +903,11 @@ static int dummy_udc_start(struct usb_gadget_driver *driver, ...@@ -922,8 +903,11 @@ static int dummy_udc_start(struct usb_gadget_driver *driver,
for (i = 0; i < DUMMY_ENDPOINTS; i++) for (i = 0; i < DUMMY_ENDPOINTS; i++)
dum->ep[i].ep.max_streams = 0x10; dum->ep[i].ep.max_streams = 0x10;
dum->ep[0].ep.maxpacket = 9; dum->ep[0].ep.maxpacket = 9;
} else } else {
for (i = 0; i < DUMMY_ENDPOINTS; i++)
dum->ep[i].ep.max_streams = 0;
dum->ep[0].ep.maxpacket = 64; dum->ep[0].ep.maxpacket = 64;
}
if (dum->gadget.speed == USB_SPEED_SUPER) if (dum->gadget.speed == USB_SPEED_SUPER)
dum->gadget.is_otg = dum->gadget.is_otg =
...@@ -932,9 +916,6 @@ static int dummy_udc_start(struct usb_gadget_driver *driver, ...@@ -932,9 +916,6 @@ static int dummy_udc_start(struct usb_gadget_driver *driver,
dum->gadget.is_otg = dum->gadget.is_otg =
(dummy_hcd_to_hcd(dum->hs_hcd)->self.otg_port != 0); (dummy_hcd_to_hcd(dum->hs_hcd)->self.otg_port != 0);
list_del_init (&dum->ep [0].ep.ep_list);
INIT_LIST_HEAD(&dum->fifo_req.queue);
driver->driver.bus = NULL; driver->driver.bus = NULL;
dum->driver = driver; dum->driver = driver;
dum->gadget.dev.driver = &driver->driver; dum->gadget.dev.driver = &driver->driver;
...@@ -984,6 +965,33 @@ dummy_gadget_release (struct device *dev) ...@@ -984,6 +965,33 @@ dummy_gadget_release (struct device *dev)
return; return;
} }
static void init_dummy_udc_hw(struct dummy *dum)
{
int i;
INIT_LIST_HEAD(&dum->gadget.ep_list);
for (i = 0; i < DUMMY_ENDPOINTS; i++) {
struct dummy_ep *ep = &dum->ep[i];
if (!ep_name[i])
break;
ep->ep.name = ep_name[i];
ep->ep.ops = &dummy_ep_ops;
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;
ep->last_io = jiffies;
ep->gadget = &dum->gadget;
ep->desc = NULL;
INIT_LIST_HEAD(&ep->queue);
}
dum->gadget.ep0 = &dum->ep[0].ep;
list_del_init(&dum->ep[0].ep.ep_list);
INIT_LIST_HEAD(&dum->fifo_req.queue);
}
static int dummy_udc_probe (struct platform_device *pdev) static int dummy_udc_probe (struct platform_device *pdev)
{ {
struct dummy *dum = &the_controller; struct dummy *dum = &the_controller;
...@@ -1002,6 +1010,8 @@ static int dummy_udc_probe (struct platform_device *pdev) ...@@ -1002,6 +1010,8 @@ static int dummy_udc_probe (struct platform_device *pdev)
return rc; return rc;
} }
init_dummy_udc_hw(dum);
rc = usb_add_gadget_udc(&pdev->dev, &dum->gadget); rc = usb_add_gadget_udc(&pdev->dev, &dum->gadget);
if (rc < 0) if (rc < 0)
goto err_udc; goto err_udc;
......
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