Skip to contentSkip to conversation

clk: tegra: Do not warn unnecessarily

PATCH Applied Thierry Reding 3 participants 10 messages Jun 13, 2019 – Jun 25, 2019

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

PATCH 1/3 clk: tegra: Do not warn unnecessarily

From: Thierry Reding <[email protected]>

There is no need to warn if the reference PLL is enabled with the correct defaults. Only warn if the boot values don't match the defaults.

---
 drivers/clk/tegra/clk-tegra210.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-tegra210.c +3 -2
index e1ba62d2b1a0..4904ac4a75db 100644
@@ -984,8 +984,6 @@ static void tegra210_pllre_set_defaults(struct tegra_clk_pll *pllre)
 	pllre->params->defaults_set = true;
 
 	if (val & PLL_ENABLE) {
-		pr_warn("PLL_RE already enabled. Postponing set full defaults\n");
-
 		/*
 		 * PLL is ON: check if defaults already set, then set those
 		 * that can be updated in flight.
@@ -1012,6 +1010,9 @@ static void tegra210_pllre_set_defaults(struct tegra_clk_pll *pllre)
 		writel_relaxed(val, clk_base + pllre->params->ext_misc_reg[0]);
 		udelay(1);
 
+		if (!pllre->params->defaults_set)
+			pr_warn("PLL_RE already enabled. Postponing set full defaults\n");
+
 		return;
 	}
 
Signature · 1 line
2.21.0
#1 lore raw

PATCH 2/3 clk: tegra: Warn if an enabled PLL is in IDDQ

From: Thierry Reding <[email protected]>

A PLL in IDDQ doesn't work, whether it's enabled or not. This is not a configuration that makes sense, so warn about it.

---
 drivers/clk/tegra/clk-tegra210.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-tegra210.c +5 -1
index 4904ac4a75db..793c7acaf4e2 100644
@@ -1003,8 +1003,12 @@ static void tegra210_pllre_set_defaults(struct tegra_clk_pll *pllre)
 		_pll_misc_chk_default(clk_base, pllre->params, 0, val,
 				~mask & PLLRE_MISC0_WRITE_MASK);
 
-		/* Enable lock detect */
+		/* The PLL doesn't work if it's in IDDQ. */
 		val = readl_relaxed(clk_base + pllre->params->ext_misc_reg[0]);
+		if (val & PLLRE_MISC0_IDDQ)
+			pr_warn("unexpected IDDQ bit set for enabled clock\n");
+
+		/* Enable lock detect */
 		val &= ~mask;
 		val |= PLLRE_MISC0_DEFAULT_VALUE & mask;
 		writel_relaxed(val, clk_base + pllre->params->ext_misc_reg[0]);
Signature · 1 line
2.21.0
maintainer Acked-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] clk: tegra: Warn if an enabled PLL is in IDDQ

Quoted 18 lines · Thierry Reding

From: Thierry Reding <[email protected]>

A PLL in IDDQ doesn't work, whether it's enabled or not. This is not a configuration that makes sense, so warn about it.

---
 drivers/clk/tegra/clk-tegra210.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-tegra210.c +0 -0
index 4904ac4a75db..793c7acaf4e2 100644
@@ -1003,8 +1003,12 @@ static void tegra210_pllre_set_defaults(struct tegra_clk_pll *pllre)
 		_pll_misc_chk_default(clk_base, pllre->params, 0, val,
 				~mask & PLLRE_MISC0_WRITE_MASK);
 

drivers/clk/tegra/clk-tegra210.c static void tegra210_pllre_set_defaults(struct tegra_clk_pll *pllre) · line 1014

Quoted 10 lines
drivers/clk/tegra/clk-tegra210.c +5 -1
-		/* Enable lock detect */
+		/* The PLL doesn't work if it's in IDDQ. */
 		val = readl_relaxed(clk_base + pllre->params->ext_misc_reg[0]);
+		if (val & PLLRE_MISC0_IDDQ)
+			pr_warn("unexpected IDDQ bit set for enabled clock\n");
+
+		/* Enable lock detect */
 		val &= ~mask;
 		val |= PLLRE_MISC0_DEFAULT_VALUE & mask;
 		writel_relaxed(val, clk_base + pllre->params->ext_misc_reg[0]);

Looks like there are a few other instances of this that could be fixed as well.

Cheers
Jon

Signature · 1 line
nvpublic
#3 lore raw

Re: [PATCH 2/3] clk: tegra: Warn if an enabled PLL is in IDDQ

Quoted 20 lines · Jon Hunter
Quoted 18 lines · Thierry Reding

From: Thierry Reding <[email protected]>

A PLL in IDDQ doesn't work, whether it's enabled or not. This is not a configuration that makes sense, so warn about it.

---
 drivers/clk/tegra/clk-tegra210.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-tegra210.c +0 -0
index 4904ac4a75db..793c7acaf4e2 100644
@@ -1003,8 +1003,12 @@ static void tegra210_pllre_set_defaults(struct tegra_clk_pll *pllre)
 		_pll_misc_chk_default(clk_base, pllre->params, 0, val,
 				~mask & PLLRE_MISC0_WRITE_MASK);
 
Quoted 13 lines

drivers/clk/tegra/clk-tegra210.c static void tegra210_pllre_set_defaults(struct tegra_clk_pll *pllre) · line 1014

Quoted 10 lines
drivers/clk/tegra/clk-tegra210.c +5 -1
-		/* Enable lock detect */
+		/* The PLL doesn't work if it's in IDDQ. */
 		val = readl_relaxed(clk_base + pllre->params->ext_misc_reg[0]);
+		if (val & PLLRE_MISC0_IDDQ)
+			pr_warn("unexpected IDDQ bit set for enabled clock\n");
+
+		/* Enable lock detect */
 		val &= ~mask;
 		val |= PLLRE_MISC0_DEFAULT_VALUE & mask;
 		writel_relaxed(val, clk_base + pllre->params->ext_misc_reg[0]);

Looks like there are a few other instances of this that could be fixed as well.

Yeah. This is the only one that's showing up in logs, so I was concentrating on this one. I'll make another pass over the driver and clean up the rest of them in a separate patch.

Thierry

#5 lore raw

PATCH 3/3 clk: tegra: Do not enable PLL_RE_VCO on Tegra210

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

It turns out that this PLL is not used on Tegra210, so there's no need to enable it via the init table. Remove the init table entry for this PLL to avoid it getting enabled at boot time. If the bootloader enabled it and forgot to turn it off, the common clock framework will now know to disable it because it is unused.

---
 drivers/clk/tegra/clk-tegra210.c | 1 -
 1 file changed, 1 deletion(-)
drivers/clk/tegra/clk-tegra210.c +0 -1
index 793c7acaf4e2..13537e4458b5 100644
@@ -3337,7 +3337,6 @@ static struct tegra_clk_init_table init_table[] __initdata = {
 	{ TEGRA210_CLK_DFLL_SOC, TEGRA210_CLK_PLL_P, 51000000, 1 },
 	{ TEGRA210_CLK_DFLL_REF, TEGRA210_CLK_PLL_P, 51000000, 1 },
 	{ TEGRA210_CLK_SBC4, TEGRA210_CLK_PLL_P, 12000000, 1 },
-	{ TEGRA210_CLK_PLL_RE_VCO, TEGRA210_CLK_CLK_MAX, 672000000, 1 },
 	{ TEGRA210_CLK_XUSB_GATE, TEGRA210_CLK_CLK_MAX, 0, 1 },
 	{ TEGRA210_CLK_XUSB_SS_SRC, TEGRA210_CLK_PLL_U_480M, 120000000, 0 },
 	{ TEGRA210_CLK_XUSB_FS_SRC, TEGRA210_CLK_PLL_U_48M, 48000000, 0 },
Signature · 1 line
2.21.0
maintainer Acked-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] clk: tegra: Do not enable PLL_RE_VCO on Tegra210

Quoted 18 lines · Thierry Reding

From: Thierry Reding <[email protected]>

It turns out that this PLL is not used on Tegra210, so there's no need to enable it via the init table. Remove the init table entry for this PLL to avoid it getting enabled at boot time. If the bootloader enabled it and forgot to turn it off, the common clock framework will now know to disable it because it is unused.

---
 drivers/clk/tegra/clk-tegra210.c | 1 -
 1 file changed, 1 deletion(-)
drivers/clk/tegra/clk-tegra210.c +0 -0
index 793c7acaf4e2..13537e4458b5 100644

drivers/clk/tegra/clk-tegra210.c static struct tegra_clk_init_table init_table[] __initdata = { · line 3342

Quoted 7 lines
drivers/clk/tegra/clk-tegra210.c +0 -1
@@ -3337,7 +3337,6 @@ static struct tegra_clk_init_table init_table[] __initdata = {
 	{ TEGRA210_CLK_DFLL_SOC, TEGRA210_CLK_PLL_P, 51000000, 1 },
 	{ TEGRA210_CLK_DFLL_REF, TEGRA210_CLK_PLL_P, 51000000, 1 },
 	{ TEGRA210_CLK_SBC4, TEGRA210_CLK_PLL_P, 12000000, 1 },
-	{ TEGRA210_CLK_PLL_RE_VCO, TEGRA210_CLK_CLK_MAX, 672000000, 1 },
 	{ TEGRA210_CLK_XUSB_GATE, TEGRA210_CLK_CLK_MAX, 0, 1 },
 	{ TEGRA210_CLK_XUSB_SS_SRC, TEGRA210_CLK_PLL_U_480M, 120000000, 0 },
 	{ TEGRA210_CLK_XUSB_FS_SRC, TEGRA210_CLK_PLL_U_48M, 48000000, 0 },

Cheers
Jon

Signature · 1 line
nvpublic
maintainer Applied
#7 lore raw

Re: [PATCH 3/3] clk: tegra: Do not enable PLL_RE_VCO on Tegra210

In reply to Thierry Reding

Quoting Thierry Reding (2019-06-13 09:12:25)

Quoted 10 lines

From: Thierry Reding <[email protected]>

It turns out that this PLL is not used on Tegra210, so there's no need to enable it via the init table. Remove the init table entry for this PLL to avoid it getting enabled at boot time. If the bootloader enabled it and forgot to turn it off, the common clock framework will now know to disable it because it is unused.

---

Applied to clk-next

maintainer Acked-by on v1 1/3
#8 lore raw
In reply to Thierry Reding
Quoted 24 lines · Thierry Reding

From: Thierry Reding <[email protected]>

There is no need to warn if the reference PLL is enabled with the correct defaults. Only warn if the boot values don't match the defaults.

---
 drivers/clk/tegra/clk-tegra210.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-tegra210.c +0 -2
index e1ba62d2b1a0..4904ac4a75db 100644
@@ -984,8 +984,6 @@ static void tegra210_pllre_set_defaults(struct tegra_clk_pll *pllre)
 	pllre->params->defaults_set = true;
 
 	if (val & PLL_ENABLE) {
-		pr_warn("PLL_RE already enabled. Postponing set full defaults\n");
-
 		/*
 		 * PLL is ON: check if defaults already set, then set those
 		 * that can be updated in flight.

drivers/clk/tegra/clk-tegra210.c static void tegra210_pllre_set_defaults(struct tegra_clk_pll *pllre) · line 1017

Quoted 8 lines
drivers/clk/tegra/clk-tegra210.c +3 -0
@@ -1012,6 +1010,9 @@ static void tegra210_pllre_set_defaults(struct tegra_clk_pll *pllre)
 		writel_relaxed(val, clk_base + pllre->params->ext_misc_reg[0]);
 		udelay(1);
 
+		if (!pllre->params->defaults_set)
+			pr_warn("PLL_RE already enabled. Postponing set full defaults\n");
+
 		return;
 	}

Cheers
Jon

Signature · 1 line
nvpublic