[PATCH] clk: qcom: stop enforcing INTERCONNECT_CLK dependency for everybody

Dmitry Baryshkov posted 1 patch 1 week ago
drivers/clk/qcom/Kconfig  | 13 +++++++++++--
drivers/clk/qcom/common.c | 11 ++++++++---
drivers/clk/qcom/common.h |  2 ++
3 files changed, 21 insertions(+), 5 deletions(-)
[PATCH] clk: qcom: stop enforcing INTERCONNECT_CLK dependency for everybody
Posted by Dmitry Baryshkov 1 week ago
Only several (typically IPQ) platforms use INTERCONNECT_CLK to turn
clocks into the interconnect providers. Stop inferring this dependency
on everybody and set it only when required. As a safety measure, make
sure that the coresponding clock description fields are not available if
corresponding Kconfig option isn't enabled.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 drivers/clk/qcom/Kconfig  | 13 +++++++++++--
 drivers/clk/qcom/common.c | 11 ++++++++---
 drivers/clk/qcom/common.h |  2 ++
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
index d9cff5b0281d..de8485b5ed9e 100644
--- a/drivers/clk/qcom/Kconfig
+++ b/drivers/clk/qcom/Kconfig
@@ -7,6 +7,9 @@ config QCOM_GDSC
 	bool
 	select PM_GENERIC_DOMAINS if PM
 
+config QCOM_NEED_INTERCONNECT_CLK
+	bool
+
 menuconfig COMMON_CLK_QCOM
 	tristate "Support for Qualcomm's clock controllers"
 	depends on OF
@@ -14,8 +17,8 @@ menuconfig COMMON_CLK_QCOM
 	select RATIONAL
 	select REGMAP_MMIO
 	select RESET_CONTROLLER
-	select INTERCONNECT
-	select INTERCONNECT_CLK
+	select INTERCONNECT if QCOM_NEED_INTERCONNECT_CLK
+	select INTERCONNECT_CLK if QCOM_NEED_INTERCONNECT_CLK
 
 if COMMON_CLK_QCOM
 
@@ -342,6 +345,7 @@ config IPQ_APSS_PLL
 config IPQ_APSS_5424
 	tristate "IPQ5424 APSS Clock Controller"
 	select IPQ_APSS_PLL
+	select QCOM_NEED_INTERCONNECT_CLK
 	default y if IPQ_GCC_5424
 	help
 	  Support for APSS Clock controller on Qualcomm IPQ5424 platform.
@@ -395,6 +399,7 @@ config IPQ_GCC_5210
 config IPQ_GCC_5332
 	tristate "IPQ5332 Global Clock Controller"
 	depends on ARM64 || COMPILE_TEST
+	select QCOM_NEED_INTERCONNECT_CLK
 	help
 	  Support for the global clock controller on ipq5332 devices.
 	  Say Y if you want to use peripheral devices such as UART, SPI,
@@ -403,6 +408,7 @@ config IPQ_GCC_5332
 config IPQ_GCC_5424
 	tristate "IPQ5424 Global Clock Controller"
 	depends on ARM64 || COMPILE_TEST
+	select QCOM_NEED_INTERCONNECT_CLK
 	help
 	  Support for the global clock controller on ipq5424 devices.
 	  Say Y if you want to use peripheral devices such as UART, SPI,
@@ -444,6 +450,7 @@ config IPQ_GCC_8074
 
 config IPQ_GCC_9574
 	tristate "IPQ9574 Global Clock Controller"
+	select QCOM_NEED_INTERCONNECT_CLK
 	help
 	  Support for global clock controller on ipq9574 devices.
 	  Say Y if you want to use peripheral devices such as UART, SPI,
@@ -464,6 +471,7 @@ config IPQ_NSSCC_5424
 	tristate "IPQ5424 NSS Clock Controller"
 	depends on ARM64 || COMPILE_TEST
 	depends on IPQ_GCC_5424
+	select QCOM_NEED_INTERCONNECT_CLK
 	help
 	  Support for NSS clock controller on ipq5424 devices.
 	  NSSCC receives the clock sources from GCC, CMN PLL and UNIPHY (PCS).
@@ -475,6 +483,7 @@ config IPQ_NSSCC_9574
         tristate "IPQ9574 NSS Clock Controller"
         depends on ARM64 || COMPILE_TEST
         depends on IPQ_GCC_9574
+	select QCOM_NEED_INTERCONNECT_CLK
         help
           Support for NSS clock controller on ipq9574 devices.
 
diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
index eec369d2173b..2bac581efa02 100644
--- a/drivers/clk/qcom/common.c
+++ b/drivers/clk/qcom/common.c
@@ -255,6 +255,7 @@ static struct clk_hw *qcom_cc_clk_hw_get(struct of_phandle_args *clkspec,
 	return cc->rclks[idx] ? &cc->rclks[idx]->hw : NULL;
 }
 
+#if IS_REACHABLE(CONFIG_INTERCONNECT_CLK)
 static int qcom_cc_icc_register(struct device *dev,
 				const struct qcom_cc_desc *desc)
 {
@@ -262,9 +263,6 @@ static int qcom_cc_icc_register(struct device *dev,
 	struct clk_hw *hws;
 	int i;
 
-	if (!IS_ENABLED(CONFIG_INTERCONNECT_CLK))
-		return 0;
-
 	if (!desc->icc_hws)
 		return 0;
 
@@ -286,6 +284,13 @@ static int qcom_cc_icc_register(struct device *dev,
 	return devm_icc_clk_register(dev, desc->icc_first_node_id,
 						     desc->num_icc_hws, icd);
 }
+#else
+static int qcom_cc_icc_register(struct device *dev,
+				const struct qcom_cc_desc *desc)
+{
+	return 0;
+}
+#endif
 
 static int qcom_cc_clk_pll_configure(const struct qcom_cc_driver_data *data,
 				     struct regmap *regmap)
diff --git a/drivers/clk/qcom/common.h b/drivers/clk/qcom/common.h
index 6f2406f8839e..1ebdfe831ac8 100644
--- a/drivers/clk/qcom/common.h
+++ b/drivers/clk/qcom/common.h
@@ -45,8 +45,10 @@ struct qcom_cc_desc {
 	size_t num_gdscs;
 	struct clk_hw **clk_hws;
 	size_t num_clk_hws;
+#if IS_REACHABLE(CONFIG_INTERCONNECT_CLK)
 	const struct qcom_icc_hws_data *icc_hws;
 	size_t num_icc_hws;
+#endif
 	unsigned int icc_first_node_id;
 	bool use_rpm;
 	const struct qcom_cc_driver_data *driver_data;

---
base-commit: 230cbc83bec52234e456f33a01f400f78bfac0f9
change-id: 20260517-qcom-clk-icc-fc6122236e5b

Best regards,
--  
With best wishes
Dmitry
Re: [PATCH] clk: qcom: stop enforcing INTERCONNECT_CLK dependency for everybody
Posted by Konrad Dybcio 3 days, 19 hours ago
On 5/17/26 8:51 PM, Dmitry Baryshkov wrote:
> Only several (typically IPQ) platforms use INTERCONNECT_CLK to turn
> clocks into the interconnect providers. Stop inferring this dependency
> on everybody and set it only when required. As a safety measure, make
> sure that the coresponding clock description fields are not available if
> corresponding Kconfig option isn't enabled.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---

[...]

> @@ -395,6 +399,7 @@ config IPQ_GCC_5210
>  config IPQ_GCC_5332
>  	tristate "IPQ5332 Global Clock Controller"
>  	depends on ARM64 || COMPILE_TEST
> +	select QCOM_NEED_INTERCONNECT_CLK
>  	help
>  	  Support for the global clock controller on ipq5332 devices.
>  	  Say Y if you want to use peripheral devices such as UART, SPI,

There's a number of entries where there's spaces instead of tabs,
Krzysztof fixed that up for interconnect earlier today

[...]

> +#if IS_REACHABLE(CONFIG_INTERCONNECT_CLK)
>  	const struct qcom_icc_hws_data *icc_hws;
>  	size_t num_icc_hws;
> +#endif
>  	unsigned int icc_first_node_id;

this uint is also only present in drivers that use icc-clk

Konrad
Re: [PATCH] clk: qcom: stop enforcing INTERCONNECT_CLK dependency for everybody
Posted by Konrad Dybcio 6 days, 20 hours ago
On 5/17/26 8:51 PM, Dmitry Baryshkov wrote:
> Only several (typically IPQ) platforms use INTERCONNECT_CLK to turn
> clocks into the interconnect providers. Stop inferring this dependency
> on everybody and set it only when required. As a safety measure, make
> sure that the coresponding clock description fields are not available if
> corresponding Kconfig option isn't enabled.

I think this should be a 'depends on' instead, if you like having
PCIe/USB

Konrad
Re: [PATCH] clk: qcom: stop enforcing INTERCONNECT_CLK dependency for everybody
Posted by Dmitry Baryshkov 6 days, 17 hours ago
On Mon, May 18, 2026 at 11:22:06AM +0200, Konrad Dybcio wrote:
> On 5/17/26 8:51 PM, Dmitry Baryshkov wrote:
> > Only several (typically IPQ) platforms use INTERCONNECT_CLK to turn
> > clocks into the interconnect providers. Stop inferring this dependency
> > on everybody and set it only when required. As a safety measure, make
> > sure that the coresponding clock description fields are not available if
> > corresponding Kconfig option isn't enabled.
> 
> I think this should be a 'depends on' instead, if you like having
> PCIe/USB

I'm not sure I follow. The INTERCONNECT_CLK will be selected for the
platforms which use it to control NoCs.

-- 
With best wishes
Dmitry
Re: [PATCH] clk: qcom: stop enforcing INTERCONNECT_CLK dependency for everybody
Posted by Konrad Dybcio 3 days, 20 hours ago
On 5/18/26 2:04 PM, Dmitry Baryshkov wrote:
> On Mon, May 18, 2026 at 11:22:06AM +0200, Konrad Dybcio wrote:
>> On 5/17/26 8:51 PM, Dmitry Baryshkov wrote:
>>> Only several (typically IPQ) platforms use INTERCONNECT_CLK to turn
>>> clocks into the interconnect providers. Stop inferring this dependency
>>> on everybody and set it only when required. As a safety measure, make
>>> sure that the coresponding clock description fields are not available if
>>> corresponding Kconfig option isn't enabled.
>>
>> I think this should be a 'depends on' instead, if you like having
>> PCIe/USB
> 
> I'm not sure I follow. The INTERCONNECT_CLK will be selected for the
> platforms which use it to control NoCs.

Eeh, sorry.. brain fart

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad