Skip to contentSkip to conversation

clk: fractional-divider: support for divider bypassing

PATCH Applied Heikki Krogerus 3 participants 4 messages Feb 2, 2015 – Feb 25, 2015 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: fractional-divider: support for divider bypassing

If the divider or multiplier values values are 0 in the register, bypassing the divider and returning the parent clock rate in clk_fd_recalc_rate().

---
 drivers/clk/clk-fractional-divider.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/clk-fractional-divider.c +3 -0
index dc91da7..34d6c51 100644
@@ -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);
 
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Heikki Krogerus

If the divider or multiplier values values are 0 in the

s/values//

Quoted 5 lines

register, bypassing the divider and returning the parent clock rate in clk_fd_recalc_rate().

---

Quoted 17 lines
 drivers/clk/clk-fractional-divider.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/clk-fractional-divider.c +3 -0
index dc91da7..34d6c51 100644
@@ -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);
 
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

Quoting Stephen Boyd (2015-02-02 11:42:55)

Quoted 5 lines · Heikki Krogerus
Quoted 1 line

If the divider or multiplier values values are 0 in the

s/values//

Quoted 7 lines
Quoted 5 lines

register, bypassing the divider and returning the parent clock rate in clk_fd_recalc_rate().

---

Applied to clk-next.

Regards,
Mike

Quoted 24 lines
Quoted 18 lines
 drivers/clk/clk-fractional-divider.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/clk-fractional-divider.c +3 -0
index dc91da7..34d6c51 100644
@@ -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);
 
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#3 lore raw
In reply to Stephen Boyd

Quoting Stephen Boyd (2015-02-02 11:42:55)

Quoted 5 lines · Heikki Krogerus
Quoted 1 line

If the divider or multiplier values values are 0 in the

s/values//

Quoted 7 lines
Quoted 5 lines

register, bypassing the divider and returning the parent clock rate in clk_fd_recalc_rate().

---

Applied to clk-next.

Regards,
Mike

Quoted 24 lines
Quoted 18 lines
 drivers/clk/clk-fractional-divider.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/clk-fractional-divider.c +3 -0
index dc91da7..34d6c51 100644
@@ -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);
 
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project