All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dinh Nguyen <dinguyen@kernel.org>
To: linux-clk@vger.kernel.org
Cc: dinguyen@kernel.org, sboyd@kernel.org, mturquette@baylibre.com,
	stable@vger.kernel.org
Subject: [PATCH 4/4] clk: agilex/stratix10/n5x: fix how the bypass_reg is handled
Date: Wed,  9 Jun 2021 13:50:08 -0500	[thread overview]
Message-ID: <20210609185008.36056-4-dinguyen@kernel.org> (raw)
In-Reply-To: <20210609185008.36056-1-dinguyen@kernel.org>

If the bypass_reg is set, then we can return the bypass parent, however,
if there is not a bypass_reg, we need to figure what the correct parent
mux is.

The previous code never handled the parent mux if there was a
bypass_reg.

Fixes: 80c6b7a0894f ("clk: socfpga: agilex: add clock driver for the Agilex platform")
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
---
 drivers/clk/socfpga/clk-periph-s10.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/socfpga/clk-periph-s10.c b/drivers/clk/socfpga/clk-periph-s10.c
index e5a5fef76df7..e2aad5d37611 100644
--- a/drivers/clk/socfpga/clk-periph-s10.c
+++ b/drivers/clk/socfpga/clk-periph-s10.c
@@ -66,14 +66,19 @@ static u8 clk_periclk_get_parent(struct clk_hw *hwclk)
 	u32 clk_src, mask;
 	u8 parent;
 
+	/* handle the bypass first */
 	if (socfpgaclk->bypass_reg) {
 		mask = (0x1 << socfpgaclk->bypass_shift);
 		parent = ((readl(socfpgaclk->bypass_reg) & mask) >>
 			   socfpgaclk->bypass_shift);
-	} else {
+		if (parent)
+			return parent;
+	}
+
+	if (socfpgaclk->hw.reg) {
 		clk_src = readl(socfpgaclk->hw.reg);
 		parent = (clk_src >> CLK_MGR_FREE_SHIFT) &
-			CLK_MGR_FREE_MASK;
+			  CLK_MGR_FREE_MASK;
 	}
 	return parent;
 }
-- 
2.25.1


  parent reply	other threads:[~2021-06-09 18:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 18:50 [PATCH 1/4] clk: agilex/stratix10: remove noc_clk Dinh Nguyen
2021-06-09 18:50 ` [PATCH 2/4] clk: agilex/stratix10: fix bypass representation Dinh Nguyen
2021-06-09 18:58   ` Greg KH
2021-06-09 18:50 ` [PATCH 3/4] clk: agilex/stratix10: add support for the 2nd bypass Dinh Nguyen
2021-06-09 18:58   ` Greg KH
2021-06-09 18:50 ` Dinh Nguyen [this message]
2021-06-09 18:58   ` [PATCH 4/4] clk: agilex/stratix10/n5x: fix how the bypass_reg is handled Greg KH
2021-06-09 18:57 ` [PATCH 1/4] clk: agilex/stratix10: remove noc_clk Greg KH

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=20210609185008.36056-4-dinguyen@kernel.org \
    --to=dinguyen@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.