diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-cris/arch-v10/io.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-cris/arch-v10/io.h')
-rw-r--r-- | include/asm-cris/arch-v10/io.h | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/include/asm-cris/arch-v10/io.h b/include/asm-cris/arch-v10/io.h new file mode 100644 index 000000000000..0bc38a0313c1 --- /dev/null +++ b/include/asm-cris/arch-v10/io.h | |||
@@ -0,0 +1,193 @@ | |||
1 | #ifndef _ASM_ARCH_CRIS_IO_H | ||
2 | #define _ASM_ARCH_CRIS_IO_H | ||
3 | |||
4 | #include <asm/arch/svinto.h> | ||
5 | #include <linux/config.h> | ||
6 | |||
7 | /* Etrax shadow registers - which live in arch/cris/kernel/shadows.c */ | ||
8 | |||
9 | extern unsigned long port_g_data_shadow; | ||
10 | extern unsigned char port_pa_dir_shadow; | ||
11 | extern unsigned char port_pa_data_shadow; | ||
12 | extern unsigned char port_pb_i2c_shadow; | ||
13 | extern unsigned char port_pb_config_shadow; | ||
14 | extern unsigned char port_pb_dir_shadow; | ||
15 | extern unsigned char port_pb_data_shadow; | ||
16 | extern unsigned long r_timer_ctrl_shadow; | ||
17 | |||
18 | extern unsigned long port_cse1_shadow; | ||
19 | extern unsigned long port_csp0_shadow; | ||
20 | extern unsigned long port_csp4_shadow; | ||
21 | |||
22 | extern volatile unsigned long *port_cse1_addr; | ||
23 | extern volatile unsigned long *port_csp0_addr; | ||
24 | extern volatile unsigned long *port_csp4_addr; | ||
25 | |||
26 | /* macro for setting regs through a shadow - | ||
27 | * r = register name (like R_PORT_PA_DATA) | ||
28 | * s = shadow name (like port_pa_data_shadow) | ||
29 | * b = bit number | ||
30 | * v = value (0 or 1) | ||
31 | */ | ||
32 | |||
33 | #define REG_SHADOW_SET(r,s,b,v) *r = s = (s & ~(1 << (b))) | ((v) << (b)) | ||
34 | |||
35 | /* The LED's on various Etrax-based products are set differently. */ | ||
36 | |||
37 | #if defined(CONFIG_ETRAX_NO_LEDS) || defined(CONFIG_SVINTO_SIM) | ||
38 | #undef CONFIG_ETRAX_PA_LEDS | ||
39 | #undef CONFIG_ETRAX_PB_LEDS | ||
40 | #undef CONFIG_ETRAX_CSP0_LEDS | ||
41 | #define LED_NETWORK_SET_G(x) | ||
42 | #define LED_NETWORK_SET_R(x) | ||
43 | #define LED_ACTIVE_SET_G(x) | ||
44 | #define LED_ACTIVE_SET_R(x) | ||
45 | #define LED_DISK_WRITE(x) | ||
46 | #define LED_DISK_READ(x) | ||
47 | #endif | ||
48 | |||
49 | #if !defined(CONFIG_ETRAX_CSP0_LEDS) | ||
50 | #define LED_BIT_SET(x) | ||
51 | #define LED_BIT_CLR(x) | ||
52 | #endif | ||
53 | |||
54 | #define LED_OFF 0x00 | ||
55 | #define LED_GREEN 0x01 | ||
56 | #define LED_RED 0x02 | ||
57 | #define LED_ORANGE (LED_GREEN | LED_RED) | ||
58 | |||
59 | #if CONFIG_ETRAX_LED1G == CONFIG_ETRAX_LED1R | ||
60 | #define LED_NETWORK_SET(x) \ | ||
61 | do { \ | ||
62 | LED_NETWORK_SET_G((x) & LED_GREEN); \ | ||
63 | } while (0) | ||
64 | #else | ||
65 | #define LED_NETWORK_SET(x) \ | ||
66 | do { \ | ||
67 | LED_NETWORK_SET_G((x) & LED_GREEN); \ | ||
68 | LED_NETWORK_SET_R((x) & LED_RED); \ | ||
69 | } while (0) | ||
70 | #endif | ||
71 | #if CONFIG_ETRAX_LED2G == CONFIG_ETRAX_LED2R | ||
72 | #define LED_ACTIVE_SET(x) \ | ||
73 | do { \ | ||
74 | LED_ACTIVE_SET_G((x) & LED_GREEN); \ | ||
75 | } while (0) | ||
76 | #else | ||
77 | #define LED_ACTIVE_SET(x) \ | ||
78 | do { \ | ||
79 | LED_ACTIVE_SET_G((x) & LED_GREEN); \ | ||
80 | LED_ACTIVE_SET_R((x) & LED_RED); \ | ||
81 | } while (0) | ||
82 | #endif | ||
83 | |||
84 | #ifdef CONFIG_ETRAX_PA_LEDS | ||
85 | #define LED_NETWORK_SET_G(x) \ | ||
86 | REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED1G, !(x)) | ||
87 | #define LED_NETWORK_SET_R(x) \ | ||
88 | REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED1R, !(x)) | ||
89 | #define LED_ACTIVE_SET_G(x) \ | ||
90 | REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED2G, !(x)) | ||
91 | #define LED_ACTIVE_SET_R(x) \ | ||
92 | REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED2R, !(x)) | ||
93 | #define LED_DISK_WRITE(x) \ | ||
94 | do{\ | ||
95 | REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED3G, !(x));\ | ||
96 | REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED3R, !(x));\ | ||
97 | }while(0) | ||
98 | #define LED_DISK_READ(x) \ | ||
99 | REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, CONFIG_ETRAX_LED3G, !(x)) | ||
100 | #endif | ||
101 | |||
102 | #ifdef CONFIG_ETRAX_PB_LEDS | ||
103 | #define LED_NETWORK_SET_G(x) \ | ||
104 | REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED1G, !(x)) | ||
105 | #define LED_NETWORK_SET_R(x) \ | ||
106 | REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED1R, !(x)) | ||
107 | #define LED_ACTIVE_SET_G(x) \ | ||
108 | REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED2G, !(x)) | ||
109 | #define LED_ACTIVE_SET_R(x) \ | ||
110 | REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED2R, !(x)) | ||
111 | #define LED_DISK_WRITE(x) \ | ||
112 | do{\ | ||
113 | REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED3G, !(x));\ | ||
114 | REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED3R, !(x));\ | ||
115 | }while(0) | ||
116 | #define LED_DISK_READ(x) \ | ||
117 | REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, CONFIG_ETRAX_LED3G, !(x)) | ||
118 | #endif | ||
119 | |||
120 | #ifdef CONFIG_ETRAX_CSP0_LEDS | ||
121 | #define CONFIGURABLE_LEDS\ | ||
122 | ((1 << CONFIG_ETRAX_LED1G ) | (1 << CONFIG_ETRAX_LED1R ) |\ | ||
123 | (1 << CONFIG_ETRAX_LED2G ) | (1 << CONFIG_ETRAX_LED2R ) |\ | ||
124 | (1 << CONFIG_ETRAX_LED3G ) | (1 << CONFIG_ETRAX_LED3R ) |\ | ||
125 | (1 << CONFIG_ETRAX_LED4G ) | (1 << CONFIG_ETRAX_LED4R ) |\ | ||
126 | (1 << CONFIG_ETRAX_LED5G ) | (1 << CONFIG_ETRAX_LED5R ) |\ | ||
127 | (1 << CONFIG_ETRAX_LED6G ) | (1 << CONFIG_ETRAX_LED6R ) |\ | ||
128 | (1 << CONFIG_ETRAX_LED7G ) | (1 << CONFIG_ETRAX_LED7R ) |\ | ||
129 | (1 << CONFIG_ETRAX_LED8Y ) | (1 << CONFIG_ETRAX_LED9Y ) |\ | ||
130 | (1 << CONFIG_ETRAX_LED10Y ) |(1 << CONFIG_ETRAX_LED11Y )|\ | ||
131 | (1 << CONFIG_ETRAX_LED12R )) | ||
132 | |||
133 | #define LED_NETWORK_SET_G(x) \ | ||
134 | REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED1G, !(x)) | ||
135 | #define LED_NETWORK_SET_R(x) \ | ||
136 | REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED1R, !(x)) | ||
137 | #define LED_ACTIVE_SET_G(x) \ | ||
138 | REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED2G, !(x)) | ||
139 | #define LED_ACTIVE_SET_R(x) \ | ||
140 | REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED2R, !(x)) | ||
141 | #define LED_DISK_WRITE(x) \ | ||
142 | do{\ | ||
143 | REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED3G, !(x));\ | ||
144 | REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED3R, !(x));\ | ||
145 | }while(0) | ||
146 | #define LED_DISK_READ(x) \ | ||
147 | REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_LED3G, !(x)) | ||
148 | #define LED_BIT_SET(x)\ | ||
149 | do{\ | ||
150 | if((( 1 << x) & CONFIGURABLE_LEDS) != 0)\ | ||
151 | REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, x, 1);\ | ||
152 | }while(0) | ||
153 | #define LED_BIT_CLR(x)\ | ||
154 | do{\ | ||
155 | if((( 1 << x) & CONFIGURABLE_LEDS) != 0)\ | ||
156 | REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, x, 0);\ | ||
157 | }while(0) | ||
158 | #endif | ||
159 | |||
160 | # | ||
161 | #ifdef CONFIG_ETRAX_SOFT_SHUTDOWN | ||
162 | #define SOFT_SHUTDOWN() \ | ||
163 | REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, CONFIG_ETRAX_SHUTDOWN_BIT, 1) | ||
164 | #else | ||
165 | #define SOFT_SHUTDOWN() | ||
166 | #endif | ||
167 | |||
168 | /* Console I/O for simulated etrax100. Use #ifdef so erroneous | ||
169 | use will be evident. */ | ||
170 | #ifdef CONFIG_SVINTO_SIM | ||
171 | /* Let's use the ucsim interface since it lets us do write(2, ...) */ | ||
172 | #define SIMCOUT(s,len) \ | ||
173 | asm ("moveq 4,$r9 \n\t" \ | ||
174 | "moveq 2,$r10 \n\t" \ | ||
175 | "move.d %0,$r11 \n\t" \ | ||
176 | "move.d %1,$r12 \n\t" \ | ||
177 | "push $irp \n\t" \ | ||
178 | "move 0f,$irp \n\t" \ | ||
179 | "jump -6809 \n" \ | ||
180 | "0: \n\t" \ | ||
181 | "pop $irp" \ | ||
182 | : : "rm" (s), "rm" (len) : "r9","r10","r11","r12","memory") | ||
183 | #define TRACE_ON() __extension__ \ | ||
184 | ({ int _Foofoo; __asm__ volatile ("bmod [%0],%0" : "=r" (_Foofoo) : "0" \ | ||
185 | (255)); _Foofoo; }) | ||
186 | |||
187 | #define TRACE_OFF() do { __asm__ volatile ("bmod [%0],%0" :: "r" (254)); } while (0) | ||
188 | #define SIM_END() do { __asm__ volatile ("bmod [%0],%0" :: "r" (28)); } while (0) | ||
189 | #define CRIS_CYCLES() __extension__ \ | ||
190 | ({ unsigned long c; asm ("bmod [%1],%0" : "=r" (c) : "r" (27)); c;}) | ||
191 | #endif /* ! defined CONFIG_SVINTO_SIM */ | ||
192 | |||
193 | #endif | ||