提交 fe659bcc 编写于 作者: A Alan Stern 提交者: Felipe Balbi

USB: dummy-hcd: fix connection failures (wrong speed)

The dummy-hcd UDC driver is not careful about the way it handles
connection speeds.  It ignores the module parameter that is supposed
to govern the maximum connection speed and it doesn't set the HCD
flags properly for the case where it ends up running at full speed.

The result is that in many cases, gadget enumeration over dummy-hcd
fails because the bMaxPacketSize byte in the device descriptor is set
incorrectly.  For example, the default settings call for a high-speed
connection, but the maxpacket value for ep0 ends up being set for a
Super-Speed connection.

This patch fixes the problem by initializing the gadget's max_speed
and the HCD flags correctly.
Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
上级 8fec9355
...@@ -1036,7 +1036,12 @@ static int dummy_udc_probe(struct platform_device *pdev) ...@@ -1036,7 +1036,12 @@ static int dummy_udc_probe(struct platform_device *pdev)
memzero_explicit(&dum->gadget, sizeof(struct usb_gadget)); memzero_explicit(&dum->gadget, sizeof(struct usb_gadget));
dum->gadget.name = gadget_name; dum->gadget.name = gadget_name;
dum->gadget.ops = &dummy_ops; dum->gadget.ops = &dummy_ops;
dum->gadget.max_speed = USB_SPEED_SUPER; if (mod_data.is_super_speed)
dum->gadget.max_speed = USB_SPEED_SUPER;
else if (mod_data.is_high_speed)
dum->gadget.max_speed = USB_SPEED_HIGH;
else
dum->gadget.max_speed = USB_SPEED_FULL;
dum->gadget.dev.parent = &pdev->dev; dum->gadget.dev.parent = &pdev->dev;
init_dummy_udc_hw(dum); init_dummy_udc_hw(dum);
...@@ -2560,8 +2565,6 @@ static struct hc_driver dummy_hcd = { ...@@ -2560,8 +2565,6 @@ static struct hc_driver dummy_hcd = {
.product_desc = "Dummy host controller", .product_desc = "Dummy host controller",
.hcd_priv_size = sizeof(struct dummy_hcd), .hcd_priv_size = sizeof(struct dummy_hcd),
.flags = HCD_USB3 | HCD_SHARED,
.reset = dummy_setup, .reset = dummy_setup,
.start = dummy_start, .start = dummy_start,
.stop = dummy_stop, .stop = dummy_stop,
...@@ -2590,8 +2593,12 @@ static int dummy_hcd_probe(struct platform_device *pdev) ...@@ -2590,8 +2593,12 @@ static int dummy_hcd_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); dev_info(&pdev->dev, "%s, driver " DRIVER_VERSION "\n", driver_desc);
dum = *((void **)dev_get_platdata(&pdev->dev)); dum = *((void **)dev_get_platdata(&pdev->dev));
if (!mod_data.is_super_speed) if (mod_data.is_super_speed)
dummy_hcd.flags = HCD_USB3 | HCD_SHARED;
else if (mod_data.is_high_speed)
dummy_hcd.flags = HCD_USB2; dummy_hcd.flags = HCD_USB2;
else
dummy_hcd.flags = HCD_USB11;
hs_hcd = usb_create_hcd(&dummy_hcd, &pdev->dev, dev_name(&pdev->dev)); hs_hcd = usb_create_hcd(&dummy_hcd, &pdev->dev, dev_name(&pdev->dev));
if (!hs_hcd) if (!hs_hcd)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册