From: Renaud Barbier <Renaud.Barbier@ametek.com>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>,
Barebox List <barebox@lists.infradead.org>
Subject: RE: Subject: [PATCH 1/1] ARM:lib32: add architected timer
Date: Mon, 6 Mar 2023 13:13:06 +0000 [thread overview]
Message-ID: <BL0PR07MB5665970B726821E524978A61ECB69@BL0PR07MB5665.namprd07.prod.outlook.com> (raw)
In-Reply-To: <2d905868-b24b-040e-ac2e-86337a1c6304@pengutronix.de>
> > ---
> > arch/arm/lib32/Makefile | 2 ++
> > arch/arm/lib32/arm_architected_timer.c | 17 +++++++++++++++++
> > include/clock.h | 2 ++
> > 3 files changed, 21 insertions(+)
> > --- /dev/null
> > +++ b/arch/arm/lib32/arm_architected_timer.c
> > @@ -0,0 +1,17 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +
> > +#include <asm/system.h>
> > +#include <clock.h>
> > +#include <common.h>
> > +
> > +/* Unlike the ARMv8, the timer is not generic to ARM32 */ void
> > +arm_architected_timer_udelay(unsigned long us) {
> > + unsigned long long ticks, cntfrq = get_cntfrq();
> > + unsigned long long start = get_cntpct();
> > +
> > + ticks = us * cntfrq + 999999;
> > + do_div(ticks, 1000000);
>
> There's DIV_ROUND_UP_ULL you could use instead of opencoding that.
> I see that we round down in the udelay for ARM64.
> Do you think we should rather be rounding up there too?
>
> In any case, it's worth mentioning why you choose to round up here in the
> commit message.
>
I must have picked up these two lines of code somewhere because I had to use do_div as I was getting an error: " undefined reference to `__udivdi3'"
To round down I will use DIV_ROUND_DOWN_ULL instead.
Thanks you for pointing this out.
next prev parent reply other threads:[~2023-03-06 13:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 17:05 Renaud Barbier
2023-03-03 17:31 ` Ahmad Fatoum
2023-03-04 14:14 ` Sascha Hauer
2023-03-06 13:13 ` Renaud Barbier [this message]
2023-03-07 16:17 Renaud Barbier
2023-03-09 10:48 ` Sascha Hauer
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=BL0PR07MB5665970B726821E524978A61ECB69@BL0PR07MB5665.namprd07.prod.outlook.com \
--to=renaud.barbier@ametek.com \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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