linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: Olof Johansson <olof@lixom.net>
Cc: linuxppc-dev@ozlabs.org, sl@powerlinux.fr,
	Philippe Lachenal <philippe.lachenal@hotmail.fr>
Subject: Re: MPC8349ea Random Device Generator driver
Date: Wed, 06 Jun 2007 17:48:03 -0500	[thread overview]
Message-ID: <466739A3.1070201@freescale.com> (raw)
In-Reply-To: <20070606222456.GA28225@lixom.net>

Olof Johansson wrote:

> 	typedef __u16 __bitwise __le16;
> 	typedef __u16 __bitwise __be16;
> 	typedef __u32 __bitwise __le32;
> 	typedef __u32 __bitwise __be32;
> 	typedef __u64 __bitwise __le64;
> 	typedef __u64 __bitwise __be64;

Wait a minute - why are all the endian-specific types __bitwise?

What if I have a 32-bit MMIO register that just contains a number, but it has to be 
written in big-endian?  I can't use __be32 to designate it.

For instance, I was going to do this for a new memory-mapped device I'm working with:

struct ccsr_dma {
	u8 res0[0x100];
	struct {
		__be32 mr;	/* x00 Mode register */
		__be32 sr;	/* x04 Status register */
		__be32 eclndar; /* x08 Current link descriptor extended address register */
		__be32 clndar;	/* x0C Current link descriptor address register */
		__be32 satr;	/* x10 Source attributes register */
		__be32 sar;	/* x14 Source address register */
...
		u8 res2[0x38];
	} channel[4];
}

The SAR register is defined as:

Bits	Name	Description
0–31	SAD	Source address. This register contains the low-order bits of the 36-bit source 
address of the DMA transfer.  The contents are updated after every DMA write operation 
unless the final stride of a striding operation is less than the stride size, in which 
case it remains equal to the address from which the last stride began.

In other words, the SAR register is just one number, but it must be written as a single 
big-endian number.  So is __be32 the wrong type?

-- 
Timur Tabi
Linux Kernel Developer @ Freescale

  parent reply	other threads:[~2007-06-06 22:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-05 15:42 MPC8349ea Random Device Generator driver Philippe Lachenal
2007-06-06 14:15 ` Arnd Bergmann
2007-06-07 11:29   ` MPC8349ea Random Number " Philippe Lachenal
2007-06-07 14:03     ` Arnd Bergmann
2007-06-06 21:57 ` MPC8349ea Random Device " Timur Tabi
2007-06-06 22:09   ` Olof Johansson
2007-06-06 22:07     ` Timur Tabi
2007-06-06 22:11       ` Arnd Bergmann
2007-06-06 22:19         ` Timur Tabi
2007-06-06 22:35           ` Arnd Bergmann
2007-06-06 22:38             ` Timur Tabi
2007-06-06 22:24       ` Olof Johansson
2007-06-06 22:32         ` Timur Tabi
2007-06-06 23:54           ` Olof Johansson
2007-06-07 14:23             ` Timur Tabi
2007-06-07 15:20               ` Olof Johansson
2007-06-07 15:20                 ` Timur Tabi
2007-06-07 15:36                   ` Olof Johansson
2007-06-06 22:48         ` Timur Tabi [this message]
2007-06-07  0:00           ` Olof Johansson
2007-06-07  2:55 ` Kim Phillips

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=466739A3.1070201@freescale.com \
    --to=timur@freescale.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=olof@lixom.net \
    --cc=philippe.lachenal@hotmail.fr \
    --cc=sl@powerlinux.fr \
    /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;
as well as URLs for NNTP newsgroup(s).