lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2B3535C5ECE8B5419E3ECBE30077290901DC335B43@us01wembx1.internal.synopsys.com>
Date:	Wed, 19 Aug 2015 00:19:55 +0000
From:	John Youn <John.Youn@...opsys.com>
To:	Yunzhi Li <lyz@...k-chips.com>,
	"jwerner@...omium.org" <jwerner@...omium.org>,
	"dianders@...omium.org" <dianders@...omium.org>
CC:	"huangtao@...k-chips.com" <huangtao@...k-chips.com>,
	"cf@...k-chips.com" <cf@...k-chips.com>,
	"hl@...k-chips.com" <hl@...k-chips.com>,
	John Youn <John.Youn@...opsys.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] usb: dwc2: reset dwc2 core before dwc2_get_hwparams()

On 8/18/2015 2:41 AM, Yunzhi Li wrote:
> We initiate dwc2 usb controller in BIOS, dwc2_core_reset() should
> be called before dwc2_get_hwparams() to reset core registers to
> default value. Without this the FIFO setting might be incorrect
> because calculating FIFO size need power-on value of
> GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers.
> 
> This patch could avoid warnning massage like in rk3288 platform:
> [    2.074764] dwc2 ff580000.usb: 256 invalid for
> host_perio_tx_fifo_size. Check HW configuration.
> 
> Signed-off-by: Yunzhi Li <lyz@...k-chips.com>
> 
> ---
> 
>  drivers/usb/dwc2/core.c     | 2 +-
>  drivers/usb/dwc2/core.h     | 1 +
>  drivers/usb/dwc2/platform.c | 6 ++++++
>  3 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
> index c3cc1a7..86d1d65 100644
> --- a/drivers/usb/dwc2/core.c
> +++ b/drivers/usb/dwc2/core.c
> @@ -474,7 +474,7 @@ static void dwc2_init_fs_ls_pclk_sel(struct dwc2_hsotg *hsotg)
>   * Do core a soft reset of the core.  Be careful with this because it
>   * resets all the internal state machines of the core.
>   */
> -static int dwc2_core_reset(struct dwc2_hsotg *hsotg)
> +int dwc2_core_reset(struct dwc2_hsotg *hsotg)
>  {
>  	u32 greset;
>  	int count = 0;
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index 0ed87620..5d95aec 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -846,6 +846,7 @@ enum dwc2_halt_status {
>   * The following functions support initialization of the core driver component
>   * and the DWC_otg controller
>   */
> +extern int dwc2_core_reset(struct dwc2_hsotg *hsotg);
>  extern void dwc2_core_host_init(struct dwc2_hsotg *hsotg);
>  extern int dwc2_enter_hibernation(struct dwc2_hsotg *hsotg);
>  extern int dwc2_exit_hibernation(struct dwc2_hsotg *hsotg, bool restore);
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index 9093530..8d3be4a 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -243,6 +243,12 @@ static int dwc2_driver_probe(struct platform_device *dev)
>  	spin_lock_init(&hsotg->lock);
>  	mutex_init(&hsotg->init_mutex);
>  
> +	/*
> +	 * Reset before dwc2_get_hwparams() then it could get power-on real
> +	 * reset value form registers.
> +	 */
> +	dwc2_core_reset(hsotg);
> +
>  	/* Detect config values from hardware */
>  	retval = dwc2_get_hwparams(hsotg);
>  	if (retval)
> 

Hi Yunzhi,

My concern is with the delays due to calling the dwc2_core_reset
during probe. You could factor out the assertion of the core
soft reset from the dwc2_core_reset and just use that before
calling dwc2_get_hwparams().

You had previously addressed the lengthy probe time issue here:
http://marc.info/?l=linux-usb&m=142357721304377

This reducing delays patch looks reasonable to me and I think it
should get merged also. I'll do some testing with it later this
week.

John


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ