Skip to contentSkip to conversation

clk: tegra: use pll_ref as the pll_e parent

PATCH In review Peter De Schrijver 3 participants 10 messages Oct 30, 2013 – Nov 25, 2013

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

PATCH 1/1 clk: tegra: use pll_ref as the pll_e parent

Use pll_ref instead of pll_re_vco as the pll_e parent on Tegra114 and Tegra124. Also add a pll_ref table entry for pll_e for Tegra114.

---
 drivers/clk/tegra/clk-pll.c      |    7 ++++---
 drivers/clk/tegra/clk-tegra114.c |    3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/clk/tegra/clk-pll.c +4 -3
index 7d775a9..193457b 100644
@@ -1712,11 +1712,12 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name,
 	val_aux = pll_readl(pll_params->aux_reg, pll);
 
 	if (val & PLL_BASE_ENABLE) {
-		if (!(val_aux & PLLE_AUX_PLLRE_SEL))
+		if ((val_aux & PLLE_AUX_PLLRE_SEL) || (val_aux & val_aux))
 			WARN(1, "pll_e enabled with unsupported parent %s\n",
-			  (val & PLLE_AUX_PLLP_SEL) ? "pllp_out0" : "pll_ref");
+			  (val_aux & PLLE_AUX_PLLP_SEL) ? "pllp_out0" :
+					"pll_re_vco");
 	} else {
-		val_aux |= PLLE_AUX_PLLRE_SEL;
+		val_aux &= ~(PLLE_AUX_PLLRE_SEL | PLLE_AUX_PLLP_SEL);
 		pll_writel(val, pll_params->aux_reg, pll);
 	}
 
drivers/clk/tegra/clk-tegra114.c +2 -1
index e365b35..5cfcd3e 100644
@@ -560,6 +560,7 @@ static struct tegra_clk_pll_freq_table pll_e_freq_table[] = {
 	/* PLLE special case: use cpcon field to store cml divider value */
 	{336000000, 100000000, 100, 21, 16, 11},
 	{312000000, 100000000, 200, 26, 24, 13},
+	{12000000, 100000000, 200,  1,  24, 13},
 	{0, 0, 0, 0, 0, 0},
 };
 
@@ -1178,7 +1179,7 @@ static void __init tegra114_pll_init(void __iomem *clk_base,
 	clks[TEGRA114_CLK_PLL_RE_OUT] = clk;
 
 	/* PLLE */
-	clk = tegra_clk_register_plle_tegra114("pll_e_out0", "pll_re_vco",
+	clk = tegra_clk_register_plle_tegra114("pll_e_out0", "pll_ref",
 				      clk_base, 0, &pll_e_params, NULL);
 	clks[TEGRA114_CLK_PLL_E_OUT0] = clk;
 }
Signature · 1 line
1.7.7.rc0.72.g4b5ea.dirty
#1 lore raw
Quoted 2 lines · Peter De Schrijver

Use pll_ref instead of pll_re_vco as the pll_e parent on Tegra114 and Tegra124. Also add a pll_ref table entry for pll_e for Tegra114.

Why? What benefit does this give, or what bug does this fix?

drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_plle_tegra114(const char *name, · line 1715

Quoted 7 lines
drivers/clk/tegra/clk-pll.c +1 -1
 
 	val_aux = pll_readl(pll_params->aux_reg, pll);
 
 	if (val & PLL_BASE_ENABLE) {
-		if (!(val_aux & PLLE_AUX_PLLRE_SEL))
+		if ((val_aux & PLLE_AUX_PLLRE_SEL) || (val_aux & val_aux))

Isn't "|| (val_aux & val_aux)" always true, at least if the value is non-zero? Either this should be simply "|| val_aux", or one of those two "val_aux" is the wrong thing.

Quoted 13 lines
drivers/clk/tegra/clk-pll.c +3 -2
 			WARN(1, "pll_e enabled with unsupported parent %s\n",
-			  (val & PLLE_AUX_PLLP_SEL) ? "pllp_out0" : "pll_ref");
+			  (val_aux & PLLE_AUX_PLLP_SEL) ? "pllp_out0" :
+					"pll_re_vco");
 	} else {
-		val_aux |= PLLE_AUX_PLLRE_SEL;
+		val_aux &= ~(PLLE_AUX_PLLRE_SEL | PLLE_AUX_PLLP_SEL);
 		pll_writel(val, pll_params->aux_reg, pll);
 	}

drivers/clk/tegra/clk-tegra114.c static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { · line 563

Quoted 4 lines
drivers/clk/tegra/clk-tegra114.c +1 -0
@@ -560,6 +560,7 @@ static struct tegra_clk_pll_freq_table pll_e_freq_table[] = {
 	/* PLLE special case: use cpcon field to store cml divider value */
 	{336000000, 100000000, 100, 21, 16, 11},
 	{312000000, 100000000, 200, 26, 24, 13},
+	{12000000, 100000000, 200,  1,  24, 13},

Presumably this is because pll_ref is the crystal, which runs at 12MHz. What if it doesn't; Tegra supports a bunch of other crystal rates. Don't we need entries for all the other potential crystal rates too?

#2 lore raw

Am Mittwoch, den 30.10.2013, 09:41 -0600 schrieb Stephen Warren:

Quoted 30 lines · Peter De Schrijver
Quoted 2 lines

Use pll_ref instead of pll_re_vco as the pll_e parent on Tegra114 and Tegra124. Also add a pll_ref table entry for pll_e for Tegra114.

Why? What benefit does this give, or what bug does this fix?

drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_plle_tegra114(const char *name, · line 1715

Quoted 7 lines
drivers/clk/tegra/clk-pll.c +1 -1
 
 	val_aux = pll_readl(pll_params->aux_reg, pll);
 
 	if (val & PLL_BASE_ENABLE) {
-		if (!(val_aux & PLLE_AUX_PLLRE_SEL))
+		if ((val_aux & PLLE_AUX_PLLRE_SEL) || (val_aux & val_aux))

Isn't "|| (val_aux & val_aux)" always true, at least if the value is non-zero? Either this should be simply "|| val_aux", or one of those two "val_aux" is the wrong thing.

Quoted 11 lines
drivers/clk/tegra/clk-pll.c +3 -2
 			WARN(1, "pll_e enabled with unsupported parent %s\n",
-			  (val & PLLE_AUX_PLLP_SEL) ? "pllp_out0" : "pll_ref");
+			  (val_aux & PLLE_AUX_PLLP_SEL) ? "pllp_out0" :
+					"pll_re_vco");
 	} else {
-		val_aux |= PLLE_AUX_PLLRE_SEL;
+		val_aux &= ~(PLLE_AUX_PLLRE_SEL | PLLE_AUX_PLLP_SEL);
 		pll_writel(val, pll_params->aux_reg, pll);
 	}
drivers/clk/tegra/clk-tegra114.c +0 -0
Quoted 9 lines

drivers/clk/tegra/clk-tegra114.c static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { · line 563

Quoted 5 lines
drivers/clk/tegra/clk-tegra114.c +1 -0
@@ -560,6 +560,7 @@ static struct tegra_clk_pll_freq_table pll_e_freq_table[] = {
 	/* PLLE special case: use cpcon field to store cml divider value */
 	{336000000, 100000000, 100, 21, 16, 11},
 	{312000000, 100000000, 200, 26, 24, 13},
+	{12000000, 100000000, 200,  1,  24, 13},

Presumably this is because pll_ref is the crystal, which runs at 12MHz. What if it doesn't; Tegra supports a bunch of other crystal rates. Don't we need entries for all the other potential crystal rates too?

The TRM states that PCIe and thus PLLE are only supported with 12MHz external crystal rate.

Signature · 4 lines
Pengutronix e.K.                           | Lucas Stach                 |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#4 lore raw
In reply to Stephen Warren
Quoted 6 lines · Stephen Warren
Quoted 2 lines · Peter De Schrijver

Use pll_ref instead of pll_re_vco as the pll_e parent on Tegra114 and Tegra124. Also add a pll_ref table entry for pll_e for Tegra114.

Why? What benefit does this give, or what bug does this fix?

Otherrwise Tegra114 will crash on boot.

Quoted 4 lines
Quoted 4 lines
drivers/clk/tegra/clk-pll.c +0 -0
 
 	val_aux = pll_readl(pll_params->aux_reg, pll);
Quoted 8 lines

drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_plle_tegra114(const char *name, · line 1715

Quoted 3 lines
drivers/clk/tegra/clk-pll.c +1 -1
 	if (val & PLL_BASE_ENABLE) {
-		if (!(val_aux & PLLE_AUX_PLLRE_SEL))
+		if ((val_aux & PLLE_AUX_PLLRE_SEL) || (val_aux & val_aux))

Isn't "|| (val_aux & val_aux)" always true, at least if the value is non-zero? Either this should be simply "|| val_aux", or one of those two "val_aux" is the wrong thing.

It should have been val_aux & PLLE_AUX_PLLP_SEL...

Cheers,

Peter.

#3 lore raw
In reply to Lucas Stach
Quoted 41 lines · Lucas Stach

Am Mittwoch, den 30.10.2013, 09:41 -0600 schrieb Stephen Warren:

Quoted 30 lines · Peter De Schrijver
Quoted 2 lines

Use pll_ref instead of pll_re_vco as the pll_e parent on Tegra114 and Tegra124. Also add a pll_ref table entry for pll_e for Tegra114.

Why? What benefit does this give, or what bug does this fix?

drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_plle_tegra114(const char *name, · line 1715

Quoted 7 lines
drivers/clk/tegra/clk-pll.c +1 -1
 
 	val_aux = pll_readl(pll_params->aux_reg, pll);
 
 	if (val & PLL_BASE_ENABLE) {
-		if (!(val_aux & PLLE_AUX_PLLRE_SEL))
+		if ((val_aux & PLLE_AUX_PLLRE_SEL) || (val_aux & val_aux))

Isn't "|| (val_aux & val_aux)" always true, at least if the value is non-zero? Either this should be simply "|| val_aux", or one of those two "val_aux" is the wrong thing.

Quoted 11 lines
drivers/clk/tegra/clk-pll.c +3 -2
 			WARN(1, "pll_e enabled with unsupported parent %s\n",
-			  (val & PLLE_AUX_PLLP_SEL) ? "pllp_out0" : "pll_ref");
+			  (val_aux & PLLE_AUX_PLLP_SEL) ? "pllp_out0" :
+					"pll_re_vco");
 	} else {
-		val_aux |= PLLE_AUX_PLLRE_SEL;
+		val_aux &= ~(PLLE_AUX_PLLRE_SEL | PLLE_AUX_PLLP_SEL);
 		pll_writel(val, pll_params->aux_reg, pll);
 	}
drivers/clk/tegra/clk-tegra114.c +0 -0
Quoted 9 lines

drivers/clk/tegra/clk-tegra114.c static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { · line 563

Quoted 5 lines
drivers/clk/tegra/clk-tegra114.c +1 -0
@@ -560,6 +560,7 @@ static struct tegra_clk_pll_freq_table pll_e_freq_table[] = {
 	/* PLLE special case: use cpcon field to store cml divider value */
 	{336000000, 100000000, 100, 21, 16, 11},
 	{312000000, 100000000, 200, 26, 24, 13},
+	{12000000, 100000000, 200,  1,  24, 13},

Presumably this is because pll_ref is the crystal, which runs at 12MHz. What if it doesn't; Tegra supports a bunch of other crystal rates. Don't we need entries for all the other potential crystal rates too?

Quoted 3 lines

The TRM states that PCIe and thus PLLE are only supported with 12MHz external crystal rate.

This is has been different for Tegra114 at least (where PLLE is used for USB3)

Cheers,

Peter.

#5 lore raw
In reply to Peter De Schrijver
Quoted 8 lines · Peter De Schrijver
Quoted 5 lines · Stephen Warren
Quoted 2 lines · Peter De Schrijver

Use pll_ref instead of pll_re_vco as the pll_e parent on Tegra114 and Tegra124. Also add a pll_ref table entry for pll_e for Tegra114.

Why? What benefit does this give, or what bug does this fix?

Otherrwise Tegra114 will crash on boot.

Sigh. For what reason?

#6 lore raw
Quoted 11 lines · Stephen Warren
Quoted 8 lines · Peter De Schrijver
Quoted 5 lines · Stephen Warren
Quoted 2 lines · Peter De Schrijver

Use pll_ref instead of pll_re_vco as the pll_e parent on Tegra114 and Tegra124. Also add a pll_ref table entry for pll_e for Tegra114.

Why? What benefit does this give, or what bug does this fix?

Otherrwise Tegra114 will crash on boot.

Sigh. For what reason?

pll_re_vco having an unsupported rate of 300Mhz. My guess is that it depends on the bootloader if you will see this. I'm fairly sure I verified this on my dalmore in helsinki and it worked, but it failed on Paul's test setup.

Cheers,

Peter.

#7 lore raw
Quoted 9 lines · Peter De Schrijver
Quoted 8 lines · Stephen Warren
Quoted 7 lines · Peter De Schrijver
Quoted 5 lines · Stephen Warren
Quoted 2 lines · Peter De Schrijver

Use pll_ref instead of pll_re_vco as the pll_e parent on Tegra114 and Tegra124. Also add a pll_ref table entry for pll_e for Tegra114.

Why? What benefit does this give, or what bug does this fix?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Otherrwise Tegra114 will crash on boot.

Sigh. For what reason?

pll_re_vco having an unsupported rate of 300Mhz. My guess is that it depends on the bootloader if you will see this. I'm fairly sure I verified this on my dalmore in helsinki and it worked, but it failed on Paul's test setup.

OK, so this is primarily a SW issue, because pll_e's freq_table simply doesn't have an entry for input frequency 300MHz. Can you make sure the commit description explains that?

#9 lore raw
Quoted 9 lines · Peter De Schrijver
Quoted 4 lines · Peter De Schrijver

Use pll_ref instead of pll_re_vco as the pll_e parent on Tegra114 and Tegra124. Also add a pll_ref table entry for pll_e for Tegra114.

I will squash this into the next tegra-clk-next as the previous pull request has never made it.

Looking again at this, I think the Tegra114 and generic PLL part of the patch better stays as a separate patch. The Tegra124 bit will be squashed into the Tegra124 support patch.

Cheers,

Peter.