]> git.baikalelectronics.ru Git - kernel.git/commitdiff
clk: ingenic: Fix recalc_rate for clocks with fixed divider
authorPaul Cercueil <paul@crapouillou.net>
Tue, 16 Jan 2018 15:47:52 +0000 (16:47 +0100)
committerJames Hogan <jhogan@kernel.org>
Thu, 18 Jan 2018 22:04:56 +0000 (22:04 +0000)
Previously, the clocks with a fixed divider would report their rate
as being the same as the one of their parent, independently of the
divider in use. This commit fixes this behaviour.

This went unnoticed as neither the jz4740 nor the jz4780 CGU code
have clocks with fixed dividers yet.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Maarten ter Huurne <maarten@treewalker.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/18477/
Signed-off-by: James Hogan <jhogan@kernel.org>
drivers/clk/ingenic/cgu.c

index ab393637f7b0f80791657fa88f458df9b3e7b609..a2e73a6d60fddc232fe3d4974707eacad6983835 100644 (file)
@@ -328,6 +328,8 @@ ingenic_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
                div *= clk_info->div.div;
 
                rate /= div;
+       } else if (clk_info->type & CGU_CLK_FIXDIV) {
+               rate /= clk_info->fixdiv.div;
        }
 
        return rate;