mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Alexander Shiyan <shc_work@mail.ru>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets
Date: Wed, 8 May 2013 09:35:49 +0200	[thread overview]
Message-ID: <20130508073549.GZ32299@pengutronix.de> (raw)
In-Reply-To: <1367081935-6738-1-git-send-email-shc_work@mail.ru>

On Sat, Apr 27, 2013 at 08:58:54PM +0400, Alexander Shiyan wrote:
> This patch moves OMAP syslib functions into common ARM location, so
> make these functions available to other ARM targets.
> 
> +/**
> + * @brief clear & set a value in a bit range for a 32 bit address
> + *
> + * @param[in] addr Address to set/read from
> + * @param[in] start_bit Where to put the value
> + * @param[in] num_bits number of bits the value should be set
> + * @param[in] value the value to set
> + *
> + * @return void
> + */
> +static inline void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value)
> +{
> +	u32 tmp, msk = 0;
> +	msk = 1 << num_bits;
> +	--msk;
> +	tmp = readl(addr) & ~(msk << start_bit);
> +	tmp |=  value << start_bit;
> +	writel(tmp, addr);
> +}
> +
> +u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound);

I'm still undecided on this. On one hand it's good to have common
functions for these jobs, but on the other hand I'm not sure these are
the versions we should use as the definite answer to the problem. I
don't know how many versions of read-modify-write functions are around,
but there are many.

> +void sdelay(unsigned long loops);

The sdelay change is a good one, though I think this should be a static
inline function.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-05-08  7:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-27 16:58 Alexander Shiyan
2013-04-27 16:58 ` [PATCH 2/2] ARM: Use syslib instead of using private functions Alexander Shiyan
2013-05-08  7:35 ` Sascha Hauer [this message]
2013-05-08  7:42   ` Re[2]: [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets Alexander Shiyan
2013-05-08 19:57     ` 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=20130508073549.GZ32299@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=shc_work@mail.ru \
    /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