All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/1] Fix H-PLL and M-PLL clock rate calculation in ast2500 clock driver
@ 2017-01-30 19:35 Maxim Sloyko
  2017-01-30 19:35 ` [U-Boot] [PATCH 1/1] aspeed: ast2500: Fix H-PLL and M-PLL clock rate calculation Maxim Sloyko
  0 siblings, 1 reply; 4+ messages in thread
From: Maxim Sloyko @ 2017-01-30 19:35 UTC (permalink / raw)
  To: u-boot


This is a fix to a very dumb (division by zero) mistake I made in the
series where I added support for ast2500 eval board. It is not causing
any problems for that board yet, because no driver requests the rate of
any clock yet, but I think it's still better to fix it for this release.


Maxim Sloyko (1):
  aspeed: ast2500: Fix H-PLL and M-PLL clock rate calculation

 drivers/clk/aspeed/clk_ast2500.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.11.0.483.g087da7b7c-goog

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

* [U-Boot] [PATCH 1/1] aspeed: ast2500: Fix H-PLL and M-PLL clock rate calculation
  2017-01-30 19:35 [U-Boot] [PATCH 0/1] Fix H-PLL and M-PLL clock rate calculation in ast2500 clock driver Maxim Sloyko
@ 2017-01-30 19:35 ` Maxim Sloyko
  2017-02-05  3:34   ` Simon Glass
  2017-02-09  3:01   ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Maxim Sloyko @ 2017-01-30 19:35 UTC (permalink / raw)
  To: u-boot

Fix H-PLL and M-PLL rate calculation in ast2500 clock driver.
Without this fix, valid setting can lead to division by zero
when requesting the rate of H-PLL or M-PLL clocks.

Signed-off-by: Maxim Sloyko <maxims@google.com>

---

---
 drivers/clk/aspeed/clk_ast2500.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/aspeed/clk_ast2500.c b/drivers/clk/aspeed/clk_ast2500.c
index af369cc4c8..26a5e58221 100644
--- a/drivers/clk/aspeed/clk_ast2500.c
+++ b/drivers/clk/aspeed/clk_ast2500.c
@@ -35,7 +35,7 @@ static ulong ast2500_get_mpll_rate(ulong clkin, u32 mpll_reg)
 	const ulong post_div = (mpll_reg >> SCU_MPLL_POST_SHIFT)
 			& SCU_MPLL_POST_MASK;
 
-	return (clkin * ((num + 1) / (denum + 1))) / post_div;
+	return (clkin * ((num + 1) / (denum + 1))) / (post_div + 1);
 }
 
 /*
@@ -50,7 +50,7 @@ static ulong ast2500_get_hpll_rate(ulong clkin, u32 hpll_reg)
 	const ulong post_div = (hpll_reg >> SCU_HPLL_POST_SHIFT)
 			& SCU_HPLL_POST_MASK;
 
-	return (clkin * ((num + 1) / (denum + 1))) / post_div;
+	return (clkin * ((num + 1) / (denum + 1))) / (post_div + 1);
 }
 
 static ulong ast2500_get_clkin(struct ast2500_scu *scu)
-- 
2.11.0.483.g087da7b7c-goog

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

* [U-Boot] [PATCH 1/1] aspeed: ast2500: Fix H-PLL and M-PLL clock rate calculation
  2017-01-30 19:35 ` [U-Boot] [PATCH 1/1] aspeed: ast2500: Fix H-PLL and M-PLL clock rate calculation Maxim Sloyko
@ 2017-02-05  3:34   ` Simon Glass
  2017-02-09  3:01   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Glass @ 2017-02-05  3:34 UTC (permalink / raw)
  To: u-boot

On 30 January 2017 at 12:35, Maxim Sloyko <maxims@google.com> wrote:
>
> Fix H-PLL and M-PLL rate calculation in ast2500 clock driver.
> Without this fix, valid setting can lead to division by zero
> when requesting the rate of H-PLL or M-PLL clocks.
>
> Signed-off-by: Maxim Sloyko <maxims@google.com>

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [U-Boot, 1/1] aspeed: ast2500: Fix H-PLL and M-PLL clock rate calculation
  2017-01-30 19:35 ` [U-Boot] [PATCH 1/1] aspeed: ast2500: Fix H-PLL and M-PLL clock rate calculation Maxim Sloyko
  2017-02-05  3:34   ` Simon Glass
@ 2017-02-09  3:01   ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2017-02-09  3:01 UTC (permalink / raw)
  To: u-boot

On Mon, Jan 30, 2017 at 11:35:04AM -0800, maxims at google.com wrote:

> Fix H-PLL and M-PLL rate calculation in ast2500 clock driver.
> Without this fix, valid setting can lead to division by zero
> when requesting the rate of H-PLL or M-PLL clocks.
> 
> Signed-off-by: Maxim Sloyko <maxims@google.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170208/774d6275/attachment.sig>

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

end of thread, other threads:[~2017-02-09  3:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-30 19:35 [U-Boot] [PATCH 0/1] Fix H-PLL and M-PLL clock rate calculation in ast2500 clock driver Maxim Sloyko
2017-01-30 19:35 ` [U-Boot] [PATCH 1/1] aspeed: ast2500: Fix H-PLL and M-PLL clock rate calculation Maxim Sloyko
2017-02-05  3:34   ` Simon Glass
2017-02-09  3:01   ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.