[2.6 patch] make ocfs2_find_entry_el() static
[pv_ops_mirror.git] / arch / sh / boards / se / 7206 / io.c
blob1308e618e044d1a5aaa996ac934e26cb15201163
1 /* $Id: io.c,v 1.5 2004/02/22 23:08:43 kkojima Exp $
3 * linux/arch/sh/boards/se/7206/io.c
5 * Copyright (C) 2006 Yoshinori Sato
7 * I/O routine for Hitachi 7206 SolutionEngine.
9 */
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <asm/io.h>
14 #include <asm/se7206.h>
17 static inline void delay(void)
19 ctrl_inw(0x20000000); /* P2 ROM Area */
22 /* MS7750 requires special versions of in*, out* routines, since
23 PC-like io ports are located at upper half byte of 16-bit word which
24 can be accessed only with 16-bit wide. */
26 static inline volatile __u16 *
27 port2adr(unsigned int port)
29 if (port >= 0x2000 && port < 0x2020)
30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
31 else if (port >= 0x300 && port < 0x310)
32 return (volatile __u16 *) (PA_SMSC + (port - 0x300));
34 return (volatile __u16 *)port;
37 unsigned char se7206_inb(unsigned long port)
39 return (*port2adr(port)) & 0xff;
42 unsigned char se7206_inb_p(unsigned long port)
44 unsigned long v;
46 v = (*port2adr(port)) & 0xff;
47 delay();
48 return v;
51 unsigned short se7206_inw(unsigned long port)
53 return *port2adr(port);;
56 void se7206_outb(unsigned char value, unsigned long port)
58 *(port2adr(port)) = value;
61 void se7206_outb_p(unsigned char value, unsigned long port)
63 *(port2adr(port)) = value;
64 delay();
67 void se7206_outw(unsigned short value, unsigned long port)
69 *port2adr(port) = value;
72 void se7206_insb(unsigned long port, void *addr, unsigned long count)
74 volatile __u16 *p = port2adr(port);
75 __u8 *ap = addr;
77 while (count--)
78 *ap++ = *p;
81 void se7206_insw(unsigned long port, void *addr, unsigned long count)
83 volatile __u16 *p = port2adr(port);
84 __u16 *ap = addr;
85 while (count--)
86 *ap++ = *p;
89 void se7206_outsb(unsigned long port, const void *addr, unsigned long count)
91 volatile __u16 *p = port2adr(port);
92 const __u8 *ap = addr;
94 while (count--)
95 *p = *ap++;
98 void se7206_outsw(unsigned long port, const void *addr, unsigned long count)
100 volatile __u16 *p = port2adr(port);
101 const __u16 *ap = addr;
102 while (count--)
103 *p = *ap++;