Skip to content

Commit 0f6eaf1

Browse files
committed
Merge tag 'qcom-clk-fixes-for-6.11' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into clk-fixes
Pull Qualcomm clk driver fixes from Bjorn Andersson: This corrects several issues with the Alpha PLL clock driver. It updates IPQ9574 GCC driver to correctly use the EVO PLL registers for GPLL clocks. X1E USB GDSC flags are corrected to leave these in retention as the controllers are suspended. * tag 'qcom-clk-fixes-for-6.11' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux: clk: qcom: ipq9574: Update the alpha PLL type for GPLLs clk: qcom: gcc-x1e80100: Fix USB 0 and 1 PHY GDSC pwrsts flags clk: qcom: clk-alpha-pll: Update set_rate for Zonda PLL clk: qcom: clk-alpha-pll: Fix zonda set_rate failure when PLL is disabled clk: qcom: clk-alpha-pll: Fix the trion pll postdiv set rate API clk: qcom: clk-alpha-pll: Fix the pll post div mask
2 parents 39a3396 + 6357efe commit 0f6eaf1

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

drivers/clk/qcom/clk-alpha-pll.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040

4141
#define PLL_USER_CTL(p) ((p)->offset + (p)->regs[PLL_OFF_USER_CTL])
4242
# define PLL_POST_DIV_SHIFT 8
43-
# define PLL_POST_DIV_MASK(p) GENMASK((p)->width, 0)
43+
# define PLL_POST_DIV_MASK(p) GENMASK((p)->width - 1, 0)
44+
# define PLL_ALPHA_MSB BIT(15)
4445
# define PLL_ALPHA_EN BIT(24)
4546
# define PLL_ALPHA_MODE BIT(25)
4647
# define PLL_VCO_SHIFT 20
@@ -1552,8 +1553,8 @@ clk_trion_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
15521553
}
15531554

15541555
return regmap_update_bits(regmap, PLL_USER_CTL(pll),
1555-
PLL_POST_DIV_MASK(pll) << PLL_POST_DIV_SHIFT,
1556-
val << PLL_POST_DIV_SHIFT);
1556+
PLL_POST_DIV_MASK(pll) << pll->post_div_shift,
1557+
val << pll->post_div_shift);
15571558
}
15581559

15591560
const struct clk_ops clk_alpha_pll_postdiv_trion_ops = {
@@ -2117,6 +2118,18 @@ static void clk_zonda_pll_disable(struct clk_hw *hw)
21172118
regmap_write(regmap, PLL_OPMODE(pll), 0x0);
21182119
}
21192120

2121+
static void zonda_pll_adjust_l_val(unsigned long rate, unsigned long prate, u32 *l)
2122+
{
2123+
u64 remainder, quotient;
2124+
2125+
quotient = rate;
2126+
remainder = do_div(quotient, prate);
2127+
*l = quotient;
2128+
2129+
if ((remainder * 2) / prate)
2130+
*l = *l + 1;
2131+
}
2132+
21202133
static int clk_zonda_pll_set_rate(struct clk_hw *hw, unsigned long rate,
21212134
unsigned long prate)
21222135
{
@@ -2133,9 +2146,15 @@ static int clk_zonda_pll_set_rate(struct clk_hw *hw, unsigned long rate,
21332146
if (ret < 0)
21342147
return ret;
21352148

2149+
if (a & PLL_ALPHA_MSB)
2150+
zonda_pll_adjust_l_val(rate, prate, &l);
2151+
21362152
regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL(pll), a);
21372153
regmap_write(pll->clkr.regmap, PLL_L_VAL(pll), l);
21382154

2155+
if (!clk_hw_is_enabled(hw))
2156+
return 0;
2157+
21392158
/* Wait before polling for the frequency latch */
21402159
udelay(5);
21412160

drivers/clk/qcom/gcc-ipq9574.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static const struct clk_parent_data gcc_sleep_clk_data[] = {
6868

6969
static struct clk_alpha_pll gpll0_main = {
7070
.offset = 0x20000,
71-
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
71+
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO],
7272
.clkr = {
7373
.enable_reg = 0x0b000,
7474
.enable_mask = BIT(0),
@@ -96,7 +96,7 @@ static struct clk_fixed_factor gpll0_out_main_div2 = {
9696

9797
static struct clk_alpha_pll_postdiv gpll0 = {
9898
.offset = 0x20000,
99-
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
99+
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO],
100100
.width = 4,
101101
.clkr.hw.init = &(const struct clk_init_data) {
102102
.name = "gpll0",
@@ -110,7 +110,7 @@ static struct clk_alpha_pll_postdiv gpll0 = {
110110

111111
static struct clk_alpha_pll gpll4_main = {
112112
.offset = 0x22000,
113-
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
113+
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO],
114114
.clkr = {
115115
.enable_reg = 0x0b000,
116116
.enable_mask = BIT(2),
@@ -125,7 +125,7 @@ static struct clk_alpha_pll gpll4_main = {
125125

126126
static struct clk_alpha_pll_postdiv gpll4 = {
127127
.offset = 0x22000,
128-
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
128+
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO],
129129
.width = 4,
130130
.clkr.hw.init = &(const struct clk_init_data) {
131131
.name = "gpll4",
@@ -139,7 +139,7 @@ static struct clk_alpha_pll_postdiv gpll4 = {
139139

140140
static struct clk_alpha_pll gpll2_main = {
141141
.offset = 0x21000,
142-
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
142+
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO],
143143
.clkr = {
144144
.enable_reg = 0x0b000,
145145
.enable_mask = BIT(1),
@@ -154,7 +154,7 @@ static struct clk_alpha_pll gpll2_main = {
154154

155155
static struct clk_alpha_pll_postdiv gpll2 = {
156156
.offset = 0x21000,
157-
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
157+
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO],
158158
.width = 4,
159159
.clkr.hw.init = &(const struct clk_init_data) {
160160
.name = "gpll2",

drivers/clk/qcom/gcc-x1e80100.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6203,7 +6203,7 @@ static struct gdsc gcc_usb_0_phy_gdsc = {
62036203
.pd = {
62046204
.name = "gcc_usb_0_phy_gdsc",
62056205
},
6206-
.pwrsts = PWRSTS_OFF_ON,
6206+
.pwrsts = PWRSTS_RET_ON,
62076207
.flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE,
62086208
};
62096209

@@ -6215,7 +6215,7 @@ static struct gdsc gcc_usb_1_phy_gdsc = {
62156215
.pd = {
62166216
.name = "gcc_usb_1_phy_gdsc",
62176217
},
6218-
.pwrsts = PWRSTS_OFF_ON,
6218+
.pwrsts = PWRSTS_RET_ON,
62196219
.flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE,
62206220
};
62216221

0 commit comments

Comments
 (0)