[PATCH] clk: keystone: sci-clk: Remove firmware based clock ID detection

From: Andrew Davis

Date: Thu Dec 03 2026 - 17:49:59 EST


For all drives using this driver clocks are probed from DT. The older
method of getting clock IDs from firmware was left in case it would
be useful for debugging purposes. The old code has bitrotted and most
likely doesn't work with new firmware. As AI is now finding bugs in it
and causing churn, easier to just delete this old function.

Signed-off-by: Andrew Davis <afd@xxxxxx>
---
drivers/clk/keystone/Kconfig | 11 -----
drivers/clk/keystone/sci-clk.c | 85 ----------------------------------
2 files changed, 96 deletions(-)

diff --git a/drivers/clk/keystone/Kconfig b/drivers/clk/keystone/Kconfig
index e64d6726048f6..9d019fc32fd64 100644
--- a/drivers/clk/keystone/Kconfig
+++ b/drivers/clk/keystone/Kconfig
@@ -16,17 +16,6 @@ config TI_SCI_CLK
If you wish to use clock resources from the PMMC firmware, say Y.
Otherwise, say N.

-config TI_SCI_CLK_PROBE_FROM_FW
- bool "Probe available clocks from firmware"
- depends on TI_SCI_CLK
- default n
- help
- Forces the TI SCI clock driver to probe available clocks from the
- firmware. By default, only the used clocks are probed from DT.
- This is mostly only useful for debugging purposes, and will
- increase the boot time of the device. If you want the clocks probed
- from firmware, say Y. Otherwise, say N.
-
config TI_SYSCON_CLK
tristate "Syscon based clock driver for K2/K3 SoCs"
depends on ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index 967f779003587..193b503ad29e1 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -453,82 +453,6 @@ static const struct of_device_id ti_sci_clk_of_match[] = {
};
MODULE_DEVICE_TABLE(of, ti_sci_clk_of_match);

-#ifdef CONFIG_TI_SCI_CLK_PROBE_FROM_FW
-static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider)
-{
- int ret;
- int num_clks = 0;
- struct sci_clk **clks = NULL;
- struct sci_clk **tmp_clks;
- struct sci_clk *sci_clk;
- int max_clks = 0;
- int clk_id = 0;
- int dev_id = 0;
- u32 num_parents = 0;
- int gap_size = 0;
- struct device *dev = provider->dev;
-
- while (1) {
- ret = provider->ops->get_num_parents(provider->sci, dev_id,
- clk_id,
- (void *)&num_parents);
- if (ret) {
- gap_size++;
- if (!clk_id) {
- if (gap_size >= 5)
- break;
- dev_id++;
- } else {
- if (gap_size >= 2) {
- dev_id++;
- clk_id = 0;
- gap_size = 0;
- } else {
- clk_id++;
- }
- }
- continue;
- }
-
- gap_size = 0;
-
- if (num_clks == max_clks) {
- tmp_clks = devm_kmalloc_objs(dev, sci_clk,
- max_clks + 64);
- memcpy(tmp_clks, clks, max_clks * sizeof(sci_clk));
- if (max_clks)
- devm_kfree(dev, clks);
- max_clks += 64;
- clks = tmp_clks;
- }
-
- sci_clk = devm_kzalloc_obj(dev, *sci_clk);
- if (!sci_clk)
- return -ENOMEM;
- sci_clk->dev_id = dev_id;
- sci_clk->clk_id = clk_id;
- sci_clk->provider = provider;
- sci_clk->num_parents = num_parents;
-
- clks[num_clks] = sci_clk;
-
- clk_id++;
- num_clks++;
- }
-
- provider->clocks = devm_kmemdup_array(dev, clks, num_clks, sizeof(sci_clk), GFP_KERNEL);
- if (!provider->clocks)
- return -ENOMEM;
-
- provider->num_clocks = num_clks;
-
- devm_kfree(dev, clks);
-
- return 0;
-}
-
-#else
-
static int _cmp_sci_clk_list(void *priv, const struct list_head *a,
const struct list_head *b)
{
@@ -667,7 +591,6 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider)

return 0;
}
-#endif

/**
* ti_sci_clk_probe - Probe function for the TI SCI clock driver
@@ -699,19 +622,11 @@ static int ti_sci_clk_probe(struct platform_device *pdev)
provider->ops = &handle->ops.clk_ops;
provider->dev = dev;

-#ifdef CONFIG_TI_SCI_CLK_PROBE_FROM_FW
- ret = ti_sci_scan_clocks_from_fw(provider);
- if (ret) {
- dev_err(dev, "scan clocks from FW failed: %d\n", ret);
- return ret;
- }
-#else
ret = ti_sci_scan_clocks_from_dt(provider);
if (ret) {
dev_err(dev, "scan clocks from DT failed: %d\n", ret);
return ret;
}
-#endif

ret = ti_sci_init_clocks(provider);
if (ret) {
--
2.43.0