3 # Patch managed by http://www.holgerschurig.de/patcher.html
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
10 #include <asm/byteorder.h>
12 +#define SA1100_USB_DEBUG
13 +#ifdef SA1100_USB_DEBUG
14 +extern int sa1100_usb_debug;
17 typedef void (*usb_callback_t)(int flag, int size);
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
23 #include "sa1100_usb.h"
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.
32 //////////////////////////////////////////////////////////////////////////////
34 //////////////////////////////////////////////////////////////////////////////
36 //////////////////////////////////////////////////////////////////////////////
38 //////////////////////////////////////////////////////////////////////////////
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;
47 +static void do_usb_helper (void *status)
49 + char *argv [3], *envp [3];
52 + argv [0] = "/sbin/sausb-hotplug";
54 + argv [1] = device_state_names[(int)status];
57 + envp [0] = "HOME=/";
58 + envp [1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
61 + v = call_usermodehelper (argv [0], argv, envp);
64 + printk ("sausb hotplug returned 0x%x", v);
67 +static struct tq_struct usb_task;
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);
78 static void core_kicker(void);
80 static inline void enable_resume_mask_suspend( void );
83 __u32 status = Ser0UDCSR;
86 /* ReSeT Interrupt Request - UDC has been reset */
87 if ( status & UDCSR_RSTIR )
90 // mask reset ints, they flood during sequence, enable
92 Ser0UDCCR |= UDCCR_REM; // mask reset
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
98 if (status & UDCSR_EIR)
102 + if (Ser0UDCOMP!=63) {
103 + printk("%s: Ser0UDCOMP = %d. Reset to 63\n",__FUNCTION__,Ser0UDCOMP);
108 if (status & UDCSR_RIR)
109 ep1_int_hndlr(status);
113 configured_callback();
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);
121 usbd_info.state = next_device_state;
122 ep1_state_change_notify( next_device_state );
123 ep2_state_change_notify( next_device_state );
128 +#ifdef SA1100_USB_DEBUG
129 +#include <asm/uaccess.h> /* to copy to/from userspace */
130 +struct proc_dir_entry *debug_entry;
132 +static int proc_debug_read (struct file * file, char * buf,
133 + size_t nbytes, loff_t *ppos)
140 + count=sprintf(outputbuf, "%d\n",sa1100_usb_debug);
141 + if (copy_to_user(buf, outputbuf, count))
146 +static ssize_t proc_debug_write(struct file * file, const char * buffer,
147 + size_t count, loff_t *ppos)
152 + sa1100_usb_debug = simple_strtoul(buffer,&endp,0);
153 + // we claim all is read
159 +static struct file_operations proc_debug_operations = {
160 + read: proc_debug_read,
161 + write: proc_debug_write
165 #endif /* CONFIG_PROC_FS */
167 //////////////////////////////////////////////////////////////////////////////
171 create_proc_read_entry ( PROC_NODE_NAME, 0, NULL, usbctl_read_proc, NULL);
172 +#ifdef SA1100_USB_DEBUG
174 + debug_entry = create_proc_entry("sa1100_usb_debug",
175 + S_IWUSR |S_IRUSR | S_IRGRP | S_IROTH,
178 + debug_entry->proc_fops = &proc_debug_operations;
187 remove_proc_entry ( PROC_NODE_NAME, NULL);
188 +#ifdef SA1100_USB_DEBUG
189 + remove_proc_entry("sa1100_usb_debug",&proc_root);
193 sa1100_free_dma(usbd_info.dmach_rx);
195 EXPORT_SYMBOL( sa1100_usb_get_string_descriptor );
196 EXPORT_SYMBOL( sa1100_usb_kmalloc_string_descriptor );
198 +#ifdef SA1100_USB_DEBUG
199 +int sa1100_usb_debug=0;
200 +EXPORT_SYMBOL(sa1100_usb_debug);
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
208 dep_bool ' Yopy' CONFIG_SA1100_YOPY $CONFIG_ARCH_SA1100
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
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