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
5 #define __NR_getcpu 318
6 #define __NR_epoll_pwait 319
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
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
32 + #define NR_syscalls 325
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
44 + #define NR_syscalls 327
48 + #define NR_syscalls 320
54 -#define NR_syscalls 320
56 #include <asm/arch/unistd.h>
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
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>
77 +// pin defines for PORTG
100 +#define PG22 (1<<22)
101 +#define PG23 (1<<23)
102 +#define PG24 (1<<24)
104 +#define PG8_15 0x00ff00
105 +#define PG16_23 0xff0000
108 +// pin defines for PORTA
118 +// pin defines for PORTB
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);
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 @@
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
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
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
167 +#include <linux/autoconf.h>
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>
181 +#include <asm/uaccess.h>
182 +#include <linux/gpio_syscalls.h>
184 +#include <asm/etraxgpio.h>
185 +#include <asm/arch/svinto.h>
187 +#include <asm/system.h>
188 +#include <asm/irq.h>
189 +#include <asm/arch/io_interface_mux.h>
191 +#include <asm/unistd.h>
197 +asmlinkage void sys_gpiosetbits(unsigned char port, unsigned int bits){
201 + *R_PORT_G_DATA = port_g_data_shadow |= bits;
206 + *R_PORT_PA_DATA = port_pa_data_shadow |= bits;
211 + *R_PORT_PB_DATA = port_pb_data_shadow |= bits;
218 +asmlinkage void sys_gpioclearbits(unsigned char port, unsigned int bits){
222 + *R_PORT_G_DATA = port_g_data_shadow &= ~bits;
227 + *R_PORT_PA_DATA = port_pa_data_shadow &= ~bits;
232 + *R_PORT_PB_DATA = port_pb_data_shadow &= ~bits;
238 +asmlinkage void sys_gpiosetdir(unsigned char port, unsigned char dir, unsigned int bits){
239 + if((dir=='I' )||(dir=='i')){
244 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, g0dir);
246 + if((bits & 0x0000FF00)==0x0000FF00){
247 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, g8_15dir);
249 + if((bits & 0x00FF0000)==0x00FF0000){
250 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, g16_23dir);
252 + if(bits & (1<<24)){
253 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, g24dir);
255 + *R_GEN_CONFIG = genconfig_shadow;
260 + *R_PORT_PA_DIR = port_pa_dir_shadow &= ~(bits & 0xff);
265 + *R_PORT_PB_DIR = port_pb_dir_shadow &= ~(bits & 0xff);
268 + } else if((dir=='O' )||(dir=='o')){
273 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG, g0dir);
275 + if((bits & 0x0000FF00)==0x0000FF00){
276 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG, g8_15dir);
278 + if((bits & 0x00FF0000)==0x00FF0000){
279 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG, g8_15dir);
281 + if(bits & (1<<24)){
282 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG, g24dir);
284 + *R_GEN_CONFIG = genconfig_shadow;
289 + *R_PORT_PA_DIR = port_pa_dir_shadow |= (bits & 0xff);
294 + *R_PORT_PB_DIR = port_pb_dir_shadow |= (bits & 0xff);
301 +asmlinkage void sys_gpiotogglebit(unsigned char port, unsigned int bits){
305 + if(port_g_data_shadow & bits){
306 + *R_PORT_G_DATA = port_g_data_shadow &= ~bits;
308 + *R_PORT_G_DATA = port_g_data_shadow |= bits;
314 + if(*R_PORT_PA_DATA & bits){
315 + *R_PORT_PA_DATA = port_pa_data_shadow &= ~(bits & 0xff);
317 + *R_PORT_PA_DATA = port_pa_data_shadow |= (bits & 0xff);
323 + if(*R_PORT_PB_DATA & bits){
324 + *R_PORT_PB_DATA = port_pb_data_shadow &= ~(bits & 0xff);
326 + *R_PORT_PB_DATA = port_pb_data_shadow |= (bits & 0xff);
334 +asmlinkage unsigned int sys_gpiogetbits(unsigned char port, unsigned int bits){
335 + unsigned int data = 0;
339 + data = *R_PORT_G_DATA;
344 + data = *R_PORT_PA_DATA;
349 + data = *R_PORT_PB_DATA;
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
361 > obj-$(CONFIG_ETRAX_GPIO) += gpio_syscalls.o