more changes on original files
[linux-2.4.git] / include / asm-sh / io_snapgear.h
1 /*
2  * include/asm-sh/io_snapgear.h
3  *
4  * Modified version of io_se.h for the snapgear-specific functions.
5  *
6  * May be copied or modified under the terms of the GNU General Public
7  * License.  See linux/COPYING for more information.
8  *
9  * IO functions for a SnapGear
10  */
11
12 #ifndef _ASM_SH_IO_SNAPGEAR_H
13 #define _ASM_SH_IO_SNAPGEAR_H
14
15 #include <asm/irq.h>
16
17 #if defined(__SH4__)
18 /*
19  * The external interrupt lines, these take up ints 0 - 15 inclusive
20  * depending on the priority for the interrupt.  In fact the priority
21  * is the interrupt :-)
22  */
23
24 #define IRL0_IRQ                2
25 #define IRL0_IPR_ADDR   INTC_IPRD
26 #define IRL0_IPR_POS    3
27 #define IRL0_PRIORITY   13
28
29 #define IRL1_IRQ                5
30 #define IRL1_IPR_ADDR   INTC_IPRD
31 #define IRL1_IPR_POS    2
32 #define IRL1_PRIORITY   10
33
34 #define IRL2_IRQ                8
35 #define IRL2_IPR_ADDR   INTC_IPRD
36 #define IRL2_IPR_POS    1
37 #define IRL2_PRIORITY   7
38
39 #define IRL3_IRQ                11
40 #define IRL3_IPR_ADDR   INTC_IPRD
41 #define IRL3_IPR_POS    0
42 #define IRL3_PRIORITY   4
43 #endif
44
45 #include <asm/io_generic.h>
46
47 extern unsigned char snapgear_inb(unsigned long port);
48 extern unsigned short snapgear_inw(unsigned long port);
49 extern unsigned int snapgear_inl(unsigned long port);
50
51 extern void snapgear_outb(unsigned char value, unsigned long port);
52 extern void snapgear_outw(unsigned short value, unsigned long port);
53 extern void snapgear_outl(unsigned int value, unsigned long port);
54
55 extern unsigned char snapgear_inb_p(unsigned long port);
56 extern void snapgear_outb_p(unsigned char value, unsigned long port);
57
58 extern void snapgear_insb(unsigned long port, void *addr, unsigned long count);
59 extern void snapgear_insw(unsigned long port, void *addr, unsigned long count);
60 extern void snapgear_insl(unsigned long port, void *addr, unsigned long count);
61 extern void snapgear_outsb(unsigned long port, const void *addr, unsigned long count);
62 extern void snapgear_outsw(unsigned long port, const void *addr, unsigned long count);
63 extern void snapgear_outsl(unsigned long port, const void *addr, unsigned long count);
64
65 extern unsigned char snapgear_readb(unsigned long addr);
66 extern unsigned short snapgear_readw(unsigned long addr);
67 extern unsigned int snapgear_readl(unsigned long addr);
68 extern void snapgear_writeb(unsigned char b, unsigned long addr);
69 extern void snapgear_writew(unsigned short b, unsigned long addr);
70 extern void snapgear_writel(unsigned int b, unsigned long addr);
71
72 extern unsigned long snapgear_isa_port2addr(unsigned long offset);
73
74 #ifdef __WANT_IO_DEF
75
76 # define __inb                  snapgear_inb
77 # define __inw                  snapgear_inw
78 # define __inl                  snapgear_inl
79 # define __outb                 snapgear_outb
80 # define __outw                 snapgear_outw
81 # define __outl                 snapgear_outl
82
83 # define __inb_p                snapgear_inb_p
84 # define __inw_p                snapgear_inw
85 # define __inl_p                snapgear_inl
86 # define __outb_p               snapgear_outb_p
87 # define __outw_p               snapgear_outw
88 # define __outl_p               snapgear_outl
89
90 # define __insb                 snapgear_insb
91 # define __insw                 snapgear_insw
92 # define __insl                 snapgear_insl
93 # define __outsb                snapgear_outsb
94 # define __outsw                snapgear_outsw
95 # define __outsl                snapgear_outsl
96
97 # define __readb                snapgear_readb
98 # define __readw                snapgear_readw
99 # define __readl                snapgear_readl
100 # define __writeb               snapgear_writeb
101 # define __writew               snapgear_writew
102 # define __writel               snapgear_writel
103
104 # define __isa_port2addr        snapgear_isa_port2addr
105 # define __ioremap              generic_ioremap
106 # define __iounmap              generic_iounmap
107
108 #endif
109
110 #ifdef CONFIG_SH_SECUREEDGE5410
111 /*
112  * We need to remember what was written to the ioport as some bits
113  * are shared with other functions and you cannot read back what was
114  * written :-|
115  *
116  * Bit        Read                   Write
117  * -----------------------------------------------
118  * D0         DCD on ttySC1          power
119  * D1         Reset Switch           heatbeat
120  * D2         ttySC0 CTS (7100)      LAN
121  * D3         -                      WAN
122  * D4         ttySC0 DCD (7100)      CONSOLE
123  * D5         -                      ONLINE
124  * D6         -                      VPN
125  * D7         -                      DTR on ttySC1
126  * D8         -                      ttySC0 RTS (7100)
127  * D9         -                      ttySC0 DTR (7100)
128  * D10        -                      RTC SCLK
129  * D11        RTC DATA               RTC DATA
130  * D12        -                      RTS RESET
131  */
132
133  #define SECUREEDGE_IOPORT_ADDR ((volatile short *) 0xb0000000)
134  extern unsigned short secureedge5410_ioport;
135
136  #define SECUREEDGE_WRITE_IOPORT(val, mask) (*SECUREEDGE_IOPORT_ADDR = \
137                  (secureedge5410_ioport = \
138                                 ((secureedge5410_ioport & ~(mask)) | ((val) & (mask)))))
139  #define SECUREEDGE_READ_IOPORT() \
140                  ((*SECUREEDGE_IOPORT_ADDR&0x0817) | (secureedge5410_ioport&~0x0817))
141 #endif
142
143 #endif /* _ASM_SH_IO_SNAPGEAR_H */