* [PATCH v2 1/4] clk: ti: fapll: remove ti_dt_clk_name helper
2026-10-28 15:53 [PATCH v2 0/4] clk: ti: fapll/dm816x: clock tree and calculation fixes Ettore Chimenti
@ 2026-10-28 15:53 ` Ettore Chimenti
2026-10-28 15:53 ` [PATCH v2 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-28 15:53 UTC (permalink / raw)
To: Tero Kristo, Stephen Boyd, Brian Masney, Jerome Brunet,
Tony Lindgren, Michael Turquette, 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 [flat|nested] 6+ messages in thread* [PATCH v2 2/4] clk: ti: fapll: Fix clock speed calculation
2026-10-28 15:53 [PATCH v2 0/4] clk: ti: fapll/dm816x: clock tree and calculation fixes Ettore Chimenti
2026-10-28 15:53 ` [PATCH v2 1/4] clk: ti: fapll: remove ti_dt_clk_name helper Ettore Chimenti
@ 2026-10-28 15:53 ` Ettore Chimenti
2026-10-28 15:53 ` [PATCH v2 3/4] clk: ti: fapll: print clock name that fails to register Ettore Chimenti
2026-10-28 15:53 ` [PATCH v2 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-28 15:53 UTC (permalink / raw)
To: Tero Kristo, Stephen Boyd, Brian Masney, Jerome Brunet,
Tony Lindgren, Michael Turquette, 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
whereas it is in fact 1/2^24 (1/16777216). This led to incorrect clock
speeds being reported when a fractional divider was in use. Correct it.
As well as fixing the clock speed calculation when read, also update the
calculation on set in a similar manner.
Fixes: 163152cbbe32 ("clk: ti: Add support for FAPLL on dm816x")
Signed-off-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, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
index ae2f6fed10f6..8ab9acd57b60 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 * 16777216) + synth_frac_div;
+ rate *= 16777216;
do_div(rate, synth_div_freq);
rate *= SYNTH_PHASE_K;
}
@@ -378,10 +378,10 @@ static u32 ti_fapll_synth_set_frac_rate(struct fapll_synth *synth,
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,
+ 16777216,
rate * post_div_m);
- synth_frac_div = synth_int_div % 10000000;
- synth_int_div /= 10000000;
+ synth_frac_div = synth_int_div % 16777216;
+ synth_int_div /= 16777216;
if (synth_int_div <= SYNTH_MAX_INT_DIV)
break;
--
2.56.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 3/4] clk: ti: fapll: print clock name that fails to register
2026-10-28 15:53 [PATCH v2 0/4] clk: ti: fapll/dm816x: clock tree and calculation fixes Ettore Chimenti
2026-10-28 15:53 ` [PATCH v2 1/4] clk: ti: fapll: remove ti_dt_clk_name helper Ettore Chimenti
2026-10-28 15:53 ` [PATCH v2 2/4] clk: ti: fapll: Fix clock speed calculation Ettore Chimenti
@ 2026-10-28 15:53 ` Ettore Chimenti
2026-10-28 15:53 ` [PATCH v2 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-28 15:53 UTC (permalink / raw)
To: Tero Kristo, Stephen Boyd, Brian Masney, Jerome Brunet,
Tony Lindgren, Michael Turquette, 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 8ab9acd57b60..d360e9d986c3 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 [flat|nested] 6+ messages in thread* [PATCH v2 4/4] clk-816x: add sys_ck clock as sys_clkin_ck alias
2026-10-28 15:53 [PATCH v2 0/4] clk: ti: fapll/dm816x: clock tree and calculation fixes Ettore Chimenti
` (2 preceding siblings ...)
2026-10-28 15:53 ` [PATCH v2 3/4] clk: ti: fapll: print clock name that fails to register Ettore Chimenti
@ 2026-10-28 15:53 ` Ettore Chimenti
2026-10-30 10:48 ` Ettore Chimenti
3 siblings, 1 reply; 6+ messages in thread
From: Ettore Chimenti @ 2026-10-28 15:53 UTC (permalink / raw)
To: Tero Kristo, Stephen Boyd, Brian Masney, Jerome Brunet,
Tony Lindgren, Michael Turquette, 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 [flat|nested] 6+ messages in thread* Re: [PATCH v2 4/4] clk-816x: add sys_ck clock as sys_clkin_ck alias
2026-10-28 15:53 ` [PATCH v2 4/4] clk-816x: add sys_ck clock as sys_clkin_ck alias Ettore Chimenti
@ 2026-10-30 10:48 ` Ettore Chimenti
0 siblings, 0 replies; 6+ messages in thread
From: Ettore Chimenti @ 2026-10-30 10:48 UTC (permalink / raw)
To: Ettore Chimenti, Tero Kristo, Stephen Boyd, Brian Masney,
Jerome Brunet, Tony Lindgren, Michael Turquette, Andrew Goodbody,
Rouven Czerwinski
Cc: linux-omap, linux-clk, linux-kernel
Hi,
On Wed Oct 28, 2026 at 4:53 PM CET, Ettore Chimenti wrote:
> 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 },
> };
>
I'll drop this patch from the series. The proposed approach from Sashiko
seems sound and I just sent a separate patch that implements that.
Best regards,
Ettore
^ permalink raw reply [flat|nested] 6+ messages in thread