clk: qcom: gcc-sm8550: Don't park the USB RCG at registration time

Amit Pundir reports that audio and USB-C host mode stops working if the
gcc_usb30_prim_master_clk_src clk is registered and
clk_rcg2_shared_init() parks it on XO. Skip parking this clk at
registration time to fix those issues.

Partially revert commit 01a0a6cc8cfd ("clk: qcom: Park shared RCGs upon
registration") by skipping the parking bit for this clk, but keep the
part where we cache the config register. That's still necessary to
figure out the true parent of the clk at registration time.

Fixes: 01a0a6cc8cfd ("clk: qcom: Park shared RCGs upon registration")
Fixes: 929c75d57566 ("clk: qcom: gcc-sm8550: Mark RCGs shared where applicable")
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Taniya Das <quic_tdas@quicinc.com>
Reported-by: Amit Pundir <amit.pundir@linaro.org>
Closes: https://lore.kernel.org/CAMi1Hd1KQBE4kKUdAn8E5FV+BiKzuv+8FoyWQrrTHPDoYTuhgA@mail.gmail.com
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20240819233628.2074654-3-swboyd@chromium.org
Tested-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by Stephen Boyd and committed by Stephen Boyd 7b6dfa1b d10eeb75

+32 -1
+1
drivers/clk/qcom/clk-rcg.h
··· 198 extern const struct clk_ops clk_pixel_ops; 199 extern const struct clk_ops clk_gfx3d_ops; 200 extern const struct clk_ops clk_rcg2_shared_ops; 201 extern const struct clk_ops clk_dp_ops; 202 203 struct clk_rcg_dfs_data {
··· 198 extern const struct clk_ops clk_pixel_ops; 199 extern const struct clk_ops clk_gfx3d_ops; 200 extern const struct clk_ops clk_rcg2_shared_ops; 201 + extern const struct clk_ops clk_rcg2_shared_no_init_park_ops; 202 extern const struct clk_ops clk_dp_ops; 203 204 struct clk_rcg_dfs_data {
+30
drivers/clk/qcom/clk-rcg2.c
··· 1348 }; 1349 EXPORT_SYMBOL_GPL(clk_rcg2_shared_ops); 1350 1351 /* Common APIs to be used for DFS based RCGR */ 1352 static void clk_rcg2_dfs_populate_freq(struct clk_hw *hw, unsigned int l, 1353 struct freq_tbl *f)
··· 1348 }; 1349 EXPORT_SYMBOL_GPL(clk_rcg2_shared_ops); 1350 1351 + static int clk_rcg2_shared_no_init_park(struct clk_hw *hw) 1352 + { 1353 + struct clk_rcg2 *rcg = to_clk_rcg2(hw); 1354 + 1355 + /* 1356 + * Read the config register so that the parent is properly mapped at 1357 + * registration time. 1358 + */ 1359 + regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &rcg->parked_cfg); 1360 + 1361 + return 0; 1362 + } 1363 + 1364 + /* 1365 + * Like clk_rcg2_shared_ops but skip the init so that the clk frequency is left 1366 + * unchanged at registration time. 1367 + */ 1368 + const struct clk_ops clk_rcg2_shared_no_init_park_ops = { 1369 + .init = clk_rcg2_shared_no_init_park, 1370 + .enable = clk_rcg2_shared_enable, 1371 + .disable = clk_rcg2_shared_disable, 1372 + .get_parent = clk_rcg2_shared_get_parent, 1373 + .set_parent = clk_rcg2_shared_set_parent, 1374 + .recalc_rate = clk_rcg2_shared_recalc_rate, 1375 + .determine_rate = clk_rcg2_determine_rate, 1376 + .set_rate = clk_rcg2_shared_set_rate, 1377 + .set_rate_and_parent = clk_rcg2_shared_set_rate_and_parent, 1378 + }; 1379 + EXPORT_SYMBOL_GPL(clk_rcg2_shared_no_init_park_ops); 1380 + 1381 /* Common APIs to be used for DFS based RCGR */ 1382 static void clk_rcg2_dfs_populate_freq(struct clk_hw *hw, unsigned int l, 1383 struct freq_tbl *f)
+1 -1
drivers/clk/qcom/gcc-sm8550.c
··· 1159 .parent_data = gcc_parent_data_0, 1160 .num_parents = ARRAY_SIZE(gcc_parent_data_0), 1161 .flags = CLK_SET_RATE_PARENT, 1162 - .ops = &clk_rcg2_shared_ops, 1163 }, 1164 }; 1165
··· 1159 .parent_data = gcc_parent_data_0, 1160 .num_parents = ARRAY_SIZE(gcc_parent_data_0), 1161 .flags = CLK_SET_RATE_PARENT, 1162 + .ops = &clk_rcg2_shared_no_init_park_ops, 1163 }, 1164 }; 1165