Skip to content

Commit

Permalink
clk: sunxi-ng: sun5i: Fix bit offset of audio PLL post-divider
Browse files Browse the repository at this point in the history
The post-divider for the audio PLL is in bits [29:26], as specified
in the user manual, not [19:16] as currently programmed in the code.
The post-divider has a default register value of 2, i.e. a divider
of 3. This means the clock rate fed to the audio codec would be off.

This was discovered when porting sigma-delta modulation for the PLL
to sun5i, which needs the post-divider to be 1.

Fix the bit offset, so we do actually force the post-divider to a
certain value.

Fixes: 5e73761 ("clk: sunxi-ng: Add sun5i CCU driver")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
  • Loading branch information
Chen-Yu Tsai authored and Maxime Ripard committed Oct 13, 2017
1 parent 7c4f63e commit d51fe3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/clk/sunxi-ng/ccu-sun5i.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,8 +982,8 @@ static void __init sun5i_ccu_init(struct device_node *node,

/* Force the PLL-Audio-1x divider to 4 */
val = readl(reg + SUN5I_PLL_AUDIO_REG);
val &= ~GENMASK(19, 16);
writel(val | (3 << 16), reg + SUN5I_PLL_AUDIO_REG);
val &= ~GENMASK(29, 26);
writel(val | (3 << 26), reg + SUN5I_PLL_AUDIO_REG);

/*
* Use the peripheral PLL as the AHB parent, instead of CPU /
Expand Down

0 comments on commit d51fe3b

Please sign in to comment.