PERFORCE change 136655 for review

Hans Petter Selasky hselasky at FreeBSD.org
Sun Mar 2 12:49:11 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=136655

Change 136655 by hselasky at hselasky_laptop001 on 2008/03/02 12:48:26

	
	This commit is related to USB Device Side support.
	
	Bugfix: We need to reset the data toggle when configuring
	the device for non-control endpoints.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/uss820_dci.c#8 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/uss820_dci.c#8 (text+ko) ====

@@ -397,7 +397,8 @@
 	rx_stat = bus_space_read_1(td->io_tag, td->io_hdl,
 	    td->rx_stat_reg);
 
-	DPRINTFN(4, "rx_stat=0x%02x rem=%u\n", rx_stat, td->remainder);
+	DPRINTFN(4, "rx_stat=0x%02x rx_flag=0x%02x rem=%u\n",
+	    rx_stat, rx_flag, td->remainder);
 
 	if (rx_stat & (USS820_RXSTAT_RXSETUP |
 	    USS820_RXSTAT_RXSOVW |
@@ -445,6 +446,8 @@
 	    td->rx_count_high_reg) << 8);
 	count &= 0x3FF;
 
+	DPRINTFN(4, "count=0x%04x\n", count);
+
 	/* verify the packet byte count */
 	if (count != td->max_packet_size) {
 		if (count < td->max_packet_size) {
@@ -1443,12 +1446,24 @@
 		USS820_WRITE_1(sc, USS820_EPINDEX, n);
 
 		if ((ep_dir == UE_DIR_IN) || (ep_type == UE_CONTROL)) {
+
+			if (ep_type != UE_CONTROL) {
+				/* reset data toggle */
+				USS820_WRITE_1(sc, USS820_TXSTAT,
+				    USS820_TXSTAT_TXSOVW);
+			}
 			/* configure endpoint */
 			USS820_WRITE_1(sc, USS820_TXCON, temp |
 			    USS820_TXCON_TXCLR);
 			USS820_WRITE_1(sc, USS820_TXCON, temp);
 		}
 		if ((ep_dir == UE_DIR_OUT) || (ep_type == UE_CONTROL)) {
+
+			if (ep_type != UE_CONTROL) {
+				/* reset data toggle */
+				uss820_dci_update_shared_1(sc, USS820_RXSTAT,
+				    0, USS820_RXSTAT_RXSOVW);
+			}
 			/* configure endpoint */
 			USS820_WRITE_1(sc, USS820_RXCON, temp |
 			    USS820_RXCON_RXCLR);


More information about the p4-projects mailing list