From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Illegal use of FP ops in clock_ti814x.c
Date: Fri, 21 Feb 2014 14:14:51 -0500 [thread overview]
Message-ID: <20140221191451.GC16805@bill-the-cat> (raw)
In-Reply-To: <yw1xd2mp0yqu.fsf@unicorn.mansr.com>
On Mon, Oct 28, 2013 at 11:19:53PM +0000, M?ns Rullg?rd wrote:
> Wolfgang Denk <wd@denx.de> writes:
>
> > Dear Matt,
> >
> > I hope you are the right person to address this to - if not, please
> > help to redirect to the current responsible developer.
> >
> > Function pll_sigma_delta_val() in arch/arm/cpu/armv7/am33xx/clock_ti814x.c
> > incorrectly uses "float" data, which results in FP operations which
> > are not permitted in U-Boot.
> >
> > The actual computation appears simple enough so a rewrite of the code
> > without using any floating point operations should be fairly easy, but
> > I don't understand the actual logic of this code, so I'd rather leave
> > this to someone who does.
> >
> > Could you please help and clean up these three lines of code?
>
> Something like this should be equivalent. That said, it looks
> suspiciously like it's meant to simply do a division and round up. If
> that is the case, +225 should be +249. It probably makes no difference
> for the values actually encountered.
> Acked-by: Matt Porter <mporter@linaro.org>
>
>
> diff --git a/arch/arm/cpu/armv7/am33xx/clock_ti814x.c b/arch/arm/cpu/armv7/am33xx/clock_ti814x.c
> index ef14f47..9b5a47b 100644
> --- a/arch/arm/cpu/armv7/am33xx/clock_ti814x.c
> +++ b/arch/arm/cpu/armv7/am33xx/clock_ti814x.c
> @@ -211,11 +211,8 @@ static u32 pll_dco_freq_sel(u32 clkout_dco)
> static u32 pll_sigma_delta_val(u32 clkout_dco)
> {
> u32 sig_val = 0;
> - float frac_div;
>
> - frac_div = (float) clkout_dco / 250;
> - frac_div = frac_div + 0.90;
> - sig_val = (int)frac_div;
> + sig_val = (clkout_dco + 225) / 250;
> sig_val = sig_val << 24;
>
> return sig_val;
With a massively re-worded commit message, applied to u-boot-ti/master,
thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140221/6faf9ab1/attachment.pgp>
prev parent reply other threads:[~2014-02-21 19:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-27 21:11 [U-Boot] Illegal use of FP ops in clock_ti814x.c Wolfgang Denk
2013-10-28 21:55 ` Tom Rini
2013-10-28 23:19 ` Måns Rullgård
2013-10-28 23:56 ` Wolfgang Denk
2013-10-29 0:54 ` Måns Rullgård
2013-10-29 10:48 ` Wolfgang Denk
2013-10-29 12:23 ` Tom Rini
2014-01-28 17:48 ` Matt Porter
2013-10-29 12:44 ` Måns Rullgård
2014-02-21 19:14 ` Tom Rini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140221191451.GC16805@bill-the-cat \
--to=trini@ti.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox