devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] usb: xhci: fix interrupt transfer error happened on MTK platforms
@ 2018-09-07  7:29 Chunfeng Yun
  2018-09-07  7:42 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Chunfeng Yun @ 2018-09-07  7:29 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Greg Kroah-Hartman, Felipe Balbi, Matthias Brugger, Chunfeng Yun,
	Sean Wang, linux-usb, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, stable

The MTK xHCI controller use some reserved bytes in endpoint context for
bandwidth scheduling, so need keep them in xhci_endpoint_copy();

The issue is introduced by:
commit f5249461b504 ("xhci: Clear the host side toggle manually when
endpoint is soft reset")
It resets endpoints and will drop bandwidth scheduling parameters used
by interrupt or isochronous endpoints on MTK xHCI controller.
Fixes: f5249461b504 ("xhci: Clear the host side toggle manually when
endpoint is soft reset")

Cc: stable@vger.kernel.org
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Tested-by: Sean Wang <sean.wang@mediatek.com>
---
v2: add fix tag, Cc and Tested-by
---
 drivers/usb/host/xhci-mem.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index ef350c3..b1f27aa 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1613,6 +1613,10 @@ void xhci_endpoint_copy(struct xhci_hcd *xhci,
 	in_ep_ctx->ep_info2 = out_ep_ctx->ep_info2;
 	in_ep_ctx->deq = out_ep_ctx->deq;
 	in_ep_ctx->tx_info = out_ep_ctx->tx_info;
+	if (xhci->quirks & XHCI_MTK_HOST) {
+		in_ep_ctx->reserved[0] = out_ep_ctx->reserved[0];
+		in_ep_ctx->reserved[1] = out_ep_ctx->reserved[1];
+	}
 }
 
 /* Copy output xhci_slot_ctx to the input xhci_slot_ctx.
-- 
1.9.1

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

* Re: [PATCH v2] usb: xhci: fix interrupt transfer error happened on MTK platforms
  2018-09-07  7:29 [PATCH v2] usb: xhci: fix interrupt transfer error happened on MTK platforms Chunfeng Yun
@ 2018-09-07  7:42 ` Greg Kroah-Hartman
  2018-09-07  8:43   ` Chunfeng Yun
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2018-09-07  7:42 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Mathias Nyman, Felipe Balbi, Matthias Brugger, Sean Wang,
	linux-usb, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, stable

On Fri, Sep 07, 2018 at 03:29:12PM +0800, Chunfeng Yun wrote:
> The MTK xHCI controller use some reserved bytes in endpoint context for
> bandwidth scheduling, so need keep them in xhci_endpoint_copy();

If they are "reserved" shouldn't they be properly named?  And by using
reserved bytes, isn't that a spec violation?

thanks,

greg k-h

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

* Re: [PATCH v2] usb: xhci: fix interrupt transfer error happened on MTK platforms
  2018-09-07  7:42 ` Greg Kroah-Hartman
@ 2018-09-07  8:43   ` Chunfeng Yun
  2018-09-07  8:56     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Chunfeng Yun @ 2018-09-07  8:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mathias Nyman, Felipe Balbi, Matthias Brugger, Sean Wang,
	linux-usb, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, stable

Hi,

On Fri, 2018-09-07 at 09:42 +0200, Greg Kroah-Hartman wrote:
> On Fri, Sep 07, 2018 at 03:29:12PM +0800, Chunfeng Yun wrote:
> > The MTK xHCI controller use some reserved bytes in endpoint context for
> > bandwidth scheduling, so need keep them in xhci_endpoint_copy();
> 
> If they are "reserved" shouldn't they be properly named?  And by using
> reserved bytes, isn't that a spec violation?
It indeed violates the spec, "they shall be treated by system software
as Reserved and Opaque", and it's a quirk of the MTK xHCI controller.

> 
> thanks,
> 
> greg k-h

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

* Re: [PATCH v2] usb: xhci: fix interrupt transfer error happened on MTK platforms
  2018-09-07  8:43   ` Chunfeng Yun
@ 2018-09-07  8:56     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2018-09-07  8:56 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Mathias Nyman, Felipe Balbi, Matthias Brugger, Sean Wang,
	linux-usb, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, stable

On Fri, Sep 07, 2018 at 04:43:46PM +0800, Chunfeng Yun wrote:
> Hi,
> 
> On Fri, 2018-09-07 at 09:42 +0200, Greg Kroah-Hartman wrote:
> > On Fri, Sep 07, 2018 at 03:29:12PM +0800, Chunfeng Yun wrote:
> > > The MTK xHCI controller use some reserved bytes in endpoint context for
> > > bandwidth scheduling, so need keep them in xhci_endpoint_copy();
> > 
> > If they are "reserved" shouldn't they be properly named?  And by using
> > reserved bytes, isn't that a spec violation?
> It indeed violates the spec, "they shall be treated by system software
> as Reserved and Opaque", and it's a quirk of the MTK xHCI controller.

So as the "system software" here, we should just ignore them otherwise
we violate the spec?  :)

Anyway, that's fine, no objection from me for the patch, thanks.

greg k-h

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

end of thread, other threads:[~2018-09-07  8:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-07  7:29 [PATCH v2] usb: xhci: fix interrupt transfer error happened on MTK platforms Chunfeng Yun
2018-09-07  7:42 ` Greg Kroah-Hartman
2018-09-07  8:43   ` Chunfeng Yun
2018-09-07  8:56     ` Greg Kroah-Hartman

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).