PERFORCE change 160709 for review

Hans Petter Selasky hselasky at FreeBSD.org
Thu Apr 16 12:38:39 PDT 2009


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

Change 160709 by hselasky at hselasky_laptop001 on 2009/04/16 19:37:41

	
	USB controller (ATMEGADCI):
	
	Re-do last patch. Use single buffering. Double buffering
	does not seem to be supported for 64-byte wMaxPacketSize.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.c#19 edit
.. //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.h#7 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.c#19 (text+ko) ====

@@ -105,7 +105,6 @@
 		.max_in_frame_size = 64,
 		.max_out_frame_size = 64,
 		.is_simplex = 1,
-		.support_multi_buffer = 1,
 		.support_bulk = 1,
 		.support_interrupt = 1,
 		.support_isochronous = 1,
@@ -453,17 +452,13 @@
 		td->error = 1;
 		return (0);		/* complete */
 	}
-	if (!(temp & (ATMEGA_UEINTX_FIFOCON |
-	    ATMEGA_UEINTX_TXINI))) {
-		/* cannot write any data */
+
+	temp = ATMEGA_READ_1(sc, ATMEGA_UESTA0X);
+	if (temp & 3) {
+		/* cannot write any data - a bank is busy */
 		goto not_complete;
 	}
-	if (!(temp & ATMEGA_UEINTX_RWAL)) {
-		if (!td->control_xfr) {
-			/* cannot write any data */
-			goto not_complete;
-		}
-	}
+
 	count = td->max_packet_size;
 	if (td->remainder < count) {
 		/* we have a short packet */
@@ -537,9 +532,9 @@
 	 * The control endpoint has only got one bank, so if that bank
 	 * is free the packet has been transferred!
 	 */
-	if (!(temp & (ATMEGA_UEINTX_FIFOCON |
-	    ATMEGA_UEINTX_TXINI))) {
-		/* cannot write any data */
+	temp = ATMEGA_READ_1(sc, ATMEGA_UESTA0X);
+	if (temp & 3) {
+		/* cannot write any data - a bank is busy */
 		goto not_complete;
 	}
 	if (sc->sc_dv_addr != 0xFF) {
@@ -1174,7 +1169,7 @@
 		ATMEGA_WRITE_1(sc, ATMEGA_UECFG0X, temp);
 		ATMEGA_WRITE_1(sc, ATMEGA_UECFG1X,
 		    ATMEGA_UECFG1X_ALLOC |
-		    ATMEGA_UECFG1X_EPBK1 |
+		    ATMEGA_UECFG1X_EPBK0 |	/* one bank */
 		    ATMEGA_UECFG1X_EPSIZE(3));
 
 		temp = ATMEGA_READ_1(sc, ATMEGA_UESTA0X);
@@ -1985,7 +1980,6 @@
 	uint32_t ntd;
 	uint32_t n;
 	uint8_t ep_no;
-	uint8_t is_control;
 
 	sc = ATMEGA_BUS2SC(parm->udev->bus);
 	xfer = parm->curr_xfer;
@@ -2004,8 +1998,7 @@
 	/*
 	 * compute maximum number of TDs
 	 */
-	is_control = ((xfer->pipe->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL);
-	if (is_control) {
+	if ((xfer->pipe->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) {
 
 		ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */
 		    + 1 /* SYNC 2 */ ;
@@ -2049,8 +2042,6 @@
 			td = USB_ADD_BYTES(parm->buf, parm->size[0]);
 
 			/* init TD */
-			if (is_control)
-				td->control_xfr = 1;
 			td->max_packet_size = xfer->max_packet_size;
 			td->ep_no = ep_no;
 			if (pf->support_multi_buffer) {

==== //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.h#7 (text+ko) ====

@@ -189,7 +189,6 @@
 	uint8_t	short_pkt:1;
 	uint8_t	support_multi_buffer:1;
 	uint8_t	did_stall:1;
-	uint8_t	control_xfr:1;
 	uint8_t	ep_no:3;
 };
 


More information about the p4-projects mailing list