Subject: Re: Malta + USB on 2.4, anyone?

From: "Maciej W. Rozycki" <[email-masked]>
Date: Fri, 1 Aug 2003 09:58:15 +0200 (MET DST)

On Thu, 31 Jul 2003, Jun Sun wrote:

> Using the alternative JE driver sovles the problem.  
> 
> I suspect the main UHCI driver does not get cache flushing
> or bus/virt address right.

 Well, since the JE driver is the UHCI driver for 2.6, I wouldn't care.

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email-masked], PGP key available        +

---

From: Atsushi Nemoto <[email-masked]>
Date: Fri, 01 Aug 2003 17:26:23 +0900 (JST)

>>>>> On Thu, 31 Jul 2003 11:15:06 -0700, Jun Sun <[email-masked]> said:
jsun> I suspect the main UHCI driver does not get cache flushing or
jsun> bus/virt address right.

It seems usb_control_msg is not safe with an unaligned buffer.  Is
this patch solve your problem?

diff -u linux-2.4.21/drivers/usb/usb.c linux/drivers/usb/usb.c
--- linux-2.4.21/drivers/usb/usb.c	Tue Jul 15 13:49:34 2003
+++ linux/drivers/usb/usb.c	Tue Jul 15 21:20:44 2003
@@ -1172,9 +1172,24 @@
 {
 	struct usb_ctrlrequest *dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
 	int ret;
+#ifdef __mips__ /* BUG??? */
+	void *tmpdata = NULL;
+#endif
 	
 	if (!dr)
 		return -ENOMEM;
+#ifdef __mips__ /* BUG??? */
+	if (size) {
+		tmpdata = kmalloc(size, GFP_KERNEL);
+		if (!data) {
+			kfree(dr);
+			return -ENOMEM;
+		}
+		memcpy(tmpdata, data, size);
+	} else {
+		tmpdata = data;
+	}
+#endif
 
 	dr->bRequestType = requesttype;
 	dr->bRequest = request;
@@ -1184,7 +1199,15 @@
 
 	//dbg("usb_control_msg");	
 
+#ifdef __mips__ /* BUG??? */
+	ret = usb_internal_control_msg(dev, pipe, dr, tmpdata, size, timeout);
+	if (size) {
+		memcpy(data, tmpdata, size);
+		kfree(tmpdata);
+	}
+#else
 	ret = usb_internal_control_msg(dev, pipe, dr, data, size, timeout);
+#endif
 
 	kfree(dr);
 
---
Atsushi Nemoto

---

From: Jun Sun <[email-masked]>
Date: Fri, 1 Aug 2003 10:47:25 -0700

> this patch solve your problem?

Nope.

The symptoms of erractic hw behavior seems to suggest maybe addressing
is wrong in physical space.  Just a guess.  I don't think I will spend
more time on this though. :)

Thanks for the patch.

Jun