Skip to content

Commit 8411aa5

Browse files
Wesley Chengbebarino
authored andcommitted
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 <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 1aec193 commit 8411aa5

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

drivers/clk/qcom/gcc-sm8150.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "clk-rcg.h"
2222
#include "clk-regmap.h"
2323
#include "reset.h"
24+
#include "gdsc.h"
2425

2526
enum {
2627
P_BI_TCXO,
@@ -3171,6 +3172,18 @@ static struct clk_branch gcc_usb3_prim_phy_com_aux_clk = {
31713172
},
31723173
};
31733174

3175+
static struct clk_branch gcc_usb3_prim_phy_pipe_clk = {
3176+
.halt_check = BRANCH_HALT_SKIP,
3177+
.clkr = {
3178+
.enable_reg = 0xf058,
3179+
.enable_mask = BIT(0),
3180+
.hw.init = &(struct clk_init_data){
3181+
.name = "gcc_usb3_prim_phy_pipe_clk",
3182+
.ops = &clk_branch2_ops,
3183+
},
3184+
},
3185+
};
3186+
31743187
static struct clk_branch gcc_usb3_sec_clkref_clk = {
31753188
.halt_reg = 0x8c028,
31763189
.halt_check = BRANCH_HALT,
@@ -3218,6 +3231,18 @@ static struct clk_branch gcc_usb3_sec_phy_com_aux_clk = {
32183231
},
32193232
};
32203233

3234+
static struct clk_branch gcc_usb3_sec_phy_pipe_clk = {
3235+
.halt_check = BRANCH_HALT_SKIP,
3236+
.clkr = {
3237+
.enable_reg = 0x10058,
3238+
.enable_mask = BIT(0),
3239+
.hw.init = &(struct clk_init_data){
3240+
.name = "gcc_usb3_sec_phy_pipe_clk",
3241+
.ops = &clk_branch2_ops,
3242+
},
3243+
},
3244+
};
3245+
32213246
/*
32223247
* Clock ON depends on external parent 'config noc', so cant poll
32233248
* delay and also mark as crtitical for video boot
@@ -3292,6 +3317,24 @@ static struct clk_branch gcc_video_xo_clk = {
32923317
},
32933318
};
32943319

3320+
static struct gdsc usb30_prim_gdsc = {
3321+
.gdscr = 0xf004,
3322+
.pd = {
3323+
.name = "usb30_prim_gdsc",
3324+
},
3325+
.pwrsts = PWRSTS_OFF_ON,
3326+
.flags = POLL_CFG_GDSCR,
3327+
};
3328+
3329+
static struct gdsc usb30_sec_gdsc = {
3330+
.gdscr = 0x10004,
3331+
.pd = {
3332+
.name = "usb30_sec_gdsc",
3333+
},
3334+
.pwrsts = PWRSTS_OFF_ON,
3335+
.flags = POLL_CFG_GDSCR,
3336+
};
3337+
32953338
static struct clk_regmap *gcc_sm8150_clocks[] = {
32963339
[GCC_AGGRE_NOC_PCIE_TBU_CLK] = &gcc_aggre_noc_pcie_tbu_clk.clkr,
32973340
[GCC_AGGRE_UFS_CARD_AXI_CLK] = &gcc_aggre_ufs_card_axi_clk.clkr,
@@ -3480,10 +3523,12 @@ static struct clk_regmap *gcc_sm8150_clocks[] = {
34803523
[GCC_USB3_PRIM_PHY_AUX_CLK] = &gcc_usb3_prim_phy_aux_clk.clkr,
34813524
[GCC_USB3_PRIM_PHY_AUX_CLK_SRC] = &gcc_usb3_prim_phy_aux_clk_src.clkr,
34823525
[GCC_USB3_PRIM_PHY_COM_AUX_CLK] = &gcc_usb3_prim_phy_com_aux_clk.clkr,
3526+
[GCC_USB3_PRIM_PHY_PIPE_CLK] = &gcc_usb3_prim_phy_pipe_clk.clkr,
34833527
[GCC_USB3_SEC_CLKREF_CLK] = &gcc_usb3_sec_clkref_clk.clkr,
34843528
[GCC_USB3_SEC_PHY_AUX_CLK] = &gcc_usb3_sec_phy_aux_clk.clkr,
34853529
[GCC_USB3_SEC_PHY_AUX_CLK_SRC] = &gcc_usb3_sec_phy_aux_clk_src.clkr,
34863530
[GCC_USB3_SEC_PHY_COM_AUX_CLK] = &gcc_usb3_sec_phy_com_aux_clk.clkr,
3531+
[GCC_USB3_SEC_PHY_PIPE_CLK] = &gcc_usb3_sec_phy_pipe_clk.clkr,
34873532
[GCC_VIDEO_AHB_CLK] = &gcc_video_ahb_clk.clkr,
34883533
[GCC_VIDEO_AXI0_CLK] = &gcc_video_axi0_clk.clkr,
34893534
[GCC_VIDEO_AXI1_CLK] = &gcc_video_axi1_clk.clkr,
@@ -3527,6 +3572,11 @@ static const struct qcom_reset_map gcc_sm8150_resets[] = {
35273572
[GCC_USB_PHY_CFG_AHB2PHY_BCR] = { 0x6a000 },
35283573
};
35293574

3575+
static struct gdsc *gcc_sm8150_gdscs[] = {
3576+
[USB30_PRIM_GDSC] = &usb30_prim_gdsc,
3577+
[USB30_SEC_GDSC] = &usb30_sec_gdsc,
3578+
};
3579+
35303580
static const struct regmap_config gcc_sm8150_regmap_config = {
35313581
.reg_bits = 32,
35323582
.reg_stride = 4,
@@ -3541,6 +3591,8 @@ static const struct qcom_cc_desc gcc_sm8150_desc = {
35413591
.num_clks = ARRAY_SIZE(gcc_sm8150_clocks),
35423592
.resets = gcc_sm8150_resets,
35433593
.num_resets = ARRAY_SIZE(gcc_sm8150_resets),
3594+
.gdscs = gcc_sm8150_gdscs,
3595+
.num_gdscs = ARRAY_SIZE(gcc_sm8150_gdscs),
35443596
};
35453597

35463598
static const struct of_device_id gcc_sm8150_match_table[] = {

include/dt-bindings/clock/qcom,gcc-sm8150.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,8 @@
240240
#define GCC_USB30_SEC_BCR 27
241241
#define GCC_USB_PHY_CFG_AHB2PHY_BCR 28
242242

243+
/* GCC GDSCRs */
244+
#define USB30_PRIM_GDSC 4
245+
#define USB30_SEC_GDSC 5
246+
243247
#endif

0 commit comments

Comments
 (0)