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

Configure Feed

Select the types of activity you want to include in your feed.

phy: qcom-qmp-ufs: provide symbol clocks

Register three UFS symbol clocks (ufs_rx_symbol_0_clk_src,
ufs_rx_symbol_1_clk_src ufs_tx_symbol_0_clk_src). Register OF clock
provider to let other devices link these clocks through the DT.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20221123104443.3415267-3-dmitry.baryshkov@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Dmitry Baryshkov and committed by
Vinod Koul
7bd7044f 521d431f

+57
+57
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
··· 1021 1021 return devm_clk_bulk_get(dev, num, qmp->clks); 1022 1022 } 1023 1023 1024 + static void qmp_ufs_clk_release_provider(void *res) 1025 + { 1026 + of_clk_del_provider(res); 1027 + } 1028 + 1029 + #define UFS_SYMBOL_CLOCKS 3 1030 + 1031 + static int qmp_ufs_register_clocks(struct qmp_ufs *qmp, struct device_node *np) 1032 + { 1033 + struct clk_hw_onecell_data *clk_data; 1034 + struct clk_hw *hw; 1035 + char name[64]; 1036 + int ret; 1037 + 1038 + clk_data = devm_kzalloc(qmp->dev, 1039 + struct_size(clk_data, hws, UFS_SYMBOL_CLOCKS), 1040 + GFP_KERNEL); 1041 + if (!clk_data) 1042 + return -ENOMEM; 1043 + 1044 + clk_data->num = UFS_SYMBOL_CLOCKS; 1045 + 1046 + snprintf(name, sizeof(name), "%s::rx_symbol_0", dev_name(qmp->dev)); 1047 + hw = devm_clk_hw_register_fixed_rate(qmp->dev, name, NULL, 0, 0); 1048 + if (IS_ERR(hw)) 1049 + return PTR_ERR(hw); 1050 + 1051 + clk_data->hws[0] = hw; 1052 + 1053 + snprintf(name, sizeof(name), "%s::rx_symbol_1", dev_name(qmp->dev)); 1054 + hw = devm_clk_hw_register_fixed_rate(qmp->dev, name, NULL, 0, 0); 1055 + if (IS_ERR(hw)) 1056 + return PTR_ERR(hw); 1057 + 1058 + clk_data->hws[1] = hw; 1059 + 1060 + snprintf(name, sizeof(name), "%s::tx_symbol_0", dev_name(qmp->dev)); 1061 + hw = devm_clk_hw_register_fixed_rate(qmp->dev, name, NULL, 0, 0); 1062 + if (IS_ERR(hw)) 1063 + return PTR_ERR(hw); 1064 + 1065 + clk_data->hws[2] = hw; 1066 + 1067 + ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); 1068 + if (ret) 1069 + return ret; 1070 + 1071 + /* 1072 + * Roll a devm action because the clock provider can be a child node. 1073 + */ 1074 + return devm_add_action_or_reset(qmp->dev, qmp_ufs_clk_release_provider, np); 1075 + } 1076 + 1024 1077 static int qmp_ufs_parse_dt_legacy(struct qmp_ufs *qmp, struct device_node *np) 1025 1078 { 1026 1079 struct platform_device *pdev = to_platform_device(qmp->dev); ··· 1183 1130 np = of_node_get(dev->of_node); 1184 1131 ret = qmp_ufs_parse_dt(qmp); 1185 1132 } 1133 + if (ret) 1134 + goto err_node_put; 1135 + 1136 + ret = qmp_ufs_register_clocks(qmp, np); 1186 1137 if (ret) 1187 1138 goto err_node_put; 1188 1139