summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk-fractional-divider.c
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2015-02-02 15:37:04 +0200
committerStephen Boyd <sboyd@codeaurora.org>2015-03-12 12:18:47 -0700
commit6b54783620bcfaff37ad41e957d29c326211cc18 (patch)
treebbbe58b4b00f178c43aa45efefb6239a2ac00767 /drivers/clk/clk-fractional-divider.c
parent496eadf821c2a5111a4b1b401ddda8d1fc18fb0b (diff)
downloadlinux-stable-6b54783620bcfaff37ad41e957d29c326211cc18.tar.gz
linux-stable-6b54783620bcfaff37ad41e957d29c326211cc18.tar.bz2
linux-stable-6b54783620bcfaff37ad41e957d29c326211cc18.zip
clk: fractional-divider: support for divider bypassing
If the divider or multiplier values are 0 in the register, bypassing the divider and returning the parent clock rate in clk_fd_recalc_rate(). Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Michael Turquette <mturquette@linaro.org> [mturquette@linaro.org: fixed commitlog typo]
Diffstat (limited to 'drivers/clk/clk-fractional-divider.c')
-rw-r--r--drivers/clk/clk-fractional-divider.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c
index 82a59d0086cc..6aa72d9d79ba 100644
--- a/drivers/clk/clk-fractional-divider.c
+++ b/drivers/clk/clk-fractional-divider.c
@@ -36,6 +36,9 @@ static unsigned long clk_fd_recalc_rate(struct clk_hw *hw,
m = (val & fd->mmask) >> fd->mshift;
n = (val & fd->nmask) >> fd->nshift;
+ if (!n || !m)
+ return parent_rate;
+
ret = (u64)parent_rate * m;
do_div(ret, n);