All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V3 09/11] ARM/PPC: add a common way to access registers
Date: Tue, 26 Jan 2010 00:04:25 +0100	[thread overview]
Message-ID: <20100125230425.86A1BD334C9@gemini.denx.de> (raw)
In-Reply-To: <1264008133-20906-1-git-send-email-sbabic@denx.de>

Dear Stefano Babic,

In message <1264008133-20906-1-git-send-email-sbabic@denx.de> you wrote:
> Some Freescale's processors of different architecture
> have the same peripheral (eSDHC controller in PowerPC
> and i.MX51). This patch adds neutral functions to access
> to the internal registers of the SOCs that can be used
> by both architectures.
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> ---
>  include/asm-arm/io.h |   39 +++++++++++++++++++++++++++++++++++++++
>  include/asm-ppc/io.h |   21 +++++++++++++++++++++
>  2 files changed, 60 insertions(+), 0 deletions(-)

Please document these new macros.  Please be explicit about the
behaviour of these macros on systems with different endianess.

> +/* Clear and set bits in one shot. These macros can be used to clear and
> + * set multiple bits in a register using a single call. These macros can
> + * also be used to set a multiple-bit bit pattern using a mask, by
> + * specifying the mask in the 'clear' parameter and the new bit pattern
> + * in the 'set' parameter.
> + */

Incorrect multi-line comment style.

> +#define clrbits(type, addr, clear) \
> +	write##type(__raw_read##type(addr) & ~(clear), (addr))
> +
> +#define setbits(type, addr, set) \
> +	write##type(__raw_read##type(addr) | (set), (addr))
> +
> +#define clrsetbits(type, addr, clear, set) \
> +	write##type((__raw_read##type(addr) & ~(clear)) | (set), (addr))
> +
> +#define write_reg(type,a,v)	write##type(v,a)
> +#define read_reg(type,a)	__raw_read##type(a)
> +
> +#define write_reg32(a,v)	write_reg(l,a,v)
> +#define write_reg16(a,v)	write_reg(w,a,v)
> +#define write_reg8(a,v)		write_reg(b,a,v)
> +
> +#define read_reg32(a)		read_reg(l,a)
> +#define read_reg16(a)		read_reg(w,a)
> +#define read_reg8(a)		read_reg(b,a)

What exactly is the definition of a "register" here? Is this memory
mapped I/O?

and - should we really invent our own, private way of doing this?
Should we not rather reuse definitions already present in Linux?

How about using ioread*()/iowrite*() instead?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The Gates in my computer are AND, OR and NOT; they are not Bill.

  reply	other threads:[~2010-01-25 23:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-20 17:22 [U-Boot] [PATCH V3 09/11] ARM/PPC: add a common way to access registers Stefano Babic
2010-01-25 23:04 ` Wolfgang Denk [this message]
2010-01-26  9:09   ` Stefano Babic
2010-02-05 14:07 ` [U-Boot] [PATCH V4 09/11] ARM: add accessors functions Stefano Babic

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=20100125230425.86A1BD334C9@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.