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@xxxxxxxxxxxxxxxx> > To: linux-mips@xxxxxxxxxxxxxx > 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