Re: [PATCH v3 06/14 RESEND] clk: samsung: clk-pll: Add support for pll_4313
From: Peter Griffin
Date: Fri Nov 13 2026 - 16:37:32 EST
Hi Raghav,
On Fri, 13 Nov 2026 at 10:53, Raghav Sharma <raghav.s@xxxxxxxxxxx> wrote:
>
> From: Alim Akhtar <alim.akhtar@xxxxxxxxxxx>
>
> PLLs 4313 are found in the Exynos8855 SoC and it is similar
> to pll_531x except for CON8 offset, so re-using code for
> pll_4313
>
> Signed-off-by: Alim Akhtar <alim.akhtar@xxxxxxxxxxx>
> Signed-off-by: Raghav Sharma <raghav.s@xxxxxxxxxxx>
> ---
> drivers/clk/samsung/clk-pll.c | 11 ++++++++++-
> drivers/clk/samsung/clk-pll.h | 1 +
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
> index 3d837bd74355..7b0756127306 100644
> --- a/drivers/clk/samsung/clk-pll.c
> +++ b/drivers/clk/samsung/clk-pll.c
> @@ -1306,7 +1306,15 @@ static unsigned long samsung_pll531x_recalc_rate(struct clk_hw *hw,
> u64 mdiv, fout = parent_rate;
>
> pll_con0 = readl_relaxed(pll->con_reg);
> - pll_con8 = readl_relaxed(pll->con_reg + 20);
> + if (pll->type == pll_4313) {
> + /* Offset for PLL_CON8 which hold FDIV different for PLL_4313
> + * which is PLL_LOCKTIME_OFFSET - 0x4
> + */
> + pll_con8 = readl_relaxed(pll->lock_reg - 4);
> + } else {
> + pll_con8 = readl_relaxed(pll->con_reg + 20);
> + }
> +
This starts to feel a bit hacky (pll_con8 register being referenced as
an offset from lock_reg). Is the register really called pll_con8 on
8855? Or is it called something else, but happens to contain fdiv?
I think something like this would look cleaner:
u32 fdiv_reg;
if (pll->type == pll_4313) {
/* fdiv in <insert name> register
fdiv_reg = readl_relaxed(pll->lock_reg - 4);
} else {
/* fdiv in pll_con8 register */
fdiv_reg = readl_relaxed(pll->con_reg + 20);
}
regards,
Peter