Add support for IPA clock for SC7180
Subsystems (3)
cover Add support for IPA clock for SC7180
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.
PATCH 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. Also remove referencing the clock name before valid hardware.
--- drivers/clk/qcom/clk-rpmh.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/clk/qcom/clk-rpmh.c +5 -2
@@ -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.
Stephen Boyd
maintainerRe: [PATCH v1 1/2] clk: qcom: rpmh: skip undefined clocks when registering
Quoting Taniya Das (2019-12-31 03:00:47)
drivers/clk/qcom/clk-rpmh.c static int clk_rpmh_probe(struct platform_device *pdev) · line 468
Quoted 11 lines
drivers/clk/qcom/clk-rpmh.c +2
-1@@ -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.
Re: [PATCH v1 1/2] clk: qcom: rpmh: skip undefined clocks when registering
Hello Stephen,
Thanks for your review comments.
Quoted 7 lines · Stephen Boyd
Quoting Taniya Das (2019-12-31 03:00:47)
Quoted 6 lines
drivers/clk/qcom/clk-rpmh.c +0
-0@@ -462,7 +464,8 @@ static int clk_rpmh_probe(struct platform_device *pdev)
Quoted 9 lines
drivers/clk/qcom/clk-rpmh.c static int clk_rpmh_probe(struct platform_device *pdev) · line 468
Quoted 5 lines
drivers/clk/qcom/clk-rpmh.c +2
-1ret =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::initis NULL. This will probably oops. It would be better to save off the name before registering.
Will take care in the next patch series.
Signature · 4 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation. --
PATCH 2/2 clk: qcom: rpmh: Add IPA clock for SC7180
In reply to Taniya DasThe 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
@@ -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.