usb: xhci: Error enumerating USB TV Tuner
Subsystems (2)
PATCH 1/1 usb: xhci: Error enumerating USB TV Tuner
Unable to complete the enumeration of a USB TV Tuner device.
Per XHCI spec (4.6.5), the EP state field of the input context shall be cleared for a set address command. In the special case of an FS device that has "MaxPacketSize0 = 8", the Linux XHCI driver does not do this before evaluating the context. With an XHCI controller that checks the EP state field for parameter context error this causes a problem in cases such as the device getting reset again after enumeration.
When that field is cleared, the problem does not occur.
This was found and fixed by Sasi Kumar.
--- drivers/usb/host/xhci.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/xhci.c +1 -0
@@ -1428,6 +1428,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, xhci->devs[slot_id]->out_ctx, ep_index); ep_ctx =xhci_get_ep_ctx (xhci, command->in_ctx, ep_index); + ep_ctx->ep_info &=cpu_to_le32 (~EP_STATE_MASK );/* must clear */ ep_ctx->ep_info2 &=cpu_to_le32 (~MAX_PACKET_MASK ); ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet_size));
Signature · 1 line
2.17.1
Quoted 25 lines · Al Cooper
Unable to complete the enumeration of a USB TV Tuner device.
Per XHCI spec (4.6.5), the EP state field of the input context shall be cleared for a set address command. In the special case of an FS device that has "MaxPacketSize0 = 8", the Linux XHCI driver does not do this before evaluating the context. With an XHCI controller that checks the EP state field for parameter context error this causes a problem in cases such as the device getting reset again after enumeration.
When that field is cleared, the problem does not occur.
This was found and fixed by Sasi Kumar.
Signed-off-by Al Cooper <[email protected]>--- drivers/usb/host/xhci.c | 1 + 1 file changed, 1 insertion(+)drivers/usb/host/xhci.c +0
-0
drivers/usb/host/xhci.c static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, · line 1434
Quoted 7 lines
drivers/usb/host/xhci.c +1
-0@@ -1428,6 +1428,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, xhci->devs[slot_id]->out_ctx, ep_index); ep_ctx =xhci_get_ep_ctx (xhci, command->in_ctx, ep_index); + ep_ctx->ep_info &=cpu_to_le32 (~EP_STATE_MASK );/* must clear */ ep_ctx->ep_info2 &=cpu_to_le32 (~MAX_PACKET_MASK ); ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet_size));
Thanks, nice catch.
If you agree I'd like to change the the subject of this patch to something like:
"xhci: Fix enumeration issue when setting actual max packet size for FS devices"
While looking at this it seems that the current EP_STATE_MASK is not correct either. It should be 0x7 instead of 0xf.
-Mathias
Agree on both points.
Should I re-send a v2?
Thanks
Al
Quoted 44 lines · Mathias Nyman
Quoted 25 lines · Al Cooper
Unable to complete the enumeration of a USB TV Tuner device.
Per XHCI spec (4.6.5), the EP state field of the input context shall be cleared for a set address command. In the special case of an FS device that has "MaxPacketSize0 = 8", the Linux XHCI driver does not do this before evaluating the context. With an XHCI controller that checks the EP state field for parameter context error this causes a problem in cases such as the device getting reset again after enumeration.
When that field is cleared, the problem does not occur.
This was found and fixed by Sasi Kumar.
Signed-off-by Al Cooper <[email protected]>--- drivers/usb/host/xhci.c | 1 + 1 file changed, 1 insertion(+)drivers/usb/host/xhci.c +0
-0drivers/usb/host/xhci.c static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, · line 1434
Quoted 7 lines
drivers/usb/host/xhci.c +1
-0@@ -1428,6 +1428,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, xhci->devs[slot_id]->out_ctx, ep_index); ep_ctx =xhci_get_ep_ctx (xhci, command->in_ctx, ep_index); + ep_ctx->ep_info &=cpu_to_le32 (~EP_STATE_MASK );/* must clear */ ep_ctx->ep_info2 &=cpu_to_le32 (~MAX_PACKET_MASK ); ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet_size));Thanks, nice catch.
If you agree I'd like to change the the subject of this patch to something like:
"xhci: Fix enumeration issue when setting actual max packet size for FS devices"While looking at this it seems that the current
EP_STATE_MASKis not correct either. It should be0x7instead of0xf.-Mathias
Quoted 42 lines · Alan Cooper
Quoted 40 lines · Mathias Nyman
Quoted 25 lines · Al Cooper
Unable to complete the enumeration of a USB TV Tuner device.
Per XHCI spec (4.6.5), the EP state field of the input context shall be cleared for a set address command. In the special case of an FS device that has "MaxPacketSize0 = 8", the Linux XHCI driver does not do this before evaluating the context. With an XHCI controller that checks the EP state field for parameter context error this causes a problem in cases such as the device getting reset again after enumeration.
When that field is cleared, the problem does not occur.
This was found and fixed by Sasi Kumar.
Signed-off-by Al Cooper <[email protected]>--- drivers/usb/host/xhci.c | 1 + 1 file changed, 1 insertion(+)drivers/usb/host/xhci.c +0
-0drivers/usb/host/xhci.c static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, · line 1434
Quoted 7 lines
drivers/usb/host/xhci.c +1
-0@@ -1428,6 +1428,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, xhci->devs[slot_id]->out_ctx, ep_index); ep_ctx =xhci_get_ep_ctx (xhci, command->in_ctx, ep_index); + ep_ctx->ep_info &=cpu_to_le32 (~EP_STATE_MASK );/* must clear */ ep_ctx->ep_info2 &=cpu_to_le32 (~MAX_PACKET_MASK ); ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet_size));Thanks, nice catch.
If you agree I'd like to change the the subject of this patch to something like:
"xhci: Fix enumeration issue when setting actual max packet size for FS devices"
Quoted 7 lines
Quoted 3 lines
While looking at this it seems that the current
EP_STATE_MASKis not correct either. It should be0x7instead of0xf.Agree on both points.
Should I re-send a v2?
No need, I can make those changes
-Mathias
Thanks!
Al
Quoted 55 lines · Mathias Nyman
Quoted 42 lines · Alan Cooper
Quoted 40 lines · Mathias Nyman
Quoted 25 lines · Al Cooper
Unable to complete the enumeration of a USB TV Tuner device.
Per XHCI spec (4.6.5), the EP state field of the input context shall be cleared for a set address command. In the special case of an FS device that has "MaxPacketSize0 = 8", the Linux XHCI driver does not do this before evaluating the context. With an XHCI controller that checks the EP state field for parameter context error this causes a problem in cases such as the device getting reset again after enumeration.
When that field is cleared, the problem does not occur.
This was found and fixed by Sasi Kumar.
Signed-off-by Al Cooper <[email protected]>--- drivers/usb/host/xhci.c | 1 + 1 file changed, 1 insertion(+)drivers/usb/host/xhci.c +0
-0drivers/usb/host/xhci.c static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, · line 1434
Quoted 7 lines
drivers/usb/host/xhci.c +1
-0@@ -1428,6 +1428,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, xhci->devs[slot_id]->out_ctx, ep_index); ep_ctx =xhci_get_ep_ctx (xhci, command->in_ctx, ep_index); + ep_ctx->ep_info &=cpu_to_le32 (~EP_STATE_MASK );/* must clear */ ep_ctx->ep_info2 &=cpu_to_le32 (~MAX_PACKET_MASK ); ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet_size));Thanks, nice catch.
If you agree I'd like to change the the subject of this patch to something like:
"xhci: Fix enumeration issue when setting actual max packet size for FS devices"Quoted 7 lines
Quoted 3 lines
While looking at this it seems that the current
EP_STATE_MASKis not correct either. It should be0x7instead of0xf.Agree on both points.
Should I re-send a v2?No need, I can make those changes
-Mathias