mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH next 1/2] fixup! clk: stm32mp1: sync with Linux v5.17-rc1
Date: Mon,  7 Mar 2022 18:02:09 +0100	[thread overview]
Message-ID: <20220307170210.3937726-1-a.fatoum@pengutronix.de> (raw)

clk: stm32mp1: fix infinite recursion with composite clock

Linux clk_hw_reparent does some accounting, which seems to be not necessary
for barebox. It does not do any hardware access and is distinct from
clk_hw_set_parent. The faulty barebox implementation, however,
configures a new parent leading to:

  &rcc {
    assigned-clocks = <&rcc ETHCK_K>;
     assigned-clock-parents = <&rcc PLL4_P>;
  };

to trigger an infinite recursion: ETHCK will have its parent set, then
set the parent of its mux sibling, which in turn sets ETHCK and so on.

Restore old working behavior.

Fixes: 3045cc773a94 ("clk: stm32mp1: sync with Linux v5.17-rc1")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Please fixup
---
 drivers/clk/clk-stm32mp1.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c
index 3e0c15ee32b9..c4b03e9f6d74 100644
--- a/drivers/clk/clk-stm32mp1.c
+++ b/drivers/clk/clk-stm32mp1.c
@@ -704,22 +704,7 @@ static int clk_mmux_get_parent(struct clk_hw *hw)
 
 static int clk_mmux_set_parent(struct clk_hw *hw, u8 index)
 {
-	struct clk_mux *mux = to_clk_mux(hw);
-	struct stm32_clk_mmux *clk_mmux = to_clk_mmux(mux);
-	struct clk_hw *hwp;
-	int ret, n;
-
-	ret = clk_mux_ops.set_parent(hw, index);
-	if (ret)
-		return ret;
-
-	hwp = clk_hw_get_parent(hw);
-
-	for (n = 0; n < clk_mmux->mmux->nbr_clk; n++)
-		if (clk_mmux->mmux->hws[n] != hw)
-			clk_hw_reparent(clk_mmux->mmux->hws[n], hwp);
-
-	return 0;
+	return clk_mux_ops.set_parent(hw, index);
 }
 
 static const struct clk_ops clk_mmux_ops = {
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


             reply	other threads:[~2022-03-07 17:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 17:02 Ahmad Fatoum [this message]
2022-03-07 17:02 ` [PATCH next 2/2] fixup! clk: implement clk_hw_reparent Ahmad Fatoum
2022-03-08  8:20 ` [PATCH next 1/2] fixup! clk: stm32mp1: sync with Linux v5.17-rc1 Sascha Hauer

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=20220307170210.3937726-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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