Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Nov 2014 08:47:05 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274842 - head/sys/dev/usb/controller
Message-ID:  <201411220847.sAM8l5ph027433@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Sat Nov 22 08:47:04 2014
New Revision: 274842
URL: https://svnweb.freebsd.org/changeset/base/274842

Log:
  Use correct length mask for split transactions. The hardware would
  sometimes put non-zero values in the upper length bits, which are
  available for high-speed-only USB transactions, breaking the reception
  of data.

Modified:
  head/sys/dev/usb/controller/saf1761_otg.c
  head/sys/dev/usb/controller/saf1761_otg_reg.h

Modified: head/sys/dev/usb/controller/saf1761_otg.c
==============================================================================
--- head/sys/dev/usb/controller/saf1761_otg.c	Sat Nov 22 08:09:26 2014	(r274841)
+++ head/sys/dev/usb/controller/saf1761_otg.c	Sat Nov 22 08:47:04 2014	(r274842)
@@ -510,7 +510,10 @@ saf1761_host_bulk_data_rx(struct saf1761
 			td->error_any = 1;
 			goto complete;
 		}
-		count = (status & SOTG_PTD_DW3_XFER_COUNT);
+		if (td->dw1_value & SOTG_PTD_DW1_ENABLE_SPLIT)
+			count = (status & SOTG_PTD_DW3_XFER_COUNT_SPLIT);
+		else
+			count = (status & SOTG_PTD_DW3_XFER_COUNT_HS);
 		got_short = 0;
 
 		/* verify the packet byte count */
@@ -700,7 +703,10 @@ saf1761_host_intr_data_rx(struct saf1761
 			td->error_any = 1;
 			goto complete;
 		}
-		count = (status & SOTG_PTD_DW3_XFER_COUNT);
+		if (td->dw1_value & SOTG_PTD_DW1_ENABLE_SPLIT)
+			count = (status & SOTG_PTD_DW3_XFER_COUNT_SPLIT);
+		else
+			count = (status & SOTG_PTD_DW3_XFER_COUNT_HS);
 		got_short = 0;
 
 		/* verify the packet byte count */
@@ -895,7 +901,10 @@ saf1761_host_isoc_data_rx(struct saf1761
 		} else if (status & SOTG_PTD_DW3_HALTED) {
 			goto complete;
 		}
-		count = (status & SOTG_PTD_DW3_XFER_COUNT);
+		if (td->dw1_value & SOTG_PTD_DW1_ENABLE_SPLIT)
+			count = (status & SOTG_PTD_DW3_XFER_COUNT_SPLIT);
+		else
+			count = (status & SOTG_PTD_DW3_XFER_COUNT_HS);
 
 		/* verify the packet byte count */
 		if (count != td->max_packet_size) {

Modified: head/sys/dev/usb/controller/saf1761_otg_reg.h
==============================================================================
--- head/sys/dev/usb/controller/saf1761_otg_reg.h	Sat Nov 22 08:09:26 2014	(r274841)
+++ head/sys/dev/usb/controller/saf1761_otg_reg.h	Sat Nov 22 08:47:04 2014	(r274842)
@@ -211,7 +211,8 @@
 #define	SOTG_PTD_DW3_CERR_3 (3U << 23)
 #define	SOTG_PTD_DW3_CERR_2 (2U << 23)	/* infinite NAKs */
 #define	SOTG_PTD_DW3_CERR_1 (1U << 23)
-#define	SOTG_PTD_DW3_XFER_COUNT 0x7FFF
+#define	SOTG_PTD_DW3_XFER_COUNT_HS 0x7FFF
+#define	SOTG_PTD_DW3_XFER_COUNT_SPLIT 0x03FF
 #define	SOTG_PTD_DW4 16
 #define	SOTG_PTD_DW5 20
 #define	SOTG_PTD_DW6 24



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411220847.sAM8l5ph027433>