Re: [RFT PATCH v2 3/4] usb: dwc2: Properly account for the force mode delays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi John,

Am Mittwoch, 24. August 2016, 16:20:01 schrieb John Youn:
> When a force mode bit is set and the IDDIG debounce filter is enabled,
> there is a delay for the forced mode to take effect. This delay is due
> to the IDDIG debounce filter and is variable depending on the platform's
> PHY clock speed. To account for this delay we can poll for the expected
> mode.
> 
> On a clear force mode, since we don't know what mode to poll for, delay
> for a fixed 50 ms. This is the maximum delay based on the slowest PHY
> clock speed.
> 
> Signed-off-by: John Youn <johnyoun@xxxxxxxxxxxx>

starting with this patch, I see debounce-failed messages:
[    7.934100] usb usb2-port1: connect-debounce failed

on my rk3188. Port is in host-mode and I'll try to investigate further.

One more thing below.

> ---
>  drivers/usb/dwc2/core.c | 32 ++++++++++++++------------------
>  1 file changed, 14 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
> index bb903e2..caad6121 100644
> --- a/drivers/usb/dwc2/core.c
> +++ b/drivers/usb/dwc2/core.c
> @@ -397,9 +397,9 @@ int dwc2_core_reset(struct dwc2_hsotg *hsotg)
>   * Checks are done in this function to determine whether doing a force
>   * would be valid or not.
>   *
> - * If a force is done, it requires a 25ms delay to take effect.
> - *
> - * Returns true if the mode was forced.
> + * If a force is done, it requires a IDDIG debounce filter delay if
> + * the filter is configured and enabled. We poll the current mode of
> + * the controller to account for this delay.
>   */
>  static bool dwc2_force_mode(struct dwc2_hsotg *hsotg, bool host)
>  {
> @@ -434,12 +434,17 @@ static bool dwc2_force_mode(struct dwc2_hsotg *hsotg,
> bool host) gusbcfg |= set;
>  	dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
> 
> -	msleep(25);
> -	return true;
> +	dwc2_wait_for_mode(hsotg, host, 50);

missing a return value and thus resulting in

../drivers/usb/dwc2/core.c: In function ‘dwc2_force_mode’:
../drivers/usb/dwc2/core.c:438:1: warning: control reaches end of non-void function [-Wreturn-type]


Heiko
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux