Skip to contentSkip to conversation

Add support for IPA clock for SC7180

PATCH Applied Taniya Das 3 participants 6 messages Jan 6, 2020

Subsystems (3)
lore
Share & tools
lore

Taniya Das

author
#0 lore raw

v2 cover Add support for IPA clock for SC7180

[v2]
* After register clk_hw::init is NULL, save off the name before registering.

[v1]
* Support IPA clock for SC7180 and also handle undefined clock registration in clk-rpmh driver.

Taniya Das (2):
clk: qcom: rpmh: skip undefined clocks when registering
clk: qcom: rpmh: Add IPA clock for SC7180

 drivers/clk/qcom/clk-rpmh.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

author
#1 lore raw

PATCH v2 1/2 clk: qcom: rpmh: skip undefined clocks when registering

When iterating over a platform's available clocks in clk_rpmh_probe(), check for undefined (null) entries in the clocks array. Not all clock indexes necessarily have clocks defined.

---
 drivers/clk/qcom/clk-rpmh.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/clk/qcom/clk-rpmh.c +5 -1
index 7ed313a..075cc43 100644
@@ -431,11 +431,15 @@ static int clk_rpmh_probe(struct platform_device *pdev)
 	hw_clks = desc->clks;
 
 	for (i = 0; i < desc->num_clks; i++) {
-		const char *name = hw_clks[i]->init->name;
 		u32 res_addr;
 		size_t aux_data_len;
 		const struct bcm_db *data;
 
+		if (!hw_clks[i])
+			continue;
+
+		const char *name = hw_clks[i]->init->name;
+
 		rpmh_clk = to_clk_rpmh(hw_clks[i]);
 		res_addr = cmd_db_read_addr(rpmh_clk->res_name);
 		if (!res_addr) {

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

#2 lore raw

Re: [PATCH v2 1/2] clk: qcom: rpmh: skip undefined clocks when registering

Thank you for the patch! Perhaps something to improve:

Hi Taniya,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on clk/clk-next]
[also build test WARNING on v5.5-rc5 next-20191220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Taniya-Das/Add-support-for-IPA-clock-for-SC7180/20200106-201629
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 7.5.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

drivers/clk//qcom/clk-rpmh.c: In function 'clk_rpmh_probe':

>> drivers/clk//qcom/clk-rpmh.c:441:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      const char *name = hw_clks[i]->init->name;
      ^~~~~

vim +441 drivers/clk//qcom/clk-rpmh.c

419
420 static int clk_rpmh_probe(struct platform_device *pdev)
421 {
422 struct clk_hw **hw_clks;
423 struct clk_rpmh *rpmh_clk;
424 const struct clk_rpmh_desc *desc;
425 int ret, i;
426
427 desc = of_device_get_match_data(&pdev->dev);
428 if (!desc)
429 return -ENODEV;
430
431 hw_clks = desc->clks;
432
433 for (i = 0; i < desc->num_clks; i++) {
434 u32 res_addr;
435 size_t aux_data_len;
436 const struct bcm_db *data;
437
438 if (!hw_clks[i])
439 continue;
440

 > 441			const char *name = hw_clks[i]->init->name;

442
443 rpmh_clk = to_clk_rpmh(hw_clks[i]);
444 res_addr = cmd_db_read_addr(rpmh_clk->res_name);
445 if (!res_addr) {
446 dev_err(&pdev->dev, "missing RPMh resource address for %s\n",
447 rpmh_clk->res_name);
448 return -ENODEV;
449 }
450
451 data = cmd_db_read_aux_data(rpmh_clk->res_name, &aux_data_len);
452 if (IS_ERR(data)) {
453 ret = PTR_ERR(data);
454 dev_err(&pdev->dev,
455 "error reading RPMh aux data for %s (%d)\n",
456 rpmh_clk->res_name, ret);
457 return ret;
458 }
459
460 /* Convert unit from Khz to Hz */
461 if (aux_data_len == sizeof(*data))
462 rpmh_clk->unit = le32_to_cpu(data->unit) * 1000ULL;
463
464 rpmh_clk->res_addr += res_addr;
465 rpmh_clk->dev = &pdev->dev;
466
467 ret = devm_clk_hw_register(&pdev->dev, hw_clks[i]);
468 if (ret) {
469 dev_err(&pdev->dev, "failed to register %s\n", name);
470 return ret;
471 }
472 }
473
474 /* typecast to silence compiler warning */
475 ret = devm_of_clk_add_hw_provider(&pdev->dev, of_clk_rpmh_hw_get,
476 (void *)desc);
477 if (ret) {
478 dev_err(&pdev->dev, "Failed to add clock provider\n");
479 return ret;
480 }
481
482 dev_dbg(&pdev->dev, "Registered RPMh clocks\n");
483
484 return 0;
485 }
486

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

maintainer Applied
#3 lore raw

Re: [PATCH v2 1/2] clk: qcom: rpmh: skip undefined clocks when registering

In reply to Taniya Das

Quoting Taniya Das (2020-01-06 02:18:42)

Quoted 6 lines

When iterating over a platform's available clocks in clk_rpmh_probe(), check for undefined (null) entries in the clocks array. Not all clock indexes necessarily have clocks defined.

---

Applied to clk-next + added the fix for type declaration.

author
#4 lore raw

PATCH v2 2/2 clk: qcom: rpmh: Add IPA clock for SC7180

In reply to Taniya Das

The Qualcomm IP Accelerator (IPA) clock resource that is managed by the BCM is required by the IPA driver in order to scale its core clock.

---
 drivers/clk/qcom/clk-rpmh.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/qcom/clk-rpmh.c +1 -0
index 075cc43..8b0844b 100644
@@ -396,6 +396,7 @@ static struct clk_hw *sc7180_rpmh_clocks[] = {
 	[RPMH_RF_CLK1_A]	= &sdm845_rf_clk1_ao.hw,
 	[RPMH_RF_CLK2]		= &sdm845_rf_clk2.hw,
 	[RPMH_RF_CLK2_A]	= &sdm845_rf_clk2_ao.hw,
+	[RPMH_IPA_CLK]		= &sdm845_ipa.hw,
 };
 
 static const struct clk_rpmh_desc clk_rpmh_sc7180 = {

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

maintainer Applied
#5 lore raw

Re: [PATCH v2 2/2] clk: qcom: rpmh: Add IPA clock for SC7180

Quoting Taniya Das (2020-01-06 02:18:43)

Quoted 5 lines

The Qualcomm IP Accelerator (IPA) clock resource that is managed by the BCM is required by the IPA driver in order to scale its core clock.

---

Applied to clk-next