Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <neil.armstrong@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
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 <vkoul@kernel.org>

authored by

Neil Armstrong and committed by
Vinod Koul
677b4511 72bea132

+11 -4
+11 -4
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
··· 3664 3664 struct clk_init_data init = { }; 3665 3665 int ret; 3666 3666 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); 3668 3668 if (ret) { 3669 3669 dev_err(qmp->dev, "%pOFn: No clock-output-names\n", np); 3670 3670 return ret; ··· 3683 3683 3684 3684 fixed->hw.init = &init; 3685 3685 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); 3687 3694 if (ret) 3688 3695 return ret; 3689 3696 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); 3691 3698 if (ret) 3692 3699 return ret; 3693 3700 ··· 3906 3899 if (ret) 3907 3900 goto err_node_put; 3908 3901 3909 - ret = phy_pipe_clk_register(qmp, np); 3902 + ret = qmp_pcie_register_clocks(qmp, np); 3910 3903 if (ret) 3911 3904 goto err_node_put; 3912 3905