* [PATCH 0/4] clk: ti: fapll/dm816x: clock tree and calculation fixes
@ 2026-10-15 16:54 Ettore Chimenti
2026-10-15 16:54 ` [PATCH 1/4] clk: ti: fapll: remove ti_dt_clk_name helper Ettore Chimenti
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Ettore Chimenti @ 2026-10-15 16:54 UTC (permalink / raw)
To: Tero Kristo, Stephen Boyd, Brian Masney, Jerome Brunet,
Tony Lindgren, Andrew Goodbody, Rouven Czerwinski
Cc: linux-omap, linux-clk, linux-kernel, Ettore Chimenti
During TI DM8168-EVM board testing we found that the clock hierarcy and
clock calculation was broken already on 6.12:
main_pll_clk1 <--- main PLL should be parent of other PLLs.
sysclk1_ck
main_pll_clk7
...
main_pll_clk6
...
main_pll_clk5
...
main_pll_clk4
...
This series brings fixes and additions for TI DM816x / FAPLL clock tree
and frequency calculation.
Summary:
- Fix clock tree hierarchy by not using ti_dt_clk_name helper(), that
causes the first PLL as the parent of all clocks in DM816x.
- Add sys_ck alias required for DM816x clock lookup, fixing a boot
error.
- Correct rate calculation logic in fapll driver.
- Add error logging for clocks failing registration to ease debugging.
Fixing clock tree hierarcy is critical as it fixes DM8168-EVM boot
failure in 7.3-rc7. These fixes are affecting DM816x SoCs only.
Signed-off-by: Ettore Chimenti <ettore.chimenti@linaro.org>
---
Andrew Goodbody (1):
clk: ti: fapll: Fix clock speed calculation
Ettore Chimenti (1):
clk-816x: add sys_ck clock as sys_clkin_ck alias
Rouven Czerwinski (2):
clk: ti: fapll: remove ti_dt_clk_name helper
clk: ti: fapll: print clock name that fails to register
drivers/clk/ti/clk-816x.c | 1 +
drivers/clk/ti/fapll.c | 16 ++++++----------
2 files changed, 7 insertions(+), 10 deletions(-)
---
base-commit: 0fcb05b72344f40806cbe810de8872f1698bf053
change-id: 20261014-patch-ektor5-dm8168-clk-e426101415b0
Best regards,
--
Ettore Chimenti <ettore.chimenti@linaro.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] clk: ti: fapll: remove ti_dt_clk_name helper
2026-10-15 16:54 [PATCH 0/4] clk: ti: fapll/dm816x: clock tree and calculation fixes Ettore Chimenti
@ 2026-10-15 16:54 ` Ettore Chimenti
2026-10-15 16:54 ` [PATCH 2/4] clk: ti: fapll: Fix clock speed calculation Ettore Chimenti
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Ettore Chimenti @ 2026-10-15 16:54 UTC (permalink / raw)
To: Tero Kristo, Stephen Boyd, Brian Masney, Jerome Brunet,
Tony Lindgren, Andrew Goodbody, Rouven Czerwinski
Cc: linux-omap, linux-clk, linux-kernel, Ettore Chimenti
From: Rouven Czerwinski <rouven.czerwinski@linaro.org>
The fapll driver uses multiple `clock-output-names`, so we cannot use the
DT helper in this driver because that would assign the first clock
output name as the parent name. This change do not affect other SoCs as
the only consumer is DM816x.
Fixes: 9e56a7d4263c ("clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name()")
Signed-off-by: Rouven Czerwinski <rouven.czerwinski@linaro.org>
Tested-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Signed-off-by: Ettore Chimenti <ettore.chimenti@linaro.org>
---
drivers/clk/ti/fapll.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
index e54b1df3436e..ae2f6fed10f6 100644
--- a/drivers/clk/ti/fapll.c
+++ b/drivers/clk/ti/fapll.c
@@ -10,8 +10,6 @@
#include <linux/of_address.h>
#include <linux/clk/ti.h>
-#include "clock.h"
-
/* FAPLL Control Register PLL_CTRL */
#define FAPLL_MAIN_MULT_N_SHIFT 16
#define FAPLL_MAIN_DIV_P_SHIFT 8
@@ -541,7 +539,6 @@ static void __init ti_fapll_setup(struct device_node *node)
struct clk_init_data *init = NULL;
const char *parent_name[2];
struct clk *pll_clk;
- const char *name;
int i;
fd = kzalloc_obj(*fd);
@@ -559,8 +556,7 @@ static void __init ti_fapll_setup(struct device_node *node)
goto free;
init->ops = &ti_fapll_ops;
- name = ti_dt_clk_name(node);
- init->name = name;
+ init->name = node->name;
init->num_parents = of_clk_get_parent_count(node);
if (init->num_parents != 2) {
@@ -592,7 +588,7 @@ static void __init ti_fapll_setup(struct device_node *node)
if (fapll_is_ddr_pll(fd->base))
fd->bypass_bit_inverted = true;
- fd->name = name;
+ fd->name = node->name;
fd->hw.init = init;
/* Register the parent PLL */
@@ -639,7 +635,7 @@ static void __init ti_fapll_setup(struct device_node *node)
freq = NULL;
}
synth_clk = ti_fapll_synth_setup(fd, freq, div, output_instance,
- output_name, name, pll_clk);
+ output_name, node->name, pll_clk);
if (IS_ERR(synth_clk))
continue;
--
2.56.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] clk: ti: fapll: Fix clock speed calculation
2026-10-15 16:54 [PATCH 0/4] clk: ti: fapll/dm816x: clock tree and calculation fixes Ettore Chimenti
2026-10-15 16:54 ` [PATCH 1/4] clk: ti: fapll: remove ti_dt_clk_name helper Ettore Chimenti
@ 2026-10-15 16:54 ` Ettore Chimenti
2026-10-15 17:05 ` sashiko-bot
2026-10-15 16:54 ` [PATCH 3/4] clk: ti: fapll: print clock name that fails to register Ettore Chimenti
2026-10-15 16:54 ` [PATCH 4/4] clk-816x: add sys_ck clock as sys_clkin_ck alias Ettore Chimenti
3 siblings, 1 reply; 6+ messages in thread
From: Ettore Chimenti @ 2026-10-15 16:54 UTC (permalink / raw)
To: Tero Kristo, Stephen Boyd, Brian Masney, Jerome Brunet,
Tony Lindgren, Andrew Goodbody, Rouven Czerwinski
Cc: linux-omap, linux-clk, linux-kernel, Ettore Chimenti
From: Andrew Goodbody <andrew.goodbody@linaro.org>
The fractional part of the divider was being treated as 1/10000000 wheras
it is in fact 1/16777215. This led to incorrect clock speeds being
reported when a fractional divider was in use. Correct it.
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Signed-off-by: Ettore Chimenti <ettore.chimenti@linaro.org>
---
drivers/clk/ti/fapll.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
index ae2f6fed10f6..008a61f45ac1 100644
--- a/drivers/clk/ti/fapll.c
+++ b/drivers/clk/ti/fapll.c
@@ -336,8 +336,8 @@ static unsigned long ti_fapll_synth_recalc_rate(struct clk_hw *hw,
v = readl_relaxed(synth->freq);
synth_int_div = (v >> 24) & 0xf;
synth_frac_div = v & 0xffffff;
- synth_div_freq = (synth_int_div * 10000000) + synth_frac_div;
- rate *= 10000000;
+ synth_div_freq = (synth_int_div * 16777215) + synth_frac_div;
+ rate *= 16777215;
do_div(rate, synth_div_freq);
rate *= SYNTH_PHASE_K;
}
--
2.56.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] clk: ti: fapll: print clock name that fails to register
2026-10-15 16:54 [PATCH 0/4] clk: ti: fapll/dm816x: clock tree and calculation fixes Ettore Chimenti
2026-10-15 16:54 ` [PATCH 1/4] clk: ti: fapll: remove ti_dt_clk_name helper Ettore Chimenti
2026-10-15 16:54 ` [PATCH 2/4] clk: ti: fapll: Fix clock speed calculation Ettore Chimenti
@ 2026-10-15 16:54 ` Ettore Chimenti
2026-10-15 16:54 ` [PATCH 4/4] clk-816x: add sys_ck clock as sys_clkin_ck alias Ettore Chimenti
3 siblings, 0 replies; 6+ messages in thread
From: Ettore Chimenti @ 2026-10-15 16:54 UTC (permalink / raw)
To: Tero Kristo, Stephen Boyd, Brian Masney, Jerome Brunet,
Tony Lindgren, Andrew Goodbody, Rouven Czerwinski
Cc: linux-omap, linux-clk, linux-kernel, Ettore Chimenti
From: Rouven Czerwinski <rouven.czerwinski@linaro.org>
Improve the error message when a clock fails to register by including
the clock's name and its parent's name for better debugging.
Signed-off-by: Rouven Czerwinski <rouven.czerwinski@linaro.org>
Signed-off-by: Ettore Chimenti <ettore.chimenti@linaro.org>
---
drivers/clk/ti/fapll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
index 008a61f45ac1..5aab90cf5438 100644
--- a/drivers/clk/ti/fapll.c
+++ b/drivers/clk/ti/fapll.c
@@ -520,7 +520,7 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd,
clk = clk_register(NULL, &synth->hw);
if (IS_ERR(clk)) {
- pr_err("failed to register clock\n");
+ pr_err("failed to register clock '%s' for parent '%s'\n", name, parent);
goto free;
}
--
2.56.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] clk-816x: add sys_ck clock as sys_clkin_ck alias
2026-10-15 16:54 [PATCH 0/4] clk: ti: fapll/dm816x: clock tree and calculation fixes Ettore Chimenti
` (2 preceding siblings ...)
2026-10-15 16:54 ` [PATCH 3/4] clk: ti: fapll: print clock name that fails to register Ettore Chimenti
@ 2026-10-15 16:54 ` Ettore Chimenti
3 siblings, 0 replies; 6+ messages in thread
From: Ettore Chimenti @ 2026-10-15 16:54 UTC (permalink / raw)
To: Tero Kristo, Stephen Boyd, Brian Masney, Jerome Brunet,
Tony Lindgren, Andrew Goodbody, Rouven Czerwinski
Cc: linux-omap, linux-clk, linux-kernel, Ettore Chimenti
This patch adds a new clock alias for the DM816x system, mapping
'sys_ck' to 'sys_clkin_ck'. This change is necessary because the voltage
management driver searches for 'sys_ck' in these systems and fails
without this alias. By including 'sys_ck' as an alias for
'sys_clkin_ck', we ensure compatibility with existing drivers that may
reference 'sys_ck'.
Tested-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Signed-off-by: Ettore Chimenti <ettore.chimenti@linaro.org>
---
drivers/clk/ti/clk-816x.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/ti/clk-816x.c b/drivers/clk/ti/clk-816x.c
index 3b8e483aec92..fe6f66fc5a05 100644
--- a/drivers/clk/ti/clk-816x.c
+++ b/drivers/clk/ti/clk-816x.c
@@ -57,6 +57,7 @@ static struct ti_dt_clk dm816x_clks[] = {
DT_CLK(NULL, "timer_sys_ck", "sys_clkin_ck"),
DT_CLK(NULL, "timer_32k_ck", "sysclk18_ck"),
DT_CLK(NULL, "timer_ext_ck", "tclkin_ck"),
+ DT_CLK(NULL, "sys_ck", "sys_clkin_ck"),
{ .node_name = NULL },
};
--
2.56.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/4] clk: ti: fapll: Fix clock speed calculation
2026-10-15 16:54 ` [PATCH 2/4] clk: ti: fapll: Fix clock speed calculation Ettore Chimenti
@ 2026-10-15 17:05 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-10-15 17:05 UTC (permalink / raw)
To: Ettore Chimenti; +Cc: linux-clk
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] clk: ti: fapll: set_frac_rate uses incorrect 10000000 base causing clock mismatch
- [High] clk: ti: fapll: mismatched set/get fractional bases and off-by-one denominator
--
commit 1dcae77615d6eede1d731b41214f02cb5834c02c
Author: Andrew Goodbody <andrew.goodbody@linaro.org>
clk: ti: fapll: Fix clock speed calculation
The fractional part of the divider was being treated as 1/10000000 wheras
it is in fact 1/16777215. This led to incorrect clock speeds being
reported when a fractional divider was in use. Correct it.
> The fractional part of the divider was being treated as 1/10000000 wheras
[Severity: Low]
This isn't a bug, but there is a typo (wheras) in the commit message.
diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
index ae2f6fed10f66..008a61f45ac14 100644
--- a/drivers/clk/ti/fapll.c
+++ b/drivers/clk/ti/fapll.c
@@ -336,8 +336,8 @@ static unsigned long ti_fapll_synth_recalc_rate(struct clk_hw *hw,
v = readl_relaxed(synth->freq);
synth_int_div = (v >> 24) & 0xf;
synth_frac_div = v & 0xffffff;
- synth_div_freq = (synth_int_div * 10000000) + synth_frac_div;
- rate *= 10000000;
+ synth_div_freq = (synth_int_div * 16777215) + synth_frac_div;
+ rate *= 16777215;
[Severity: High]
Is the new 16777215 denominator an off-by-one error?
Standard 24-bit hardware dividers typically use a base of 16,777,216 (2^24).
While 0xffffff is the maximum 24-bit value, the fractional denominator is
usually the full 2^24.
[Severity: High]
Does this create a mismatch between calculating the rate and setting the rate?
Looking at ti_fapll_synth_set_frac_rate() which was not updated in this patch,
it still uses the 10000000 base to calculate the divider:
drivers/clk/ti/fapll.c:ti_fapll_synth_set_frac_rate() {
for (; post_div_m < SYNTH_MAX_DIV_M; post_div_m++) {
synth_int_div = DIV_ROUND_UP_ULL((u64)parent_rate *
SYNTH_PHASE_K *
10000000,
rate * post_div_m);
synth_frac_div = synth_int_div % 10000000;
synth_int_div /= 10000000;
if (synth_int_div <= SYNTH_MAX_INT_DIV)
break;
}
...
}
If a clock rate is set using ti_fapll_synth_set_frac_rate(), the programmed
hardware fractional divider will use the 10000000 base. However,
ti_fapll_synth_recalc_rate() will interpret that same register using the new
16777215 denominator. Should ti_fapll_synth_set_frac_rate() also be updated
to use the new denominator?
do_div(rate, synth_div_freq);
rate *= SYNTH_PHASE_K;
}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015-patch-ektor5-dm8168-clk-v1-0-8b99c5cd5541@linaro.org?part=2
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-15 17:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 16:54 [PATCH 0/4] clk: ti: fapll/dm816x: clock tree and calculation fixes Ettore Chimenti
2026-10-15 16:54 ` [PATCH 1/4] clk: ti: fapll: remove ti_dt_clk_name helper Ettore Chimenti
2026-10-15 16:54 ` [PATCH 2/4] clk: ti: fapll: Fix clock speed calculation Ettore Chimenti
2026-10-15 17:05 ` sashiko-bot
2026-10-15 16:54 ` [PATCH 3/4] clk: ti: fapll: print clock name that fails to register Ettore Chimenti
2026-10-15 16:54 ` [PATCH 4/4] clk-816x: add sys_ck clock as sys_clkin_ck alias Ettore Chimenti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox