Skip to content

Commit c140348

Browse files
committed
WIP: trying to add more sc7280 clocks to enable
Signed-off-by: Eugene Lepshy <fekz115@gmail.com>
1 parent 6ecf96c commit c140348

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/clk/qcom/clock-sc7280.c

+24
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,22 @@
1616

1717
#include "clock-qcom.h"
1818

19+
#define UFS_PHY_AXI_CLK_CMD_RCGR 0x77024
20+
1921
#define USB30_PRIM_MASTER_CLK_CMD_RCGR 0xf020
2022
#define USB30_PRIM_MOCK_UTMI_CLK_CMD_RCGR 0xf038
2123
#define USB30_SEC_MASTER_CLK_CMD_RCGR 0x9e020
2224
#define USB30_SEC_MOCK_UTMI_CLK_CMD_RCGR 0x9e038
2325

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+
2435
static const struct freq_tbl ftbl_gcc_usb30_prim_master_clk_src[] = {
2536
F(66666667, CFG_CLK_SRC_GPLL0_EVEN, 4.5, 0, 0),
2637
F(133333333, CFG_CLK_SRC_GPLL0, 4.5, 0, 0),
@@ -44,6 +55,11 @@ static ulong sc7280_set_rate(struct clk *clk, ulong rate)
4455
debug("%s: %s, requested rate=%ld\n", __func__, priv->data->clks[clk->id].name, rate);
4556

4657
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;
4763
case GCC_USB30_PRIM_MASTER_CLK:
4864
freq = qcom_find_freq(ftbl_gcc_usb30_prim_master_clk_src, rate);
4965
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)
7288
}
7389

7490
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),
7593
GATE_CLK(GCC_CFG_NOC_USB3_PRIM_AXI_CLK, 0xf07c, 1),
7694
GATE_CLK(GCC_USB30_PRIM_MASTER_CLK, 0xf010, 1),
7795
GATE_CLK(GCC_AGGRE_USB3_PRIM_AXI_CLK, 0xf080, 1),
@@ -98,6 +116,10 @@ static int sc7280_enable(struct clk *clk)
98116
debug("%s: clk %ld: %s\n", __func__, clk->id, sc7280_clks[clk->id].name);
99117

100118
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;
101123
case GCC_AGGRE_USB3_PRIM_AXI_CLK:
102124
qcom_gate_clk_en(priv, GCC_USB30_PRIM_MASTER_CLK);
103125
fallthrough;
@@ -147,11 +169,13 @@ static const struct qcom_power_map sc7280_gdscs[] = {
147169
static const phys_addr_t sc7280_rcg_addrs[] = {
148170
0x10f020, // USB30_PRIM_MASTER_CLK_CMD_RCGR
149171
0x10f038, // USB30_PRIM_MOCK_UTMI_CLK_CMD_RCGR
172+
0x177024, // UFS_PHY_AXI_CLK
150173
};
151174

152175
static const char * sc7280_rcg_names[] = {
153176
"USB30_PRIM_MASTER_CLK",
154177
"USB30_PRIM_MOCK_UTMI_CLK",
178+
"UFS_PHY_AXI_CLK",
155179
};
156180

157181
static struct msm_clk_data qcs404_gcc_data = {

0 commit comments

Comments
 (0)