# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.383.2.94 -> 1.383.20.1
#	drivers/usb/usb-ohci.c	1.22    -> 1.23   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/05/02	david-b@pacbell.net	1.383.20.1
# [PATCH] PATCH 2.4.19-pre7 usb-ohci and wmb()
# 
# USB usb-ohci fix
# 
# This patch just adds a few strategic wmb() calls, to ensure
# that the HC and HCD agree on just what control and bulk
# requests are being made.
# 
# Seems restructuring "usb-ohci" into "ohci-hcd" made that
# failure become more common/visible. (Faster code?)  So
# this backports a 2.5 "ohci-hcd" fix into 2.4's "usb-ohci".
# 
# The effect of not having these calls was that some hardware
# could fail to enumerate devices ... kernel messages would
# report a "usb_control/bulk_msg: timeout" happened.  We've
# had such (infrequent) problem reports before, but until now
# nobody was able to confirm the wmb() calls mattered.
# --------------------------------------------
#
diff -Nru a/drivers/usb/usb-ohci.c b/drivers/usb/usb-ohci.c
--- a/drivers/usb/usb-ohci.c	Fri May  3 14:51:45 2002
+++ b/drivers/usb/usb-ohci.c	Fri May  3 14:51:45 2002
@@ -1336,6 +1336,7 @@
 	td->hwPSW [0] = cpu_to_le16 ((data & 0x0FFF) | 0xE000);
 
 	/* append to queue */
+	wmb();
 	td->ed->hwTailP = td->hwNextTD;
 }
 
@@ -1399,8 +1400,10 @@
 				cnt++;
 			}
 
-			if (!ohci->sleeping)
+			if (!ohci->sleeping) {
+				wmb();
 				writel (OHCI_BLF, &ohci->regs->cmdstatus); /* start bulk list */
+			}
 			break;
 
 		case PIPE_INTERRUPT:
@@ -1425,8 +1428,10 @@
 			info = usb_pipeout (urb->pipe)? 
  				TD_CC | TD_DP_IN | TD_T_DATA1: TD_CC | TD_DP_OUT | TD_T_DATA1;
 			td_fill (ohci, info, data, 0, urb, cnt++);
-			if (!ohci->sleeping)
+			if (!ohci->sleeping) {
+				wmb();
 				writel (OHCI_CLF, &ohci->regs->cmdstatus); /* start Control list */
+			}
 			break;
 
 		case PIPE_ISOCHRONOUS:
