mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 05/12] add cpu native ordered io accessors
Date: Fri, 23 Sep 2011 11:24:13 +0200	[thread overview]
Message-ID: <1316769860-24549-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1316769860-24549-1-git-send-email-s.hauer@pengutronix.de>

There are no generic native ordered io accessors. This sometimes
leads to

	v = in_be32(a);
	v = readl(a);

in generic drivers. Instead, use io accessors which are explicitely
native ordered.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 include/io.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/include/io.h b/include/io.h
index 8eb56b0..39b5e61 100644
--- a/include/io.h
+++ b/include/io.h
@@ -3,4 +3,21 @@
 
 #include <asm/io.h>
 
+/* cpu_read/cpu_write: cpu native io accessors */
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define cpu_readb(a)		readb(a)
+#define cpu_readw(a)		in_be16(a)
+#define cpu_readl(a)		in_be32(a)
+#define cpu_writeb(v, a)	writeb((v), (a))
+#define cpu_writew(v, a)	out_be16((a), (v))
+#define cpu_writel(v, a)	out_be32((a), (v))
+#else
+#define cpu_readb(a)		readb(a)
+#define cpu_readw(a)		readw(a)
+#define cpu_readl(a)		readl(a)
+#define cpu_writeb(v, a)	writeb((v), (a))
+#define cpu_writew(v, a)	writew((v), (a))
+#define cpu_writel(v, a)	writel((v), (a))
+#endif
+
 #endif /* __IO_H */
-- 
1.7.6.3


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

  parent reply	other threads:[~2011-09-23  9:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23  9:24 patches for next Sascha Hauer
2011-09-23  9:24 ` [PATCH 01/12] introduce io.h Sascha Hauer
2011-09-23  9:24 ` [PATCH 02/12] introduce asm-generic/io.h Sascha Hauer
2011-09-23  9:24 ` [PATCH 03/12] arm: use asm-generic/io.h Sascha Hauer
2011-09-23  9:24 ` [PATCH 04/12] Jean-christophe, more careful please Sascha Hauer
2011-09-23 12:43   ` Jean-Christophe PLAGNIOL-VILLARD
2011-09-23 14:29     ` Sascha Hauer
2011-09-23 14:33       ` Sascha Hauer
2011-09-23  9:24 ` Sascha Hauer [this message]
2011-09-23  9:24 ` [PATCH 06/12] cfi flash: use cpu native accessors Sascha Hauer
2011-09-23  9:24 ` [PATCH 07/12] ppc pcm030: remove puts in early init Sascha Hauer
2011-09-23  9:24 ` [PATCH 08/12] cfi flash: fix flash_make_cmd for big endian access Sascha Hauer
2011-09-23  9:26   ` Sascha Hauer
2011-09-23 14:05     ` Teresa Gamez
2011-09-23 14:27       ` Sascha Hauer
2011-09-23  9:24 ` [PATCH 09/12] rename include/mem_malloc.h to include/memory.h Sascha Hauer
2011-09-23  9:24 ` [PATCH 10/12] ARM mmu: find second level descriptors by walking the page table Sascha Hauer
2011-09-23  9:24 ` [PATCH 11/12] introduce generic memory bank handling Sascha Hauer
2011-09-23  9:24 ` [PATCH 12/12] ARM: switch to generic memory banks 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=1316769860-24549-6-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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