From: monstr@monstr.eu
To: monstr@monstr.eu
Cc: linux-kernel@vger.kernel.org, stephen.neuendorffer@xilinx.com,
john.williams@petalogix.com, microblaze-uclinux@itee.uq.edu.au
Subject: [PATCH 36/52] [microblaze] io.h IO operations
Date: Thu, 24 Jan 2008 16:03:11 +0100 [thread overview]
Message-ID: <c09d54c49393bedbe4ca43df0e35cefa5fcc649c.1201107832.git.monstr@monstr.eu> (raw)
In-Reply-To: <43f77bd3045d72346eb39d3170de727050c835c1.1201107832.git.monstr@monstr.eu>
In-Reply-To: <8051f6df628e1ff896ec7d580b613da50f718fb4.1201107832.git.monstr@monstr.eu>
From: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
include/asm-microblaze/io.h | 210 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 210 insertions(+), 0 deletions(-)
create mode 100644 include/asm-microblaze/io.h
diff --git a/include/asm-microblaze/io.h b/include/asm-microblaze/io.h
new file mode 100644
index 0000000..a0a5401
--- /dev/null
+++ b/include/asm-microblaze/io.h
@@ -0,0 +1,210 @@
+/*
+ * include/asm-microblaze/io.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ */
+
+#ifndef _ASM_IO_H
+#define _ASM_IO_H
+
+#include <asm/byteorder.h>
+#include <asm/page.h>
+
+static inline unsigned char __raw_readb(const volatile void *addr)
+{
+ return *(volatile unsigned char __force *)addr;
+}
+static inline unsigned short __raw_readw(const volatile void *addr)
+{
+ return *(volatile unsigned short __force *)addr;
+}
+static inline unsigned int __raw_readl(const volatile void *addr)
+{
+ return *(volatile unsigned int __force *)addr;
+}
+static inline unsigned long __raw_readq(const volatile void *addr)
+{
+ return *(volatile unsigned long __force *)addr;
+}
+static inline void __raw_writeb(unsigned char v, volatile void *addr)
+{
+ *(volatile unsigned char __force *)addr = v;
+}
+static inline void __raw_writew(unsigned short v, volatile void *addr)
+{
+ *(volatile unsigned short __force *)addr = v;
+}
+static inline void __raw_writel(unsigned int v, volatile void *addr)
+{
+ *(volatile unsigned int __force *)addr = v;
+}
+static inline void __raw_writeq(unsigned long v, volatile void *addr)
+{
+ *(volatile unsigned long __force *)addr = v;
+}
+
+/*
+ * read (readb, readw, readl, readq) and write (writeb, writew,
+ * writel, writeq) accessors are for PCI and thus littel endian.
+ * Linux 2.4 for Microblaze had this wrong.
+ */
+static inline unsigned char readb(const volatile void *addr)
+{
+ return *(volatile unsigned char __force *)addr;
+}
+static inline unsigned short readw(const volatile void *addr)
+{
+ return le16_to_cpu(*(volatile unsigned short __force *)addr);
+}
+static inline unsigned int readl(const volatile void *addr)
+{
+ return le32_to_cpu(*(volatile unsigned int __force *)addr);
+}
+static inline void writeb(unsigned char v, volatile void *addr)
+{
+ *(volatile unsigned char __force *)addr = v;
+}
+static inline void writew(unsigned short v, volatile void *addr)
+{
+ *(volatile unsigned short __force *)addr = cpu_to_le16(v);
+}
+static inline void writel(unsigned int v, volatile void __iomem *addr)
+{
+ *(volatile unsigned int __force *)addr = cpu_to_le32(v);
+}
+
+/* ioread and iowrite variants. thease are for now same as __raw_
+ * variants of accessors. we might check for endianess in the feature
+ */
+#define ioread8(addr) __raw_readb((u8 *)(addr))
+#define ioread16(addr) __raw_readw((u16 *)(addr))
+#define ioread32(addr) __raw_readl((u32 *)(addr))
+#define iowrite8(v, addr) __raw_writeb((u8)(v), (u8 *)(addr))
+#define iowrite16(v, addr) __raw_writew((u16)(v), (u16 *)(addr))
+#define iowrite32(v, addr) __raw_writel((u32)(v), (u32 *)(addr))
+
+/* These are the definitions for the x86 IO instructions
+ * inb/inw/inl/outb/outw/outl, the "string" versions
+ * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions
+ * inb_p/inw_p/...
+ * The macros don't do byte-swapping.
+ */
+#define inb(port) readb((u8 *)((port)))
+#define outb(val, port) writeb((val), (u8 *)((unsigned long)(port)))
+#define inw(port) readw((u16 *)((port)))
+#define outw(val, port) writew((val), (u16 *)((unsigned long)(port)))
+#define inl(port) readl((u32 *)((port)))
+#define outl(val, port) writel((val), (u32 *)((unsigned long)(port)))
+
+#define inb_p(port) inb((port))
+#define outb_p(val, port) outb((val), (port))
+#define inw_p(port) inw((port))
+#define outw_p(val, port) outw((val), (port))
+#define inl_p(port) inl((port))
+#define outl_p(val, port) outl((val), (port))
+
+#define memset_io(a, b, c) memset((void *)(a), (b), (c))
+#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
+#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
+
+/**
+ * virt_to_phys - map virtual addresses to physical
+ * @address: address to remap
+ *
+ * The returned physical address is the physical (CPU) mapping for
+ * the memory address given. It is only valid to use this function on
+ * addresses directly mapped or allocated via kmalloc.
+ *
+ * This function does not give bus mappings for DMA transfers. In
+ * almost all conceivable cases a device driver should not be using
+ * this function
+ */
+static inline unsigned long __iomem virt_to_phys(volatile void *address)
+{
+ return __pa((unsigned long)address);
+}
+
+#define virt_to_bus virt_to_phys
+
+/**
+ * phys_to_virt - map physical address to virtual
+ * @address: address to remap
+ *
+ * The returned virtual address is a current CPU mapping for
+ * the memory address given. It is only valid to use this function on
+ * addresses that have a kernel mapping
+ *
+ * This function does not handle bus mappings for DMA transfers. In
+ * almost all conceivable cases a device driver should not be using
+ * this function
+ */
+static inline void *phys_to_virt(unsigned long address)
+{
+ return (void *)__va(address);
+}
+
+#define bus_to_virt(a) phys_to_virt(a)
+
+static inline void *__ioremap(unsigned long address, unsigned long size,
+ unsigned long flags)
+{
+ return (void *)address;
+}
+
+
+#define IO_SPACE_LIMIT ~(0UL)
+
+#define ioremap(physaddr, size) ((void *)(unsigned long)(physaddr))
+#define iounmap(addr) ((void)0)
+#define ioremap_nocache(physaddr, size) ioremap(physaddr, size)
+
+/*
+ * Convert a physical pointer to a virtual kernel pointer for /dev/mem
+ * access
+ */
+#define xlate_dev_mem_ptr(p) __va(p)
+
+/*
+ * Convert a virtual cached pointer to an uncached pointer
+ */
+#define xlate_dev_kmem_ptr(p) p
+
+/*
+ * Big Endian
+ */
+#define out_be32(a, v) __raw_writel((v), (a))
+#define out_be16(a, v) __raw_writew((v), (a))
+
+#define in_be32(a) __raw_readl(a)
+#define in_be16(a) __raw_readw(a)
+
+/*
+ * Little endian
+ */
+
+#define out_le32(a, v) __raw_writel(__cpu_to_le32(v), (a));
+#define out_le16(a, v) __raw_writew(__cpu_to_le16(v), (a))
+
+#define in_le32(a) __le32_to_cpu(__raw_readl(a))
+#define in_le16(a) __le16_to_cpu(__raw_readw(a))
+
+/* Byte ops */
+#define out_8(a, v) __raw_writeb((v), (a))
+#define in_8(a) __raw_readb(a)
+
+/* FIXME */
+static inline void __iomem *ioport_map(unsigned long port, unsigned int len)
+{
+ return (void __iomem *) (port);
+}
+
+static inline void ioport_unmap(void __iomem *addr)
+{
+ /* Nothing to do */
+}
+
+#endif /* _ASM_IO_H */
--
1.5.4.rc4.14.g6fc74
next prev parent reply other threads:[~2008-01-26 16:03 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-24 15:02 Microblaze init port monstr
2008-01-24 15:05 ` [PATCH 01/52] [microblaze] Kconfig patches monstr
2008-01-24 15:02 ` [PATCH 10/52] [microblaze] Generic dts file for platforms monstr
2008-01-24 15:02 ` [PATCH 11/52] [microblaze] kernel modules support monstr
2008-01-26 16:27 ` Jan Engelhardt
2008-01-24 15:02 ` [PATCH 12/52] [microblaze] lmb support monstr
2008-01-27 12:51 ` Jan Engelhardt
2008-01-24 15:02 ` [PATCH 13/52] [microblaze] PVR support, cpuinfo support monstr
2008-01-24 15:02 ` [PATCH 14/52] [microblaze] defconfig file monstr
2008-01-24 15:02 ` [PATCH 15/52] [microblaze] assembler files head.S, entry.S, monstr
2008-01-24 15:02 ` [PATCH 16/52] [microblaze] supported function for memory - kernel/lib monstr
2008-01-29 21:26 ` Jan Engelhardt
2008-01-24 15:02 ` [PATCH 17/52] [microblaze] checksum support monstr
2008-01-27 11:57 ` Geert Uytterhoeven
2008-01-27 13:41 ` Michal Simek
2008-01-27 15:12 ` Geert Uytterhoeven
2008-01-29 21:30 ` Jan Engelhardt
2008-01-24 15:02 ` [PATCH 18/52] [microblaze] early_printk support monstr
2008-01-24 15:02 ` [PATCH 19/52] [microblaze] uaccess files monstr
2008-01-24 15:02 ` [PATCH 20/52] [microblaze] heartbeat file monstr
2008-01-24 15:02 ` [PATCH 21/52] [microblaze] setup.c - system setting monstr
2008-01-24 15:02 ` [PATCH 22/52] [microblaze] asm-offsets monstr
2008-01-24 15:02 ` [PATCH 23/52] [microblaze] process and init task function monstr
2008-01-24 15:02 ` [PATCH 24/52] [microblaze] time support monstr
[not found] ` <47BD86F3.9030400@petalogix.com>
[not found] ` <20080221163040.5E9FA6A0056@mail168-sin.bigfish.com>
2008-03-02 19:25 ` [microblaze-uclinux] " Michal Simek
2008-01-24 15:03 ` [PATCH 25/52] [microblaze] ptrace support monstr
2008-01-24 15:03 ` [PATCH 26/52] [microblaze] IPC support monstr
2008-01-24 15:03 ` [PATCH 27/52] [microblaze] traps support monstr
2008-01-24 15:03 ` [PATCH 28/52] [microblaze] support for a.out monstr
2008-01-24 15:03 ` [PATCH 29/52] [microblaze] memory inicialization, MMU, TLB monstr
2008-01-24 15:03 ` [PATCH 30/52] [microblaze] consistent allocation & page.h, monstr
2008-01-24 15:03 ` [PATCH 31/52] [microblaze] pci header files monstr
2008-01-24 15:03 ` [PATCH 32/52] [microblaze] includes SHM*, msgbuf monstr
2008-01-24 15:03 ` [PATCH 33/52] [microblaze] bug headers files monstr
2008-01-24 15:03 ` [PATCH 34/52] [microblaze] definitions of types monstr
2008-01-24 15:03 ` [PATCH 35/52] [microblaze] ioctl support monstr
2008-01-24 15:03 ` monstr [this message]
2008-01-24 15:03 ` [PATCH 37/52] [microblaze] headers for executables format FLAT, ELF monstr
2008-01-24 15:03 ` [PATCH 38/52] [microblaze] dma support monstr
2008-01-24 15:03 ` [PATCH 39/52] [microblaze] headers for irq monstr
2008-01-24 15:03 ` [PATCH 40/52] [microblaze] atomic.h bitops.h byteorder.h monstr
2008-01-24 15:03 ` [PATCH 41/52] [microblaze] headers pgalloc.h pgtable.h monstr
2008-01-24 15:03 ` [PATCH 42/52] [microblaze] system.h pvr.h processor.h monstr
2008-01-24 15:03 ` [PATCH 43/52] [microblaze] clinkage.h linkage.h sections.h kmap_types.h monstr
2008-01-24 15:03 ` [PATCH 44/52] [microblaze] stats headers monstr
2008-01-24 15:03 ` [PATCH 45/52] [microblaze] termbits.h termios.h monstr
2008-01-24 15:03 ` [PATCH 46/52] [microblaze] sigcontext.h siginfo.h monstr
2008-01-24 15:03 ` [PATCH 47/52] [microblaze] headers simple files monstr
2008-01-24 15:03 ` [PATCH 48/52] [microblaze] headers files entry.h current.h mman.h registers.h sembuf.h monstr
2008-01-24 15:03 ` [PATCH 49/52] [microblaze] device.h param.h topology.h monstr
2008-01-24 15:03 ` [PATCH 50/52] [microblaze] pool.h socket.h monstr
2008-01-24 15:03 ` [PATCH 51/52] [microblaze] fcntl.h sockios.h ucontext.h unistd.h monstr
2008-01-24 15:03 ` [PATCH 52/52] [microblaze] setup.h string.h thread_info.h monstr
2008-01-24 15:03 ` [PATCH 03/52] [microblaze] Cpuinfo handling monstr
2008-01-27 12:55 ` Jan Engelhardt
2008-01-24 15:03 ` [PATCH 04/52] [microblaze] Open firmware files monstr
2008-01-24 15:03 ` [PATCH 05/52] [microblaze] Support for semaphores monstr
2008-01-24 15:03 ` [PATCH 06/52] [microblaze] exception handling monstr
2008-01-24 15:03 ` [PATCH 07/52] [microblaze] Signal support monstr
2008-01-24 15:03 ` [PATCH 08/52] [microblaze] Interrupt handling, timer support, supported function monstr
2008-01-24 15:03 ` [PATCH 09/52] [microblaze] cache support monstr
2008-01-24 15:05 ` [PATCH 02/52] [microblaze] Makefiles for Microblaze cpu monstr
2008-01-26 17:36 ` [PATCH 01/52] [microblaze] Kconfig patches Randy Dunlap
2008-01-27 10:39 ` Michal Simek
2008-01-27 10:41 ` [PATCH 01/52] [microblaze] Kconfig patches v2 Michal Simek
2008-01-27 17:15 ` Randy Dunlap
2008-01-27 11:59 ` Microblaze init port Geert Uytterhoeven
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=c09d54c49393bedbe4ca43df0e35cefa5fcc649c.1201107832.git.monstr@monstr.eu \
--to=monstr@monstr.eu \
--cc=john.williams@petalogix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=microblaze-uclinux@itee.uq.edu.au \
--cc=stephen.neuendorffer@xilinx.com \
/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®