From: Haavard Skinnemoen <hskinnemoen@atmel.com>
To: torvalds@osdl.org
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
Ben Nizette <ben@mallochdigital.com>,
Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: [PATCH 5/8] AVR32: add io{read,write}{8,16,32}{be,} support
Date: Tue, 24 Oct 2006 10:12:43 +0200 [thread overview]
Message-ID: <1161677566524-git-send-email-hskinnemoen@atmel.com> (raw)
In-Reply-To: <11616775661978-git-send-email-hskinnemoen@atmel.com>
From: Ben Nizette <ben@mallochdigital.com>
A number of new drivers require io{read,write}{8,16,32}{be,} family of io
operations. These are provided for the AVR32 by this patch in the form of
a series of macros.
Access to the (memory mapped) io space through these macros is defined to
be little endian only as little endian devices (such as PCI) are the main
consumer of IO access. If high speed access is required,
io{read,write}{16,32}be macros are supplied to perform native big endian
access to this io space.
Signed-off-by: Ben Nizette <ben@mallochdigital.com>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
include/asm-avr32/io.h | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index 2fc8f11..eec4750 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -76,6 +76,39 @@ #define readsb(p, d, l) __raw_readsb((u
#define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l)
#define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l)
+
+/*
+ * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be
+ */
+#ifndef ioread8
+
+#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; })
+
+#define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; })
+#define ioread16be(p) ({ unsigned int __v = be16_to_cpu(__raw_readw(p)); __v; })
+
+#define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; })
+#define ioread32be(p) ({ unsigned int __v = be32_to_cpu(__raw_readl(p)); __v; })
+
+#define iowrite8(v,p) __raw_writeb(v, p)
+
+#define iowrite16(v,p) __raw_writew(cpu_to_le16(v), p)
+#define iowrite16be(v,p) __raw_writew(cpu_to_be16(v), p)
+
+#define iowrite32(v,p) __raw_writel(cpu_to_le32(v), p)
+#define iowrite32be(v,p) __raw_writel(cpu_to_be32(v), p)
+
+#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
+#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)
+#define ioread32_rep(p,d,c) __raw_readsl(p,d,c)
+
+#define iowrite8_rep(p,s,c) __raw_writesb(p,s,c)
+#define iowrite16_rep(p,s,c) __raw_writesw(p,s,c)
+#define iowrite32_rep(p,s,c) __raw_writesl(p,s,c)
+
+#endif
+
+
/*
* These two are only here because ALSA _thinks_ it needs them...
*/
--
1.4.1.1
next prev parent reply other threads:[~2006-10-24 8:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-24 8:12 [PATCH 0/8] AVR32 update Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 1/8] AVR32: Minor Makefile cleanup Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 2/8] AVR32: Silence some compile warnings Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 3/8] AVR32: Don't try to iounmap P2 segment addresses Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 4/8] AVR32: Fix oversize immediates in atomic.h Haavard Skinnemoen
2006-10-24 8:12 ` Haavard Skinnemoen [this message]
2006-10-24 8:12 ` [PATCH 6/8] AVR32: Implement and export __raw_{read,write}s[bwl] Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 7/8] AVR32: Use __raw MMIO access for internal peripherals Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 8/8] AVR32: Update defconfig Haavard Skinnemoen
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=1161677566524-git-send-email-hskinnemoen@atmel.com \
--to=hskinnemoen@atmel.com \
--cc=akpm@osdl.org \
--cc=ben@mallochdigital.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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
all inboxes | Powered by JetHome®