Skip to content

Commit 677b451

Browse files
superna9999vinodkoul
authored andcommitted
phy: qcom: qmp-pcie: refactor clock register code
The PCIe Gen4x2 PHY found in the SM8[456]50 SoCs have a second clock, in order to expose it, split the current clock registering in two parts: - CCF clock registering - DT clock registering Keep the of_clk_add_hw_provider/devm_add_action_or_reset to keep compatibility with the legacy subnode bindings. Signed-off-by: Neil Armstrong <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/20240322-topic-sm8x50-upstream-pcie-1-phy-aux-clk-v2-2-3ec0a966d52f@linaro.org Signed-off-by: Vinod Koul <[email protected]>
1 parent 72bea13 commit 677b451

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/phy/qualcomm/phy-qcom-qmp-pcie.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3664,7 +3664,7 @@ static int phy_pipe_clk_register(struct qmp_pcie *qmp, struct device_node *np)
36643664
struct clk_init_data init = { };
36653665
int ret;
36663666

3667-
ret = of_property_read_string(np, "clock-output-names", &init.name);
3667+
ret = of_property_read_string_index(np, "clock-output-names", 0, &init.name);
36683668
if (ret) {
36693669
dev_err(qmp->dev, "%pOFn: No clock-output-names\n", np);
36703670
return ret;
@@ -3683,11 +3683,18 @@ static int phy_pipe_clk_register(struct qmp_pcie *qmp, struct device_node *np)
36833683

36843684
fixed->hw.init = &init;
36853685

3686-
ret = devm_clk_hw_register(qmp->dev, &fixed->hw);
3686+
return devm_clk_hw_register(qmp->dev, &fixed->hw);
3687+
}
3688+
3689+
static int qmp_pcie_register_clocks(struct qmp_pcie *qmp, struct device_node *np)
3690+
{
3691+
int ret;
3692+
3693+
ret = phy_pipe_clk_register(qmp, np);
36873694
if (ret)
36883695
return ret;
36893696

3690-
ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, &fixed->hw);
3697+
ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, &qmp->pipe_clk_fixed.hw);
36913698
if (ret)
36923699
return ret;
36933700

@@ -3899,7 +3906,7 @@ static int qmp_pcie_probe(struct platform_device *pdev)
38993906
if (ret)
39003907
goto err_node_put;
39013908

3902-
ret = phy_pipe_clk_register(qmp, np);
3909+
ret = qmp_pcie_register_clocks(qmp, np);
39033910
if (ret)
39043911
goto err_node_put;
39053912

0 commit comments

Comments
 (0)