Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: Rob Weber <rob@gnarbox.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: dwc3 Disable Compliance Mode
Date: Fri, 12 Jul 2019 10:15:19 +0300
Message-ID: <871ryvu3js.fsf@linux.intel.com> (raw)
In-Reply-To: <20190712050139.GA28879@coops>

[-- Attachment #1: Type: text/plain, Size: 3049 bytes --]


Hi,

Rob Weber <rob@gnarbox.com> writes:
>> > If not, is there some mechanism we could implement to reset the
>> > dwc3 when we enter compliance mode? I attempted some sort of mechanism
>> > to reset the link state, but it does not seem to help the issue. I've
>> > attached my patch and the trace events for my attempted workaround to
>> > this email. My initial approach was to transition the link from
>> > Compliance -> SS.Disabled -> Rx.Detect when we detect we've entered
>> > compliance mode. The traces show that the dwc3 just enters LFPS.Polling
>> > and subsequently enters compliance mode, despite the link being reset.
>> 
>> I think you would have to go through the entire Power On Reset
>> sequence, but that's likely to be flakey.
>
> Okay, good to know. I am not confident in this approach as well because of
> the state management / recovery we might have to perform.
>
> I wanted to explain our goal a little bit more in depth in case some
> other apprach might come to mind. Our product supports 3 ways in which
> the user can work with the USB port: Host mode, Mass Storage Mode, and
> Ethernet Mode. Host mode is pretty straightforward. Users will generally
> work with USB mass storage devices and USB-Ethernet adapters in host
> mode. Mass storage mode exposes an internal user data partition using
> f_mass_storage and configfs so the user can connect our product to their
> host computer for backing up data. Ethernet uses the f_ecm and f_rndis
> functions creating an ethernet connection with USB hosts, particularly
> mobile devices, to interact with our mobile applications and servers
> through a wired connection.
>
> We control this functionality through a userspace application written in Go
> that creates the gadget/function configuration in configfs. Given this
> background information, are there any approaches that come to mind, such
> as reconfiguring the gadget? Thanks in advance for your input.

Not really, if it goes into compliance mode, the only way to get it out
of there is with a power-on reset. You can't even change link state back
to U0 as that will just tell dwc3 to walk through the compliance
patterns :-p

I think our best bet is understanding why we're transitioning to
compliance and preventing that.

One question comes to mind: Does this happen *only* with the ethernet
gadget? Does it happen with *all* hosts or just a particular host?

Any chance you can capture a full session with both CATC or Beagle 5000
analyzer and dwc3 tracepoints and send it to me?

>> >           <idle>-0     [003] dNs2   184.588232: dwc3_core: Compliance Mode detected. Attempting recovery routine
>> 
>> Don't we get an interrupt for Compliance mode entry?
>
> Not that I've seen, surprisingly. My compliance mode recovery mechanism
> looks for both compliance mode and loopback mode, neither of which I
> have ever seen in the link state change events.

That's odd, I would expect it to still give the event. Oh well, moving
on :-)

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 23:01 Rob Weber
2019-07-11  7:37 ` Felipe Balbi
2019-07-12  5:01   ` Rob Weber
2019-07-12  7:15     ` Felipe Balbi [this message]
     [not found]       ` <20190715060336.GB30262@coops>
2019-07-15  6:50         ` Felipe Balbi

Reply instructions:

You may reply publically 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=871ryvu3js.fsf@linux.intel.com \
    --to=felipe.balbi@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=rob@gnarbox.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

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org linux-usb@archiver.kernel.org
	public-inbox-index linux-usb


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/ public-inbox