Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Hiroshi DOYU <Hiroshi_DOYU@montavista.co.jp>
Cc: linux-mips@linux-mips.org
Subject: Re: how to access structured registers correctly
Date: Tue, 26 Jul 2005 15:06:43 -0400	[thread overview]
Message-ID: <20050726190643.GD7088@linux-mips.org> (raw)
In-Reply-To: <20050726182531.6341586f.Hiroshi_DOYU@montavista.co.jp>

On Tue, Jul 26, 2005 at 06:25:31PM +0900, Hiroshi DOYU wrote:
> Date:	Tue, 26 Jul 2005 18:25:31 +0900
> From:	Hiroshi DOYU <Hiroshi_DOYU@montavista.co.jp>
> To:	linux-mips@linux-mips.org
> Subject: how to access structured registers correctly
> Content-Type: text/plain; charset=US-ASCII
> 
> Hello experts,
> 
> I am wondering how to access registers correctly by usging structured 
> register definitions in TX4938 particularly.
> 
> Some time ago, Linus told "volatile" on a data structure as described 
> below,
> 
> 	http://www.ussg.iu.edu/hypermail/linux/kernel/0401.0/1387.html
> 
> 
> In tx4938, every register access is done by using "volatile" like below.

Linus is right, volatile is a dangerous thing.  If you want to write
portable code there's a bunch of things that are not being taken care of
by plain C - even though in my opinion foo->somereg = 42 is more
readable than writel(somereg, 42).  Among the things the pointer to
volatile struct method doesn't catch are endianess conversion that might
be necessary on some systems, write merging, dealing with write buffers
or completly insane methods of attaching the bus such as the infamous
ISA / EISA cage that's attached to the host system through a USB
interface.

Now, how does that affect your TX4928 code?  Probably not terribly much
because you're using a SOC so the configuration of the system is fixed.

  Ralf

  reply	other threads:[~2005-07-26 19:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-26  9:25 how to access structured registers correctly Hiroshi DOYU
2005-07-26 19:06 ` Ralf Baechle [this message]
2005-07-27  7:28   ` Dominic Sweetman
2005-08-01  7:51     ` Ralf Baechle

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=20050726190643.GD7088@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=Hiroshi_DOYU@montavista.co.jp \
    --cc=linux-mips@linux-mips.org \
    /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