linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Weber <rob@gnarbox.com>
To: Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: mathias.nyman@intel.com, linux-usb@vger.kernel.org
Subject: Re: xHCI Driver Compliance Test Support
Date: Mon, 24 Jun 2019 13:09:08 -0700	[thread overview]
Message-ID: <20190624200908.GA25232@coops> (raw)
In-Reply-To: <fc2609bc-2441-0293-1eca-3781af410414@linux.intel.com>

Hello,

On Mon, Jun 24, 2019 at 09:15:24AM +0300, Mathias Nyman wrote:
> On 19.6.2019 22.03, Rob Weber wrote:
> > I am working on running our custom USB dual-role product through some
> > compliance testing. It seems that the SoC and host controller are
> > not responding to the LFPS signaling and timeout that is supposed to
> > automatically begin the compliance test sequence.
> > 
> > I'm currently running a 4.9.115 kernel, and I'm afraid I might be
> > missing some critical patches for compliance test support. I noticed
> > these two patches came up in a google search:
> > 
> > https://patchwork.kernel.org/patch/10415345/
> > https://www.spinics.net/lists/linux-usb/msg160002.html
> > 
> > Besides these patches, is there anything else that comes to mind that I
> > might need to do to start compliance testing? I'm about to build a more
> > recent kernel to see if that improves my situation as well.
> 
> If xHC hw has a "Compliance Transition Capability" (CTC) bit set in the
> HCCPARAMS2 register then ports won't go to compliance unless software
> specifically allows it.
> 
> see xhci spec section 4.19.1.2.4.1 for more details.
> 
> Compliance can be allowed either with a SetPortFeature(PORT_LINK_STATE) request,
> or via debugfs.
> 
> To allow compliance using debugfs, first check port is in disabled state:
> 
> # cat /sys/kernel/debug/usb/xhci/0000:00:15.0/ports/port01/portsc
> Powered Not-connected Disabled Link:RxDetect PortSpeed:0 Change: Wake:
> 
> enable compliance by writing "compliance" to the port:
> # echo compliance > /sys/kernel/debug/usb/xhci/0000:00:15.0/ports/port01/portsc
> 
> This needs to be done for that specific port, and after every port warm reset.
> 
> After 1st LFPS timeout the port should go to compliance, can be read from portsc
> 
> Also make sure you don't have XHCI_COMP_MODE_QUIRK or XHCI_MISSING_CAS quirks set,
> these try to recover ports that accidentally enter compliance mode in normal use.

Thanks for the tip! I will try this approach with a newer kernel soon. I
learned that the port enters compliance mode after the 1st LFPS polling
timeout last week after watching the port become "disabled" after
the first connection. We're currently doing a full power cycle to
correct this state, but unbinding and re-binding the pci device with the
xhci_hcd driver has also been successful at resetting the xHC. The portsc
register and warm_reset file will help improve our workflow for compliance
testing.

> > Just for reference, our product uses an intel atom z8550 SoC that uses
> > an xHCI host controller and a dwc3 device controller. Our platform also
> > uses a USB 3.0 redriver. The datasheet for this redriver (tusb542)
> > indicates that it's internal LFPS controller supports full USB 3.0
> > compliance requirements.
> > 
> 
> z8550 is Cherry Trail? I unfortunately don't have those around anymore.

Yeah, they are increasingly hard to come by. But so far your description
aligns with our findings and research about the xHCI implementation in
this SoC. Thanks for your help!

Cheers,
Rob Weber

      reply	other threads:[~2019-06-24 20:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 19:03 xHCI Driver Compliance Test Support Rob Weber
2019-06-24  6:15 ` Mathias Nyman
2019-06-24 20:09   ` Rob Weber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190624200908.GA25232@coops \
    --to=rob@gnarbox.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=mathias.nyman@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).