Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1419943

Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls

From Boris Brezillon <boris.brezillon@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls
Date 2016-06-11 10:00 +0200
Message-ID <rILZL-en-1@gated-at.bofh.it> (permalink)
References <rICMO-2IE-7@gated-at.bofh.it> <rICWu-2P1-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, 11 Jun 2016 00:03:04 +0200
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> From: Cyrille Pitchen <cyrille.pitchen@atmel.com>
> 
> Fix the main and slow clock .prepare() implementations which used to call
> usleep() when the scheduler wasn't ready yet.
> 
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: linux-clk@vger.kernel.org
> Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>  drivers/clk/at91/clk-main.c | 2 +-
>  drivers/clk/at91/clk-slow.c | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
> index 58b5baca670c..12c5062aeb92 100644
> --- a/drivers/clk/at91/clk-main.c
> +++ b/drivers/clk/at91/clk-main.c
> @@ -342,7 +342,7 @@ static int clk_main_probe_frequency(struct regmap *regmap)
>  		regmap_read(regmap, AT91_CKGR_MCFR, &mcfr);
>  		if (mcfr & AT91_PMC_MAINRDY)
>  			return 0;
> -		usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT);
> +		udelay(MAINF_LOOP_MIN_WAIT);
>  	} while (time_before(prep_time, timeout));
>  
>  	return -ETIMEDOUT;
> diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c
> index 61090b1146cf..612e893ce994 100644
> --- a/drivers/clk/at91/clk-slow.c
> +++ b/drivers/clk/at91/clk-slow.c
> @@ -76,7 +76,7 @@ static int clk_slow_osc_prepare(struct clk_hw *hw)
>  
>  	writel(tmp | AT91_SCKC_OSC32EN, sckcr);
>  
> -	usleep_range(osc->startup_usec, osc->startup_usec + 1);
> +	udelay(osc->startup_usec);

If you're using udelay() you should probably move the code in
->prepare() into ->enable(). The same goes for the following changes.

>  
>  	return 0;
>  }
> @@ -195,7 +195,7 @@ static int clk_slow_rc_osc_prepare(struct clk_hw *hw)
>  
>  	writel(readl(sckcr) | AT91_SCKC_RCEN, sckcr);
>  
> -	usleep_range(osc->startup_usec, osc->startup_usec + 1);
> +	udelay(osc->startup_usec);
>  
>  	return 0;
>  }
> @@ -304,7 +304,7 @@ static int clk_sam9x5_slow_set_parent(struct clk_hw *hw, u8 index)
>  
>  	writel(tmp, sckcr);
>  
> -	usleep_range(SLOWCK_SW_TIME_USEC, SLOWCK_SW_TIME_USEC + 1);
> +	udelay(SLOWCK_SW_TIME_USEC);
>  
>  	return 0;
>  }



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/48] ARM: at91: rework Atmel TCB drivers Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
    Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Arnd Bergmann <arnd@arndb.de> - 2016-06-11 00:40 +0200
      Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:40 +0200
      Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-13 17:30 +0200
        Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Arnd Bergmann <arnd@arndb.de> - 2016-06-13 21:30 +0200
        Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Afzal Mohammed <afzal.mohd.ma@gmail.com> - 2016-06-14 18:10 +0200
          Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-14 18:20 +0200
    Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-11 10:00 +0200
  [PATCH 07/48] ARM: dts: at91: ethernut5: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 02/48] ARM: at91: Document new TCB bindings Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
    Re: [PATCH 02/48] ARM: at91: Document new TCB bindings Rob Herring <robh@kernel.org> - 2016-06-14 23:50 +0200
      Re: [PATCH 02/48] ARM: at91: Document new TCB bindings Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-15 09:40 +0200
        Re: [PATCH 02/48] ARM: at91: Document new TCB bindings Rob Herring <robh@kernel.org> - 2016-06-21 22:10 +0200
        Re: [PATCH 02/48] ARM: at91: Document new TCB bindings Rob Herring <robh@kernel.org> - 2016-06-21 22:50 +0200
  [PATCH 11/48] ARM: dts: at91: at91sam9g20ek: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 23/48] ARM: dts: at91: at91sam9n12: TC blocks are also simple-mfd and syscon devices Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 26/48] ARM: dts: at91: at91sam9x5cm: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 22/48] ARM: dts: at91: at91sam9rlek: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 06/48] ARM: dts: at91: at91sam9260: TC blocks are also simple-mfd and syscon devices Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 14/48] ARM: dts: at91: at91sam9261ek: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 28/48] ARM: dts: at91: cosino: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 29/48] ARM: dts: at91: kizboxmini: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 24/48] ARM: dts: at91: at91sam9n12ek: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 08/48] ARM: dts: at91: foxg20: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
  [PATCH 20/48] ARM: dts: at91: pm9g45: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200

csiph-web