Message ID | 1447911713-28639-1-git-send-email-aneesh.bansal@freescale.com |
---|---|
State | Superseded |
Delegated to: | York Sun |
Headers | show |
On 11/18/2015 09:41 PM, Aneesh Bansal wrote: > usec2ticks() function has been defined for ARMv8 which will > be used by SEC Driver. > > Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com> > --- > Changes in v2: > New Patch Set created with an additional patch. > > arch/arm/cpu/armv8/generic_timer.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c > index 8e60bae..8f47a82 100644 > --- a/arch/arm/cpu/armv8/generic_timer.c > +++ b/arch/arm/cpu/armv8/generic_timer.c > @@ -40,3 +40,14 @@ unsigned long timer_read_counter(void) > #endif > return cntpct; > } > + > +unsigned long usec2ticks(unsigned long usec) > +{ > + ulong ticks; > + if (usec < 1000) > + ticks = ((usec * (get_tbclk()/1000)) + 500) / 1000; > + else > + ticks = ((usec / 10) * (get_tbclk() / 100000)); > + > + return ticks; > +} > Is existing usec_to_tick() in lib/time.c good for you? York
> -----Original Message----- > From: York Sun [mailto:yorksun@freescale.com] > Sent: Thursday, November 19, 2015 10:26 PM > To: Bansal Aneesh-B39320 <aneesh.bansal@freescale.com>; u-boot@lists.denx.de > Cc: Gupta Ruchika-R66431 <ruchika.gupta@freescale.com>; Kushwaha Prabhakar- > B32579 <prabhakar@freescale.com> > Subject: Re: [PATCH 1/5][v2] armv8: usec2ticks function defined > > On 11/18/2015 09:41 PM, Aneesh Bansal wrote: > > usec2ticks() function has been defined for ARMv8 which will be used by > > SEC Driver. > > > > Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com> > > --- > > Changes in v2: > > New Patch Set created with an additional patch. > > > > arch/arm/cpu/armv8/generic_timer.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/arch/arm/cpu/armv8/generic_timer.c > > b/arch/arm/cpu/armv8/generic_timer.c > > index 8e60bae..8f47a82 100644 > > --- a/arch/arm/cpu/armv8/generic_timer.c > > +++ b/arch/arm/cpu/armv8/generic_timer.c > > @@ -40,3 +40,14 @@ unsigned long timer_read_counter(void) #endif > > return cntpct; > > } > > + > > +unsigned long usec2ticks(unsigned long usec) { > > + ulong ticks; > > + if (usec < 1000) > > + ticks = ((usec * (get_tbclk()/1000)) + 500) / 1000; > > + else > > + ticks = ((usec / 10) * (get_tbclk() / 100000)); > > + > > + return ticks; > > +} > > > > Is existing usec_to_tick() in lib/time.c good for you? > > York The CAAM driver in U-Boot uses the function usec2ticks(). This is already defined for previous SoC's LS1020 (ARM v7) and PPC. Aneesh
diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c index 8e60bae..8f47a82 100644 --- a/arch/arm/cpu/armv8/generic_timer.c +++ b/arch/arm/cpu/armv8/generic_timer.c @@ -40,3 +40,14 @@ unsigned long timer_read_counter(void) #endif return cntpct; } + +unsigned long usec2ticks(unsigned long usec) +{ + ulong ticks; + if (usec < 1000) + ticks = ((usec * (get_tbclk()/1000)) + 500) / 1000; + else + ticks = ((usec / 10) * (get_tbclk() / 100000)); + + return ticks; +}
usec2ticks() function has been defined for ARMv8 which will be used by SEC Driver. Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com> --- Changes in v2: New Patch Set created with an additional patch. arch/arm/cpu/armv8/generic_timer.c | 11 +++++++++++ 1 file changed, 11 insertions(+)