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

clk: qcom: gcc: Add USB3 PIPE clock and GDSC for SM8150

This adds the USB3 PIPE clock and GDSC structures, so
that the USB driver can vote for these resources to be
enabled/disabled when required. Both are needed for SS
and HS USB paths to operate properly. The GDSC will
allow the USB system to be brought out of reset, while
the PIPE clock is needed for data transactions between
the PHY and controller.

Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Link: https://lkml.kernel.org/r/1584478412-7798-2-git-send-email-wcheng@codeaurora.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Wesley Cheng and committed by
Stephen Boyd
8411aa50 1aec193e

+56
+52
drivers/clk/qcom/gcc-sm8150.c
··· 21 21 #include "clk-rcg.h" 22 22 #include "clk-regmap.h" 23 23 #include "reset.h" 24 + #include "gdsc.h" 24 25 25 26 enum { 26 27 P_BI_TCXO, ··· 3172 3171 }, 3173 3172 }; 3174 3173 3174 + static struct clk_branch gcc_usb3_prim_phy_pipe_clk = { 3175 + .halt_check = BRANCH_HALT_SKIP, 3176 + .clkr = { 3177 + .enable_reg = 0xf058, 3178 + .enable_mask = BIT(0), 3179 + .hw.init = &(struct clk_init_data){ 3180 + .name = "gcc_usb3_prim_phy_pipe_clk", 3181 + .ops = &clk_branch2_ops, 3182 + }, 3183 + }, 3184 + }; 3185 + 3175 3186 static struct clk_branch gcc_usb3_sec_clkref_clk = { 3176 3187 .halt_reg = 0x8c028, 3177 3188 .halt_check = BRANCH_HALT, ··· 3226 3213 &gcc_usb3_sec_phy_aux_clk_src.clkr.hw }, 3227 3214 .num_parents = 1, 3228 3215 .flags = CLK_SET_RATE_PARENT, 3216 + .ops = &clk_branch2_ops, 3217 + }, 3218 + }, 3219 + }; 3220 + 3221 + static struct clk_branch gcc_usb3_sec_phy_pipe_clk = { 3222 + .halt_check = BRANCH_HALT_SKIP, 3223 + .clkr = { 3224 + .enable_reg = 0x10058, 3225 + .enable_mask = BIT(0), 3226 + .hw.init = &(struct clk_init_data){ 3227 + .name = "gcc_usb3_sec_phy_pipe_clk", 3229 3228 .ops = &clk_branch2_ops, 3230 3229 }, 3231 3230 }, ··· 3315 3290 .ops = &clk_branch2_ops, 3316 3291 }, 3317 3292 }, 3293 + }; 3294 + 3295 + static struct gdsc usb30_prim_gdsc = { 3296 + .gdscr = 0xf004, 3297 + .pd = { 3298 + .name = "usb30_prim_gdsc", 3299 + }, 3300 + .pwrsts = PWRSTS_OFF_ON, 3301 + .flags = POLL_CFG_GDSCR, 3302 + }; 3303 + 3304 + static struct gdsc usb30_sec_gdsc = { 3305 + .gdscr = 0x10004, 3306 + .pd = { 3307 + .name = "usb30_sec_gdsc", 3308 + }, 3309 + .pwrsts = PWRSTS_OFF_ON, 3310 + .flags = POLL_CFG_GDSCR, 3318 3311 }; 3319 3312 3320 3313 static struct clk_regmap *gcc_sm8150_clocks[] = { ··· 3523 3480 [GCC_USB3_PRIM_PHY_AUX_CLK] = &gcc_usb3_prim_phy_aux_clk.clkr, 3524 3481 [GCC_USB3_PRIM_PHY_AUX_CLK_SRC] = &gcc_usb3_prim_phy_aux_clk_src.clkr, 3525 3482 [GCC_USB3_PRIM_PHY_COM_AUX_CLK] = &gcc_usb3_prim_phy_com_aux_clk.clkr, 3483 + [GCC_USB3_PRIM_PHY_PIPE_CLK] = &gcc_usb3_prim_phy_pipe_clk.clkr, 3526 3484 [GCC_USB3_SEC_CLKREF_CLK] = &gcc_usb3_sec_clkref_clk.clkr, 3527 3485 [GCC_USB3_SEC_PHY_AUX_CLK] = &gcc_usb3_sec_phy_aux_clk.clkr, 3528 3486 [GCC_USB3_SEC_PHY_AUX_CLK_SRC] = &gcc_usb3_sec_phy_aux_clk_src.clkr, 3529 3487 [GCC_USB3_SEC_PHY_COM_AUX_CLK] = &gcc_usb3_sec_phy_com_aux_clk.clkr, 3488 + [GCC_USB3_SEC_PHY_PIPE_CLK] = &gcc_usb3_sec_phy_pipe_clk.clkr, 3530 3489 [GCC_VIDEO_AHB_CLK] = &gcc_video_ahb_clk.clkr, 3531 3490 [GCC_VIDEO_AXI0_CLK] = &gcc_video_axi0_clk.clkr, 3532 3491 [GCC_VIDEO_AXI1_CLK] = &gcc_video_axi1_clk.clkr, ··· 3572 3527 [GCC_USB_PHY_CFG_AHB2PHY_BCR] = { 0x6a000 }, 3573 3528 }; 3574 3529 3530 + static struct gdsc *gcc_sm8150_gdscs[] = { 3531 + [USB30_PRIM_GDSC] = &usb30_prim_gdsc, 3532 + [USB30_SEC_GDSC] = &usb30_sec_gdsc, 3533 + }; 3534 + 3575 3535 static const struct regmap_config gcc_sm8150_regmap_config = { 3576 3536 .reg_bits = 32, 3577 3537 .reg_stride = 4, ··· 3591 3541 .num_clks = ARRAY_SIZE(gcc_sm8150_clocks), 3592 3542 .resets = gcc_sm8150_resets, 3593 3543 .num_resets = ARRAY_SIZE(gcc_sm8150_resets), 3544 + .gdscs = gcc_sm8150_gdscs, 3545 + .num_gdscs = ARRAY_SIZE(gcc_sm8150_gdscs), 3594 3546 }; 3595 3547 3596 3548 static const struct of_device_id gcc_sm8150_match_table[] = {
+4
include/dt-bindings/clock/qcom,gcc-sm8150.h
··· 240 240 #define GCC_USB30_SEC_BCR 27 241 241 #define GCC_USB_PHY_CFG_AHB2PHY_BCR 28 242 242 243 + /* GCC GDSCRs */ 244 + #define USB30_PRIM_GDSC 4 245 + #define USB30_SEC_GDSC 5 246 + 243 247 #endif