Linux USB
 help / color / mirror / Atom feed
From: claus.stovgaard@gmail.com
To: Felipe Balbi <balbi@kernel.org>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: linux-usb@vger.kernel.org, v.anuragkumar@gmail.com,
	Rob Weber <rob@gnarbox.com>
Subject: Clarification of set_sel handling when dwc3 is a device (gadget)
Date: Sat, 29 Jun 2019 22:26:08 +0200	[thread overview]
Message-ID: <6dbe8df06875947d7ea6d6a21f83ac68315c0ef4.camel@gmail.com> (raw)

Hi

I have earlier worked with the possibility for disabling U1/U2 to solve
an issue where the dwc3 acting as a gadget device sometimes failing to
leave U2.

Analyzing the situation when the dwc3 failing to leave U2, it happens
when the link is in U2 after timeout from U1, and when the device wants
to leave U2. Not when the host wants to leave U2.

Going back the BOS descriptor from the device reports

bU1DevExitLat 1us
bU2DevExitLat 500us

And the SetSystemExitLatency control transfer ends with

U1 System Exit Latency 86 us
U1 Device to Host Exit Latency 1 us
U2 System Exit Latency 585 us
U2 Device to Host Exit Latency 500 us

Looking at the length of LFPS etc. it seems that the U2 exit is just
above 80 us,and it start link training just after.

So I was wandering how the exit latency of the system is communicated
to dwc3 core, and found the following code from ep0.c
dwc3_ep0_set_sel_cmpl

----
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
if (reg & DWC3_DCTL_INITU2ENA)
	param = dwc->u2pel;
if (reg & DWC3_DCTL_INITU1ENA)
	param = dwc->u1pel;

/*
 * According to Synopsys Databook, if parameter is
 * greater than 125, a value of zero should be
 * programmed in the register.
 */
if (param > 125)
	param = 0;

/* now that we have the time, issue DGCMD Set Sel */
ret = dwc3_send_gadget_generic_command(dwc,
		DWC3_DGCMD_SET_PERIODIC_PAR, param);
WARN_ON(ret < 0);
----

I don't have access to Synopsys Databook, so I am puzzled about
the DWC3_DGCMD_SET_PERIODIC_PAR command. The code favor to use the
device to host exit latency, and use the u1 if present over the u2.

So the dwc3 core never get the system exit latency times, and they just
disapeer.

I hope that someone have access to the Databook, and is able to share
some details about the set periodic command and the parameter.

Regards
Claus



             reply	other threads:[~2019-06-29 20:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-29 20:26 claus.stovgaard [this message]
2019-07-01 20:48 ` Clarification of set_sel handling when dwc3 is a device (gadget) Thinh Nguyen
2019-07-03 20:34   ` claus.stovgaard
2019-07-03 21:12     ` Thinh Nguyen

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=6dbe8df06875947d7ea6d6a21f83ac68315c0ef4.camel@gmail.com \
    --to=claus.stovgaard@gmail.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rob@gnarbox.com \
    --cc=v.anuragkumar@gmail.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