Skip to contentSkip to conversation

fixup! clk: stm32mp1: sync with Linux v5.17-rc1

PATCH Applied Ahmad Fatoum 2 participants 3 messages Mar 7, 2022 – Mar 8, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 fixup! clk: stm32mp1: sync with Linux v5.17-rc1

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")

---
Please fixup

---
 drivers/clk/clk-stm32mp1.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
drivers/clk/clk-stm32mp1.c +1 -16
index 3e0c15ee32b9..c4b03e9f6d74 100644
@@ -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 = {
Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/2 fixup! clk: implement clk_hw_reparent

Revert "clk: implement clk_hw_reparent"

The implementation is faulty. In Linux, the function does accounting, which seems not applicable to barebox and it does not do any hardware access or set parentage, unlike the barebox port. As a previous commit removed the sole use site of the helper to fix a bug, drop the helper altogether.

This reverts commit 55a41677e2be90bbcaaa93cc541ead71a1e632d6.

---
Should result in an empty patch that can be skipped.

---
 include/linux/clk.h | 8 --------
 1 file changed, 8 deletions(-)
include/linux/clk.h +0 -8
index ab96e36010c3..7fd835c35e51 100644
@@ -241,14 +241,6 @@ int clk_hw_set_rate(struct clk_hw *hw, unsigned long rate);
 int clk_set_parent(struct clk *clk, struct clk *parent);
 int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *hwp);
 
-static inline void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent)
-{
-	if (!hw)
-		return;
-
-	clk_hw_set_parent(hw, new_parent);
-}
-
 /**
  * clk_get_parent - get the parent clock source for this clock
  * @clk: clock source
Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#2 lore raw
In reply to Ahmad Fatoum
Quoted 17 lines · Ahmad Fatoum

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.

Quoted 7 lines
Fixes 3045cc773a94 ("clk: stm32mp1: sync with Linux v5.17-rc1")

---
Please fixup

---
 drivers/clk/clk-stm32mp1.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

Applied, thanks

Sascha

Quoted 38 lines
drivers/clk/clk-stm32mp1.c +1 -16
index 3e0c15ee32b9..c4b03e9f6d74 100644
@@ -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 = {
Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox