Remove reference to old ar7-2.4 code
[openwrt.git] / target / linux / etrax-2.6 / patches / cris / 020-syscalls.patch
1 diff -urN linux-2.6.19.2.orig/include/asm-cris/unistd.h linux-2.6.19.2/include/asm/unistd.h
2 --- linux-2.6.19.2.orig/include/asm-cris/unistd.h 2007-06-16 23:59:11.000000000 +0200
3 +++ linux-2.6.19.2/include/asm/unistd.h 2007-06-17 03:43:10.000000000 +0200
4 @@ -325,9 +325,52 @@
5 #define __NR_getcpu 318
6 #define __NR_epoll_pwait 319
7
8 +#ifdef CONFIG_ETRAX_GPIO
9 + #ifdef CONFIG_FOXBONE
10 + #define __NR_gpiosetbits 320
11 + #define __NR_gpioclearbits 321
12 + #define __NR_gpiosetdir 322
13 + #define __NR_gpiotogglebit 323
14 + #define __NR_gpiogetbits 324
15 + #define __NR_foxboneread 325
16 + #define __NR_foxbonewrite 326
17 + #define __NR_foxbonebulkread 327
18 + #define __NR_foxbonebulkwrite 328
19 + #define __NR_foxbonereset 329
20 + #define __NR_foxboneintreg 330
21 + #define __NR_foxboneintcheck 331
22 + #define __NR_foxboneintwait 332
23 + #define NR_syscalls 333
24 +
25 + #else
26 + #define __NR_gpiosetbits 320
27 + #define __NR_gpioclearbits 321
28 + #define __NR_gpiosetdir 322
29 + #define __NR_gpiotogglebit 323
30 + #define __NR_gpiogetbits 324
31 +
32 + #define NR_syscalls 325
33 + #endif
34 +#else
35 + #ifdef CONFIG_FOXBONE
36 + #define __NR_foxboneread 320
37 + #define __NR_foxbonewrite 321
38 + #define __NR_foxbonebulkread 322
39 + #define __NR_foxbonebulkwrite 323
40 + #define __NR_foxboneintreg 324
41 + #define __NR_foxboneintcheck 325
42 + #define __NR_foxboneintwait 326
43 +
44 + #define NR_syscalls 327
45 +
46 + #else
47 +
48 + #define NR_syscalls 320
49 + #endif
50 +#endif
51 +
52 #ifdef __KERNEL__
53
54 -#define NR_syscalls 320
55
56 #include <asm/arch/unistd.h>
57
58 --- linux-2.6.19.2.orig/include/linux/gpio_syscalls.h 1970-01-01 01:00:00.000000000 +0100
59 +++ linux-2.6.19.2/include/linux/gpio_syscalls.h 2007-06-17 03:44:49.000000000 +0200
60 @@ -0,0 +1,75 @@
61 +#ifndef __LINUX_SYSCALL_GPIO
62 +#define __LINUX_SYSCALL_GPIO
63 +#include <linux/autoconf.h>
64 +#include <linux/kernel.h>
65 +#include <linux/errno.h>
66 +#include <asm/unistd.h>
67 +
68 +// port defines
69 +#define PORTA 'A'
70 +#define PORTB 'B'
71 +#define PORTG 'G'
72 +
73 +//direction defines
74 +#define DIRIN 'I'
75 +#define DIROUT 'O'
76 +
77 +// pin defines for PORTG
78 +#define PG0 (1<<0)
79 +#define PG1 (1<<1)
80 +#define PG2 (1<<2)
81 +#define PG3 (1<<3)
82 +#define PG4 (1<<4)
83 +#define PG5 (1<<5)
84 +#define PG6 (1<<6)
85 +#define PG7 (1<<7)
86 +#define PG8 (1<<8)
87 +#define PG9 (1<<9)
88 +#define PG10 (1<<10)
89 +#define PG11 (1<<11)
90 +#define PG12 (1<<12)
91 +#define PG13 (1<<13)
92 +#define PG14 (1<<14)
93 +#define PG15 (1<<15)
94 +#define PG16 (1<<16)
95 +#define PG17 (1<<17)
96 +#define PG18 (1<<18)
97 +#define PG19 (1<<19)
98 +#define PG20 (1<<20)
99 +#define PG21 (1<<21)
100 +#define PG22 (1<<22)
101 +#define PG23 (1<<23)
102 +#define PG24 (1<<24)
103 +
104 +#define PG8_15 0x00ff00
105 +#define PG16_23 0xff0000
106 +
107 +
108 +// pin defines for PORTA
109 +#define PA0 (1<<0)
110 +#define PA1 (1<<1)
111 +#define PA2 (1<<2)
112 +#define PA3 (1<<3)
113 +#define PA4 (1<<4)
114 +#define PA5 (1<<5)
115 +#define PA6 (1<<6)
116 +#define PA7 (1<<7)
117 +
118 +// pin defines for PORTB
119 +#define PB0 (1<<0)
120 +#define PB1 (1<<1)
121 +#define PB2 (1<<2)
122 +#define PB3 (1<<3)
123 +#define PB4 (1<<4)
124 +#define PB5 (1<<5)
125 +#define PB6 (1<<6)
126 +#define PB7 (1<<7)
127 +
128 +int errno;
129 +_syscall2(void, gpiosetbits, unsigned char, port, unsigned int, bits);
130 +_syscall2(void, gpioclearbits, unsigned char, port, unsigned int, bits);
131 +_syscall3(void, gpiosetdir, unsigned char, port, unsigned char, dir, unsigned int, bits);
132 +_syscall2(void, gpiotogglebit, unsigned char, port, unsigned int, bits);
133 +_syscall2(unsigned int, gpiogetbits, unsigned char, port, unsigned int, bits);
134 +
135 +#endif
136 --- linux-2.6.19.2.orig/arch/cris/arch-v10/kernel/entry.S 2007-06-16 23:58:14.000000000 +0200
137 +++ linux-2.6.19.2/arch/cris/arch-v10/kernel/entry.S 2007-06-17 03:48:21.000000000 +0200
138 @@ -1200,6 +1200,23 @@
139 .long sys_move_pages
140 .long sys_getcpu
141 .long sys_epoll_pwait
142 +#ifdef CONFIG_ETRAX_GPIO
143 + .long sys_gpiosetbits
144 + .long sys_gpioclearbits
145 + .long sys_gpiosetdir
146 + .long sys_gpiotogglebit
147 + .long sys_gpiogetbits
148 +#endif
149 +#ifdef CONFIG_FOXBONE
150 + .long sys_foxboneread
151 + .long sys_foxbonewrite
152 + .long sys_foxbonebulkread
153 + .long sys_foxbonebulkwrite
154 + .long sys_foxbonereset
155 + .long sys_foxboneintreg
156 + .long sys_foxboneintcheck
157 + .long sys_foxboneintwait
158 +#endif
159
160 /*
161 * NOTE!! This doesn't have to be exact - we just have
162 diff -urN linux-2.6.19.2.orig/arch/cris/arch-v10/drivers/gpio_syscalls.c linux-2.6.19.2/arch/cris/arch-v10/drivers/gpio_syscalls.c
163 --- linux-2.6.19.2.orig/arch/cris/arch-v10/drivers/gpio_syscalls.c 1970-01-01 01:00:00.000000000 +0100
164 +++ linux-2.6.19.2/arch/cris/arch-v10/drivers/gpio_syscalls.c 2007-06-17 04:09:15.000000000 +0200
165 @@ -0,0 +1,192 @@
166 +
167 +#include <linux/autoconf.h>
168 +
169 +#include <linux/module.h>
170 +#include <linux/sched.h>
171 +#include <linux/slab.h>
172 +#include <linux/ioport.h>
173 +#include <linux/errno.h>
174 +#include <linux/kernel.h>
175 +#include <linux/fs.h>
176 +#include <linux/string.h>
177 +#include <linux/poll.h>
178 +#include <linux/init.h>
179 +#include <linux/interrupt.h>
180 +
181 +#include <asm/uaccess.h>
182 +#include <linux/gpio_syscalls.h>
183 +
184 +#include <asm/etraxgpio.h>
185 +#include <asm/arch/svinto.h>
186 +#include <asm/io.h>
187 +#include <asm/system.h>
188 +#include <asm/irq.h>
189 +#include <asm/arch/io_interface_mux.h>
190 +
191 +#include <asm/unistd.h>
192 +
193 +
194 +extern int errno;
195 +
196 +
197 +asmlinkage void sys_gpiosetbits(unsigned char port, unsigned int bits){
198 + switch(port){
199 + case 'G':
200 + case 'g':
201 + *R_PORT_G_DATA = port_g_data_shadow |= bits;
202 + break;
203 +
204 + case 'A':
205 + case 'a':
206 + *R_PORT_PA_DATA = port_pa_data_shadow |= bits;
207 + break;
208 +
209 + case 'B':
210 + case 'b':
211 + *R_PORT_PB_DATA = port_pb_data_shadow |= bits;
212 + break;
213 +
214 + };
215 +};
216 +
217 +
218 +asmlinkage void sys_gpioclearbits(unsigned char port, unsigned int bits){
219 + switch(port){
220 + case 'G':
221 + case 'g':
222 + *R_PORT_G_DATA = port_g_data_shadow &= ~bits;
223 + break;
224 +
225 + case 'A':
226 + case 'a':
227 + *R_PORT_PA_DATA = port_pa_data_shadow &= ~bits;
228 + break;
229 +
230 + case 'B':
231 + case 'b':
232 + *R_PORT_PB_DATA = port_pb_data_shadow &= ~bits;
233 + break;
234 +
235 + };
236 +};
237 +
238 +asmlinkage void sys_gpiosetdir(unsigned char port, unsigned char dir, unsigned int bits){
239 + if((dir=='I' )||(dir=='i')){
240 + switch(port){
241 + case 'G':
242 + case 'g':
243 + if(bits & (1<<0)){
244 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, g0dir);
245 + };
246 + if((bits & 0x0000FF00)==0x0000FF00){
247 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, g8_15dir);
248 + };
249 + if((bits & 0x00FF0000)==0x00FF0000){
250 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, g16_23dir);
251 + };
252 + if(bits & (1<<24)){
253 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, g24dir);
254 + };
255 + *R_GEN_CONFIG = genconfig_shadow;
256 + break;
257 +
258 + case 'A':
259 + case 'a':
260 + *R_PORT_PA_DIR = port_pa_dir_shadow &= ~(bits & 0xff);
261 + break;
262 +
263 + case 'B':
264 + case 'b':
265 + *R_PORT_PB_DIR = port_pb_dir_shadow &= ~(bits & 0xff);
266 + break;
267 + };
268 + } else if((dir=='O' )||(dir=='o')){
269 + switch(port){
270 + case 'G':
271 + case 'g':
272 + if(bits & (1<<0)){
273 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG, g0dir);
274 + };
275 + if((bits & 0x0000FF00)==0x0000FF00){
276 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG, g8_15dir);
277 + };
278 + if((bits & 0x00FF0000)==0x00FF0000){
279 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG, g8_15dir);
280 + };
281 + if(bits & (1<<24)){
282 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG, g24dir);
283 + };
284 + *R_GEN_CONFIG = genconfig_shadow;
285 + break;
286 +
287 + case 'A':
288 + case 'a':
289 + *R_PORT_PA_DIR = port_pa_dir_shadow |= (bits & 0xff);
290 + break;
291 +
292 + case 'B':
293 + case 'b':
294 + *R_PORT_PB_DIR = port_pb_dir_shadow |= (bits & 0xff);
295 + break;
296 + };
297 + };
298 +};
299 +
300 +
301 +asmlinkage void sys_gpiotogglebit(unsigned char port, unsigned int bits){
302 + switch(port){
303 + case 'G':
304 + case 'g':
305 + if(port_g_data_shadow & bits){
306 + *R_PORT_G_DATA = port_g_data_shadow &= ~bits;
307 + } else {
308 + *R_PORT_G_DATA = port_g_data_shadow |= bits;
309 + };
310 + break;
311 +
312 + case 'A':
313 + case 'a':
314 + if(*R_PORT_PA_DATA & bits){
315 + *R_PORT_PA_DATA = port_pa_data_shadow &= ~(bits & 0xff);
316 + } else {
317 + *R_PORT_PA_DATA = port_pa_data_shadow |= (bits & 0xff);
318 + };
319 + break;
320 +
321 + case 'B':
322 + case 'b':
323 + if(*R_PORT_PB_DATA & bits){
324 + *R_PORT_PB_DATA = port_pb_data_shadow &= ~(bits & 0xff);
325 + } else {
326 + *R_PORT_PB_DATA = port_pb_data_shadow |= (bits & 0xff);
327 + };
328 + break;
329 +
330 + };
331 +};
332 +
333 +
334 +asmlinkage unsigned int sys_gpiogetbits(unsigned char port, unsigned int bits){
335 + unsigned int data = 0;
336 + switch(port){
337 + case 'G':
338 + case 'g':
339 + data = *R_PORT_G_DATA;
340 + break;
341 +
342 + case 'A':
343 + case 'a':
344 + data = *R_PORT_PA_DATA;
345 + break;
346 +
347 + case 'B':
348 + case 'b':
349 + data = *R_PORT_PB_DATA;
350 + break;
351 +
352 + };
353 + data &= bits;
354 + return data;
355 +};
356 +
357 +
358 Only in linux-2.6.19.2/arch/cris/arch-v10/drivers/: gpio_syscalls.c
359 diff linux-2.6.19.2.orig/arch/cris/arch-v10/drivers/Makefile linux-2.6.19.2/arch/cris/arch-v10/drivers/Makefile
360 8a9
361 > obj-$(CONFIG_ETRAX_GPIO) += gpio_syscalls.o
This page took 0.061696 seconds and 5 git commands to generate.