clk: shmobile: div6: Fix .recalc_rate() using a stale divisor
authorGeert Uytterhoeven <geert+renesas@glider.be>
Thu, 18 Feb 2016 14:16:02 +0000 (15:16 +0100)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 26 Feb 2016 11:03:10 +0000 (12:03 +0100)
commit3092d3b8e56e09ff74d7ef9f1c34a4c358e9f0fe
treea8c2e856d856cbadbe322c5429eebb80ca9bf5d4
parent31aeb5a523b0f6c1b7cc4f802e6f925168f7d60d
clk: shmobile: div6: Fix .recalc_rate() using a stale divisor

cpg_div6_clock_set_rate() only programs the new divisor if the clock
isn't stopped. If the clock is stopped, it will update the cached
divisor value only, which will be programmed into the clock registers
when enabling the clock later.

However, cpg_div6_clock_recalc_rate() reads the divisor from the clock
registers instead of using the cached value, leading to an incorrect
result if the clock is currently stopped.

Make cpg_div6_clock_recalc_rate() use the cached value to fix this.

Reported-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
drivers/clk/shmobile/clk-div6.c