diff options
author | Rajan Vaja <rajan.vaja@xilinx.com> | 2019-03-04 15:27:46 -0800 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2019-04-11 11:31:33 -0700 |
commit | 60d74e011c8e7450846563739a8530f823e5d77a (patch) | |
tree | ac2d30533dba9b247892f609ba1938965fa28ed9 /drivers/clk/zynqmp | |
parent | 9e98c678c2d6ae3a17cb2de55d17f69dddaa231b (diff) | |
download | linux-60d74e011c8e7450846563739a8530f823e5d77a.tar.bz2 |
drivers: clk: zynqmp: Allow zero divisor value
Zero divider is valid and default for some of ZynqMP
clocks. Allow zero divisor when CLK_DIVIDER_ALLOW_ZERO
for the clock is set.
Signed-off-by: Rajan Vaja <rajanv@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/zynqmp')
-rw-r--r-- | drivers/clk/zynqmp/divider.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c index a371c66e72ef..e146b6fac6b2 100644 --- a/drivers/clk/zynqmp/divider.c +++ b/drivers/clk/zynqmp/divider.c @@ -76,6 +76,13 @@ static unsigned long zynqmp_clk_divider_recalc_rate(struct clk_hw *hw, else value = div >> 16; + if (!value) { + WARN(!(divider->flags & CLK_DIVIDER_ALLOW_ZERO), + "%s: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set\n", + clk_name); + return parent_rate; + } + return DIV_ROUND_UP_ULL(parent_rate, value); } |