mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Renaud Barbier <Renaud.Barbier@ametek.com>
To: Sascha Hauer <sha@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: RE: Subject: [PATCH 2/2] ARM: Layerscape: Add LS1021A IOT board support
Date: Fri, 24 Feb 2023 14:09:10 +0000	[thread overview]
Message-ID: <BL0PR07MB5665E13FE364D02FB8A36E09ECA89@BL0PR07MB5665.namprd07.prod.outlook.com> (raw)
In-Reply-To: <20230224104340.GI32097@pengutronix.de>


> On Thu, Feb 23, 2023 at 01:58:46PM +0000, Renaud Barbier wrote:
> > diff --git a/arch/arm/lib32/pbl.c b/arch/arm/lib32/pbl.c new file mode
> > 100644 index 0000000000..f4be7b57dc
> > --- /dev/null
> > +++ b/arch/arm/lib32/pbl.c
> > @@ -0,0 +1,21 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +
> > +#include <asm/system.h>
> > +#include <clock.h>
> > +#include <common.h>
> > +
> > +void 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);
> > +
> > +     while ((long)(start + ticks - get_cntpct()) > 0); }
> > +
> > +void mdelay(unsigned long ms)
> > +{
> > +     udelay(ms * 1000);
> > +}
> 
> This will be compiled for every arm32 build, but the architected timer is not
> generally available, only a small fraction of CPUs actually have it. I just tested
> this on a i.MX6 and it just answers with an illegal instruction abort when
> get_cntfrq() is called.
> 
> We could name this arm_architected_timer_udelay() or similar.
> 
> This change should be in a separate patch.
> 
And then you would add a udelay/mdelay wrapper at the board or machine level?



  reply	other threads:[~2023-02-24 14:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 13:58 Renaud Barbier
2023-02-24 10:43 ` Sascha Hauer
2023-02-24 14:09   ` Renaud Barbier [this message]
2023-02-24 18:04     ` 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=BL0PR07MB5665E13FE364D02FB8A36E09ECA89@BL0PR07MB5665.namprd07.prod.outlook.com \
    --to=renaud.barbier@ametek.com \
    --cc=barebox@lists.infradead.org \
    --cc=sha@pengutronix.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