Skip to contentSkip to conversation

OMAP: OMAP3 DSS related clock patches

PATCH New Tomi Valkeinen 6 participants 27 messages Feb 13, 2014 – Mar 19, 2014

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

cover OMAP: OMAP3 DSS related clock patches

Hi,

I've been debugging OMAP3 related issues with DSS clocks, and I hopefully have them all fixed with this series. This fixes the problems for both non-DT boot, but also for DT boot with DSS DT support (which is not merged yet).

The non-DT boot related fixes should be merged for 3.14, but I'd like the DT boot related fixes to be merged for 3.14 also, as that'll make handling the DSS DT support easier.

This is based on v3.14-rc2.

Tomi

Tomi Valkeinen (8):
clk: divider: fix rate calculation for fractional rates
clk: ti/divider: fix rate calculation for fractional rates
ARM: OMAP2+: clock: fix clkoutx2 with CLK_SET_RATE_PARENT
ARM: dts: fix omap3 dss clock handle names
ARM: dts: fix DPLL4 x2 clkouts on 3630
ARM: dts: use ti,fixed-factor-clock for dpll4_m4x2_mul_ck
ARM: dts: set 'ti,set-rate-parent' for dpll4_m4 path
OMAPDSS: fix rounding when calculating fclk rate

 arch/arm/boot/dts/omap3430es1-clocks.dtsi          |  6 +--
 .../omap36xx-am35xx-omap3430es2plus-clocks.dtsi    |  6 +--
 arch/arm/boot/dts/omap36xx-clocks.dtsi             | 20 +++++++
 arch/arm/boot/dts/omap36xx.dtsi                    |  2 +-
 arch/arm/boot/dts/omap3xxx-clocks.dtsi             |  8 +--
 arch/arm/mach-omap2/cclock3xxx_data.c              |  2 +
 arch/arm/mach-omap2/dpll3xxx.c                     | 62 ++++++++++++++++++++++
 drivers/clk/clk-divider.c                          | 10 ++--
 drivers/clk/ti/divider.c                           |  8 +--
 drivers/video/omap2/dss/dss.c                      |  4 +-
 include/linux/clk/ti.h                             |  4 ++
 11 files changed, 111 insertions(+), 21 deletions(-)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/8 clk: divider: fix rate calculation for fractional rates

clk-divider.c does not calculate the rates consistently at the moment.

As an example, on OMAP3 we have a clock divider with a source clock of 864000000 Hz. With dividers 6, 7 and 8 the theoretical rates are:

6: 144000000
7: 123428571.428571...
8: 108000000

Calling clk_round_rate() with the rate in the first column will give the rate in the second column:

144000000 -> 144000000
143999999 -> 123428571
123428572 -> 123428571
123428571 -> 108000000

Note how clk_round_rate() returns 123428571 for rates from 123428572 to 143999999, which is mathematically correct, but when clk_round_rate() is called with 123428571, the returned value is surprisingly 108000000.

This means that the following code works a bit oddly:

rate = clk_round_rate(clk, 123428572);
clk_set_rate(clk, rate);

As clk_set_rate() also does clock rate rounding, the result is that the clock is set to the rate of 108000000, not 123428571 returned by the clk_round_rate.

This patch changes the clk-divider.c to use DIV_ROUND_UP when calculating the rate. This gives the following behavior which fixes the inconsistency:

144000000 -> 144000000
143999999 -> 123428572
123428572 -> 123428572
123428571 -> 108000000

---
 drivers/clk/clk-divider.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/clk-divider.c +5 -5
index 5543b7df8e16..ec22112e569f 100644
@@ -24,7 +24,7 @@
  * Traits of this clock:
  * prepare - clk_prepare only ensures that parents are prepared
  * enable - clk_enable only ensures that parents are enabled
- * rate - rate is adjustable.  clk->rate = parent->rate / divisor
+ * rate - rate is adjustable.  clk->rate = DIV_ROUND_UP(parent->rate / divisor)
  * parent - fixed parent.  No clk_set_parent support
  */
 
@@ -115,7 +115,7 @@ static unsigned long clk_divider_recalc_rate(struct clk_hw *hw,
 		return parent_rate;
 	}
 
-	return parent_rate / div;
+	return DIV_ROUND_UP(parent_rate, div);
 }
 
 /*
@@ -185,7 +185,7 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
 		}
 		parent_rate = __clk_round_rate(__clk_get_parent(hw->clk),
 				MULT_ROUND_UP(rate, i));
-		now = parent_rate / i;
+		now = DIV_ROUND_UP(parent_rate, i);
 		if (now <= rate && now > best) {
 			bestdiv = i;
 			best = now;
@@ -207,7 +207,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 	int div;
 	div = clk_divider_bestdiv(hw, rate, prate);
 
-	return *prate / div;
+	return DIV_ROUND_UP(*prate, div);
 }
 
 static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -218,7 +218,7 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 	unsigned long flags = 0;
 	u32 val;
 
-	div = parent_rate / rate;
+	div = DIV_ROUND_UP(parent_rate, rate);
 	value = _get_val(divider, div);
 
 	if (value > div_mask(divider))
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 1/8 clk: divider: fix rate calculation for fractional rates

Quoted 87 lines · Tomi Valkeinen

clk-divider.c does not calculate the rates consistently at the moment.

As an example, on OMAP3 we have a clock divider with a source clock of 864000000 Hz. With dividers 6, 7 and 8 the theoretical rates are:

6: 144000000
7: 123428571.428571...
8: 108000000

Calling clk_round_rate() with the rate in the first column will give the rate in the second column:

144000000 -> 144000000
143999999 -> 123428571
123428572 -> 123428571
123428571 -> 108000000

Note how clk_round_rate() returns 123428571 for rates from 123428572 to 143999999, which is mathematically correct, but when clk_round_rate() is called with 123428571, the returned value is surprisingly 108000000.

This means that the following code works a bit oddly:

rate = clk_round_rate(clk, 123428572);
clk_set_rate(clk, rate);

As clk_set_rate() also does clock rate rounding, the result is that the clock is set to the rate of 108000000, not 123428571 returned by the clk_round_rate.

This patch changes the clk-divider.c to use DIV_ROUND_UP when calculating the rate. This gives the following behavior which fixes the inconsistency:

144000000 -> 144000000
143999999 -> 123428572
123428572 -> 123428572
123428571 -> 108000000

---
  drivers/clk/clk-divider.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/clk-divider.c +4 -4
index 5543b7df8e16..ec22112e569f 100644
@@ -24,7 +24,7 @@
   * Traits of this clock:
   * prepare - clk_prepare only ensures that parents are prepared
   * enable - clk_enable only ensures that parents are enabled
- * rate - rate is adjustable.  clk->rate = parent->rate / divisor
+ * rate - rate is adjustable.  clk->rate = DIV_ROUND_UP(parent->rate / divisor)
   * parent - fixed parent.  No clk_set_parent support
   */
 
@@ -115,7 +115,7 @@ static unsigned long clk_divider_recalc_rate(struct clk_hw *hw,
  		return parent_rate;
  	}
 
-	return parent_rate / div;
+	return DIV_ROUND_UP(parent_rate, div);
  }
 
  /*
@@ -185,7 +185,7 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
  		}
  		parent_rate = __clk_round_rate(__clk_get_parent(hw->clk),
  				MULT_ROUND_UP(rate, i));
-		now = parent_rate / i;
+		now = DIV_ROUND_UP(parent_rate, i);
  		if (now <= rate && now > best) {
  			bestdiv = i;
  			best = now;
@@ -207,7 +207,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
  	int div;
  	div = clk_divider_bestdiv(hw, rate, prate);
 
-	return *prate / div;
+	return DIV_ROUND_UP(*prate, div);
  }
 
  static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,

drivers/clk/clk-divider.c static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, · line 224

Quoted 8 lines
drivers/clk/clk-divider.c +1 -1
@@ -218,7 +218,7 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
  	unsigned long flags = 0;
  	u32 val;
 
-	div = parent_rate / rate;
+	div = DIV_ROUND_UP(parent_rate, rate);
  	value = _get_val(divider, div);
 
  	if (value > div_mask(divider))

Basically the patch looks good to me, but it might be good to have a testing round of sort with this. It can potentially cause regressions on multiple boards if the drivers happen to rely on the "broken" clock rates. Same for patch #2 which is a copy paste of this one, but only impacts TI boards.

-Tero

#3 lore raw

PATCH 1/8 clk: divider: fix rate calculation for fractional rates

Quoting Tero Kristo (2014-02-14 05:45:22)

Quoted 94 lines · Tomi Valkeinen
Quoted 93 lines

clk-divider.c does not calculate the rates consistently at the moment.

As an example, on OMAP3 we have a clock divider with a source clock of 864000000 Hz. With dividers 6, 7 and 8 the theoretical rates are:

6: 144000000
7: 123428571.428571...
8: 108000000

Calling clk_round_rate() with the rate in the first column will give the rate in the second column:

144000000 -> 144000000
143999999 -> 123428571
123428572 -> 123428571
123428571 -> 108000000

Note how clk_round_rate() returns 123428571 for rates from 123428572 to 143999999, which is mathematically correct, but when clk_round_rate() is called with 123428571, the returned value is surprisingly 108000000.

This means that the following code works a bit oddly:

rate = clk_round_rate(clk, 123428572);
clk_set_rate(clk, rate);

As clk_set_rate() also does clock rate rounding, the result is that the clock is set to the rate of 108000000, not 123428571 returned by the clk_round_rate.

This patch changes the clk-divider.c to use DIV_ROUND_UP when calculating the rate. This gives the following behavior which fixes the inconsistency:

144000000 -> 144000000
143999999 -> 123428572
123428572 -> 123428572
123428571 -> 108000000

---
  drivers/clk/clk-divider.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/clk-divider.c +5 -5
index 5543b7df8e16..ec22112e569f 100644
@@ -24,7 +24,7 @@
   * Traits of this clock:
   * prepare - clk_prepare only ensures that parents are prepared
   * enable - clk_enable only ensures that parents are enabled
- * rate - rate is adjustable.  clk->rate = parent->rate / divisor
+ * rate - rate is adjustable.  clk->rate = DIV_ROUND_UP(parent->rate / divisor)
   * parent - fixed parent.  No clk_set_parent support
   */
 
@@ -115,7 +115,7 @@ static unsigned long clk_divider_recalc_rate(struct clk_hw *hw,
              return parent_rate;
      }
 
-     return parent_rate / div;
+     return DIV_ROUND_UP(parent_rate, div);
  }
 
  /*
@@ -185,7 +185,7 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
              }
              parent_rate = __clk_round_rate(__clk_get_parent(hw->clk),
                              MULT_ROUND_UP(rate, i));
-             now = parent_rate / i;
+             now = DIV_ROUND_UP(parent_rate, i);
              if (now <= rate && now > best) {
                      bestdiv = i;
                      best = now;
@@ -207,7 +207,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
      int div;
      div = clk_divider_bestdiv(hw, rate, prate);
 
-     return *prate / div;
+     return DIV_ROUND_UP(*prate, div);
  }
 
  static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -218,7 +218,7 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
      unsigned long flags = 0;
      u32 val;
 
-     div = parent_rate / rate;
+     div = DIV_ROUND_UP(parent_rate, rate);
      value = _get_val(divider, div);
 
Quoted 8 lines

drivers/clk/clk-divider.c static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, · line 224

Quoted 2 lines
drivers/clk/clk-divider.c +0 -0
      if (value > div_mask(divider))

Basically the patch looks good to me, but it might be good to have a testing round of sort with this. It can potentially cause regressions on multiple boards if the drivers happen to rely on the "broken" clock rates. Same for patch #2 which is a copy paste of this one, but only impacts TI boards.

Agreed. I've taken patches #1 & #2 into clk-next. Let's let them stew in -next for a while and see if anyone's board catches on fire.

Regards,
Mike

Quoted 3 lines

-Tero

#4 lore raw

PATCH 1/8 clk: divider: fix rate calculation for fractional rates

Quoted 8 lines · Mike Turquette
Quoted 5 lines

Basically the patch looks good to me, but it might be good to have a testing round of sort with this. It can potentially cause regressions on multiple boards if the drivers happen to rely on the "broken" clock rates. Same for patch #2 which is a copy paste of this one, but only impacts TI boards.

Agreed. I've taken patches #1 & #2 into clk-next. Let's let them stew in -next for a while and see if anyone's board catches on fire.

Thanks. I understand there's a possibility this could break some other driver. I still wish we could get this to 3.14, as this would fix OMAP display subsystem.

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140228/ffb9e296/attachment.sig>

#5 lore raw

PATCH 1/8 clk: divider: fix rate calculation for fractional rates

In reply to Mike Turquette
Quoted 104 lines · Mike Turquette

Quoting Tero Kristo (2014-02-14 05:45:22)

Quoted 94 lines · Tomi Valkeinen
Quoted 93 lines

clk-divider.c does not calculate the rates consistently at the moment.

As an example, on OMAP3 we have a clock divider with a source clock of 864000000 Hz. With dividers 6, 7 and 8 the theoretical rates are:

6: 144000000
7: 123428571.428571...
8: 108000000

Calling clk_round_rate() with the rate in the first column will give the rate in the second column:

144000000 -> 144000000
143999999 -> 123428571
123428572 -> 123428571
123428571 -> 108000000

Note how clk_round_rate() returns 123428571 for rates from 123428572 to 143999999, which is mathematically correct, but when clk_round_rate() is called with 123428571, the returned value is surprisingly 108000000.

This means that the following code works a bit oddly:

rate = clk_round_rate(clk, 123428572);
clk_set_rate(clk, rate);

As clk_set_rate() also does clock rate rounding, the result is that the clock is set to the rate of 108000000, not 123428571 returned by the clk_round_rate.

This patch changes the clk-divider.c to use DIV_ROUND_UP when calculating the rate. This gives the following behavior which fixes the inconsistency:

144000000 -> 144000000
143999999 -> 123428572
123428572 -> 123428572
123428571 -> 108000000

---
  drivers/clk/clk-divider.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/clk-divider.c +5 -5
index 5543b7df8e16..ec22112e569f 100644
@@ -24,7 +24,7 @@
   * Traits of this clock:
   * prepare - clk_prepare only ensures that parents are prepared
   * enable - clk_enable only ensures that parents are enabled
- * rate - rate is adjustable.  clk->rate = parent->rate / divisor
+ * rate - rate is adjustable.  clk->rate = DIV_ROUND_UP(parent->rate / divisor)
   * parent - fixed parent.  No clk_set_parent support
   */
 
@@ -115,7 +115,7 @@ static unsigned long clk_divider_recalc_rate(struct clk_hw *hw,
              return parent_rate;
      }
 
-     return parent_rate / div;
+     return DIV_ROUND_UP(parent_rate, div);
  }
 
  /*
@@ -185,7 +185,7 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
              }
              parent_rate = __clk_round_rate(__clk_get_parent(hw->clk),
                              MULT_ROUND_UP(rate, i));
-             now = parent_rate / i;
+             now = DIV_ROUND_UP(parent_rate, i);
              if (now <= rate && now > best) {
                      bestdiv = i;
                      best = now;
@@ -207,7 +207,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
      int div;
      div = clk_divider_bestdiv(hw, rate, prate);
 
-     return *prate / div;
+     return DIV_ROUND_UP(*prate, div);
  }
 
  static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -218,7 +218,7 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
      unsigned long flags = 0;
      u32 val;
 
-     div = parent_rate / rate;
+     div = DIV_ROUND_UP(parent_rate, rate);
      value = _get_val(divider, div);
 
Quoted 8 lines

drivers/clk/clk-divider.c static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, · line 224

Quoted 2 lines
drivers/clk/clk-divider.c +0 -0
      if (value > div_mask(divider))

Basically the patch looks good to me, but it might be good to have a testing round of sort with this. It can potentially cause regressions on multiple boards if the drivers happen to rely on the "broken" clock rates. Same for patch #2 which is a copy paste of this one, but only impacts TI boards.

Quoted 2 lines

Agreed. I've taken patches #1 & #2 into clk-next. Let's let them stew in -next for a while and see if anyone's board catches on fire.

Are these on the way to 3.15?

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140317/f4945404/attachment-0001.sig>

#6 lore raw

PATCH 1/8 clk: divider: fix rate calculation for fractional rates

Quoting Tomi Valkeinen (2014-03-17 05:53:03)

Quoted 105 lines · Mike Turquette
Quoted 104 lines

Quoting Tero Kristo (2014-02-14 05:45:22)

Quoted 102 lines · Tomi Valkeinen
Quoted 87 lines

clk-divider.c does not calculate the rates consistently at the moment.

As an example, on OMAP3 we have a clock divider with a source clock of 864000000 Hz. With dividers 6, 7 and 8 the theoretical rates are:

6: 144000000
7: 123428571.428571...
8: 108000000

Calling clk_round_rate() with the rate in the first column will give the rate in the second column:

144000000 -> 144000000
143999999 -> 123428571
123428572 -> 123428571
123428571 -> 108000000

Note how clk_round_rate() returns 123428571 for rates from 123428572 to 143999999, which is mathematically correct, but when clk_round_rate() is called with 123428571, the returned value is surprisingly 108000000.

This means that the following code works a bit oddly:

rate = clk_round_rate(clk, 123428572);
clk_set_rate(clk, rate);

As clk_set_rate() also does clock rate rounding, the result is that the clock is set to the rate of 108000000, not 123428571 returned by the clk_round_rate.

This patch changes the clk-divider.c to use DIV_ROUND_UP when calculating the rate. This gives the following behavior which fixes the inconsistency:

144000000 -> 144000000
143999999 -> 123428572
123428572 -> 123428572
123428571 -> 108000000

---
  drivers/clk/clk-divider.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/clk-divider.c +4 -4
index 5543b7df8e16..ec22112e569f 100644
@@ -24,7 +24,7 @@
   * Traits of this clock:
   * prepare - clk_prepare only ensures that parents are prepared
   * enable - clk_enable only ensures that parents are enabled
- * rate - rate is adjustable.  clk->rate = parent->rate / divisor
+ * rate - rate is adjustable.  clk->rate = DIV_ROUND_UP(parent->rate / divisor)
   * parent - fixed parent.  No clk_set_parent support
   */
 
@@ -115,7 +115,7 @@ static unsigned long clk_divider_recalc_rate(struct clk_hw *hw,
              return parent_rate;
      }
 
-     return parent_rate / div;
+     return DIV_ROUND_UP(parent_rate, div);
  }
 
  /*
@@ -185,7 +185,7 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
              }
              parent_rate = __clk_round_rate(__clk_get_parent(hw->clk),
                              MULT_ROUND_UP(rate, i));
-             now = parent_rate / i;
+             now = DIV_ROUND_UP(parent_rate, i);
              if (now <= rate && now > best) {
                      bestdiv = i;
                      best = now;
@@ -207,7 +207,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
      int div;
      div = clk_divider_bestdiv(hw, rate, prate);
 
-     return *prate / div;
+     return DIV_ROUND_UP(*prate, div);
  }
 
  static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,

drivers/clk/clk-divider.c static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, · line 224

Quoted 8 lines
drivers/clk/clk-divider.c +1 -1
@@ -218,7 +218,7 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
      unsigned long flags = 0;
      u32 val;
 
-     div = parent_rate / rate;
+     div = DIV_ROUND_UP(parent_rate, rate);
      value = _get_val(divider, div);
 
      if (value > div_mask(divider))

Basically the patch looks good to me, but it might be good to have a testing round of sort with this. It can potentially cause regressions on multiple boards if the drivers happen to rely on the "broken" clock rates. Same for patch #2 which is a copy paste of this one, but only impacts TI boards.

Quoted 4 lines
Quoted 2 lines

Agreed. I've taken patches #1 & #2 into clk-next. Let's let them stew in -next for a while and see if anyone's board catches on fire.

Are these on the way to 3.15?

Yes, they've been in -next for a couple of weeks.

Regards,
Mike

Quoted 4 lines

Tomi

#7 lore raw

PATCH 2/8 clk: ti/divider: fix rate calculation for fractional rates

In reply to Tomi Valkeinen

ti/clk-divider.c does not calculate the rates consistently at the moment.

As an example, on OMAP3 we have a clock divider with a source clock of 864000000 Hz. With dividers 6, 7 and 8 the theoretical rates are:

6: 144000000
7: 123428571.428571...
8: 108000000

Calling clk_round_rate() with the rate in the first column will give the rate in the second column:

144000000 -> 144000000
143999999 -> 123428571
123428572 -> 123428571
123428571 -> 108000000

Note how clk_round_rate() returns 123428571 for rates from 123428572 to 143999999, which is mathematically correct, but when clk_round_rate() is called with 123428571, the returned value is surprisingly 108000000.

This means that the following code works a bit oddly:

rate = clk_round_rate(clk, 123428572);
clk_set_rate(clk, rate);

As clk_set_rate() also does clock rate rounding, the result is that the clock is set to the rate of 108000000, not 123428571 returned by the clk_round_rate.

This patch changes the ti/clk-divider.c to use DIV_ROUND_UP when calculating the rate. This gives the following behavior which fixes the inconsistency:

144000000 -> 144000000
143999999 -> 123428572
123428572 -> 123428572
123428571 -> 108000000

---
 drivers/clk/ti/divider.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/ti/divider.c +4 -4
index a15e445570b2..e6aa10db7bba 100644
@@ -112,7 +112,7 @@ static unsigned long ti_clk_divider_recalc_rate(struct clk_hw *hw,
 		return parent_rate;
 	}
 
-	return parent_rate / div;
+	return DIV_ROUND_UP(parent_rate, div);
 }
 
 /*
@@ -182,7 +182,7 @@ static int ti_clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
 		}
 		parent_rate = __clk_round_rate(__clk_get_parent(hw->clk),
 				MULT_ROUND_UP(rate, i));
-		now = parent_rate / i;
+		now = DIV_ROUND_UP(parent_rate, i);
 		if (now <= rate && now > best) {
 			bestdiv = i;
 			best = now;
@@ -205,7 +205,7 @@ static long ti_clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 	int div;
 	div = ti_clk_divider_bestdiv(hw, rate, prate);
 
-	return *prate / div;
+	return DIV_ROUND_UP(*prate, div);
 }
 
 static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -216,7 +216,7 @@ static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 	unsigned long flags = 0;
 	u32 val;
 
-	div = parent_rate / rate;
+	div = DIV_ROUND_UP(parent_rate, rate);
 	value = _get_val(divider, div);
 
 	if (value > div_mask(divider))
Signature · 1 line
1.8.3.2
#8 lore raw

PATCH 3/8 ARM: OMAP2+: clock: fix clkoutx2 with CLK_SET_RATE_PARENT

In reply to Tomi Valkeinen

If CLK_SET_RATE_PARENT is set for a clkoutx2 clock, calling clk_set_rate() on the clock "skips" the x2 multiplier as there are no set_rate and round_rate functions defined for the clkoutx2.

This results in getting double the requested clock rates, breaking the display on omap3430 based devices.

This patch implements set_rate and round_rate for clkoutx2.

---
 arch/arm/mach-omap2/cclock3xxx_data.c |  2 ++
 arch/arm/mach-omap2/dpll3xxx.c        | 62 +++++++++++++++++++++++++++++++++++
 include/linux/clk/ti.h                |  4 +++
 3 files changed, 68 insertions(+)
arch/arm/mach-omap2/cclock3xxx_data.c +2 -0
index 3b05aea56d1f..11ed9152e665 100644
@@ -433,7 +433,9 @@ static const struct clk_ops dpll4_m5x2_ck_ops = {
 	.enable		= &omap2_dflt_clk_enable,
 	.disable	= &omap2_dflt_clk_disable,
 	.is_enabled	= &omap2_dflt_clk_is_enabled,
+	.set_rate	= &omap3_clkoutx2_set_rate,
 	.recalc_rate	= &omap3_clkoutx2_recalc,
+	.round_rate	= &omap3_clkoutx2_round_rate,
 };
 
 static const struct clk_ops dpll4_m5x2_ck_3630_ops = {
arch/arm/mach-omap2/dpll3xxx.c +62 -0

68 lines not on this page · raw message

include/linux/clk/ti.h +4 -0
index 092b64168d7f..4a21a872dbbd 100644
@@ -245,6 +245,10 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
 void omap2_init_clk_clkdm(struct clk_hw *clk);
 unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
 				    unsigned long parent_rate);
+int omap3_clkoutx2_set_rate(struct clk_hw *hw, unsigned long rate,
+					unsigned long parent_rate);
+long omap3_clkoutx2_round_rate(struct clk_hw *hw, unsigned long rate,
+		unsigned long *prate);
 int omap2_clkops_enable_clkdm(struct clk_hw *hw);
 void omap2_clkops_disable_clkdm(struct clk_hw *hw);
 int omap2_clk_disable_autoidle_all(void);
Signature · 1 line
1.8.3.2
#9 lore raw

PATCH 3/8 ARM: OMAP2+: clock: fix clkoutx2 with CLK_SET_RATE_PARENT

Quoted 7 lines · Tomi Valkeinen

If CLK_SET_RATE_PARENT is set for a clkoutx2 clock, calling clk_set_rate() on the clock "skips" the x2 multiplier as there are no set_rate and round_rate functions defined for the clkoutx2.

This results in getting double the requested clock rates, breaking the display on omap3430 based devices.

Quoted 8 lines

This patch implements set_rate and round_rate for clkoutx2.

---
 arch/arm/mach-omap2/cclock3xxx_data.c |  2 ++
 arch/arm/mach-omap2/dpll3xxx.c        | 62 +++++++++++++++++++++++++++++++++++
 include/linux/clk/ti.h                |  4 +++
 3 files changed, 68 insertions(+)

Argh. This patch 3/8 was an old version, and not valid. It does not work for omap3430. I had earlier posted a proper version, but somehow I managed to get an old version for this series.

The correct version can be found from

http://mid.gmane.org/1391080640-23370-1-git-send-email-tomi.valkeinen at ti.com

and I'll also include it below.

Tomi

Quoted 1 line

From 0d46054a8b33bc1f7a37bc9b17dd1631b1a06047 Mon Sep 17 00:00:00 2001

From: Tomi Valkeinen <[email protected]>
Date: Thu, 30 Jan 2014 13:17:20 +0200
Subject: [PATCH] ARM: OMAP2+: clock: fix clkoutx2 with CLK_SET_RATE_PARENT

If CLK_SET_RATE_PARENT is set for a clkoutx2 clock, calling clk_set_rate() on the clock "skips" the x2 multiplier as there are no set_rate and round_rate functions defined for the clkoutx2.

This results in getting double the requested clock rates, breaking the display on omap3430 based devices. This got broken when d0f58bd3bba3877fb1af4664c4e33273d36f00e4 and related patches were merged for v3.14, as omapdss driver now relies more on the clk-framework and CLK_SET_RATE_PARENT.

This patch implements set_rate and round_rate for clkoutx2.

Tested on OMAP3430, OMAP3630, OMAP4460.

---
 arch/arm/mach-omap2/cclock3xxx_data.c |  2 +
 arch/arm/mach-omap2/dpll3xxx.c        | 92 +++++++++++++++++++++++++++++------
 include/linux/clk/ti.h                |  4 ++
 3 files changed, 83 insertions(+), 15 deletions(-)
arch/arm/mach-omap2/cclock3xxx_data.c +2 -0
index 3b05aea56d1f..11ed9152e665 100644
@@ -433,7 +433,9 @@ static const struct clk_ops dpll4_m5x2_ck_ops = {
 	.enable		= &omap2_dflt_clk_enable,
 	.disable	= &omap2_dflt_clk_disable,
 	.is_enabled	= &omap2_dflt_clk_is_enabled,
+	.set_rate	= &omap3_clkoutx2_set_rate,
 	.recalc_rate	= &omap3_clkoutx2_recalc,
+	.round_rate	= &omap3_clkoutx2_round_rate,
 };
 
 static const struct clk_ops dpll4_m5x2_ck_3630_ops = {
arch/arm/mach-omap2/dpll3xxx.c +77 -15

116 lines not on this page · raw message

include/linux/clk/ti.h +4 -0
index 092b64168d7f..4a21a872dbbd 100644
@@ -245,6 +245,10 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
 void omap2_init_clk_clkdm(struct clk_hw *clk);
 unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
 				    unsigned long parent_rate);
+int omap3_clkoutx2_set_rate(struct clk_hw *hw, unsigned long rate,
+					unsigned long parent_rate);
+long omap3_clkoutx2_round_rate(struct clk_hw *hw, unsigned long rate,
+		unsigned long *prate);
 int omap2_clkops_enable_clkdm(struct clk_hw *hw);
 void omap2_clkops_disable_clkdm(struct clk_hw *hw);
 int omap2_clk_disable_autoidle_all(void);
Signature · 11 lines
1.8.3.2



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140213/1f45fc18/attachment.sig>
#10 lore raw

PATCH 4/8 ARM: dts: fix omap3 dss clock handle names

In reply to Tomi Valkeinen

The DSS fclk and iclk handles are named differently on OMAP3430 ES1 than on later OMAP revisions. The ES1 has handles 'dss1_alwon_fck_3430es1' and 'dss_ick_3430es1', whereas later revisions have similar names but ending with 'es2'.

This means we don't have one clock handle to which we could refer to when defining the DSS clocks.

However, as the namespaces are separate for ES1 and ES2+ OMAPs, we can just rename the handles to 'dss1_alwon_fck' and 'dss_ick' for both ES1 and ES2+, removing the issue.

---
 arch/arm/boot/dts/omap3430es1-clocks.dtsi                     | 6 +++---
 arch/arm/boot/dts/omap36xx-am35xx-omap3430es2plus-clocks.dtsi | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/boot/dts/omap3430es1-clocks.dtsi +3 -3
index 02f6c7fabbec..f9202656168f 100644
@@ -152,7 +152,7 @@
 		clocks = <&usb_l4_gate_ick>, <&usb_l4_div_ick>;
 	};
 
-	dss1_alwon_fck_3430es1: dss1_alwon_fck_3430es1 {
+	dss1_alwon_fck: dss1_alwon_fck_3430es1 {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
 		clocks = <&dpll4_m4x2_ck>;
@@ -161,7 +161,7 @@
 		ti,set-rate-parent;
 	};
 
-	dss_ick_3430es1: dss_ick_3430es1 {
+	dss_ick: dss_ick_3430es1 {
 		#clock-cells = <0>;
 		compatible = "ti,omap3-no-wait-interface-clock";
 		clocks = <&l4_ick>;
@@ -184,7 +184,7 @@
 	dss_clkdm: dss_clkdm {
 		compatible = "ti,clockdomain";
 		clocks = <&dss_tv_fck>, <&dss_96m_fck>, <&dss2_alwon_fck>,
-			 <&dss1_alwon_fck_3430es1>, <&dss_ick_3430es1>;
+			 <&dss1_alwon_fck>, <&dss_ick>;
 	};
 
 	d2d_clkdm: d2d_clkdm {
arch/arm/boot/dts/omap36xx-am35xx-omap3430es2plus-clocks.dtsi +3 -3
index af9ae5346bf2..080fb3f4e429 100644
@@ -160,7 +160,7 @@
 		ti,bit-shift = <30>;
 	};
 
-	dss1_alwon_fck_3430es2: dss1_alwon_fck_3430es2 {
+	dss1_alwon_fck: dss1_alwon_fck_3430es2 {
 		#clock-cells = <0>;
 		compatible = "ti,dss-gate-clock";
 		clocks = <&dpll4_m4x2_ck>;
@@ -169,7 +169,7 @@
 		ti,set-rate-parent;
 	};
 
-	dss_ick_3430es2: dss_ick_3430es2 {
+	dss_ick: dss_ick_3430es2 {
 		#clock-cells = <0>;
 		compatible = "ti,omap3-dss-interface-clock";
 		clocks = <&l4_ick>;
@@ -216,7 +216,7 @@
 	dss_clkdm: dss_clkdm {
 		compatible = "ti,clockdomain";
 		clocks = <&dss_tv_fck>, <&dss_96m_fck>, <&dss2_alwon_fck>,
-			 <&dss1_alwon_fck_3430es2>, <&dss_ick_3430es2>;
+			 <&dss1_alwon_fck>, <&dss_ick>;
 	};
 
 	core_l4_clkdm: core_l4_clkdm {
Signature · 1 line
1.8.3.2
#11 lore raw

PATCH 4/8 ARM: dts: fix omap3 dss clock handle names

Quoted 5 lines · Tomi Valkeinen

The DSS fclk and iclk handles are named differently on OMAP3430 ES1 than on later OMAP revisions. The ES1 has handles 'dss1_alwon_fck_3430es1' and 'dss_ick_3430es1', whereas later revisions have similar names but ending with 'es2'.

Quoted 8 lines

This means we don't have one clock handle to which we could refer to when defining the DSS clocks.

However, as the namespaces are separate for ES1 and ES2+ OMAPs, we can just rename the handles to 'dss1_alwon_fck' and 'dss_ick' for both ES1 and ES2+, removing the issue.

Quoted 68 lines
---
  arch/arm/boot/dts/omap3430es1-clocks.dtsi                     | 6 +++---
  arch/arm/boot/dts/omap36xx-am35xx-omap3430es2plus-clocks.dtsi | 6 +++---
  2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/boot/dts/omap3430es1-clocks.dtsi +3 -3
index 02f6c7fabbec..f9202656168f 100644
@@ -152,7 +152,7 @@
  		clocks = <&usb_l4_gate_ick>, <&usb_l4_div_ick>;
  	};
 
-	dss1_alwon_fck_3430es1: dss1_alwon_fck_3430es1 {
+	dss1_alwon_fck: dss1_alwon_fck_3430es1 {
  		#clock-cells = <0>;
  		compatible = "ti,gate-clock";
  		clocks = <&dpll4_m4x2_ck>;
@@ -161,7 +161,7 @@
  		ti,set-rate-parent;
  	};
 
-	dss_ick_3430es1: dss_ick_3430es1 {
+	dss_ick: dss_ick_3430es1 {
  		#clock-cells = <0>;
  		compatible = "ti,omap3-no-wait-interface-clock";
  		clocks = <&l4_ick>;
@@ -184,7 +184,7 @@
  	dss_clkdm: dss_clkdm {
  		compatible = "ti,clockdomain";
  		clocks = <&dss_tv_fck>, <&dss_96m_fck>, <&dss2_alwon_fck>,
-			 <&dss1_alwon_fck_3430es1>, <&dss_ick_3430es1>;
+			 <&dss1_alwon_fck>, <&dss_ick>;
  	};
 
  	d2d_clkdm: d2d_clkdm {
arch/arm/boot/dts/omap36xx-am35xx-omap3430es2plus-clocks.dtsi +3 -3
index af9ae5346bf2..080fb3f4e429 100644
@@ -160,7 +160,7 @@
  		ti,bit-shift = <30>;
  	};
 
-	dss1_alwon_fck_3430es2: dss1_alwon_fck_3430es2 {
+	dss1_alwon_fck: dss1_alwon_fck_3430es2 {
  		#clock-cells = <0>;
  		compatible = "ti,dss-gate-clock";
  		clocks = <&dpll4_m4x2_ck>;
@@ -169,7 +169,7 @@
  		ti,set-rate-parent;
  	};
 
-	dss_ick_3430es2: dss_ick_3430es2 {
+	dss_ick: dss_ick_3430es2 {
  		#clock-cells = <0>;
  		compatible = "ti,omap3-dss-interface-clock";
  		clocks = <&l4_ick>;
@@ -216,7 +216,7 @@
  	dss_clkdm: dss_clkdm {
  		compatible = "ti,clockdomain";
  		clocks = <&dss_tv_fck>, <&dss_96m_fck>, <&dss2_alwon_fck>,
-			 <&dss1_alwon_fck_3430es2>, <&dss_ick_3430es2>;
+			 <&dss1_alwon_fck>, <&dss_ick>;
  	};
 
  	core_l4_clkdm: core_l4_clkdm {
#12 lore raw

PATCH 5/8 ARM: dts: fix DPLL4 x2 clkouts on 3630

In reply to Tomi Valkeinen

OMAP3630 DPLL4 is different than on OMAP3430, in that it doesn't have the x2 multiplier for its outputs. This is not currently reflected in the clock DT data.

Fix the issue by setting the clock multiplier to 1 (instead of 2) for the DPLL4 output clocks.

---
 arch/arm/boot/dts/omap36xx-clocks.dtsi | 20 ++++++++++++++++++++
 arch/arm/boot/dts/omap36xx.dtsi        |  2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap36xx-clocks.dtsi +20 -0
index 2fcf253b677c..0b2df76b9d38 100644
@@ -70,6 +70,26 @@
 	};
 };
 
+&dpll4_m2x2_mul_ck {
+	clock-mult = <1>;
+};
+
+&dpll4_m3x2_mul_ck {
+	clock-mult = <1>;
+};
+
+&dpll4_m4x2_mul_ck {
+	clock-mult = <1>;
+};
+
+&dpll4_m5x2_mul_ck {
+	clock-mult = <1>;
+};
+
+&dpll4_m6x2_mul_ck {
+	clock-mult = <1>;
+};
+
 &cm_clockdomains {
 	dpll4_clkdm: dpll4_clkdm {
 		compatible = "ti,clockdomain";
arch/arm/boot/dts/omap36xx.dtsi +1 -1
index 7e8dee9175d6..5e1bcd06a996 100644
@@ -52,7 +52,7 @@
 	};
 };
 
-/include/ "omap36xx-clocks.dtsi"
 /include/ "omap34xx-omap36xx-clocks.dtsi"
 /include/ "omap36xx-omap3430es2plus-clocks.dtsi"
 /include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi"
+/include/ "omap36xx-clocks.dtsi"
Signature · 1 line
1.8.3.2
#13 lore raw

PATCH 5/8 ARM: dts: fix DPLL4 x2 clkouts on 3630

Quoted 50 lines · Tomi Valkeinen

OMAP3630 DPLL4 is different than on OMAP3430, in that it doesn't have the x2 multiplier for its outputs. This is not currently reflected in the clock DT data.

Fix the issue by setting the clock multiplier to 1 (instead of 2) for the DPLL4 output clocks.

---
  arch/arm/boot/dts/omap36xx-clocks.dtsi | 20 ++++++++++++++++++++
  arch/arm/boot/dts/omap36xx.dtsi        |  2 +-
  2 files changed, 21 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap36xx-clocks.dtsi +20 -0
index 2fcf253b677c..0b2df76b9d38 100644
@@ -70,6 +70,26 @@
  	};
  };
 
+&dpll4_m2x2_mul_ck {
+	clock-mult = <1>;
+};
+
+&dpll4_m3x2_mul_ck {
+	clock-mult = <1>;
+};
+
+&dpll4_m4x2_mul_ck {
+	clock-mult = <1>;
+};
+
+&dpll4_m5x2_mul_ck {
+	clock-mult = <1>;
+};
+
+&dpll4_m6x2_mul_ck {
+	clock-mult = <1>;
+};
+
  &cm_clockdomains {
  	dpll4_clkdm: dpll4_clkdm {
  		compatible = "ti,clockdomain";
arch/arm/boot/dts/omap36xx.dtsi +0 -0
index 7e8dee9175d6..5e1bcd06a996 100644

arch/arm/boot/dts/omap36xx.dtsi line 58

Quoted 8 lines
arch/arm/boot/dts/omap36xx.dtsi +1 -1
@@ -52,7 +52,7 @@
  	};
  };
 
-/include/ "omap36xx-clocks.dtsi"
  /include/ "omap34xx-omap36xx-clocks.dtsi"
  /include/ "omap36xx-omap3430es2plus-clocks.dtsi"
  /include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi"
+/include/ "omap36xx-clocks.dtsi"

I think this re-ordering of the includes is unnecessary.

Other than that, the patch looks okay to me, so acked.

-Tero

#14 lore raw

PATCH 6/8 ARM: dts: use ti, fixed-factor-clock for dpll4_m4x2_mul_ck

In reply to Tomi Valkeinen

We need to use set-rate-parent for dpll4_m4 clock path, so use the ti,fixed-factor-clock version which supports set-rate-parent property.

---
 arch/arm/boot/dts/omap36xx-clocks.dtsi | 2 +-
 arch/arm/boot/dts/omap3xxx-clocks.dtsi | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/omap36xx-clocks.dtsi +1 -1
index 0b2df76b9d38..6b5280d04a0e 100644
@@ -79,7 +79,7 @@
 };
 
 &dpll4_m4x2_mul_ck {
-	clock-mult = <1>;
+	ti,clock-mult = <1>;
 };
 
 &dpll4_m5x2_mul_ck {
arch/arm/boot/dts/omap3xxx-clocks.dtsi +3 -3
index cb04d4b37e7f..df3c699a1893 100644
@@ -425,10 +425,10 @@
 
 	dpll4_m4x2_mul_ck: dpll4_m4x2_mul_ck {
 		#clock-cells = <0>;
-		compatible = "fixed-factor-clock";
+		compatible = "ti,fixed-factor-clock";
 		clocks = <&dpll4_m4_ck>;
-		clock-mult = <2>;
-		clock-div = <1>;
+		ti,clock-mult = <2>;
+		ti,clock-div = <1>;
 	};
 
 	dpll4_m4x2_ck: dpll4_m4x2_ck {
Signature · 1 line
1.8.3.2
#15 lore raw

PATCH 6/8 ARM: dts: use ti, fixed-factor-clock for dpll4_m4x2_mul_ck

Quoted 2 lines · Tomi Valkeinen

We need to use set-rate-parent for dpll4_m4 clock path, so use the ti,fixed-factor-clock version which supports set-rate-parent property.

.... you are talking about the flag but not introducing it in this patch, maybe squash this + patch 7...?

-Tero

Quoted 39 lines
---
  arch/arm/boot/dts/omap36xx-clocks.dtsi | 2 +-
  arch/arm/boot/dts/omap3xxx-clocks.dtsi | 6 +++---
  2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/omap36xx-clocks.dtsi +1 -1
index 0b2df76b9d38..6b5280d04a0e 100644
@@ -79,7 +79,7 @@
  };
 
  &dpll4_m4x2_mul_ck {
-	clock-mult = <1>;
+	ti,clock-mult = <1>;
  };
 
  &dpll4_m5x2_mul_ck {
arch/arm/boot/dts/omap3xxx-clocks.dtsi +3 -3
index cb04d4b37e7f..df3c699a1893 100644
@@ -425,10 +425,10 @@
 
  	dpll4_m4x2_mul_ck: dpll4_m4x2_mul_ck {
  		#clock-cells = <0>;
-		compatible = "fixed-factor-clock";
+		compatible = "ti,fixed-factor-clock";
  		clocks = <&dpll4_m4_ck>;
-		clock-mult = <2>;
-		clock-div = <1>;
+		ti,clock-mult = <2>;
+		ti,clock-div = <1>;
  	};
 
  	dpll4_m4x2_ck: dpll4_m4x2_ck {
#16 lore raw

PATCH 6/8 ARM: dts: use ti, fixed-factor-clock for dpll4_m4x2_mul_ck

Quoted 7 lines · Tero Kristo
Quoted 2 lines · Tomi Valkeinen

We need to use set-rate-parent for dpll4_m4 clock path, so use the ti,fixed-factor-clock version which supports set-rate-parent property.

.... you are talking about the flag but not introducing it in this patch, maybe squash this + patch 7...?

Hmm, yes, I should mention that the flag itself is set in a following patch.

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140214/bb600c28/attachment.sig>

#17 lore raw

PATCH 7/8 ARM: dts: set 'ti,set-rate-parent' for dpll4_m4 path

In reply to Tomi Valkeinen

Set 'ti,set-rate-parent' property for clocks in the dpll4_m4 clock path, which is used for DSS functional clock. This fixes DSS driver's clock rate configuration, which needs the rate to be propagated properly to the divider node (dpll4_m4_ck).

---
 arch/arm/boot/dts/omap3xxx-clocks.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/boot/dts/omap3xxx-clocks.dtsi +2 -0
index df3c699a1893..12be2b35dae9 100644
@@ -429,6 +429,7 @@
 		clocks = <&dpll4_m4_ck>;
 		ti,clock-mult = <2>;
 		ti,clock-div = <1>;
+		ti,set-rate-parent;
 	};
 
 	dpll4_m4x2_ck: dpll4_m4x2_ck {
@@ -438,6 +439,7 @@
 		ti,bit-shift = <0x1d>;
 		reg = <0x0d00>;
 		ti,set-bit-to-disable;
+		ti,set-rate-parent;
 	};
 
 	dpll4_m5_ck: dpll4_m5_ck {
Signature · 1 line
1.8.3.2
#18 lore raw

PATCH 7/8 ARM: dts: set 'ti,set-rate-parent' for dpll4_m4 path

Quoted 4 lines · Tomi Valkeinen

Set 'ti,set-rate-parent' property for clocks in the dpll4_m4 clock path, which is used for DSS functional clock. This fixes DSS driver's clock rate configuration, which needs the rate to be propagated properly to the divider node (dpll4_m4_ck).

... squash to #6?

-Tero

Quoted 27 lines
---
  arch/arm/boot/dts/omap3xxx-clocks.dtsi | 2 ++
  1 file changed, 2 insertions(+)
arch/arm/boot/dts/omap3xxx-clocks.dtsi +2 -0
index df3c699a1893..12be2b35dae9 100644
@@ -429,6 +429,7 @@
  		clocks = <&dpll4_m4_ck>;
  		ti,clock-mult = <2>;
  		ti,clock-div = <1>;
+		ti,set-rate-parent;
  	};
 
  	dpll4_m4x2_ck: dpll4_m4x2_ck {
@@ -438,6 +439,7 @@
  		ti,bit-shift = <0x1d>;
  		reg = <0x0d00>;
  		ti,set-bit-to-disable;
+		ti,set-rate-parent;
  	};
 
  	dpll4_m5_ck: dpll4_m5_ck {
#19 lore raw

PATCH 7/8 ARM: dts: set 'ti,set-rate-parent' for dpll4_m4 path

Quoted 8 lines · Tero Kristo
Quoted 4 lines · Tomi Valkeinen

Set 'ti,set-rate-parent' property for clocks in the dpll4_m4 clock path, which is used for DSS functional clock. This fixes DSS driver's clock rate configuration, which needs the rate to be propagated properly to the divider node (dpll4_m4_ck).

... squash to #6?

I got no problem with that, but I think it's cleaner to separate these two things. #6 converts the clock to use a different driver, and by having these separate, it's easier to see that #6 converts the node 1:1 without other functional change.

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140214/74d12cda/attachment.sig>

#20 lore raw

PATCH 8/8 OMAPDSS: fix rounding when calculating fclk rate

In reply to Tomi Valkeinen

"clk: divider: fix rate calculation for fractional rates" patch (and similar for TI specific divider) fixes the clk-divider's rounding. This patch updates the DSS driver to round the rates accordingly.

This fixes the DSS's warnings about clock rate mismatch, and also fixes the wrong fclk rate being set.

---
 drivers/video/omap2/dss/dss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/omap2/dss/dss.c +2 -2
index 9a145da35ad3..efe7c308341d 100644
@@ -471,7 +471,7 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min,
 	fckd_stop = max(DIV_ROUND_UP(prate * m, fck_hw_max), 1ul);
 
 	for (fckd = fckd_start; fckd >= fckd_stop; --fckd) {
-		fck = prate / fckd * m;
+		fck = DIV_ROUND_UP(prate, fckd) * m;
 
 		if (func(fck, data))
 			return true;
@@ -520,7 +520,7 @@ static int dss_setup_default_clock(void)
 
 		fck_div = DIV_ROUND_UP(prate * dss.feat->dss_fck_multiplier,
 				max_dss_fck);
-		fck = prate / fck_div * dss.feat->dss_fck_multiplier;
+		fck = DIV_ROUND_UP(prate, fck_div) * dss.feat->dss_fck_multiplier;
 	}
 
 	r = dss_set_fck_rate(fck);
Signature · 1 line
1.8.3.2
#21 lore raw

cover OMAP: OMAP3 DSS related clock patches

In reply to Tomi Valkeinen
Quoted 11 lines · Tomi Valkeinen

Hi,

I've been debugging OMAP3 related issues with DSS clocks, and I hopefully have them all fixed with this series. This fixes the problems for both non-DT boot, but also for DT boot with DSS DT support (which is not merged yet).

The non-DT boot related fixes should be merged for 3.14, but I'd like the DT boot related fixes to be merged for 3.14 also, as that'll make handling the DSS DT support easier.

This is based on v3.14-rc2.

Tested on gta04 board with DSS DT patches v3 (rebased on 3.14-rc2). Panel is finally working fine.
Thanks.

Quoted 26 lines

Tomi

Tomi Valkeinen (8):
clk: divider: fix rate calculation for fractional rates
clk: ti/divider: fix rate calculation for fractional rates
ARM: OMAP2+: clock: fix clkoutx2 with CLK_SET_RATE_PARENT
ARM: dts: fix omap3 dss clock handle names
ARM: dts: fix DPLL4 x2 clkouts on 3630
ARM: dts: use ti,fixed-factor-clock for dpll4_m4x2_mul_ck
ARM: dts: set 'ti,set-rate-parent' for dpll4_m4 path
OMAPDSS: fix rounding when calculating fclk rate

 arch/arm/boot/dts/omap3430es1-clocks.dtsi          |  6 +--
 .../omap36xx-am35xx-omap3430es2plus-clocks.dtsi    |  6 +--
 arch/arm/boot/dts/omap36xx-clocks.dtsi             | 20 +++++++
 arch/arm/boot/dts/omap36xx.dtsi                    |  2 +-
 arch/arm/boot/dts/omap3xxx-clocks.dtsi             |  8 +--
 arch/arm/mach-omap2/cclock3xxx_data.c              |  2 +
 arch/arm/mach-omap2/dpll3xxx.c                     | 62 ++++++++++++++++++++++
 drivers/clk/clk-divider.c                          | 10 ++--
 drivers/clk/ti/divider.c                           |  8 +--
 drivers/video/omap2/dss/dss.c                      |  4 +-
 include/linux/clk/ti.h                             |  4 ++
 11 files changed, 111 insertions(+), 21 deletions(-)
Quoted 7 lines

--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

BR,

marek

Signature · 10 lines
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
#22 lore raw

cover OMAP: OMAP3 DSS related clock patches

In reply to Tomi Valkeinen

Hi Tomi,

Quoted 10 lines · Tomi Valkeinen

Hi,

I've been debugging OMAP3 related issues with DSS clocks, and I hopefully have them all fixed with this series. This fixes the problems for both non-DT boot, but also for DT boot with DSS DT support (which is not merged yet).

The non-DT boot related fixes should be merged for 3.14, but I'd like the DT boot related fixes to be merged for 3.14 also, as that'll make handling the DSS DT support easier.

I hit this issue when developing on top of 3.14-rc4, the DSS failed to set fck. Your patches made the Overo (both OMAP35xx and OMAP36xx) to get a working DVI output when booting via DT. And the board did not catch on fire, contrary to what Mike hopped :)

#23 lore raw

cover OMAP: OMAP3 DSS related clock patches

In reply to Tomi Valkeinen

Hi Tero,

What about the dts fixes in this series? DSS DT depends on those fixes. I'd like the dts fixes to be either merged for v3.14, or I can add them to my DSS DT series (with acks).

Tomi

Quoted 24 lines · Tomi Valkeinen

Hi,

I've been debugging OMAP3 related issues with DSS clocks, and I hopefully have them all fixed with this series. This fixes the problems for both non-DT boot, but also for DT boot with DSS DT support (which is not merged yet).

The non-DT boot related fixes should be merged for 3.14, but I'd like the DT boot related fixes to be merged for 3.14 also, as that'll make handling the DSS DT support easier.

This is based on v3.14-rc2.

Tomi

Tomi Valkeinen (8):
clk: divider: fix rate calculation for fractional rates
clk: ti/divider: fix rate calculation for fractional rates
ARM: OMAP2+: clock: fix clkoutx2 with CLK_SET_RATE_PARENT
ARM: dts: fix omap3 dss clock handle names
ARM: dts: fix DPLL4 x2 clkouts on 3630
ARM: dts: use ti,fixed-factor-clock for dpll4_m4x2_mul_ck
ARM: dts: set 'ti,set-rate-parent' for dpll4_m4 path
OMAPDSS: fix rounding when calculating fclk rate

Quoted 13 lines
 arch/arm/boot/dts/omap3430es1-clocks.dtsi          |  6 +--
 .../omap36xx-am35xx-omap3430es2plus-clocks.dtsi    |  6 +--
 arch/arm/boot/dts/omap36xx-clocks.dtsi             | 20 +++++++
 arch/arm/boot/dts/omap36xx.dtsi                    |  2 +-
 arch/arm/boot/dts/omap3xxx-clocks.dtsi             |  8 +--
 arch/arm/mach-omap2/cclock3xxx_data.c              |  2 +
 arch/arm/mach-omap2/dpll3xxx.c                     | 62 ++++++++++++++++++++++
 drivers/clk/clk-divider.c                          | 10 ++--
 drivers/clk/ti/divider.c                           |  8 +--
 drivers/video/omap2/dss/dss.c                      |  4 +-
 include/linux/clk/ti.h                             |  4 ++
 11 files changed, 111 insertions(+), 21 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140305/c929fbc3/attachment.sig>

#24 lore raw

cover OMAP: OMAP3 DSS related clock patches

Quoted 5 lines · Tomi Valkeinen

Hi Tero,

What about the dts fixes in this series? DSS DT depends on those fixes. I'd like the dts fixes to be either merged for v3.14, or I can add them to my DSS DT series (with acks).

Well, I am not a maintainer of any sort, so you are asking wrong person here. I am just tossing my acks around as my approval for the patches in case someone cares. :) You need to ask Benoit here (or maybe Tony.)

-Tero

Quoted 43 lines

Tomi

Quoted 37 lines · Tomi Valkeinen

Hi,

I've been debugging OMAP3 related issues with DSS clocks, and I hopefully have them all fixed with this series. This fixes the problems for both non-DT boot, but also for DT boot with DSS DT support (which is not merged yet).

The non-DT boot related fixes should be merged for 3.14, but I'd like the DT boot related fixes to be merged for 3.14 also, as that'll make handling the DSS DT support easier.

This is based on v3.14-rc2.

Tomi

Tomi Valkeinen (8):
clk: divider: fix rate calculation for fractional rates
clk: ti/divider: fix rate calculation for fractional rates
ARM: OMAP2+: clock: fix clkoutx2 with CLK_SET_RATE_PARENT
ARM: dts: fix omap3 dss clock handle names
ARM: dts: fix DPLL4 x2 clkouts on 3630
ARM: dts: use ti,fixed-factor-clock for dpll4_m4x2_mul_ck
ARM: dts: set 'ti,set-rate-parent' for dpll4_m4 path
OMAPDSS: fix rounding when calculating fclk rate

  arch/arm/boot/dts/omap3430es1-clocks.dtsi          |  6 +--
  .../omap36xx-am35xx-omap3430es2plus-clocks.dtsi    |  6 +--
  arch/arm/boot/dts/omap36xx-clocks.dtsi             | 20 +++++++
  arch/arm/boot/dts/omap36xx.dtsi                    |  2 +-
  arch/arm/boot/dts/omap3xxx-clocks.dtsi             |  8 +--
  arch/arm/mach-omap2/cclock3xxx_data.c              |  2 +
  arch/arm/mach-omap2/dpll3xxx.c                     | 62 ++++++++++++++++++++++
  drivers/clk/clk-divider.c                          | 10 ++--
  drivers/clk/ti/divider.c                           |  8 +--
  drivers/video/omap2/dss/dss.c                      |  4 +-
  include/linux/clk/ti.h                             |  4 ++
  11 files changed, 111 insertions(+), 21 deletions(-)
#25 lore raw

cover OMAP: OMAP3 DSS related clock patches

Quoted 10 lines · Tero Kristo
Quoted 5 lines · Tomi Valkeinen

Hi Tero,

What about the dts fixes in this series? DSS DT depends on those fixes. I'd like the dts fixes to be either merged for v3.14, or I can add them to my DSS DT series (with acks).

Well, I am not a maintainer of any sort, so you are asking wrong person here. I am just tossing my acks around as my approval for the patches in case someone cares. :) You need to ask Benoit here (or maybe Tony.)

Ok.

Benoit, Tony, can we get the dts fixes in this series to v3.14, or is it ok if I merge them via DSS DT branch for 3.15?

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140305/76fc7352/attachment.sig>

maintainer
#26 lore raw

cover OMAP: OMAP3 DSS related clock patches

Quoted 8 lines · Tomi Valkeinen
Quoted 7 lines · Tero Kristo
Quoted 5 lines · Tomi Valkeinen

Hi Tero,

What about the dts fixes in this series? DSS DT depends on those fixes. I'd like the dts fixes to be either merged for v3.14, or I can add them to my DSS DT series (with acks).

Quoted 8 lines
Quoted 3 lines

Well, I am not a maintainer of any sort, so you are asking wrong person here. I am just tossing my acks around as my approval for the patches in case someone cares. :) You need to ask Benoit here (or maybe Tony.)

Ok.

Benoit, Tony, can we get the dts fixes in this series to v3.14, or is it ok if I merge them via DSS DT branch for 3.15?

It's best that you take those four dts changes into your DSS branch. They don't seem to conflict with anything I have queued, so: