linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Claudiu Beznea <claudiu.beznea@microchip.com>
To: <mturquette@baylibre.com>, <sboyd@kernel.org>,
	<nicolas.ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
	<ludovic.desroches@microchip.com>, <linux-kernel@vger.kernel.org>
Cc: <mturquette@linaro.org>, <bbrezillon@kernel.org>,
	<linux-clk@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	"Claudiu Beznea" <claudiu.beznea@microchip.com>
Subject: [PATCH 2/2] clk: at91: main: do not continue if oscillators already prepared
Date: Thu, 25 Jun 2020 13:09:28 +0300	[thread overview]
Message-ID: <1593079768-9349-2-git-send-email-claudiu.beznea@microchip.com> (raw)
In-Reply-To: <1593079768-9349-1-git-send-email-claudiu.beznea@microchip.com>

Return in clk_main_osc_prepare()/clk_main_rc_osc_prepare() if
oscillators are already enabled.

Fixes: 27cb1c2083373 ("clk: at91: rework main clk implementation")
Fixes: 1bdf02326b71e ("clk: at91: make use of syscon/regmap internally")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/at91/clk-main.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index 37c22667e831..46b4d2131989 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -74,13 +74,11 @@ static int clk_main_osc_prepare(struct clk_hw *hw)
 	regmap_read(regmap, AT91_CKGR_MOR, &tmp);
 	tmp &= ~MOR_KEY_MASK;
 
-	if (tmp & AT91_PMC_OSCBYPASS)
+	if (tmp & (AT91_PMC_OSCBYPASS | AT91_PMC_MOSCEN))
 		return 0;
 
-	if (!(tmp & AT91_PMC_MOSCEN)) {
-		tmp |= AT91_PMC_MOSCEN | AT91_PMC_KEY;
-		regmap_write(regmap, AT91_CKGR_MOR, tmp);
-	}
+	tmp |= AT91_PMC_MOSCEN | AT91_PMC_KEY;
+	regmap_write(regmap, AT91_CKGR_MOR, tmp);
 
 	while (!clk_main_osc_ready(regmap))
 		cpu_relax();
@@ -186,10 +184,12 @@ static int clk_main_rc_osc_prepare(struct clk_hw *hw)
 
 	regmap_read(regmap, AT91_CKGR_MOR, &mor);
 
-	if (!(mor & AT91_PMC_MOSCRCEN))
-		regmap_update_bits(regmap, AT91_CKGR_MOR,
-				   MOR_KEY_MASK | AT91_PMC_MOSCRCEN,
-				   AT91_PMC_MOSCRCEN | AT91_PMC_KEY);
+	if (mor & AT91_PMC_MOSCRCEN)
+		return 0;
+
+	regmap_update_bits(regmap, AT91_CKGR_MOR,
+			   MOR_KEY_MASK | AT91_PMC_MOSCRCEN,
+			   AT91_PMC_MOSCRCEN | AT91_PMC_KEY);
 
 	while (!clk_main_rc_osc_ready(regmap))
 		cpu_relax();
-- 
2.7.4


  reply	other threads:[~2020-06-25 10:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25 10:09 [PATCH 1/2] clk: at91: remove the checking of parent_name Claudiu Beznea
2020-06-25 10:09 ` Claudiu Beznea [this message]
2020-06-26 21:03   ` [PATCH 2/2] clk: at91: main: do not continue if oscillators already prepared Alexandre Belloni
2020-07-01  9:47     ` Claudiu.Beznea
2020-06-26 20:58 ` [PATCH 1/2] clk: at91: remove the checking of parent_name Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1593079768-9349-2-git-send-email-claudiu.beznea@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=mturquette@baylibre.com \
    --cc=mturquette@linaro.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).