patch-2.2.18 linux/include/asm-arm/arch-ebsa110/io.h
Next file: linux/include/asm-arm/arch-ebsa110/system.h
Previous file: linux/include/asm-arm/arch-ebsa110/hardware.h
Back to the patch index
Back to the overall index
- Lines: 221
- Date:
Fri Sep 15 23:32:34 2000
- Orig file:
v2.2.17/include/asm-arm/arch-ebsa110/io.h
- Orig date:
Fri Apr 21 12:46:48 2000
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/include/asm-arm/arch-ebsa110/io.h linux/include/asm-arm/arch-ebsa110/io.h
@@ -16,178 +16,60 @@
#undef ARCH_IO_DELAY
/*
- * We use two different types of addressing - PC style addresses, and ARM
- * addresses. PC style accesses the PC hardware with the normal PC IO
- * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+
- * and are translated to the start of IO. Note that all addresses are
- * shifted left!
+ * Note that the translation here is weird -
+ * the ISA mem space and some peripherals (ethernet and VG468)
+ * appear as a 16-bit memory on a 32-bit bus. This means that
+ * byte lanes 2 and 3 are not used, and this translation must
+ * be used.
*/
-#define __PORT_PCIO(x) (!((x) & 0x80000000))
+#define __isa_addr(x) (((x) & 1) | (((x) & 0xfffffffe)) << 1)
-/*
- * Dynamic IO functions - let the compiler
- * optimize the expressions
- */
-#define DECLARE_DYN_OUT(fnsuffix,instr) \
-extern __inline__ void __out##fnsuffix (unsigned int value, unsigned int port) \
-{ \
- unsigned long temp; \
- __asm__ __volatile__( \
- "tst %2, #0x80000000\n\t" \
- "mov %0, %4\n\t" \
- "addeq %0, %0, %3\n\t" \
- "str" ##instr## " %1, [%0, %2, lsl #2] @ out"###fnsuffix \
- : "=&r" (temp) \
- : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \
- : "cc"); \
-}
+#define __isa_io_addr(p) (PCIO_BASE + ((p) << 2))
-#define DECLARE_DYN_IN(sz,fnsuffix,instr) \
-extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \
-{ \
- unsigned long temp, value; \
- __asm__ __volatile__( \
- "tst %2, #0x80000000\n\t" \
- "mov %0, %4\n\t" \
- "addeq %0, %0, %3\n\t" \
- "ldr" ##instr## " %1, [%0, %2, lsl #2] @ in"###fnsuffix \
- : "=&r" (temp), "=r" (value) \
- : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \
- : "cc"); \
- return (unsigned sz)value; \
-}
+#define __inb(p) (*(volatile unsigned char *)__isa_io_addr(p))
+#define __inl(p) (panic("__inl(%X) called", p),0)
-extern __inline__ unsigned int __ioaddr (unsigned int port) \
-{ \
- if (__PORT_PCIO(port)) \
- return (unsigned int)(PCIO_BASE + (port << 2)); \
- else \
- return (unsigned int)(IO_BASE + (port << 2)); \
+extern __inline__ unsigned int __inw(unsigned int port)
+{
+ unsigned int value;
+ __asm__ __volatile__(
+ "ldr%?h %0, [%1] @ inw"
+ : "=r" (value)
+ : "r" (__isa_io_addr(port)));
+ return value;
}
-#define DECLARE_IO(sz,fnsuffix,instr) \
- DECLARE_DYN_OUT(fnsuffix,instr) \
- DECLARE_DYN_IN(sz,fnsuffix,instr)
-
-DECLARE_IO(char,b,"b")
-DECLARE_IO(short,w,"")
-DECLARE_IO(long,l,"")
-
-#undef DECLARE_IO
-#undef DECLARE_DYN_OUT
-#undef DECLARE_DYN_IN
+#define __outb(v,p) (*(volatile unsigned char *)__isa_io_addr(p) = v)
+#define __outl(v,p) panic("__outl(%X,%X) called", v, p)
-/*
- * Constant address IO functions
- *
- * These have to be macros for the 'J' constraint to work -
- * +/-4096 immediate operand.
- */
-#define __outbc(value,port) \
-({ \
- if (__PORT_PCIO((port))) \
- __asm__ __volatile__( \
- "strb %0, [%1, %2] @ outbc" \
- : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
- else \
- __asm__ __volatile__( \
- "strb %0, [%1, %2] @ outbc" \
- : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \
-})
-
-#define __inbc(port) \
-({ \
- unsigned char result; \
- if (__PORT_PCIO((port))) \
- __asm__ __volatile__( \
- "ldrb %0, [%1, %2] @ inbc" \
- : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
- else \
- __asm__ __volatile__( \
- "ldrb %0, [%1, %2] @ inbc" \
- : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
- result; \
-})
-
-#define __outwc(value,port) \
-({ \
- unsigned long v = value; \
- if (__PORT_PCIO((port))) \
- __asm__ __volatile__( \
- "str %0, [%1, %2] @ outwc" \
- : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
- else \
- __asm__ __volatile__( \
- "str %0, [%1, %2] @ outwc" \
- : : "r" (v|v<<16), "r" (IO_BASE), "r" ((port) << 2)); \
-})
-
-#define __inwc(port) \
-({ \
- unsigned short result; \
- if (__PORT_PCIO((port))) \
- __asm__ __volatile__( \
- "ldr %0, [%1, %2] @ inwc" \
- : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
- else \
- __asm__ __volatile__( \
- "ldr %0, [%1, %2] @ inwc" \
- : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
- result & 0xffff; \
-})
-
-#define __outlc(v,p) \
-({ \
- unsigned long v = value; \
- if (__PORT_PCIO((port))) \
- __asm__ __volatile__( \
- "str %0, [%1, %2] @ outlc" \
- : : "r" (v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
- else \
- __asm__ __volatile__( \
- "str %0, [%1, %2] @ outlc" \
- : : "r" (v), "r" (IO_BASE), "r" ((port) << 2)); \
-})
-
-#define __inlc(port) \
-({ \
- unsigned long result; \
- if (__PORT_PCIO((port))) \
- __asm__ __volatile__( \
- "ldr %0, [%1, %2] @ inlc" \
- : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
- else \
- __asm__ __volatile__( \
- "ldr %0, [%1, %2] @ inlc" \
- : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
- result; \
-})
-
-#define __ioaddrc(port) \
-({ \
- unsigned long addr; \
- if (__PORT_PCIO((port))) \
- addr = PCIO_BASE + ((port) << 2); \
- else \
- addr = IO_BASE + ((port) << 2); \
- addr; \
-})
+extern __inline__ unsigned int __outw(unsigned int value, unsigned int port)
+{
+ __asm__ __volatile__(
+ "str%?h %0, [%1] @ outw"
+ : : "r" (value), "r" (__isa_io_addr(port)));
+}
+
+#define __ioaddr(p) __isa_io_addr(p)
/*
- * Translated address IO functions
- *
- * IO address has already been translated to a virtual address
+ * ioremap support - basic support only
*/
-#define outb_t(v,p) \
- (*(volatile unsigned char *)(p) = (v))
+#define ioremap(addr,size) ((void *)(addr))
+#define iounmap(addr)
-#define inb_t(p) \
- (*(volatile unsigned char *)(p))
+#define __isa_mem_addr(x) ((void *)(0xe0000000 + __isa_addr((unsigned long)(x))))
-#define outl_t(v,p) \
- (*(volatile unsigned long *)(p) = (v))
+#define readb(addr) (*(volatile unsigned char *)__isa_mem_addr(addr))
+#define readw(addr) (*(volatile unsigned short *)__isa_mem_addr(addr))
+#define readl(addr) (*(volatile unsigned long *)__isa_mem_addr(addr))
+
+#define writeb(b,addr) (*(volatile unsigned char *)__isa_mem_addr(addr) = (b))
+#define writew(b,addr) (*(volatile unsigned short *)__isa_mem_addr(addr) = (b))
+#define writel(b,addr) (*(volatile unsigned long *)__isa_mem_addr(addr) = (b))
+
+#define memset_io(a,b,c) __ebsa110_set_isamem(__isa_mem_addr(a),(b),(c))
+#define memcpy_fromio(a,b,c) __ebsa110_copy_fromisamem((a),__isa_mem_addr(b),(c))
+#define memcpy_toio(a,b,c) __ebsa110_copy_toisamem(__isa_mem_addr(a),(b),(c))
-#define inl_t(p) \
- (*(volatile unsigned long *)(p))
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)