16
16
17
17
#include "clock-qcom.h"
18
18
19
+ #define UFS_PHY_AXI_CLK_CMD_RCGR 0x77024
20
+
19
21
#define USB30_PRIM_MASTER_CLK_CMD_RCGR 0xf020
20
22
#define USB30_PRIM_MOCK_UTMI_CLK_CMD_RCGR 0xf038
21
23
#define USB30_SEC_MASTER_CLK_CMD_RCGR 0x9e020
22
24
#define USB30_SEC_MOCK_UTMI_CLK_CMD_RCGR 0x9e038
23
25
26
+
27
+ static const struct freq_tbl ftbl_gcc_ufs_phy_axi_clk_src [] = {
28
+ F (25000000 , CFG_CLK_SRC_GPLL0_EVEN , 12 , 0 , 0 ),
29
+ F (75000000 , CFG_CLK_SRC_GPLL0_EVEN , 4 , 0 , 0 ),
30
+ F (150000000 , CFG_CLK_SRC_GPLL0_EVEN , 2 , 0 , 0 ),
31
+ F (300000000 , CFG_CLK_SRC_GPLL0_EVEN , 1 , 0 , 0 ),
32
+ { }
33
+ };
34
+
24
35
static const struct freq_tbl ftbl_gcc_usb30_prim_master_clk_src [] = {
25
36
F (66666667 , CFG_CLK_SRC_GPLL0_EVEN , 4.5 , 0 , 0 ),
26
37
F (133333333 , CFG_CLK_SRC_GPLL0 , 4.5 , 0 , 0 ),
@@ -44,6 +55,11 @@ static ulong sc7280_set_rate(struct clk *clk, ulong rate)
44
55
debug ("%s: %s, requested rate=%ld\n" , __func__ , priv -> data -> clks [clk -> id ].name , rate );
45
56
46
57
switch (clk -> id ) {
58
+ case GCC_UFS_PHY_AXI_CLK :
59
+ freq = qcom_find_freq (ftbl_gcc_ufs_phy_axi_clk_src , rate );
60
+ clk_rcg_set_rate_mnd (priv -> base , UFS_PHY_AXI_CLK_CMD_RCGR ,
61
+ freq -> pre_div , freq -> m , freq -> n , freq -> src , 8 );
62
+ return freq -> freq ;
47
63
case GCC_USB30_PRIM_MASTER_CLK :
48
64
freq = qcom_find_freq (ftbl_gcc_usb30_prim_master_clk_src , rate );
49
65
clk_rcg_set_rate_mnd (priv -> base , USB30_PRIM_MASTER_CLK_CMD_RCGR ,
@@ -72,6 +88,8 @@ static ulong sc7280_set_rate(struct clk *clk, ulong rate)
72
88
}
73
89
74
90
static const struct gate_clk sc7280_clks [] = {
91
+ GATE_CLK (GCC_UFS_PHY_AXI_CLK , 0x77010 , 1 ),
92
+ GATE_CLK (GCC_UFS_PHY_AHB_CLK , 0x77018 , 1 ),
75
93
GATE_CLK (GCC_CFG_NOC_USB3_PRIM_AXI_CLK , 0xf07c , 1 ),
76
94
GATE_CLK (GCC_USB30_PRIM_MASTER_CLK , 0xf010 , 1 ),
77
95
GATE_CLK (GCC_AGGRE_USB3_PRIM_AXI_CLK , 0xf080 , 1 ),
@@ -98,6 +116,10 @@ static int sc7280_enable(struct clk *clk)
98
116
debug ("%s: clk %ld: %s\n" , __func__ , clk -> id , sc7280_clks [clk -> id ].name );
99
117
100
118
switch (clk -> id ) {
119
+ case GCC_UFS_PHY_AXI_CLK :
120
+ qcom_gate_clk_en (priv , GCC_UFS_PHY_AHB_CLK );
121
+ qcom_gate_clk_en (priv , GCC_UFS_PHY_AXI_CLK );
122
+ break ;
101
123
case GCC_AGGRE_USB3_PRIM_AXI_CLK :
102
124
qcom_gate_clk_en (priv , GCC_USB30_PRIM_MASTER_CLK );
103
125
fallthrough ;
@@ -147,11 +169,13 @@ static const struct qcom_power_map sc7280_gdscs[] = {
147
169
static const phys_addr_t sc7280_rcg_addrs [] = {
148
170
0x10f020 , // USB30_PRIM_MASTER_CLK_CMD_RCGR
149
171
0x10f038 , // USB30_PRIM_MOCK_UTMI_CLK_CMD_RCGR
172
+ 0x177024 , // UFS_PHY_AXI_CLK
150
173
};
151
174
152
175
static const char * sc7280_rcg_names [] = {
153
176
"USB30_PRIM_MASTER_CLK" ,
154
177
"USB30_PRIM_MOCK_UTMI_CLK" ,
178
+ "UFS_PHY_AXI_CLK" ,
155
179
};
156
180
157
181
static struct msm_clk_data qcs404_gcc_data = {
0 commit comments