Linux-Clk Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v1 0/2] Add support for IPA clock for SC7180
@ 2019-12-31 11:00 Taniya Das
  2019-12-31 11:00 ` [PATCH v1 1/2] clk: qcom: rpmh: skip undefined clocks when registering Taniya Das
  2019-12-31 11:00 ` [PATCH v1 2/2] clk: qcom: rpmh: Add IPA clock for SC7180 Taniya Das
  0 siblings, 2 replies; 5+ messages in thread
From: Taniya Das @ 2019-12-31 11:00 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette  
  Cc: David Brown, Rajendra Nayak, linux-arm-msm, linux-soc, linux-clk,
	linux-kernel, Taniya Das

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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 1/2] clk: qcom: rpmh: skip undefined clocks when registering
  2019-12-31 11:00 [PATCH v1 0/2] Add support for IPA clock for SC7180 Taniya Das
@ 2019-12-31 11:00 ` Taniya Das
  2020-01-02  0:56   ` Stephen Boyd
  2019-12-31 11:00 ` [PATCH v1 2/2] clk: qcom: rpmh: Add IPA clock for SC7180 Taniya Das
  1 sibling, 1 reply; 5+ messages in thread
From: Taniya Das @ 2019-12-31 11:00 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette  
  Cc: David Brown, Rajendra Nayak, linux-arm-msm, linux-soc, linux-clk,
	linux-kernel, Taniya Das

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. Also remove referencing
the clock name before valid hardware.

Signed-off-by: Taniya Das <tdas@codeaurora.org>
---
 drivers/clk/qcom/clk-rpmh.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
index 7ed313a..05cbe6f 100644
--- a/drivers/clk/qcom/clk-rpmh.c
+++ b/drivers/clk/qcom/clk-rpmh.c
@@ -431,11 +431,13 @@ 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;
+
 		rpmh_clk = to_clk_rpmh(hw_clks[i]);
 		res_addr = cmd_db_read_addr(rpmh_clk->res_name);
 		if (!res_addr) {
@@ -462,7 +464,8 @@ static int clk_rpmh_probe(struct platform_device *pdev)

 		ret = devm_clk_hw_register(&pdev->dev, hw_clks[i]);
 		if (ret) {
-			dev_err(&pdev->dev, "failed to register %s\n", name);
+			dev_err(&pdev->dev, "failed to register %s\n",
+							hw_clks[i]->init->name);
 			return ret;
 		}
 	}
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member
of the Code Aurora Forum, hosted by the  Linux Foundation.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 2/2] clk: qcom: rpmh: Add IPA clock for SC7180
  2019-12-31 11:00 [PATCH v1 0/2] Add support for IPA clock for SC7180 Taniya Das
  2019-12-31 11:00 ` [PATCH v1 1/2] clk: qcom: rpmh: skip undefined clocks when registering Taniya Das
@ 2019-12-31 11:00 ` Taniya Das
  1 sibling, 0 replies; 5+ messages in thread
From: Taniya Das @ 2019-12-31 11:00 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette  
  Cc: David Brown, Rajendra Nayak, linux-arm-msm, linux-soc, linux-clk,
	linux-kernel, 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.

Signed-off-by: Taniya Das <tdas@codeaurora.org>
---
 drivers/clk/qcom/clk-rpmh.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
index 05cbe6f..b186479 100644
--- a/drivers/clk/qcom/clk-rpmh.c
+++ b/drivers/clk/qcom/clk-rpmh.c
@@ -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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/2] clk: qcom: rpmh: skip undefined clocks when registering
  2019-12-31 11:00 ` [PATCH v1 1/2] clk: qcom: rpmh: skip undefined clocks when registering Taniya Das
@ 2020-01-02  0:56   ` Stephen Boyd
  2020-01-06 10:18     ` Taniya Das
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2020-01-02  0:56 UTC (permalink / raw)
  To: Michael Turquette, Taniya Das
  Cc: David Brown, Rajendra Nayak, linux-arm-msm, linux-soc, linux-clk,
	linux-kernel, Taniya Das

Quoting Taniya Das (2019-12-31 03:00:47)
> diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
> index 7ed313a..05cbe6f 100644
> --- a/drivers/clk/qcom/clk-rpmh.c
> +++ b/drivers/clk/qcom/clk-rpmh.c
> @@ -462,7 +464,8 @@ static int clk_rpmh_probe(struct platform_device *pdev)
> 
>                 ret = devm_clk_hw_register(&pdev->dev, hw_clks[i]);
>                 if (ret) {
> -                       dev_err(&pdev->dev, "failed to register %s\n", name);
> +                       dev_err(&pdev->dev, "failed to register %s\n",
> +                                                       hw_clks[i]->init->name);

After register clk_hw::init is NULL. This will probably oops. It would
be better to save off the name before registering.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/2] clk: qcom: rpmh: skip undefined clocks when registering
  2020-01-02  0:56   ` Stephen Boyd
@ 2020-01-06 10:18     ` Taniya Das
  0 siblings, 0 replies; 5+ messages in thread
From: Taniya Das @ 2020-01-06 10:18 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: David Brown, Rajendra Nayak, linux-arm-msm, linux-soc, linux-clk,
	linux-kernel

Hello Stephen,

Thanks for your review comments.

On 1/2/2020 6:26 AM, Stephen Boyd wrote:
> Quoting Taniya Das (2019-12-31 03:00:47)
>> diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
>> index 7ed313a..05cbe6f 100644
>> --- a/drivers/clk/qcom/clk-rpmh.c
>> +++ b/drivers/clk/qcom/clk-rpmh.c
>> @@ -462,7 +464,8 @@ static int clk_rpmh_probe(struct platform_device *pdev)
>>
>>                  ret = devm_clk_hw_register(&pdev->dev, hw_clks[i]);
>>                  if (ret) {
>> -                       dev_err(&pdev->dev, "failed to register %s\n", name);
>> +                       dev_err(&pdev->dev, "failed to register %s\n",
>> +                                                       hw_clks[i]->init->name);
> 
> After register clk_hw::init is NULL. This will probably oops. It would
> be better to save off the name before registering.
> 

Will take care in the next patch series.

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

--

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-31 11:00 [PATCH v1 0/2] Add support for IPA clock for SC7180 Taniya Das
2019-12-31 11:00 ` [PATCH v1 1/2] clk: qcom: rpmh: skip undefined clocks when registering Taniya Das
2020-01-02  0:56   ` Stephen Boyd
2020-01-06 10:18     ` Taniya Das
2019-12-31 11:00 ` [PATCH v1 2/2] clk: qcom: rpmh: Add IPA clock for SC7180 Taniya Das

Linux-Clk Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-clk/0 linux-clk/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-clk linux-clk/ https://lore.kernel.org/linux-clk \
		linux-clk@vger.kernel.org
	public-inbox-index linux-clk

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-clk


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git