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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bdbebb19-f132-b809-239f-51993acd7ad4@synopsys.com>
Date:   Thu, 3 Feb 2022 03:09:33 +0000
From:   Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To:     Sean Anderson <sean.anderson@...o.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>
CC:     Robert Hancock <robert.hancock@...ian.com>,
        Baruch Siach <baruch@...s.co.il>,
        Felipe Balbi <balbi@...nel.org>,
        Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Balaji Prakash J <bjagadee@...eaurora.org>
Subject: Re: [PATCH v3 3/7] usb: dwc3: Calculate REFCLKPER based on reference
 clock

Sean Anderson wrote:
> Instead of using a special property to determine the reference clock
> period, use the rate of the reference clock. When we have a legacy
> snps,ref-clock-period-ns property and no reference clock, use it
> instead. Fractional clocks are not currently supported, and will be
> dealt with in the next commit.
> 
> Signed-off-by: Sean Anderson <sean.anderson@...o.com>
> Reviewed-by: Robert Hancock <robert.hancock@...ian.com>
> Tested-by: Robert Hancock <robert.hancock@...ian.com>
> ---
> 
> Changes in v3:
> - Define each variable on its own line
> 
>  drivers/usb/dwc3/core.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 699ab9abdc47..38fef5c74359 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -347,14 +347,24 @@ static void dwc3_frame_length_adjustment(struct dwc3 *dwc)
>   */
>  static void dwc3_ref_clk_period(struct dwc3 *dwc)
>  {
> +	unsigned long period;
> +	unsigned long rate;
>  	u32 reg;
>  
> -	if (dwc->ref_clk_per == 0)
> +	if (dwc->ref_clk) {
> +		rate = clk_get_rate(dwc->ref_clk);
> +		if (!rate)
> +			return;
> +		period = NSEC_PER_SEC / rate;
> +	} else if (dwc->ref_clk_per) {
> +		period = dwc->ref_clk_per;
> +	} else {
>  		return;
> +	}
>  
>  	reg = dwc3_readl(dwc->regs, DWC3_GUCTL);
>  	reg &= ~DWC3_GUCTL_REFCLKPER_MASK;
> -	reg |=  FIELD_PREP(DWC3_GUCTL_REFCLKPER_MASK, dwc->ref_clk_per);
> +	reg |=  FIELD_PREP(DWC3_GUCTL_REFCLKPER_MASK, period);
>  	dwc3_writel(dwc->regs, DWC3_GUCTL, reg);
>  }
>  

Reviewed-by: Thinh Nguyen <Thinh.Nguyen@...opsys.com>

Thanks,
Thinh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ