[PATCH 5/7] clk: spacemit: make clocks optional
Alex Elder
elder at riscstar.com
Thu Mar 20 12:44:46 PDT 2025
There are some syscon devices that support both clocks and resets,
but for now only their reset functionality is required. Make
defining clocks optional for a SpacemiT CCU, though at least one
clock or at least one reset controller must be defined.
Signed-off-by: Alex Elder <elder at riscstar.com>
---
drivers/clk/spacemit/ccu-k1.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c
index be8abd27753cb..17e321c25959a 100644
--- a/drivers/clk/spacemit/ccu-k1.c
+++ b/drivers/clk/spacemit/ccu-k1.c
@@ -1830,6 +1830,10 @@ static int k1_ccu_register(struct device *dev, struct regmap *regmap,
const struct spacemit_ccu_clk *clk;
int i, ret, max_id = 0;
+ /* Clocks are optional */
+ if (!clks)
+ return 0;
+
for (clk = clks; clk->hw; clk++)
max_id = max(max_id, clk->id);
@@ -1903,7 +1907,7 @@ static int k1_ccu_probe(struct platform_device *pdev)
int ret;
data = of_device_get_match_data(dev);
- if (!data)
+ if (!data || !(data->clk || data->rst_data))
return -EINVAL;
base_regmap = device_node_to_regmap(dev->of_node);
--
2.43.0
More information about the linux-riscv
mailing list