linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build failure after merge of the clk tree
@ 2018-11-29 22:03 Stephen Rothwell
  2018-11-29 23:50 ` [PATCH] clk: imx: Use do_div in SCCG due to 64-bit divisor Abel Vesa
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2018-11-29 22:03 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Lucas Stach,
	Abel Vesa

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

Hi all,

After merging the clk tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

arm-linux-gnueabi-ld: drivers/clk/imx/clk-frac-pll.o: in function `clk_pll_round_rate':
clk-frac-pll.c:(.text+0x50): undefined reference to `__aeabi_uldivmod'

Caused by commit

  9fd680d0fafd ("clk: imx: add fractional PLL output clock")

I have used the clk tree from next-20181129 for today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [PATCH] clk: imx: Use do_div in SCCG due to 64-bit divisor
  2018-11-29 22:03 linux-next: build failure after merge of the clk tree Stephen Rothwell
@ 2018-11-29 23:50 ` Abel Vesa
  2018-11-30  2:17   ` Stephen Rothwell
  0 siblings, 1 reply; 3+ messages in thread
From: Abel Vesa @ 2018-11-29 23:50 UTC (permalink / raw)
  To: Stephen Boyd, Stephen Rothwell
  Cc: Lucas Stach, Michael Turquette, Linux Kernel Mailing List,
	Linux Next Mailing List, Abel Vesa, dl-linux-imx, Abel Vesa

On arm32, a division with a 64-bit divisor has to be done through
do_div() function otherwise there is a link failure like:

drivers/clk/imx/clk-frac-pll.o: In function `clk_pll_round_rate':
clk-frac-pll.c:(.text+0x54): undefined reference to `__aeabi_uldivmod'
make: *** [Makefile:1040: vmlinux] Error 1

Fixes: 9fd680d0fafd ("clk: imx: add fractional PLL output clock")
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/clk/imx/clk-frac-pll.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/imx/clk-frac-pll.c b/drivers/clk/imx/clk-frac-pll.c
index 9872620..8b13df9 100644
--- a/drivers/clk/imx/clk-frac-pll.c
+++ b/drivers/clk/imx/clk-frac-pll.c
@@ -116,12 +116,13 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 			       unsigned long *prate)
 {
 	u64 parent_rate = *prate;
-	u32 divff, divfi;
-	u64 temp64;
+	u64 divff, divfi;
+	u64 temp64 = rate;
 
 	parent_rate *= 8;
 	rate *= 2;
-	divfi = rate / parent_rate;
+	do_div(temp64, parent_rate);
+	divfi = temp64;
 	temp64 = rate - divfi * parent_rate;
 	temp64 *= PLL_FRAC_DENOM;
 	do_div(temp64, parent_rate);
-- 
2.7.4


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

* Re: [PATCH] clk: imx: Use do_div in SCCG due to 64-bit divisor
  2018-11-29 23:50 ` [PATCH] clk: imx: Use do_div in SCCG due to 64-bit divisor Abel Vesa
@ 2018-11-30  2:17   ` Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2018-11-30  2:17 UTC (permalink / raw)
  To: Abel Vesa
  Cc: Stephen Boyd, Lucas Stach, Michael Turquette,
	Linux Kernel Mailing List, Linux Next Mailing List, Abel Vesa,
	dl-linux-imx

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

Hi Abel,

On Thu, 29 Nov 2018 23:50:22 +0000 Abel Vesa <abel.vesa@nxp.com> wrote:
>
> --- a/drivers/clk/imx/clk-frac-pll.c
> +++ b/drivers/clk/imx/clk-frac-pll.c
> @@ -116,12 +116,13 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
>  			       unsigned long *prate)
>  {
>  	u64 parent_rate = *prate;
> -	u32 divff, divfi;
> -	u64 temp64;
> +	u64 divff, divfi;
> +	u64 temp64 = rate;
>  
>  	parent_rate *= 8;
>  	rate *= 2;
> -	divfi = rate / parent_rate;
> +	do_div(temp64, parent_rate);
> +	divfi = temp64;

Did you mean to lose the doubling of "rate" above?

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2018-11-30  2:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 22:03 linux-next: build failure after merge of the clk tree Stephen Rothwell
2018-11-29 23:50 ` [PATCH] clk: imx: Use do_div in SCCG due to 64-bit divisor Abel Vesa
2018-11-30  2:17   ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).