mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers: clk: zynqmp: Allow zero divisor value
@ 2019-03-04 23:27 Jolly Shah
  2019-03-18 12:48 ` Michal Simek
  2019-04-11 18:32 ` Stephen Boyd
  0 siblings, 2 replies; 5+ messages in thread
From: Jolly Shah @ 2019-03-04 23:27 UTC (permalink / raw)
  To: mturquette, sboyd, michal.simek, linux-clk
  Cc: rajanv, linux-arm-kernel, linux-kernel, Rajan Vaja, Jolly Shah

From: Rajan Vaja <rajan.vaja@xilinx.com>

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>
---
 drivers/clk/zynqmp/divider.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c
index a371c66..e146b6f 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);
 }
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-11 18:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04 23:27 [PATCH] drivers: clk: zynqmp: Allow zero divisor value Jolly Shah
2019-03-18 12:48 ` Michal Simek
2019-03-18 19:42   ` Stephen Boyd
2019-03-19  7:19     ` Michal Simek
2019-04-11 18:32 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®