Skip to contentSkip to conversation

clk: meson: pll: copy retry workaround from vendor driver

PATCH RESEND Applied Heiner Kallweit 3 participants 6 messages Aug 14, 2022 – Sep 13, 2022

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

PATCH RESEND 1/1 clk: meson: pll: copy retry workaround from vendor driver

On a S905X4-based system this call fails randomly. The vendor driver has a retry mechanism and on my system the second attempt is successful always.

---
 drivers/clk/meson/clk-pll.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/clk/meson/clk-pll.c +8 -4
index 9e55617bc..daa025b6d 100644
@@ -320,12 +320,16 @@ static int meson_clk_pll_is_enabled(struct clk_hw *hw)
 
 static int meson_clk_pcie_pll_enable(struct clk_hw *hw)
 {
-	meson_clk_pll_init(hw);
+	int retries = 10;
 
-	if (meson_clk_pll_wait_lock(hw))
-		return -EIO;
+	do {
+		meson_clk_pll_init(hw);
+		if (!meson_clk_pll_wait_lock(hw))
+			return 0;
+		pr_info("Retry enabling PCIe PLL clock\n");
+	} while (--retries);
 
-	return 0;
+	return -EIO;
 }
 
 static int meson_clk_pll_enable(struct clk_hw *hw)
Signature · 7 lines
2.37.2


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
maintainer
#1 lore raw
Quoted 4 lines · Heiner Kallweit

On a S905X4-based system this call fails randomly. The vendor driver has a retry mechanism and on my system the second attempt is successful always.

This reason looks a bit weak to me.
I'd like AML team to comment on this PLL problem as I suspect it might relate to other PLL we have been seeing

Quoted 30 lines
---
 drivers/clk/meson/clk-pll.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/clk/meson/clk-pll.c +8 -4
index 9e55617bc..daa025b6d 100644
@@ -320,12 +320,16 @@ static int meson_clk_pll_is_enabled(struct clk_hw *hw)
 
 static int meson_clk_pcie_pll_enable(struct clk_hw *hw)
 {
-	meson_clk_pll_init(hw);
+	int retries = 10;
 
-	if (meson_clk_pll_wait_lock(hw))
-		return -EIO;
+	do {
+		meson_clk_pll_init(hw);
+		if (!meson_clk_pll_wait_lock(hw))
+			return 0;
+		pr_info("Retry enabling PCIe PLL clock\n");
+	} while (--retries);
 
-	return 0;
+	return -EIO;
 }
 
 static int meson_clk_pll_enable(struct clk_hw *hw)
#2 lore raw
Quoted 5 lines · Jerome Brunet

[ EXTERNAL EMAIL ]

On Sun 14 Aug 2022 at 23:25, Heiner Kallweit <[email protected]> wrote:

Quoted 8 lines
Quoted 4 lines

On a S905X4-based system this call fails randomly. The vendor driver has a retry mechanism and on my system the second attempt is successful always.

This reason looks a bit weak to me.
I'd like AML team to comment on this PLL problem as I suspect it might relate to other PLL we have been seeing

First of all, we've had this problem before. But the probability is very low, most of the PLL will not lock when the chip is tested at high and low temperature.

Our actual code has retry mechanism to solve the above problem.

Quoted 33 lines
Quoted 21 lines
---
  drivers/clk/meson/clk-pll.c | 12 ++++++++----
  1 file changed, 8 insertions(+), 4 deletions(-)
drivers/clk/meson/clk-pll.c +3 -3
index 9e55617bc..daa025b6d 100644
@@ -320,12 +320,16 @@ static int meson_clk_pll_is_enabled(struct clk_hw *hw)
 
  static int meson_clk_pcie_pll_enable(struct clk_hw *hw)
  {
-	meson_clk_pll_init(hw);
+	int retries = 10;
 
-	if (meson_clk_pll_wait_lock(hw))
-		return -EIO;
+	do {
+		meson_clk_pll_init(hw);

drivers/clk/meson/clk-pll.c static int meson_clk_pll_is_enabled(struct clk_hw *hw) · line 335

Quoted 10 lines
drivers/clk/meson/clk-pll.c +5 -1
+		if (!meson_clk_pll_wait_lock(hw))
+			return 0;
+		pr_info("Retry enabling PCIe PLL clock\n");
+	} while (--retries);
 
-	return 0;
+	return -EIO;
  }
 
  static int meson_clk_pll_enable(struct clk_hw *hw)

.

maintainer
#3 lore raw
Quoted 8 lines · Yu Tu
Quoted 7 lines · Jerome Brunet

[ EXTERNAL EMAIL ]

Quoted 3 lines · Heiner Kallweit

On a S905X4-based system this call fails randomly. The vendor driver has a retry mechanism and on my system the second attempt is successful always.

Heiner, ideally commit message should not be about 'your' system but describe what the system actually is. This would be more useful down the road.

Based on Yu Tu feedback I'd propose

'
The PCIe PLL locking may be unreliable under some circumstance, such as high or low temperature. If the PLL fails to lock, reset it a try again.

This helps on the S905X4
'

If this is OK with you, I can amend the message before applying the patch, or you may resubmit. As you wish.

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

This reason looks a bit weak to me.
I'd like AML team to comment on this PLL problem as I suspect it might relate to other PLL we have been seeing

Quoted 34 lines

First of all, we've had this problem before. But the probability is very low, most of the PLL will not lock when the chip is tested at high and low temperature.

Our actual code has retry mechanism to solve the above problem.

Quoted 28 lines
Quoted 17 lines
---
  drivers/clk/meson/clk-pll.c | 12 ++++++++----
  1 file changed, 8 insertions(+), 4 deletions(-)
drivers/clk/meson/clk-pll.c +1 -2
index 9e55617bc..daa025b6d 100644
@@ -320,12 +320,16 @@ static int meson_clk_pll_is_enabled(struct clk_hw *hw)
    static int meson_clk_pcie_pll_enable(struct clk_hw *hw)
  {
-	meson_clk_pll_init(hw);
+	int retries = 10;
  -	if (meson_clk_pll_wait_lock(hw))
-		return -EIO;

drivers/clk/meson/clk-pll.c static int meson_clk_pll_is_enabled(struct clk_hw *hw) · line 333

Quoted 10 lines
drivers/clk/meson/clk-pll.c +7 -0
+	do {
+		meson_clk_pll_init(hw);
+		if (!meson_clk_pll_wait_lock(hw))
+			return 0;
+		pr_info("Retry enabling PCIe PLL clock\n");
+	} while (--retries);
  -	return 0;
+	return -EIO;
  }
    static int meson_clk_pll_enable(struct clk_hw *hw)

.

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

#4 lore raw
Quoted 22 lines · Jerome Brunet
Quoted 8 lines · Yu Tu
Quoted 7 lines · Jerome Brunet

[ EXTERNAL EMAIL ]

Quoted 3 lines · Heiner Kallweit

On a S905X4-based system this call fails randomly. The vendor driver has a retry mechanism and on my system the second attempt is successful always.

Heiner, ideally commit message should not be about 'your' system but describe what the system actually is. This would be more useful down the road.

Based on Yu Tu feedback I'd propose

'
The PCIe PLL locking may be unreliable under some circumstance, such as high or low temperature. If the PLL fails to lock, reset it a try again.

Quoted 6 lines

This helps on the S905X4
'

If this is OK with you, I can amend the message before applying the patch, or you may resubmit. As you wish.

Yes, please amend the commit message as suggested. Thanks for the review and follow-up.

Quoted 40 lines
Quoted 39 lines
Quoted 4 lines
Quoted 1 line

This reason looks a bit weak to me.
I'd like AML team to comment on this PLL problem as I suspect it might relate to other PLL we have been seeing

First of all, we've had this problem before. But the probability is very low, most of the PLL will not lock when the chip is tested at high and low temperature.

Our actual code has retry mechanism to solve the above problem.

Quoted 28 lines
Quoted 17 lines
---
  drivers/clk/meson/clk-pll.c | 12 ++++++++----
  1 file changed, 8 insertions(+), 4 deletions(-)
drivers/clk/meson/clk-pll.c +1 -2
index 9e55617bc..daa025b6d 100644
@@ -320,12 +320,16 @@ static int meson_clk_pll_is_enabled(struct clk_hw *hw)
    static int meson_clk_pcie_pll_enable(struct clk_hw *hw)
  {
-	meson_clk_pll_init(hw);
+	int retries = 10;
  -	if (meson_clk_pll_wait_lock(hw))
-		return -EIO;

drivers/clk/meson/clk-pll.c static int meson_clk_pll_is_enabled(struct clk_hw *hw) · line 333

Quoted 10 lines
drivers/clk/meson/clk-pll.c +7 -0
+	do {
+		meson_clk_pll_init(hw);
+		if (!meson_clk_pll_wait_lock(hw))
+			return 0;
+		pr_info("Retry enabling PCIe PLL clock\n");
+	} while (--retries);
  -	return 0;
+	return -EIO;
  }
    static int meson_clk_pll_enable(struct clk_hw *hw)

.

maintainer Applied
#5 lore raw
Quoted 26 lines · Heiner Kallweit
Quoted 25 lines · Jerome Brunet
Quoted 8 lines · Yu Tu
Quoted 7 lines · Jerome Brunet

[ EXTERNAL EMAIL ]

Quoted 3 lines · Heiner Kallweit

On a S905X4-based system this call fails randomly. The vendor driver has a retry mechanism and on my system the second attempt is successful always.

Heiner, ideally commit message should not be about 'your' system but describe what the system actually is. This would be more useful down the road.

Based on Yu Tu feedback I'd propose

'
The PCIe PLL locking may be unreliable under some circumstance, such as high or low temperature. If the PLL fails to lock, reset it a try again.

This helps on the S905X4
'

Quoted 7 lines
Quoted 3 lines

If this is OK with you, I can amend the message before applying the patch, or you may resubmit. As you wish.

Yes, please amend the commit message as suggested. Thanks for the review and follow-up.

Applied, Thx