allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / sh / boards / se / 7206 / io.c
blobb557273e0cbe490c753e7e60f125a5b4f22c1a07
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)
30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
31 else if (port >= 0x300 || port < 0x310)
32 return (volatile __u16 *) (PA_SMSC + (port - 0x300));
35 unsigned char se7206_inb(unsigned long port)
37 return (*port2adr(port))&0xff;
40 unsigned char se7206_inb_p(unsigned long port)
42 unsigned long v;
44 v = (*port2adr(port))&0xff;
45 delay();
46 return v;
49 unsigned short se7206_inw(unsigned long port)
51 return *port2adr(port);;
54 unsigned int se7206_inl(unsigned long port)
56 maybebadio(port);
57 return 0;
60 void se7206_outb(unsigned char value, unsigned long port)
62 *(port2adr(port)) = value;
65 void se7206_outb_p(unsigned char value, unsigned long port)
67 *(port2adr(port)) = value;
68 delay();
71 void se7206_outw(unsigned short value, unsigned long port)
73 *port2adr(port) = value;
76 void se7206_outl(unsigned int value, unsigned long port)
78 maybebadio(port);
81 void se7206_insb(unsigned long port, void *addr, unsigned long count)
83 volatile __u16 *p = port2adr(port);
84 __u8 *ap = addr;
86 while (count--)
87 *ap++ = *p;
90 void se7206_insw(unsigned long port, void *addr, unsigned long count)
92 volatile __u16 *p = port2adr(port);
93 __u16 *ap = addr;
94 while (count--)
95 *ap++ = *p;
98 void se7206_insl(unsigned long port, void *addr, unsigned long count)
100 maybebadio(port);
103 void se7206_outsb(unsigned long port, const void *addr, unsigned long count)
105 volatile __u16 *p = port2adr(port);
106 const __u8 *ap = addr;
108 while (count--)
109 *p = *ap++;
112 void se7206_outsw(unsigned long port, const void *addr, unsigned long count)
114 volatile __u16 *p = port2adr(port);
115 const __u16 *ap = addr;
116 while (count--)
117 *p = *ap++;
120 void se7206_outsl(unsigned long port, const void *addr, unsigned long count)
122 maybebadio(port);