]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/opensimpad-64+0/sa1100-usb-tcl1.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / opensimpad-64+0 / sa1100-usb-tcl1.patch
1
2 #
3 # Patch managed by http://www.holgerschurig.de/patcher.html
4 #
5
6 --- linux-2.4.27/arch/arm/mach-sa1100/sa1100_usb.h~sa1100-usb
7 +++ linux-2.4.27/arch/arm/mach-sa1100/sa1100_usb.h
8 @@ -10,6 +10,11 @@
9  #define _SA1100_USB_H
10  #include <asm/byteorder.h>
11  
12 +#define SA1100_USB_DEBUG
13 +#ifdef SA1100_USB_DEBUG
14 +extern int sa1100_usb_debug;
15 +#endif
16 +
17  typedef void (*usb_callback_t)(int flag, int size);
18  
19  /* in usb_ctl.c (see also descriptor methods at bottom of file) */
20 --- linux-2.4.27/arch/arm/mach-sa1100/usb_ctl.c~sa1100-usb
21 +++ linux-2.4.27/arch/arm/mach-sa1100/usb_ctl.c
22 @@ -28,6 +28,12 @@
23  #include "sa1100_usb.h"
24  #include "usb_ctl.h"
25  
26 +// Toby Churchill Ltd modification to re assert Ser0UDCOMP when it gets corrupted (why?)
27 +// Identified by Chris Jones for TCL.
28 +// Added 25/3/2004 N C Bane for balloon board.
29 +#define TCL_FIX
30 +
31 +
32  //////////////////////////////////////////////////////////////////////////////
33  // Prototypes
34  //////////////////////////////////////////////////////////////////////////////
35 @@ -109,6 +115,45 @@
36  //////////////////////////////////////////////////////////////////////////////
37  // Async
38  //////////////////////////////////////////////////////////////////////////////
39 +
40 +#ifdef CONFIG_SA1100_USB_HOTPLUG
41 +// user space notification support for sa1100 usb state change
42 +// Copyright (c) 2003 N C Bane
43 +#include <linux/kmod.h>
44 +#include <linux/interrupt.h>
45 +//static int usb_hotplug_state=USB_STATE_DEFAULT;
46 +
47 +static void do_usb_helper (void *status)
48 +{
49 +       char *argv [3], *envp [3];
50 +       int v;
51 +
52 +       argv [0] = "/sbin/sausb-hotplug";
53 +
54 +       argv [1] = device_state_names[(int)status];
55 +       argv [2] = NULL;
56 +
57 +       envp [0] = "HOME=/";
58 +       envp [1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
59 +       envp [2] = NULL;
60 +
61 +       v = call_usermodehelper (argv [0], argv, envp);
62 +
63 +       if (v != 0)
64 +               printk ("sausb hotplug returned 0x%x", v);
65 +}
66 +
67 +static struct tq_struct usb_task;
68 +
69 +static void usb_helper (int status) {
70 +//    usb_hotplug_state = status;
71 +    usb_task.routine=do_usb_helper;
72 +    usb_task.data=(void *)status;
73 +    schedule_task(&usb_task);
74 +}
75 +
76 +#endif
77 +
78  static void core_kicker(void);
79  
80  static inline void enable_resume_mask_suspend( void );
81 @@ -119,6 +164,7 @@
82  {
83         __u32 status = Ser0UDCSR;
84  
85 +//static int reset;
86         /* ReSeT Interrupt Request - UDC has been reset */
87         if ( status & UDCSR_RSTIR )
88         {
89 @@ -133,6 +179,7 @@
90                 // mask reset ints, they flood during sequence, enable
91                 // suspend and resume
92                 Ser0UDCCR |= UDCCR_REM;    // mask reset
93 +//reset=true;
94                 Ser0UDCCR &= ~(UDCCR_SUSIM | UDCCR_RESIM); // enable suspend and resume
95                 UDC_flip(  Ser0UDCSR, status ); // clear all pending sources
96                 return;         // <-- no reason to continue if resetting
97 @@ -160,6 +207,13 @@
98         if (status & UDCSR_EIR)
99                  ep0_int_hndlr();
100  
101 +#ifdef TCL_FIX
102 +       if (Ser0UDCOMP!=63) {
103 +           printk("%s: Ser0UDCOMP = %d. Reset to 63\n",__FUNCTION__,Ser0UDCOMP);
104 +           Ser0UDCOMP=63;
105 +       }
106 +#endif
107 +
108         if (status & UDCSR_RIR)
109                 ep1_int_hndlr(status);
110  
111 @@ -443,6 +497,12 @@
112                            ) {
113                           configured_callback();
114                         }
115 +#ifdef CONFIG_SA1100_USB_HOTPLUG
116 +                   if (next_device_state == USB_STATE_CONFIGURED)
117 +                       usb_helper(next_device_state);
118 +                   if ((next_device_state == USB_STATE_SUSPENDED) && (usbd_info.state == USB_STATE_CONFIGURED))
119 +                       usb_helper(next_device_state);
120 +#endif
121                         usbd_info.state = next_device_state;
122                         ep1_state_change_notify( next_device_state );
123                         ep2_state_change_notify( next_device_state );
124 @@ -683,6 +743,43 @@
125          return len;
126  }
127  
128 +#ifdef SA1100_USB_DEBUG
129 +#include <asm/uaccess.h>                /* to copy to/from userspace */
130 +struct proc_dir_entry *debug_entry;
131 +
132 +static int proc_debug_read (struct file * file, char * buf,
133 +               size_t nbytes, loff_t *ppos)
134 +{
135 +       char outputbuf[8];
136 +       int count;
137 +       // read completed?
138 +       if (*ppos)
139 +           return 0;
140 +       count=sprintf(outputbuf, "%d\n",sa1100_usb_debug);
141 +       if (copy_to_user(buf, outputbuf, count))
142 +               return -EFAULT;
143 +       return count;
144 +}
145 +
146 +static ssize_t proc_debug_write(struct file * file, const char * buffer,
147 +               size_t count, loff_t *ppos)
148 +{
149 +       char *endp;
150 +       if (*ppos)
151 +           return -EINVAL;
152 +       sa1100_usb_debug = simple_strtoul(buffer,&endp,0);
153 +       // we claim all is read
154 +       return count;
155 +}
156 +
157 +
158 +
159 +static struct file_operations proc_debug_operations = {
160 +       read:   proc_debug_read,
161 +       write:  proc_debug_write
162 +};
163 +
164 +#endif
165  #endif  /* CONFIG_PROC_FS */
166  
167  //////////////////////////////////////////////////////////////////////////////
168 @@ -703,6 +800,15 @@
169  
170  #if CONFIG_PROC_FS
171         create_proc_read_entry ( PROC_NODE_NAME, 0, NULL, usbctl_read_proc, NULL);
172 +#ifdef SA1100_USB_DEBUG
173 +       {
174 +           debug_entry = create_proc_entry("sa1100_usb_debug",
175 +                               S_IWUSR |S_IRUSR | S_IRGRP | S_IROTH,
176 +                               &proc_root);
177 +           if (debug_entry) 
178 +                   debug_entry->proc_fops = &proc_debug_operations;
179 +       }
180 +#endif
181  #endif
182  
183         /* setup rx dma */
184 @@ -751,6 +857,9 @@
185  
186  #if CONFIG_PROC_FS
187      remove_proc_entry ( PROC_NODE_NAME, NULL);
188 +#ifdef SA1100_USB_DEBUG
189 +    remove_proc_entry("sa1100_usb_debug",&proc_root);
190 +#endif
191  #endif
192  
193      sa1100_free_dma(usbd_info.dmach_rx);
194 @@ -769,6 +878,10 @@
195  EXPORT_SYMBOL( sa1100_usb_get_string_descriptor );
196  EXPORT_SYMBOL( sa1100_usb_kmalloc_string_descriptor );
197  
198 +#ifdef SA1100_USB_DEBUG
199 +int sa1100_usb_debug=0;
200 +EXPORT_SYMBOL(sa1100_usb_debug);
201 +#endif
202  
203  module_init( usbctl_init );
204  module_exit( usbctl_exit );
205 --- linux-2.4.27/arch/arm/config.in~sa1100-usb
206 +++ linux-2.4.27/arch/arm/config.in
207 @@ -138,6 +138,9 @@
208  dep_bool '  Yopy' CONFIG_SA1100_YOPY $CONFIG_ARCH_SA1100
209  
210  dep_tristate 'SA1100 USB function support' CONFIG_SA1100_USB $CONFIG_ARCH_SA1100
211 +if [ "$CONFIG_SA1100_USB" != "n" ]; then
212 +   bool '  Support for SA11x0 USB usb-hotplug' CONFIG_SA1100_USB_HOTPLUG
213 +fi
214  dep_tristate '  Support for SA11x0 USB network link function' CONFIG_SA1100_USB_NETLINK $CONFIG_SA1100_USB
215  dep_tristate '  Support for SA11x0 USB character device emulation' CONFIG_SA1100_USB_CHAR $CONFIG_SA1100_USB
216