}
static unsigned long stm32_clk_pll48clk_rate(struct stm32_clk *priv,
- u32 sysclk)
+ u32 vco)
{
struct stm32_rcc_regs *regs = priv->base;
u16 pllq, pllm, pllsain, pllsaip;
return ((priv->hse_rate / pllm) * pllsain) / pllsaip;
}
/* PLL48CLK is selected from PLLQ */
- return sysclk / pllq;
+ return vco / pllq;
}
static bool stm32_get_timpre(struct stm32_clk *priv)
struct stm32_clk *priv = dev_get_priv(clk->dev);
struct stm32_rcc_regs *regs = priv->base;
u32 sysclk = 0;
+ u32 vco;
u16 pllm, plln, pllp;
if ((readl(®s->cfgr) & RCC_CFGR_SWS_MASK) ==
>> RCC_PLLCFGR_PLLN_SHIFT);
pllp = ((((readl(®s->pllcfgr) & RCC_PLLCFGR_PLLP_MASK)
>> RCC_PLLCFGR_PLLP_SHIFT) + 1) << 1);
- sysclk = ((priv->hse_rate / pllm) * plln) / pllp;
+ vco = (priv->hse_rate / pllm) * plln;
+ sysclk = vco / pllp;
} else {
return -EINVAL;
}
/* System clock is selected as SDMMC1 clock */
return sysclk;
else
- return stm32_clk_pll48clk_rate(priv, sysclk);
+ return stm32_clk_pll48clk_rate(priv, vco);
break;
case STM32F7_APB2_CLOCK(SDMMC2):
if (readl(®s->dckcfgr2) & RCC_DCKCFGR2_SDMMC2SEL)
/* System clock is selected as SDMMC2 clock */
return sysclk;
else
- return stm32_clk_pll48clk_rate(priv, sysclk);
+ return stm32_clk_pll48clk_rate(priv, vco);
break;
/* For timer clock, an additionnal prescaler is used*/