From: Tianling Shen Date: Mon, 23 Dec 2024 11:07:13 +0000 (+0800) Subject: rockchip: backport recent rk3588 clk updates X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=8ad02ca2f8477b1cfdc5ea6124fae60c07687aa1;p=openwrt%2Fstaging%2Fsvanheule.git rockchip: backport recent rk3588 clk updates Backport recent rk3588 clk updates from upstream, including one bug fix. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17349 Signed-off-by: Hauke Mehrtens --- diff --git a/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch b/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch new file mode 100644 index 0000000000..0d68f687fa --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch @@ -0,0 +1,51 @@ +From e781bffc296766b55dbd048890d558655031e8d1 Mon Sep 17 00:00:00 2001 +From: Elaine Zhang +Date: Wed, 28 Aug 2024 15:42:52 +0000 +Subject: [PATCH] clk: rockchip: Add new pll type pll_rk3588_ddr + +That PLL type is similar to the other rk3588 pll types but the actual +rate is twice the configured rate. +Therefore, the returned calculated rate must be multiplied by two. + +Signed-off-by: Elaine Zhang +Signed-off-by: Detlev Casanova +Acked-by: Dragan Simic +Link: https://lore.kernel.org/r/0102019199a76ec4-9d5846d4-d76a-4e69-a241-c88c2983d607-000000@eu-west-1.amazonses.com +Signed-off-by: Heiko Stuebner +--- + drivers/clk/rockchip/clk-pll.c | 6 +++++- + drivers/clk/rockchip/clk.h | 1 + + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/clk/rockchip/clk-pll.c ++++ b/drivers/clk/rockchip/clk-pll.c +@@ -914,7 +914,10 @@ static unsigned long rockchip_rk3588_pll + } + rate64 = rate64 >> cur.s; + +- return (unsigned long)rate64; ++ if (pll->type == pll_rk3588_ddr) ++ return (unsigned long)rate64 * 2; ++ else ++ return (unsigned long)rate64; + } + + static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll, +@@ -1167,6 +1170,7 @@ struct clk *rockchip_clk_register_pll(st + break; + case pll_rk3588: + case pll_rk3588_core: ++ case pll_rk3588_ddr: + if (!pll->rate_table) + init.ops = &rockchip_rk3588_pll_clk_norate_ops; + else +--- a/drivers/clk/rockchip/clk.h ++++ b/drivers/clk/rockchip/clk.h +@@ -287,6 +287,7 @@ enum rockchip_pll_type { + pll_rk3399, + pll_rk3588, + pll_rk3588_core, ++ pll_rk3588_ddr, + }; + + #define RK3036_PLL_RATE(_rate, _refdiv, _fbdiv, _postdiv1, \ diff --git a/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch b/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch new file mode 100644 index 0000000000..0164bf26e5 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch @@ -0,0 +1,65 @@ +From 2e7b3daa8cb1ebd17e6a7f417ef5e6553203035c Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Mon, 25 Mar 2024 20:33:32 +0100 +Subject: [PATCH] clk: rockchip: rk3588: drop unused code + +All clocks are registered early using CLK_OF_DECLARE(), which marks +the DT node as processed. For the processed DT node the probe routine +is never called. Thus this whole code is never executed. This could +be "fixed" by using CLK_OF_DECLARE_DRIVER, which avoids marking the +DT node as processed. But then the probe routine would re-register +all the clocks by calling rk3588_clk_init() again. + +Signed-off-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20240325193609.237182-2-sebastian.reichel@collabora.com +Signed-off-by: Heiko Stuebner +--- + drivers/clk/rockchip/clk-rk3588.c | 40 ------------------------------- + 1 file changed, 40 deletions(-) + +--- a/drivers/clk/rockchip/clk-rk3588.c ++++ b/drivers/clk/rockchip/clk-rk3588.c +@@ -2502,43 +2502,3 @@ static void __init rk3588_clk_init(struc + } + + CLK_OF_DECLARE(rk3588_cru, "rockchip,rk3588-cru", rk3588_clk_init); +- +-struct clk_rk3588_inits { +- void (*inits)(struct device_node *np); +-}; +- +-static const struct clk_rk3588_inits clk_3588_cru_init = { +- .inits = rk3588_clk_init, +-}; +- +-static const struct of_device_id clk_rk3588_match_table[] = { +- { +- .compatible = "rockchip,rk3588-cru", +- .data = &clk_3588_cru_init, +- }, +- { } +-}; +- +-static int __init clk_rk3588_probe(struct platform_device *pdev) +-{ +- const struct clk_rk3588_inits *init_data; +- struct device *dev = &pdev->dev; +- +- init_data = device_get_match_data(dev); +- if (!init_data) +- return -EINVAL; +- +- if (init_data->inits) +- init_data->inits(dev->of_node); +- +- return 0; +-} +- +-static struct platform_driver clk_rk3588_driver = { +- .driver = { +- .name = "clk-rk3588", +- .of_match_table = clk_rk3588_match_table, +- .suppress_bind_attrs = true, +- }, +-}; +-builtin_platform_driver_probe(clk_rk3588_driver, clk_rk3588_probe); diff --git a/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch b/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch new file mode 100644 index 0000000000..912c2c7778 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch @@ -0,0 +1,29 @@ +From ad1081a0da2744141d12e94ff816ac91feb871ca Mon Sep 17 00:00:00 2001 +From: Yao Zi +Date: Thu, 12 Sep 2024 13:32:05 +0000 +Subject: [PATCH] clk: rockchip: fix finding of maximum clock ID + +If an ID of a branch's child is greater than current maximum, we should +set new maximum to the child's ID, instead of its parent's. + +Fixes: 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage") +Signed-off-by: Yao Zi +Link: https://lore.kernel.org/r/20240912133204.29089-2-ziyao@disroot.org +Reviewed-by: Sebastian Reichel +Reviewed-by: Heiko Stuebner +Signed-off-by: Stephen Boyd +--- + drivers/clk/rockchip/clk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/clk/rockchip/clk.c ++++ b/drivers/clk/rockchip/clk.c +@@ -439,7 +439,7 @@ unsigned long rockchip_clk_find_max_clk_ + if (list->id > max) + max = list->id; + if (list->child && list->child->id > max) +- max = list->id; ++ max = list->child->id; + } + + return max;