Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Oct 2013 17:20:00 GMT
From:      dfilter@FreeBSD.ORG (dfilter service)
To:        freebsd-usb@FreeBSD.org
Subject:   Re: usb/181987: commit references a PR
Message-ID:  <201310151720.r9FHK0jv093073@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR usb/181987; it has been noted by GNATS.

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: usb/181987: commit references a PR
Date: Tue, 15 Oct 2013 17:11:22 +0000 (UTC)

 Author: hselasky
 Date: Tue Oct 15 17:11:13 2013
 New Revision: 256548
 URL: http://svnweb.freebsd.org/changeset/base/256548
 
 Log:
   Correct programming of XXX_MAXP register. This register is 16-bit wide
   and not 8-bit. Fix support for isochronous transfers in USB host mode.
   Fix a whitespace while at it.
   
   MFC after:	1 week
   Reported by:	SAITOU Toshihide <toshi@ruby.ocn.ne.jp>
   PR:		usb/181987
 
 Modified:
   head/sys/dev/usb/controller/musb_otg.c
   head/sys/dev/usb/controller/musb_otg.h
 
 Modified: head/sys/dev/usb/controller/musb_otg.c
 ==============================================================================
 --- head/sys/dev/usb/controller/musb_otg.c	Tue Oct 15 17:03:02 2013	(r256547)
 +++ head/sys/dev/usb/controller/musb_otg.c	Tue Oct 15 17:11:13 2013	(r256548)
 @@ -1661,7 +1661,7 @@ repeat:
  	}
  
  	/* Max packet size */
 -	MUSB2_WRITE_1(sc, MUSB2_REG_TXMAXP, td->max_packet);
 +	MUSB2_WRITE_2(sc, MUSB2_REG_TXMAXP, td->reg_max_packet);
  
  	/* write command */
  	MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL,
 @@ -1726,13 +1726,16 @@ repeat:
  		    td->hport);
  
  		/* RX NAK timeout */
 -		MUSB2_WRITE_1(sc, MUSB2_REG_RXNAKLIMIT, MAX_NAK_TO);
 +		if (td->transfer_type & MUSB2_MASK_TI_PROTO_ISOC)
 +			MUSB2_WRITE_1(sc, MUSB2_REG_RXNAKLIMIT, 0);
 +		else
 +			MUSB2_WRITE_1(sc, MUSB2_REG_RXNAKLIMIT, MAX_NAK_TO);
  
  		/* Protocol, speed, device endpoint */
  		MUSB2_WRITE_1(sc, MUSB2_REG_RXTI, td->transfer_type);
  
  		/* Max packet size */
 -		MUSB2_WRITE_1(sc, MUSB2_REG_RXMAXP, td->max_packet);
 +		MUSB2_WRITE_2(sc, MUSB2_REG_RXMAXP, td->reg_max_packet);
  
  		/* Data Toggle */
  		csrh = MUSB2_READ_1(sc, MUSB2_REG_RXCSRH);
 @@ -1938,7 +1941,7 @@ musbotg_host_data_tx(struct musbotg_td *
  		return (0);	/* complete */
  	}
  
 -	if (csr & MUSB2_MASK_CSRL_TXNAKTO ) {
 +	if (csr & MUSB2_MASK_CSRL_TXNAKTO) {
  		/* 
  		 * Flush TX FIFO before clearing NAK TO
  		 */
 @@ -2069,13 +2072,16 @@ musbotg_host_data_tx(struct musbotg_td *
  	    td->hport);
  
  	/* TX NAK timeout */
 -	MUSB2_WRITE_1(sc, MUSB2_REG_TXNAKLIMIT, MAX_NAK_TO);
 +	if (td->transfer_type & MUSB2_MASK_TI_PROTO_ISOC)
 +		MUSB2_WRITE_1(sc, MUSB2_REG_TXNAKLIMIT, 0);
 +	else
 +		MUSB2_WRITE_1(sc, MUSB2_REG_TXNAKLIMIT, MAX_NAK_TO);
  
  	/* Protocol, speed, device endpoint */
  	MUSB2_WRITE_1(sc, MUSB2_REG_TXTI, td->transfer_type);
  
  	/* Max packet size */
 -	MUSB2_WRITE_1(sc, MUSB2_REG_TXMAXP, td->max_packet);
 +	MUSB2_WRITE_2(sc, MUSB2_REG_TXMAXP, td->reg_max_packet);
  
  	if (!td->transaction_started) {
  		csrh = MUSB2_READ_1(sc, MUSB2_REG_TXCSRH);
 @@ -2406,7 +2412,6 @@ musbotg_setup_standard_chain(struct usb_
  
  	if (xfer->flags_int.usb_mode == USB_MODE_HOST) {
  		speed =  usbd_get_speed(xfer->xroot->udev);
 -		xfer_type = xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE;
  
  		switch (speed) {
  			case USB_SPEED_LOW:
 @@ -2444,7 +2449,6 @@ musbotg_setup_standard_chain(struct usb_
  		}
  
  		temp.transfer_type |= ep_no;
 -		td->max_packet = xfer->max_packet_size;
  		td->toggle = xfer->endpoint->toggle_next;
  	}
  
 @@ -2469,9 +2473,9 @@ musbotg_setup_standard_chain(struct usb_
  		x = 0;
  	}
  
 -	if (x != xfer->nframes) {
 -		tx = 0;
 +	tx = 0;
  
 +	if (x != xfer->nframes) {
  		if (xfer->endpointno & UE_DIR_IN)
  		    	tx = 1;
  
 @@ -2532,9 +2536,14 @@ musbotg_setup_standard_chain(struct usb_
  
  		} else {
  
 -			/* regular data transfer */
 -
 -			temp.short_pkt = (xfer->flags.force_short_xfer) ? 0 : 1;
 +			if (xfer->flags_int.isochronous_xfr) {
 +				/* isochronous data transfer */
 +				/* don't force short */
 +				temp.short_pkt = 1;
 +			} else {
 +				/* regular data transfer */
 +				temp.short_pkt = (xfer->flags.force_short_xfer ? 0 : 1);
 +			}
  		}
  
  		musbotg_setup_standard_chain_sub(&temp);
 @@ -3158,7 +3167,12 @@ musbotg_init(struct musbotg_softc *sc)
  
  		if (dynfifo) {
  			if (frx && (temp <= nrx)) {
 -				if (temp < 8) {
 +				if (temp == 1) {
 +					frx = 12;	/* 4K */
 +					MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, 
 +					    MUSB2_VAL_FIFOSZ_4096 |
 +					    MUSB2_MASK_FIFODB);
 +				} else if (temp < 8) {
  					frx = 10;	/* 1K */
  					MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, 
  					    MUSB2_VAL_FIFOSZ_512 |
 @@ -3175,7 +3189,12 @@ musbotg_init(struct musbotg_softc *sc)
  				offset += (1 << frx);
  			}
  			if (ftx && (temp <= ntx)) {
 -				if (temp < 8) {
 +				if (temp == 1) {
 +					ftx = 12;	/* 4K */
 +					MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ,
 +	 				    MUSB2_VAL_FIFOSZ_4096 |
 +	 				    MUSB2_MASK_FIFODB);
 +				} else if (temp < 8) {
  					ftx = 10;	/* 1K */
  					MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ,
  	 				    MUSB2_VAL_FIFOSZ_512 |
 @@ -4042,7 +4061,7 @@ musbotg_xfer_setup(struct usb_setup_para
  	 * reasonable dummies:
  	 */
  	parm->hc_max_packet_size = 0x400;
 -	parm->hc_max_frame_size = 0x400;
 +	parm->hc_max_frame_size = 0xc00;
  
  	if ((parm->methods == &musbotg_device_isoc_methods) ||
  	    (parm->methods == &musbotg_device_intr_methods))
 @@ -4117,6 +4136,8 @@ musbotg_xfer_setup(struct usb_setup_para
  
  			/* init TD */
  			td->max_frame_size = xfer->max_frame_size;
 +			td->reg_max_packet = xfer->max_packet_size |
 +			    ((xfer->max_packet_count - 1) << 11);
  			td->ep_no = ep_no;
  			td->obj_next = last_obj;
  
 
 Modified: head/sys/dev/usb/controller/musb_otg.h
 ==============================================================================
 --- head/sys/dev/usb/controller/musb_otg.h	Tue Oct 15 17:03:02 2013	(r256547)
 +++ head/sys/dev/usb/controller/musb_otg.h	Tue Oct 15 17:11:13 2013	(r256548)
 @@ -316,9 +316,9 @@ struct musbotg_td {
  	uint32_t offset;
  	uint32_t remainder;
  	uint16_t max_frame_size;	/* packet_size * mult */
 +	uint16_t reg_max_packet;
  	uint8_t	ep_no;
  	uint8_t	transfer_type;
 -	uint8_t	max_packet;
  	uint8_t	error:1;
  	uint8_t	alt_next:1;
  	uint8_t	short_pkt:1;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 



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