mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2024-11-22 04:56:15 +00:00
7108f5bd9f
Backport upstreamed clk/mfd/phy/usb updates for rk3588. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org> Link: https://github.com/openwrt/openwrt/pull/16149 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
79 lines
2.8 KiB
Diff
79 lines
2.8 KiB
Diff
From 2dc66a5ab2c6fb532fbb16107ee7efcb0effbfa5 Mon Sep 17 00:00:00 2001
|
|
From: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Date: Fri, 26 Jan 2024 19:18:22 +0100
|
|
Subject: [PATCH] clk: rockchip: rk3588: fix CLK_NR_CLKS usage
|
|
|
|
CLK_NR_CLKS is not part of the DT bindings and needs to be removed
|
|
from it, just like it recently happened for other platforms. This
|
|
takes care of it by introducing a new function identifying the
|
|
maximum used clock ID at runtime.
|
|
|
|
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Link: https://lore.kernel.org/r/20240126182919.48402-2-sebastian.reichel@collabora.com
|
|
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
|
---
|
|
drivers/clk/rockchip/clk-rk3588.c | 5 ++++-
|
|
drivers/clk/rockchip/clk.c | 17 +++++++++++++++++
|
|
drivers/clk/rockchip/clk.h | 2 ++
|
|
3 files changed, 23 insertions(+), 1 deletion(-)
|
|
|
|
--- a/drivers/clk/rockchip/clk-rk3588.c
|
|
+++ b/drivers/clk/rockchip/clk-rk3588.c
|
|
@@ -2458,15 +2458,18 @@ static struct rockchip_clk_branch rk3588
|
|
static void __init rk3588_clk_init(struct device_node *np)
|
|
{
|
|
struct rockchip_clk_provider *ctx;
|
|
+ unsigned long clk_nr_clks;
|
|
void __iomem *reg_base;
|
|
|
|
+ clk_nr_clks = rockchip_clk_find_max_clk_id(rk3588_clk_branches,
|
|
+ ARRAY_SIZE(rk3588_clk_branches)) + 1;
|
|
reg_base = of_iomap(np, 0);
|
|
if (!reg_base) {
|
|
pr_err("%s: could not map cru region\n", __func__);
|
|
return;
|
|
}
|
|
|
|
- ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
|
|
+ ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
|
|
if (IS_ERR(ctx)) {
|
|
pr_err("%s: rockchip clk init failed\n", __func__);
|
|
iounmap(reg_base);
|
|
--- a/drivers/clk/rockchip/clk.c
|
|
+++ b/drivers/clk/rockchip/clk.c
|
|
@@ -429,6 +429,23 @@ void rockchip_clk_register_plls(struct r
|
|
}
|
|
EXPORT_SYMBOL_GPL(rockchip_clk_register_plls);
|
|
|
|
+unsigned long rockchip_clk_find_max_clk_id(struct rockchip_clk_branch *list,
|
|
+ unsigned int nr_clk)
|
|
+{
|
|
+ unsigned long max = 0;
|
|
+ unsigned int idx;
|
|
+
|
|
+ for (idx = 0; idx < nr_clk; idx++, list++) {
|
|
+ if (list->id > max)
|
|
+ max = list->id;
|
|
+ if (list->child && list->child->id > max)
|
|
+ max = list->id;
|
|
+ }
|
|
+
|
|
+ return max;
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(rockchip_clk_find_max_clk_id);
|
|
+
|
|
void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
|
|
struct rockchip_clk_branch *list,
|
|
unsigned int nr_clk)
|
|
--- a/drivers/clk/rockchip/clk.h
|
|
+++ b/drivers/clk/rockchip/clk.h
|
|
@@ -973,6 +973,8 @@ struct rockchip_clk_provider *rockchip_c
|
|
void __iomem *base, unsigned long nr_clks);
|
|
void rockchip_clk_of_add_provider(struct device_node *np,
|
|
struct rockchip_clk_provider *ctx);
|
|
+unsigned long rockchip_clk_find_max_clk_id(struct rockchip_clk_branch *list,
|
|
+ unsigned int nr_clk);
|
|
void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
|
|
struct rockchip_clk_branch *list,
|
|
unsigned int nr_clk);
|