RE: Subject: [PATCH 1/1] ARM:lib32: add architected timer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > ---
> >  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. 




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux