linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: dwc3-octeon: Verify clock divider
@ 2023-08-08  9:37 Ladislav Michl
  2023-08-08 10:00 ` Greg Kroah-Hartman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ladislav Michl @ 2023-08-08  9:37 UTC (permalink / raw)
  To: Naresh Kamboju, Linux-Next Mailing List, linux-usb, linux-mips,
	lkft-triage
  Cc: Thinh.Nguyen, Greg Kroah-Hartman, Arnd Bergmann, Anders Roxell,
	Thomas Bogendoerfer

From: Ladislav Michl <ladis@linux-mips.org>

Although valid USB clock divider will be calculated for all valid
Octeon core frequencies, make code formally correct limiting
divider not to be greater that 7 so it fits into H_CLKDIV_SEL
field.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Closes: https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230808/testrun/18882876/suite/build/test/gcc-8-cavium_octeon_defconfig/log
---
 Greg, if you want to resent whole serie, just drop me a note.
 Otherwise, this patch is meant to be applied on to of it.
 Thank you.

 drivers/usb/dwc3/dwc3-octeon.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-octeon.c b/drivers/usb/dwc3/dwc3-octeon.c
index 6f47262a117a..73bdcebf465c 100644
--- a/drivers/usb/dwc3/dwc3-octeon.c
+++ b/drivers/usb/dwc3/dwc3-octeon.c
@@ -251,11 +251,11 @@ static int dwc3_octeon_get_divider(void)
 	while (div < ARRAY_SIZE(clk_div)) {
 		uint64_t rate = octeon_get_io_clock_rate() / clk_div[div];
 		if (rate <= 300000000 && rate >= 150000000)
-			break;
+			return div;
 		div++;
 	}
 
-	return div;
+	return -EINVAL;
 }
 
 static int dwc3_octeon_setup(struct dwc3_octeon *octeon,
@@ -289,6 +289,10 @@ static int dwc3_octeon_setup(struct dwc3_octeon *octeon,
 
 	/* Step 4b: Select controller clock frequency. */
 	div = dwc3_octeon_get_divider();
+	if (div < 0) {
+		dev_err(dev, "clock divider invalid\n");
+		return div;
+	}
 	val = dwc3_octeon_readq(uctl_ctl_reg);
 	val &= ~USBDRD_UCTL_CTL_H_CLKDIV_SEL;
 	val |= FIELD_PREP(USBDRD_UCTL_CTL_H_CLKDIV_SEL, div);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: dwc3: dwc3-octeon: Verify clock divider
  2023-08-08  9:37 [PATCH] usb: dwc3: dwc3-octeon: Verify clock divider Ladislav Michl
@ 2023-08-08 10:00 ` Greg Kroah-Hartman
  2023-08-08 10:38   ` Ladislav Michl
  2023-08-08 23:41 ` Thinh Nguyen
  2023-08-10  9:00 ` Philippe Mathieu-Daudé
  2 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-08-08 10:00 UTC (permalink / raw)
  To: Ladislav Michl
  Cc: Naresh Kamboju, Linux-Next Mailing List, linux-usb, linux-mips,
	lkft-triage, Thinh.Nguyen, Arnd Bergmann, Anders Roxell,
	Thomas Bogendoerfer

On Tue, Aug 08, 2023 at 11:37:50AM +0200, Ladislav Michl wrote:
> From: Ladislav Michl <ladis@linux-mips.org>
> 
> Although valid USB clock divider will be calculated for all valid
> Octeon core frequencies, make code formally correct limiting
> divider not to be greater that 7 so it fits into H_CLKDIV_SEL
> field.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Closes: https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230808/testrun/18882876/suite/build/test/gcc-8-cavium_octeon_defconfig/log
> ---
>  Greg, if you want to resent whole serie, just drop me a note.
>  Otherwise, this patch is meant to be applied on to of it.

On top of what series?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: dwc3: dwc3-octeon: Verify clock divider
  2023-08-08 10:00 ` Greg Kroah-Hartman
@ 2023-08-08 10:38   ` Ladislav Michl
  2023-08-08 10:45     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Ladislav Michl @ 2023-08-08 10:38 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Naresh Kamboju, Linux-Next Mailing List, linux-usb, linux-mips,
	lkft-triage, Thinh.Nguyen, Arnd Bergmann, Anders Roxell,
	Thomas Bogendoerfer

On Tue, Aug 08, 2023 at 12:00:42PM +0200, Greg Kroah-Hartman wrote:
> On Tue, Aug 08, 2023 at 11:37:50AM +0200, Ladislav Michl wrote:
> > From: Ladislav Michl <ladis@linux-mips.org>
> > 
> > Although valid USB clock divider will be calculated for all valid
> > Octeon core frequencies, make code formally correct limiting
> > divider not to be greater that 7 so it fits into H_CLKDIV_SEL
> > field.
> > 
> > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> > Closes: https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230808/testrun/18882876/suite/build/test/gcc-8-cavium_octeon_defconfig/log
> > ---
> >  Greg, if you want to resent whole serie, just drop me a note.
> >  Otherwise, this patch is meant to be applied on to of it.
> 
> On top of what series?

I'm sorry, "[PATCH v5 0/7] Cleanup Octeon DWC3 glue code".
In your usb-next, last patch of serie is:
d9216d3ef538 ("usb: dwc3: dwc3-octeon: Add SPDX header and copyright")

Thanks,
	l.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: dwc3: dwc3-octeon: Verify clock divider
  2023-08-08 10:38   ` Ladislav Michl
@ 2023-08-08 10:45     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-08-08 10:45 UTC (permalink / raw)
  To: Ladislav Michl
  Cc: Naresh Kamboju, Linux-Next Mailing List, linux-usb, linux-mips,
	lkft-triage, Thinh.Nguyen, Arnd Bergmann, Anders Roxell,
	Thomas Bogendoerfer

On Tue, Aug 08, 2023 at 12:38:46PM +0200, Ladislav Michl wrote:
> On Tue, Aug 08, 2023 at 12:00:42PM +0200, Greg Kroah-Hartman wrote:
> > On Tue, Aug 08, 2023 at 11:37:50AM +0200, Ladislav Michl wrote:
> > > From: Ladislav Michl <ladis@linux-mips.org>
> > > 
> > > Although valid USB clock divider will be calculated for all valid
> > > Octeon core frequencies, make code formally correct limiting
> > > divider not to be greater that 7 so it fits into H_CLKDIV_SEL
> > > field.
> > > 
> > > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> > > Closes: https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230808/testrun/18882876/suite/build/test/gcc-8-cavium_octeon_defconfig/log
> > > ---
> > >  Greg, if you want to resent whole serie, just drop me a note.
> > >  Otherwise, this patch is meant to be applied on to of it.
> > 
> > On top of what series?
> 
> I'm sorry, "[PATCH v5 0/7] Cleanup Octeon DWC3 glue code".
> In your usb-next, last patch of serie is:
> d9216d3ef538 ("usb: dwc3: dwc3-octeon: Add SPDX header and copyright")

I already took that series, so this is fine, I don't want to revert that
and have to add it all back :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: dwc3: dwc3-octeon: Verify clock divider
  2023-08-08  9:37 [PATCH] usb: dwc3: dwc3-octeon: Verify clock divider Ladislav Michl
  2023-08-08 10:00 ` Greg Kroah-Hartman
@ 2023-08-08 23:41 ` Thinh Nguyen
  2023-08-10  9:00 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 6+ messages in thread
From: Thinh Nguyen @ 2023-08-08 23:41 UTC (permalink / raw)
  To: Ladislav Michl
  Cc: Naresh Kamboju, Linux-Next Mailing List, linux-usb, linux-mips,
	lkft-triage, Thinh Nguyen, Greg Kroah-Hartman, Arnd Bergmann,
	Anders Roxell, Thomas Bogendoerfer

On Tue, Aug 08, 2023, Ladislav Michl wrote:
> From: Ladislav Michl <ladis@linux-mips.org>
> 
> Although valid USB clock divider will be calculated for all valid
> Octeon core frequencies, make code formally correct limiting
> divider not to be greater that 7 so it fits into H_CLKDIV_SEL
> field.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Closes: https://urldefense.com/v3/__https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230808/testrun/18882876/suite/build/test/gcc-8-cavium_octeon_defconfig/log__;!!A4F2R9G_pg!aMHLJEE_aLERK48OJY2mcfvhm6OZMeAB8IUZUc16me_jFuy-VVsgIXn-cP5K99sPe_eEZToGWIBXQJB1CxZFVgMcJA$ 
> ---
>  Greg, if you want to resent whole serie, just drop me a note.
>  Otherwise, this patch is meant to be applied on to of it.
>  Thank you.
> 
>  drivers/usb/dwc3/dwc3-octeon.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-octeon.c b/drivers/usb/dwc3/dwc3-octeon.c
> index 6f47262a117a..73bdcebf465c 100644
> --- a/drivers/usb/dwc3/dwc3-octeon.c
> +++ b/drivers/usb/dwc3/dwc3-octeon.c
> @@ -251,11 +251,11 @@ static int dwc3_octeon_get_divider(void)
>  	while (div < ARRAY_SIZE(clk_div)) {
>  		uint64_t rate = octeon_get_io_clock_rate() / clk_div[div];
>  		if (rate <= 300000000 && rate >= 150000000)
> -			break;
> +			return div;
>  		div++;
>  	}
>  
> -	return div;
> +	return -EINVAL;
>  }
>  
>  static int dwc3_octeon_setup(struct dwc3_octeon *octeon,
> @@ -289,6 +289,10 @@ static int dwc3_octeon_setup(struct dwc3_octeon *octeon,
>  
>  	/* Step 4b: Select controller clock frequency. */
>  	div = dwc3_octeon_get_divider();
> +	if (div < 0) {
> +		dev_err(dev, "clock divider invalid\n");
> +		return div;
> +	}
>  	val = dwc3_octeon_readq(uctl_ctl_reg);
>  	val &= ~USBDRD_UCTL_CTL_H_CLKDIV_SEL;
>  	val |= FIELD_PREP(USBDRD_UCTL_CTL_H_CLKDIV_SEL, div);
> -- 
> 2.39.2
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: dwc3: dwc3-octeon: Verify clock divider
  2023-08-08  9:37 [PATCH] usb: dwc3: dwc3-octeon: Verify clock divider Ladislav Michl
  2023-08-08 10:00 ` Greg Kroah-Hartman
  2023-08-08 23:41 ` Thinh Nguyen
@ 2023-08-10  9:00 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-08-10  9:00 UTC (permalink / raw)
  To: Naresh Kamboju, Linux-Next Mailing List, linux-usb, linux-mips,
	lkft-triage
  Cc: Thinh.Nguyen, Greg Kroah-Hartman, Arnd Bergmann, Anders Roxell,
	Thomas Bogendoerfer

On 8/8/23 11:37, Ladislav Michl wrote:
> From: Ladislav Michl <ladis@linux-mips.org>
> 
> Although valid USB clock divider will be calculated for all valid
> Octeon core frequencies, make code formally correct limiting
> divider not to be greater that 7 so it fits into H_CLKDIV_SEL
> field.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Closes: https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230808/testrun/18882876/suite/build/test/gcc-8-cavium_octeon_defconfig/log
> ---
>   Greg, if you want to resent whole serie, just drop me a note.
>   Otherwise, this patch is meant to be applied on to of it.
>   Thank you.
> 
>   drivers/usb/dwc3/dwc3-octeon.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-10  9:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08  9:37 [PATCH] usb: dwc3: dwc3-octeon: Verify clock divider Ladislav Michl
2023-08-08 10:00 ` Greg Kroah-Hartman
2023-08-08 10:38   ` Ladislav Michl
2023-08-08 10:45     ` Greg Kroah-Hartman
2023-08-08 23:41 ` Thinh Nguyen
2023-08-10  9:00 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).