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

+30 -11
+22 -3
drivers/clk/qcom/clk-alpha-pll.c
··· 40 41 #define PLL_USER_CTL(p) ((p)->offset + (p)->regs[PLL_OFF_USER_CTL]) 42 # define PLL_POST_DIV_SHIFT 8 43 - # define PLL_POST_DIV_MASK(p) GENMASK((p)->width, 0) 44 # define PLL_ALPHA_EN BIT(24) 45 # define PLL_ALPHA_MODE BIT(25) 46 # define PLL_VCO_SHIFT 20 ··· 1553 } 1554 1555 return regmap_update_bits(regmap, PLL_USER_CTL(pll), 1556 - PLL_POST_DIV_MASK(pll) << PLL_POST_DIV_SHIFT, 1557 - val << PLL_POST_DIV_SHIFT); 1558 } 1559 1560 const struct clk_ops clk_alpha_pll_postdiv_trion_ops = { ··· 2118 regmap_write(regmap, PLL_OPMODE(pll), 0x0); 2119 } 2120 2121 static int clk_zonda_pll_set_rate(struct clk_hw *hw, unsigned long rate, 2122 unsigned long prate) 2123 { ··· 2146 if (ret < 0) 2147 return ret; 2148 2149 regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL(pll), a); 2150 regmap_write(pll->clkr.regmap, PLL_L_VAL(pll), l); 2151 2152 /* Wait before polling for the frequency latch */ 2153 udelay(5);
··· 40 41 #define PLL_USER_CTL(p) ((p)->offset + (p)->regs[PLL_OFF_USER_CTL]) 42 # define PLL_POST_DIV_SHIFT 8 43 + # define PLL_POST_DIV_MASK(p) GENMASK((p)->width - 1, 0) 44 + # define PLL_ALPHA_MSB BIT(15) 45 # define PLL_ALPHA_EN BIT(24) 46 # define PLL_ALPHA_MODE BIT(25) 47 # define PLL_VCO_SHIFT 20 ··· 1552 } 1553 1554 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); 1557 } 1558 1559 const struct clk_ops clk_alpha_pll_postdiv_trion_ops = { ··· 2117 regmap_write(regmap, PLL_OPMODE(pll), 0x0); 2118 } 2119 2120 + static void zonda_pll_adjust_l_val(unsigned long rate, unsigned long prate, u32 *l) 2121 + { 2122 + u64 remainder, quotient; 2123 + 2124 + quotient = rate; 2125 + remainder = do_div(quotient, prate); 2126 + *l = quotient; 2127 + 2128 + if ((remainder * 2) / prate) 2129 + *l = *l + 1; 2130 + } 2131 + 2132 static int clk_zonda_pll_set_rate(struct clk_hw *hw, unsigned long rate, 2133 unsigned long prate) 2134 { ··· 2133 if (ret < 0) 2134 return ret; 2135 2136 + if (a & PLL_ALPHA_MSB) 2137 + zonda_pll_adjust_l_val(rate, prate, &l); 2138 + 2139 regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL(pll), a); 2140 regmap_write(pll->clkr.regmap, PLL_L_VAL(pll), l); 2141 + 2142 + if (!clk_hw_is_enabled(hw)) 2143 + return 0; 2144 2145 /* Wait before polling for the frequency latch */ 2146 udelay(5);
+6 -6
drivers/clk/qcom/gcc-ipq9574.c
··· 68 69 static struct clk_alpha_pll gpll0_main = { 70 .offset = 0x20000, 71 - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], 72 .clkr = { 73 .enable_reg = 0x0b000, 74 .enable_mask = BIT(0), ··· 96 97 static struct clk_alpha_pll_postdiv gpll0 = { 98 .offset = 0x20000, 99 - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], 100 .width = 4, 101 .clkr.hw.init = &(const struct clk_init_data) { 102 .name = "gpll0", ··· 110 111 static struct clk_alpha_pll gpll4_main = { 112 .offset = 0x22000, 113 - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], 114 .clkr = { 115 .enable_reg = 0x0b000, 116 .enable_mask = BIT(2), ··· 125 126 static struct clk_alpha_pll_postdiv gpll4 = { 127 .offset = 0x22000, 128 - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], 129 .width = 4, 130 .clkr.hw.init = &(const struct clk_init_data) { 131 .name = "gpll4", ··· 139 140 static struct clk_alpha_pll gpll2_main = { 141 .offset = 0x21000, 142 - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], 143 .clkr = { 144 .enable_reg = 0x0b000, 145 .enable_mask = BIT(1), ··· 154 155 static struct clk_alpha_pll_postdiv gpll2 = { 156 .offset = 0x21000, 157 - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], 158 .width = 4, 159 .clkr.hw.init = &(const struct clk_init_data) { 160 .name = "gpll2",
··· 68 69 static struct clk_alpha_pll gpll0_main = { 70 .offset = 0x20000, 71 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO], 72 .clkr = { 73 .enable_reg = 0x0b000, 74 .enable_mask = BIT(0), ··· 96 97 static struct clk_alpha_pll_postdiv gpll0 = { 98 .offset = 0x20000, 99 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO], 100 .width = 4, 101 .clkr.hw.init = &(const struct clk_init_data) { 102 .name = "gpll0", ··· 110 111 static struct clk_alpha_pll gpll4_main = { 112 .offset = 0x22000, 113 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO], 114 .clkr = { 115 .enable_reg = 0x0b000, 116 .enable_mask = BIT(2), ··· 125 126 static struct clk_alpha_pll_postdiv gpll4 = { 127 .offset = 0x22000, 128 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO], 129 .width = 4, 130 .clkr.hw.init = &(const struct clk_init_data) { 131 .name = "gpll4", ··· 139 140 static struct clk_alpha_pll gpll2_main = { 141 .offset = 0x21000, 142 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO], 143 .clkr = { 144 .enable_reg = 0x0b000, 145 .enable_mask = BIT(1), ··· 154 155 static struct clk_alpha_pll_postdiv gpll2 = { 156 .offset = 0x21000, 157 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT_EVO], 158 .width = 4, 159 .clkr.hw.init = &(const struct clk_init_data) { 160 .name = "gpll2",
+2 -2
drivers/clk/qcom/gcc-x1e80100.c
··· 6203 .pd = { 6204 .name = "gcc_usb_0_phy_gdsc", 6205 }, 6206 - .pwrsts = PWRSTS_OFF_ON, 6207 .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, 6208 }; 6209 ··· 6215 .pd = { 6216 .name = "gcc_usb_1_phy_gdsc", 6217 }, 6218 - .pwrsts = PWRSTS_OFF_ON, 6219 .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, 6220 }; 6221
··· 6203 .pd = { 6204 .name = "gcc_usb_0_phy_gdsc", 6205 }, 6206 + .pwrsts = PWRSTS_RET_ON, 6207 .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, 6208 }; 6209 ··· 6215 .pd = { 6216 .name = "gcc_usb_1_phy_gdsc", 6217 }, 6218 + .pwrsts = PWRSTS_RET_ON, 6219 .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, 6220 }; 6221