]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
clk: sunxi: rewrite sun9i_a80_get_pll4_factors()
authorHans de Goede <hdegoede@redhat.com>
Sat, 24 Jan 2015 11:56:31 +0000 (12:56 +0100)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Sun, 25 Jan 2015 15:55:13 +0000 (16:55 +0100)
commit6424e0aeebc4d21f14d5bfcbc8436c2836c38a75
treef307b79462ed2e9b332603002d779c3dbc2462b4
parent7a6fca879f59824963cd456d8cc5db24ac5acfc0
clk: sunxi: rewrite sun9i_a80_get_pll4_factors()

The old implementation of sun9i_a80_get_pll4_factors() has several issues,
it checks against 256 / 512 in various places where it should use 255 / 511,
it does the wrong thing for low frequencies which are an even multiple of
6 MHz, e.g. if you ask it for 72 MHz it will result in 144 Mhz, and it does
not take into account that n must be at least 12. Moreover it is quite hard
to read / follow it.

This commit rewrites it to be correct in all cases, and makes it much easier
to follow the code / to read.

Cc: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
drivers/clk/sunxi/clk-sun9i-core.c