public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arm: socfpga: Fix delay in clock manager
@ 2015-08-10 23:00 Marek Vasut
  2015-08-18 20:28 ` Dinh Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2015-08-10 23:00 UTC (permalink / raw)
  To: u-boot

This code claims it needs to wait 7us, yet it uses get_timer() function
which operates with millisecond granularity. Use timer_get_us() instead,
which operates with microsecond granularity.

Signed-off-by: Marek Vasut <marex@denx.de>
---
 arch/arm/mach-socfpga/clock_manager.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-socfpga/clock_manager.c b/arch/arm/mach-socfpga/clock_manager.c
index 1341df4..aa71636 100644
--- a/arch/arm/mach-socfpga/clock_manager.c
+++ b/arch/arm/mach-socfpga/clock_manager.c
@@ -90,7 +90,7 @@ static void cm_write_with_phase(uint32_t value,
 
 void cm_basic_init(const struct cm_config * const cfg)
 {
-	uint32_t start, timeout;
+	unsigned long end;
 
 	/* Start by being paranoid and gate all sw managed clocks */
 
@@ -159,12 +159,10 @@ void cm_basic_init(const struct cm_config * const cfg)
 	writel(cfg->sdram_vco_base, &clock_manager_base->sdr_pll.vco);
 
 	/*
-	 * Time starts here
-	 * must wait 7 us from BGPWRDN_SET(0) to VCO_ENABLE_SET(1)
+	 * Time starts here. Must wait 7 us from
+	 * BGPWRDN_SET(0) to VCO_ENABLE_SET(1).
 	 */
-	start = get_timer(0);
-	/* timeout in unit of us as CONFIG_SYS_HZ = 1000*1000 */
-	timeout = 7;
+	end = timer_get_us() + 7;
 
 	/* main mpu */
 	writel(cfg->mpuclk, &clock_manager_base->main_pll.mpuclk);
@@ -204,7 +202,7 @@ void cm_basic_init(const struct cm_config * const cfg)
 	writel(cfg->s2fuser1clk, &clock_manager_base->per_pll.s2fuser1clk);
 
 	/* 7 us must have elapsed before we can enable the VCO */
-	while (get_timer(start) < timeout)
+	while (timer_get_us() < end)
 		;
 
 	/* Enable vco */
-- 
2.1.4

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

* [U-Boot] [PATCH] arm: socfpga: Fix delay in clock manager
  2015-08-10 23:00 [U-Boot] [PATCH] arm: socfpga: Fix delay in clock manager Marek Vasut
@ 2015-08-18 20:28 ` Dinh Nguyen
  2015-08-18 22:06   ` Marek Vasut
  0 siblings, 1 reply; 3+ messages in thread
From: Dinh Nguyen @ 2015-08-18 20:28 UTC (permalink / raw)
  To: u-boot



On 8/10/15 6:00 PM, Marek Vasut wrote:
> This code claims it needs to wait 7us, yet it uses get_timer() function
> which operates with millisecond granularity. Use timer_get_us() instead,
> which operates with microsecond granularity.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
>  arch/arm/mach-socfpga/clock_manager.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/mach-socfpga/clock_manager.c b/arch/arm/mach-socfpga/clock_manager.c
> index 1341df4..aa71636 100644
> --- a/arch/arm/mach-socfpga/clock_manager.c
> +++ b/arch/arm/mach-socfpga/clock_manager.c
> @@ -90,7 +90,7 @@ static void cm_write_with_phase(uint32_t value,
>  

Acked-by: Dinh Nguyen <dinguyen@opensource.altera.com>

Thanks,
Dinh

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

* [U-Boot] [PATCH] arm: socfpga: Fix delay in clock manager
  2015-08-18 20:28 ` Dinh Nguyen
@ 2015-08-18 22:06   ` Marek Vasut
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2015-08-18 22:06 UTC (permalink / raw)
  To: u-boot

On Tuesday, August 18, 2015 at 10:28:55 PM, Dinh Nguyen wrote:
> On 8/10/15 6:00 PM, Marek Vasut wrote:
> > This code claims it needs to wait 7us, yet it uses get_timer() function
> > which operates with millisecond granularity. Use timer_get_us() instead,
> > which operates with microsecond granularity.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > ---
> > 
> >  arch/arm/mach-socfpga/clock_manager.c | 12 +++++-------
> >  1 file changed, 5 insertions(+), 7 deletions(-)
> > 
> > diff --git a/arch/arm/mach-socfpga/clock_manager.c
> > b/arch/arm/mach-socfpga/clock_manager.c index 1341df4..aa71636 100644
> > --- a/arch/arm/mach-socfpga/clock_manager.c
> > +++ b/arch/arm/mach-socfpga/clock_manager.c
> > @@ -90,7 +90,7 @@ static void cm_write_with_phase(uint32_t value,
> 
> Acked-by: Dinh Nguyen <dinguyen@opensource.altera.com>

Applied to u-boot-socfpga/master, thanks!

Best regards,
Marek Vasut

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

end of thread, other threads:[~2015-08-18 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10 23:00 [U-Boot] [PATCH] arm: socfpga: Fix delay in clock manager Marek Vasut
2015-08-18 20:28 ` Dinh Nguyen
2015-08-18 22:06   ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox