Skip to content

Commit

Permalink
clk: tegra: divider: Check UART's divider enable-bit state on rate's …
Browse files Browse the repository at this point in the history
…recalculation

UART clock is divided using divisor values from DLM/DLL registers when
enable-bit is unset in clk register and clk's divider configuration isn't
taken onto account in this case. This doesn't cause any problems, but
let's add a check for the divider's enable-bit state, for consistency.

Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
  • Loading branch information
Dmitry Osipenko authored and Thierry Reding committed Jan 10, 2020
1 parent d8edf52 commit cf83a28
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/clk/tegra/clk-divider.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ static unsigned long clk_frac_div_recalc_rate(struct clk_hw *hw,
int div, mul;
u64 rate = parent_rate;

reg = readl_relaxed(divider->reg) >> divider->shift;
div = reg & div_mask(divider);
reg = readl_relaxed(divider->reg);

if ((divider->flags & TEGRA_DIVIDER_UART) &&
!(reg & PERIPH_CLK_UART_DIV_ENB))
return rate;

div = (reg >> divider->shift) & div_mask(divider);

mul = get_mul(divider);
div += mul;
Expand Down

0 comments on commit cf83a28

Please sign in to comment.