Commit 74c05a33 authored by Yangbo Lu's avatar Yangbo Lu Committed by David S. Miller

ptp_qoriq: use div_u64/div_u64_rem for 64-bit division

This is a fix-up patch for below build issue with multi_v7_defconfig.

drivers/ptp/ptp_qoriq.o: In function `qoriq_ptp_probe':
ptp_qoriq.c:(.text+0xd0c): undefined reference to `__aeabi_uldivmod'

Fixes: 91305f28 ("ptp_qoriq: support automatic configuration for ptp timer")
Signed-off-by: default avatarYangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9dae3497
...@@ -373,6 +373,7 @@ static int qoriq_ptp_auto_config(struct qoriq_ptp *qoriq_ptp, ...@@ -373,6 +373,7 @@ static int qoriq_ptp_auto_config(struct qoriq_ptp *qoriq_ptp,
u64 freq_comp; u64 freq_comp;
u64 max_adj; u64 max_adj;
u32 nominal_freq; u32 nominal_freq;
u32 remainder = 0;
u32 clk_src = 0; u32 clk_src = 0;
qoriq_ptp->cksel = DEFAULT_CKSEL; qoriq_ptp->cksel = DEFAULT_CKSEL;
...@@ -400,7 +401,8 @@ static int qoriq_ptp_auto_config(struct qoriq_ptp *qoriq_ptp, ...@@ -400,7 +401,8 @@ static int qoriq_ptp_auto_config(struct qoriq_ptp *qoriq_ptp,
* freq_ratio = reference_clock_freq / nominal_freq * freq_ratio = reference_clock_freq / nominal_freq
*/ */
freq_comp = ((u64)1 << 32) * nominal_freq; freq_comp = ((u64)1 << 32) * nominal_freq;
if (do_div(freq_comp, clk_src)) freq_comp = div_u64_rem(freq_comp, clk_src, &remainder);
if (remainder)
freq_comp++; freq_comp++;
qoriq_ptp->tmr_add = freq_comp; qoriq_ptp->tmr_add = freq_comp;
...@@ -411,7 +413,7 @@ static int qoriq_ptp_auto_config(struct qoriq_ptp *qoriq_ptp, ...@@ -411,7 +413,7 @@ static int qoriq_ptp_auto_config(struct qoriq_ptp *qoriq_ptp,
* freq_ratio = reference_clock_freq / nominal_freq * freq_ratio = reference_clock_freq / nominal_freq
*/ */
max_adj = 1000000000ULL * (clk_src - nominal_freq); max_adj = 1000000000ULL * (clk_src - nominal_freq);
max_adj = max_adj / nominal_freq - 1; max_adj = div_u64(max_adj, nominal_freq) - 1;
qoriq_ptp->caps.max_adj = max_adj; qoriq_ptp->caps.max_adj = max_adj;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment