Skip to contentSkip to conversation

clk: meson: g12a: fix gp0 and hifi ranges

PATCH In review Jerome Brunet 2 participants 7 messages Apr 29, 2021 – May 24, 2021

Subsystems (3)
lore
Share & tools
lore

Jerome Brunet

author maintainer
#0 lore raw

PATCH 1/1 clk: meson: g12a: fix gp0 and hifi ranges

While some SoC samples are able to lock with a PLL factor of 55, others samples can't. ATM, a minimum of 60 appears to work on all the samples I have tried.

Even with 60, it sometimes takes a long time for the PLL to eventually lock. The documentation says that the minimum rate of these PLLs DCO should be 3GHz, a factor of 125. Let's use that to be on the safe side.

With factor range changed, the PLL seems to lock quickly (enough) so far. It is still unclear if the range was the only reason for the delay.

Fixes 085a4ea93d54 ("clk: meson: g12a: add peripheral clock controller")
---
 drivers/clk/meson/g12a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/g12a.c +1 -1
index b080359b4645..a805bac93c11 100644
@@ -1603,7 +1603,7 @@ static struct clk_regmap g12b_cpub_clk_trace = {
 };
 
 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
-	.min = 55,
+	.min = 125,
 	.max = 255,
 };
 
Signature · 1 line
2.31.1
#1 lore raw
Quoted 23 lines · Jerome Brunet

While some SoC samples are able to lock with a PLL factor of 55, others samples can't. ATM, a minimum of 60 appears to work on all the samples I have tried.

Even with 60, it sometimes takes a long time for the PLL to eventually lock. The documentation says that the minimum rate of these PLLs DCO should be 3GHz, a factor of 125. Let's use that to be on the safe side.

With factor range changed, the PLL seems to lock quickly (enough) so far. It is still unclear if the range was the only reason for the delay.

Fixes 085a4ea93d54 ("clk: meson: g12a: add peripheral clock controller")
---
 drivers/clk/meson/g12a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/g12a.c +0 -0
index b080359b4645..a805bac93c11 100644

drivers/clk/meson/g12a.c static struct clk_regmap g12b_cpub_clk_trace = { · line 1609

Quoted 8 lines
drivers/clk/meson/g12a.c +1 -1
@@ -1603,7 +1603,7 @@ static struct clk_regmap g12b_cpub_clk_trace = {
 };
 
 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
-	.min = 55,
+	.min = 125,
 	.max = 255,
 };
 

I got other issues with GP0 when trying to use it for DSI on VIM3 & VIM3L.

I had to do change the following to have it lock correctly and achieve rates usable for MIPI-DSI requested bandwidth:

drivers/clk/meson/clk-pll.c +2 -2
index cde07f7ebad6..897cd6db5c0f 100644
@@ -391,9 +391,9 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
                meson_parm_write(clk->map, &pll->frac, frac);
        }
 
-       /* If the pll is stopped, bail out now */
+       /* If the pll is stopped, bail out now * /
        if (!enabled)
-               return 0;
+               return 0;*/
 
        if (meson_clk_pll_enable(hw)) {
                pr_warn("%s: pll did not lock, trying to restore old rate %lu\n",

This one is tricky, for DSI the clock rate is set with assigned-clock-rates in DT, but then the GP0 is seen as stopped and then the rate is never set.

When afterwards we enable the PLL, the rate set in the registers is invalid and never locks, this permits setting the rate in the registers even if the PLL is stopped.

drivers/clk/meson/g12a.c +2 -2
index 1b0167b8de3b..08174724a115 100644
@@ -1602,8 +1602,8 @@ static struct clk_regmap g12b_cpub_clk_trace = {
 };
 
 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
-       .min = 55,
-       .max = 255,
+       .min = 120,
+       .max = 168,
 };
 

I had to change the min/max to achieve a stable and functional rate of 720MHz after the ODs.

Neil

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

author maintainer
#2 lore raw
Quoted 42 lines · Neil Armstrong
Quoted 23 lines · Jerome Brunet

While some SoC samples are able to lock with a PLL factor of 55, others samples can't. ATM, a minimum of 60 appears to work on all the samples I have tried.

Even with 60, it sometimes takes a long time for the PLL to eventually lock. The documentation says that the minimum rate of these PLLs DCO should be 3GHz, a factor of 125. Let's use that to be on the safe side.

With factor range changed, the PLL seems to lock quickly (enough) so far. It is still unclear if the range was the only reason for the delay.

Fixes 085a4ea93d54 ("clk: meson: g12a: add peripheral clock controller")
---
 drivers/clk/meson/g12a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/g12a.c +0 -0
index b080359b4645..a805bac93c11 100644

drivers/clk/meson/g12a.c static struct clk_regmap g12b_cpub_clk_trace = { · line 1609

Quoted 8 lines
drivers/clk/meson/g12a.c +1 -1
@@ -1603,7 +1603,7 @@ static struct clk_regmap g12b_cpub_clk_trace = {
 };
 
 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
-	.min = 55,
+	.min = 125,
 	.max = 255,
 };
 

I got other issues with GP0 when trying to use it for DSI on VIM3 & VIM3L.

I had to do change the following to have it lock correctly and achieve rates usable for MIPI-DSI requested bandwidth:

drivers/clk/meson/clk-pll.c +0 -0
index cde07f7ebad6..897cd6db5c0f 100644

drivers/clk/meson/clk-pll.c static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, · line 396

Quoted 8 lines
drivers/clk/meson/clk-pll.c +2 -2
@@ -391,9 +391,9 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
                meson_parm_write(clk->map, &pll->frac, frac);
        }
 
-       /* If the pll is stopped, bail out now */
+       /* If the pll is stopped, bail out now * /
        if (!enabled)
-               return 0;
+               return 0;*/

This enables the PLL everytime set_rate() is called :/

Quoted 6 lines
drivers/clk/meson/clk-pll.c +0 -0
        if (meson_clk_pll_enable(hw)) {
                pr_warn("%s: pll did not lock, trying to restore old rate %lu\n",
 

This one is tricky, for DSI the clock rate is set with assigned-clock-rates in DT, but then the GP0 is seen as stopped and then the rate is never set.

Audio does the same - PLL is set and enabled afterward. This has been working so far.

Quoted 4 lines

When afterwards we enable the PLL, the rate set in the registers is invalid and never locks, this permits setting the rate in the registers even if the PLL is
stopped.

There something to be explained here cause the register have been set before bailing out. What is happening ? The pokes before have no effect or are the value being reset at another point ?

I understand this need to address this concern but it does not seems related to this particular patch.

Quoted 15 lines
drivers/clk/meson/g12a.c +2 -2
index 1b0167b8de3b..08174724a115 100644
@@ -1602,8 +1602,8 @@ static struct clk_regmap g12b_cpub_clk_trace = {
 };
 
 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
-       .min = 55,
-       .max = 255,
+       .min = 120,
+       .max = 168,
 };
 
Quoted 2 lines

I had to change the min/max to achieve a stable and functional rate of 720MHz after the ODs.

How about the range provided in here ? This is range documented by AML (3GHz < DCO < 6GHz). 168 limits would limit the rate to ~4GHz which is way below spec and would negatively impact audio clocks.

Quoted 1 line

Neil

#3 lore raw
Quoted 93 lines · Jerome Brunet
Quoted 42 lines · Neil Armstrong
Quoted 23 lines · Jerome Brunet

While some SoC samples are able to lock with a PLL factor of 55, others samples can't. ATM, a minimum of 60 appears to work on all the samples I have tried.

Even with 60, it sometimes takes a long time for the PLL to eventually lock. The documentation says that the minimum rate of these PLLs DCO should be 3GHz, a factor of 125. Let's use that to be on the safe side.

With factor range changed, the PLL seems to lock quickly (enough) so far. It is still unclear if the range was the only reason for the delay.

Fixes 085a4ea93d54 ("clk: meson: g12a: add peripheral clock controller")
---
 drivers/clk/meson/g12a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/g12a.c +0 -0
index b080359b4645..a805bac93c11 100644

drivers/clk/meson/g12a.c static struct clk_regmap g12b_cpub_clk_trace = { · line 1609

Quoted 8 lines
drivers/clk/meson/g12a.c +1 -1
@@ -1603,7 +1603,7 @@ static struct clk_regmap g12b_cpub_clk_trace = {
 };
 
 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
-	.min = 55,
+	.min = 125,
 	.max = 255,
 };
 

I got other issues with GP0 when trying to use it for DSI on VIM3 & VIM3L.

I had to do change the following to have it lock correctly and achieve rates usable for MIPI-DSI requested bandwidth:

drivers/clk/meson/clk-pll.c +0 -0
index cde07f7ebad6..897cd6db5c0f 100644

drivers/clk/meson/clk-pll.c static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, · line 396

Quoted 8 lines
drivers/clk/meson/clk-pll.c +2 -2
@@ -391,9 +391,9 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
                meson_parm_write(clk->map, &pll->frac, frac);
        }
 
-       /* If the pll is stopped, bail out now */
+       /* If the pll is stopped, bail out now * /
        if (!enabled)
-               return 0;
+               return 0;*/

This enables the PLL everytime set_rate() is called :/

Quoted 6 lines
drivers/clk/meson/clk-pll.c +0 -0
        if (meson_clk_pll_enable(hw)) {
                pr_warn("%s: pll did not lock, trying to restore old rate %lu\n",
 

This one is tricky, for DSI the clock rate is set with assigned-clock-rates in DT, but then the GP0 is seen as stopped and then the rate is never set.

Audio does the same - PLL is set and enabled afterward. This has been working so far.

Quoted 4 lines

When afterwards we enable the PLL, the rate set in the registers is invalid and never locks, this permits setting the rate in the registers even if the PLL is
stopped.

There something to be explained here cause the register have been set before bailing out. What is happening ? The pokes before have no effect or are the value being reset at another point ?

I understand this need to address this concern but it does not seems related to this particular patch.

Quoted 15 lines
drivers/clk/meson/g12a.c +2 -2
index 1b0167b8de3b..08174724a115 100644
@@ -1602,8 +1602,8 @@ static struct clk_regmap g12b_cpub_clk_trace = {
 };
 
 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
-       .min = 55,
-       .max = 255,
+       .min = 120,
+       .max = 168,
 };
 
Quoted 6 lines
Quoted 2 lines

I had to change the min/max to achieve a stable and functional rate of 720MHz after the ODs.

How about the range provided in here ? This is range documented by AML (3GHz < DCO < 6GHz). 168 limits would limit the rate to ~4GHz which is way below spec and would negatively impact audio clocks.

For hifi pll right, not for GP0 ?

Quoted 2 lines
Quoted 1 line

Neil

author maintainer
#4 lore raw
Quoted 94 lines · Neil Armstrong
Quoted 93 lines · Jerome Brunet
Quoted 42 lines · Neil Armstrong
Quoted 23 lines · Jerome Brunet

While some SoC samples are able to lock with a PLL factor of 55, others samples can't. ATM, a minimum of 60 appears to work on all the samples I have tried.

Even with 60, it sometimes takes a long time for the PLL to eventually lock. The documentation says that the minimum rate of these PLLs DCO should be 3GHz, a factor of 125. Let's use that to be on the safe side.

With factor range changed, the PLL seems to lock quickly (enough) so far. It is still unclear if the range was the only reason for the delay.

Fixes 085a4ea93d54 ("clk: meson: g12a: add peripheral clock controller")
---
 drivers/clk/meson/g12a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/g12a.c +0 -0
index b080359b4645..a805bac93c11 100644

drivers/clk/meson/g12a.c static struct clk_regmap g12b_cpub_clk_trace = { · line 1609

Quoted 8 lines
drivers/clk/meson/g12a.c +1 -1
@@ -1603,7 +1603,7 @@ static struct clk_regmap g12b_cpub_clk_trace = {
 };
 
 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
-	.min = 55,
+	.min = 125,
 	.max = 255,
 };
 

I got other issues with GP0 when trying to use it for DSI on VIM3 & VIM3L.

I had to do change the following to have it lock correctly and achieve rates usable for MIPI-DSI requested bandwidth:

drivers/clk/meson/clk-pll.c +0 -0
index cde07f7ebad6..897cd6db5c0f 100644

drivers/clk/meson/clk-pll.c static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, · line 396

Quoted 8 lines
drivers/clk/meson/clk-pll.c +2 -2
@@ -391,9 +391,9 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
                meson_parm_write(clk->map, &pll->frac, frac);
        }
 
-       /* If the pll is stopped, bail out now */
+       /* If the pll is stopped, bail out now * /
        if (!enabled)
-               return 0;
+               return 0;*/

This enables the PLL everytime set_rate() is called :/

Quoted 6 lines
drivers/clk/meson/clk-pll.c +0 -0
        if (meson_clk_pll_enable(hw)) {
                pr_warn("%s: pll did not lock, trying to restore old rate %lu\n",
 

This one is tricky, for DSI the clock rate is set with assigned-clock-rates in DT, but then the GP0 is seen as stopped and then the rate is never set.

Audio does the same - PLL is set and enabled afterward. This has been working so far.

Quoted 4 lines

When afterwards we enable the PLL, the rate set in the registers is invalid and never locks, this permits setting the rate in the registers even if the PLL is
stopped.

There something to be explained here cause the register have been set before bailing out. What is happening ? The pokes before have no effect or are the value being reset at another point ?

I understand this need to address this concern but it does not seems related to this particular patch.

Quoted 15 lines
drivers/clk/meson/g12a.c +2 -2
index 1b0167b8de3b..08174724a115 100644
@@ -1602,8 +1602,8 @@ static struct clk_regmap g12b_cpub_clk_trace = {
 };
 
 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
-       .min = 55,
-       .max = 255,
+       .min = 120,
+       .max = 168,
 };
 
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

I had to change the min/max to achieve a stable and functional rate of 720MHz after the ODs.

How about the range provided in here ? This is range documented by AML (3GHz < DCO < 6GHz). 168 limits would limit the rate to ~4GHz which is way below spec and would negatively impact audio clocks.

For hifi pll right, not for GP0 ?

Both have the same spec.

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

Neil

Acked-by on v1 1/1
#5 lore raw
In reply to Jerome Brunet
Quoted 23 lines · Jerome Brunet

While some SoC samples are able to lock with a PLL factor of 55, others samples can't. ATM, a minimum of 60 appears to work on all the samples I have tried.

Even with 60, it sometimes takes a long time for the PLL to eventually lock. The documentation says that the minimum rate of these PLLs DCO should be 3GHz, a factor of 125. Let's use that to be on the safe side.

With factor range changed, the PLL seems to lock quickly (enough) so far. It is still unclear if the range was the only reason for the delay.

Fixes 085a4ea93d54 ("clk: meson: g12a: add peripheral clock controller")
---
 drivers/clk/meson/g12a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/g12a.c +0 -0
index b080359b4645..a805bac93c11 100644

drivers/clk/meson/g12a.c static struct clk_regmap g12b_cpub_clk_trace = { · line 1609

Quoted 8 lines
drivers/clk/meson/g12a.c +1 -1
@@ -1603,7 +1603,7 @@ static struct clk_regmap g12b_cpub_clk_trace = {
 };
 
 static const struct pll_mult_range g12a_gp0_pll_mult_range = {
-	.min = 55,
+	.min = 125,
 	.max = 255,
 };
 

Sorry for bothering with the DSI stuff, I'll fix this when we are ready to upstream DSI support for G12A.

I had this patch for a while in my integration branches, so:

Neil

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

author maintainer Applied
#6 lore raw
Quoted 8 lines · Neil Armstrong

On 29/04/2021 11:03, Jerome Brunet wrote:
Sorry for bothering with the DSI stuff, I'll fix this when we are ready to upstream DSI support for G12A.

I had this patch for a while in my integration branches, so:

Neil

Applied