linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: fix config fail of FS hub behind a HS hub with MTT
@ 2015-12-03  6:14 Chunfeng Yun
  2015-12-04 12:06 ` Mathias Nyman
  0 siblings, 1 reply; 2+ messages in thread
From: Chunfeng Yun @ 2015-12-03  6:14 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Matthias Brugger, Felipe Balbi, Chunfeng Yun, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek, Daniel Kurtz,
	Sergei Shtylyov, Greg Kroah-Hartman

if a full speed hub connects to a high speed hub which
supports MTT, the MTT field of its slot context will be set
to 1 when xHCI driver setups an xHCI virtual device in
xhci_setup_addressable_virt_dev(); once usb core fetch its
hub descriptor, and need to update the xHC's internal data
structures for the device, the HUB field of its slot context
will be set to 1 too, meanwhile MTT is also set before,
this will cause configure endpoint command fail, so in the
case, we should clear MTT to 0 for full speed hub according
to section 6.2.2

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6cbcd1e..27c8cf8 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4785,8 +4785,16 @@ int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev,
 	ctrl_ctx->add_flags |= cpu_to_le32(SLOT_FLAG);
 	slot_ctx = xhci_get_slot_ctx(xhci, config_cmd->in_ctx);
 	slot_ctx->dev_info |= cpu_to_le32(DEV_HUB);
+	/*
+	 * refer to section 6.2.2: MTT should be 0 for full speed hub,
+	 * but it may be already set to 1 when setup an xHCI virtual
+	 * device, so clear it anyway.
+	 */
 	if (tt->multi)
 		slot_ctx->dev_info |= cpu_to_le32(DEV_MTT);
+	else if (hdev->speed == USB_SPEED_FULL)
+		slot_ctx->dev_info &= cpu_to_le32(~DEV_MTT);
+
 	if (xhci->hci_version > 0x95) {
 		xhci_dbg(xhci, "xHCI version %x needs hub "
 				"TT think time and number of ports\n",
-- 
1.8.1.1.dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: xhci: fix config fail of FS hub behind a HS hub with MTT
  2015-12-03  6:14 [PATCH] usb: xhci: fix config fail of FS hub behind a HS hub with MTT Chunfeng Yun
@ 2015-12-04 12:06 ` Mathias Nyman
  0 siblings, 0 replies; 2+ messages in thread
From: Mathias Nyman @ 2015-12-04 12:06 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Matthias Brugger, Felipe Balbi, linux-kernel, linux-arm-kernel,
	linux-usb, linux-mediatek, Daniel Kurtz, Sergei Shtylyov,
	Greg Kroah-Hartman

On 03.12.2015 08:14, Chunfeng Yun wrote:
> if a full speed hub connects to a high speed hub which
> supports MTT, the MTT field of its slot context will be set
> to 1 when xHCI driver setups an xHCI virtual device in
> xhci_setup_addressable_virt_dev(); once usb core fetch its
> hub descriptor, and need to update the xHC's internal data
> structures for the device, the HUB field of its slot context
> will be set to 1 too, meanwhile MTT is also set before,
> this will cause configure endpoint command fail, so in the
> case, we should clear MTT to 0 for full speed hub according
> to section 6.2.2
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---

Thanks, patch added to queue

-Mathias

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-04 12:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-03  6:14 [PATCH] usb: xhci: fix config fail of FS hub behind a HS hub with MTT Chunfeng Yun
2015-12-04 12:06 ` Mathias Nyman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).