linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH 8/8] apus: update zorro bus access functions
Date: Sun, 25 Sep 2005 00:44:51 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.61.0509250044420.19187@scrub.home> (raw)


APUS only needs an eieio() to synchronize IO access, also a simple C
construct to access memory mapped IO is sufficient.

---

 include/asm-ppc/zorro.h |   52 ++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 44 insertions(+), 8 deletions(-)

Index: linux/include/asm-ppc/zorro.h
===================================================================
--- linux.orig/include/asm-ppc/zorro.h	2005-09-23 15:52:38.000000000 +0200
+++ linux/include/asm-ppc/zorro.h	2005-09-23 16:45:08.000000000 +0200
@@ -3,13 +3,50 @@
 
 #include <asm/io.h>
 
-#define z_readb in_8
-#define z_readw in_be16
-#define z_readl in_be32
-
-#define z_writeb(val, port) out_8((port), (val))
-#define z_writew(val, port) out_be16((port), (val))
-#define z_writel(val, port) out_be32((port), (val))
+static inline unsigned int z_readb(unsigned long addr)
+{
+	unsigned int ret;
+
+	ret = *(volatile u8 *)addr;
+	eieio();
+	return ret;
+}
+
+static inline unsigned int z_readw(unsigned long addr)
+{
+	unsigned int ret;
+
+	ret = *(volatile u16 *)addr;
+	eieio();
+	return ret;
+}
+
+static inline unsigned int z_readl(unsigned long addr)
+{
+	unsigned int ret;
+
+	ret = *(volatile u32 *)addr;
+	eieio();
+	return ret;
+}
+
+static inline void z_writeb(unsigned int val, unsigned long addr)
+{
+	*(volatile u8 *)addr = val;
+	eieio();
+}
+
+static inline void z_writew(unsigned int val, unsigned long addr)
+{
+	*(volatile u16 *)addr = val;
+	eieio();
+}
+
+static inline void z_writel(unsigned int val,unsigned long addr)
+{
+	*(volatile u32 *)addr = val;
+	eieio();
+}
 
 #define z_memset_io(a,b,c)	memset((void *)(a),(b),(c))
 #define z_memcpy_fromio(a,b,c)	memcpy((a),(void *)(b),(c))
@@ -19,7 +56,6 @@ extern void *__ioremap(unsigned long add
 		       unsigned long flags);
 
 extern void *ioremap(unsigned long address, unsigned long size);
-extern void iounmap(void *addr);
 
 extern void *__ioremap(unsigned long address, unsigned long size,
                        unsigned long flags);

                 reply	other threads:[~2005-09-24 22:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Pine.LNX.4.61.0509250044420.19187@scrub.home \
    --to=zippel@linux-m68k.org \
    --cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).