]> git.karo-electronics.de Git - karo-tx-linux.git/commit
clk: divider: do not propagate rate change request when unnecessary
authorShawn Guo <shawn.guo@linaro.org>
Sun, 2 Jun 2013 14:20:55 +0000 (22:20 +0800)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:53:34 +0000 (09:53 +0800)
commitd537cb10719cd000ecac5cc6640b787f319393fc
treec62971de42f59d26ca19b857edf2f7f6f289f745
parent14e9c7db465387ede7f019c42f28c90f99fc2793
clk: divider: do not propagate rate change request when unnecessary

Commit 081c9025f49da427faf50b5c14143f98a21c5e85 upstream.

If the current rate of parent clock is sufficient to provide child a
requested rate with a proper divider setting, the rate change request
should not be propagated.  Instead, changing the divider setting is good
enough to get child clock run at the requested rate.

On an imx6q clock configuration illustrated below,

  ahb --> ipg --> ipg_per
  132M    66M     66M

calling clk_set_rate(ipg_per, 22M) with the current
clk_divider_bestdiv() implementation will result in the rate change up
to ahb level like the following, because of the unnecessary/incorrect
rate change propagation.

  ahb --> ipg --> ipg_per
  66M     22M     22M

Fix the problem by trying to see if the requested rate can be achieved
by simply changing the divider value, and in that case return the
divider immediately from function clk_divider_bestdiv() as the best
one, so that all those unnecessary rate change propagation can be saved.

Reported-by: Anson Huang <b20788@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
drivers/clk/clk-divider.c