diff options
Diffstat (limited to 'drivers/usb/dwc2/hcd_intr.c')
| -rw-r--r-- | drivers/usb/dwc2/hcd_intr.c | 55 | 
1 files changed, 30 insertions, 25 deletions
diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c index 906f223542ee..b8f4b6aaf1d0 100644 --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c @@ -256,7 +256,7 @@ static void dwc2_perio_tx_fifo_empty_intr(struct dwc2_hsotg *hsotg)  static void dwc2_hprt0_enable(struct dwc2_hsotg *hsotg, u32 hprt0,  			      u32 *hprt0_modify)  { -	struct dwc2_core_params *params = hsotg->core_params; +	struct dwc2_core_params *params = &hsotg->params;  	int do_reset = 0;  	u32 usbcfg;  	u32 prtspd; @@ -395,10 +395,10 @@ static void dwc2_port_intr(struct dwc2_hsotg *hsotg)  			dwc2_hprt0_enable(hsotg, hprt0, &hprt0_modify);  		} else {  			hsotg->flags.b.port_enable_change = 1; -			if (hsotg->core_params->dma_desc_fs_enable) { +			if (hsotg->params.dma_desc_fs_enable) {  				u32 hcfg; -				hsotg->core_params->dma_desc_enable = 0; +				hsotg->params.dma_desc_enable = 0;  				hsotg->new_connection = false;  				hcfg = dwc2_readl(hsotg->regs + HCFG);  				hcfg &= ~HCFG_DESCDMA; @@ -604,7 +604,7 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state(  		/* Skip whole frame */  		if (chan->qh->do_split &&  		    chan->ep_type == USB_ENDPOINT_XFER_ISOC && chan->ep_is_in && -		    hsotg->core_params->dma_enable > 0) { +		    hsotg->params.host_dma > 0) {  			qtd->complete_split = 0;  			qtd->isoc_split_offset = 0;  		} @@ -743,7 +743,7 @@ cleanup:  	dwc2_hc_cleanup(hsotg, chan);  	list_add_tail(&chan->hc_list_entry, &hsotg->free_hc_list); -	if (hsotg->core_params->uframe_sched > 0) { +	if (hsotg->params.uframe_sched > 0) {  		hsotg->available_host_channels++;  	} else {  		switch (chan->ep_type) { @@ -789,7 +789,7 @@ static void dwc2_halt_channel(struct dwc2_hsotg *hsotg,  	if (dbg_hc(chan))  		dev_vdbg(hsotg->dev, "%s()\n", __func__); -	if (hsotg->core_params->dma_enable > 0) { +	if (hsotg->params.host_dma > 0) {  		if (dbg_hc(chan))  			dev_vdbg(hsotg->dev, "DMA enabled\n");  		dwc2_release_channel(hsotg, chan, qtd, halt_status); @@ -915,6 +915,8 @@ static int dwc2_xfercomp_isoc_split_in(struct dwc2_hsotg *hsotg,  {  	struct dwc2_hcd_iso_packet_desc *frame_desc;  	u32 len; +	u32 hctsiz; +	u32 pid;  	if (!qtd->urb)  		return 0; @@ -932,7 +934,10 @@ static int dwc2_xfercomp_isoc_split_in(struct dwc2_hsotg *hsotg,  	qtd->isoc_split_offset += len; -	if (frame_desc->actual_length >= frame_desc->length) { +	hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum)); +	pid = (hctsiz & TSIZ_SC_MC_PID_MASK) >> TSIZ_SC_MC_PID_SHIFT; + +	if (frame_desc->actual_length >= frame_desc->length || pid == 0) {  		frame_desc->status = 0;  		qtd->isoc_frame_index++;  		qtd->complete_split = 0; @@ -974,7 +979,7 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg,  	pipe_type = dwc2_hcd_get_pipe_type(&urb->pipe_info); -	if (hsotg->core_params->dma_desc_enable > 0) { +	if (hsotg->params.dma_desc_enable > 0) {  		dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, halt_status);  		if (pipe_type == USB_ENDPOINT_XFER_ISOC)  			/* Do not disable the interrupt, just clear it */ @@ -985,7 +990,7 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg,  	/* Handle xfer complete on CSPLIT */  	if (chan->qh->do_split) {  		if (chan->ep_type == USB_ENDPOINT_XFER_ISOC && chan->ep_is_in && -		    hsotg->core_params->dma_enable > 0) { +		    hsotg->params.host_dma > 0) {  			if (qtd->complete_split &&  			    dwc2_xfercomp_isoc_split_in(hsotg, chan, chnum,  							qtd)) @@ -1097,7 +1102,7 @@ static void dwc2_hc_stall_intr(struct dwc2_hsotg *hsotg,  	dev_dbg(hsotg->dev, "--Host Channel %d Interrupt: STALL Received--\n",  		chnum); -	if (hsotg->core_params->dma_desc_enable > 0) { +	if (hsotg->params.dma_desc_enable > 0) {  		dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,  					    DWC2_HC_XFER_STALL);  		goto handle_stall_done; @@ -1207,7 +1212,7 @@ static void dwc2_hc_nak_intr(struct dwc2_hsotg *hsotg,  	switch (dwc2_hcd_get_pipe_type(&qtd->urb->pipe_info)) {  	case USB_ENDPOINT_XFER_CONTROL:  	case USB_ENDPOINT_XFER_BULK: -		if (hsotg->core_params->dma_enable > 0 && chan->ep_is_in) { +		if (hsotg->params.host_dma > 0 && chan->ep_is_in) {  			/*  			 * NAK interrupts are enabled on bulk/control IN  			 * transfers in DMA mode for the sole purpose of @@ -1353,7 +1358,7 @@ static void dwc2_hc_nyet_intr(struct dwc2_hsotg *hsotg,  	 */  	if (chan->do_split && chan->complete_split) {  		if (chan->ep_is_in && chan->ep_type == USB_ENDPOINT_XFER_ISOC && -		    hsotg->core_params->dma_enable > 0) { +		    hsotg->params.host_dma > 0) {  			qtd->complete_split = 0;  			qtd->isoc_split_offset = 0;  			qtd->isoc_frame_index++; @@ -1374,7 +1379,7 @@ static void dwc2_hc_nyet_intr(struct dwc2_hsotg *hsotg,  			struct dwc2_qh *qh = chan->qh;  			bool past_end; -			if (hsotg->core_params->uframe_sched <= 0) { +			if (hsotg->params.uframe_sched <= 0) {  				int frnum = dwc2_hcd_get_frame_number(hsotg);  				/* Don't have num_hs_transfers; simple logic */ @@ -1467,7 +1472,7 @@ static void dwc2_hc_babble_intr(struct dwc2_hsotg *hsotg,  	dwc2_hc_handle_tt_clear(hsotg, chan, qtd); -	if (hsotg->core_params->dma_desc_enable > 0) { +	if (hsotg->params.dma_desc_enable > 0) {  		dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,  					    DWC2_HC_XFER_BABBLE_ERR);  		goto disable_int; @@ -1572,7 +1577,7 @@ static void dwc2_hc_ahberr_intr(struct dwc2_hsotg *hsotg,  	dev_err(hsotg->dev, "  Interval: %d\n", urb->interval);  	/* Core halts the channel for Descriptor DMA mode */ -	if (hsotg->core_params->dma_desc_enable > 0) { +	if (hsotg->params.dma_desc_enable > 0) {  		dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,  					    DWC2_HC_XFER_AHB_ERR);  		goto handle_ahberr_done; @@ -1604,7 +1609,7 @@ static void dwc2_hc_xacterr_intr(struct dwc2_hsotg *hsotg,  	dwc2_hc_handle_tt_clear(hsotg, chan, qtd); -	if (hsotg->core_params->dma_desc_enable > 0) { +	if (hsotg->params.dma_desc_enable > 0) {  		dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,  					    DWC2_HC_XFER_XACT_ERR);  		goto handle_xacterr_done; @@ -1798,8 +1803,8 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg,  	if (chan->halt_status == DWC2_HC_XFER_URB_DEQUEUE ||  	    (chan->halt_status == DWC2_HC_XFER_AHB_ERR && -	     hsotg->core_params->dma_desc_enable <= 0)) { -		if (hsotg->core_params->dma_desc_enable > 0) +	     hsotg->params.dma_desc_enable <= 0)) { +		if (hsotg->params.dma_desc_enable > 0)  			dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,  						    chan->halt_status);  		else @@ -1830,7 +1835,7 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg,  	} else if (chan->hcint & HCINTMSK_STALL) {  		dwc2_hc_stall_intr(hsotg, chan, chnum, qtd);  	} else if ((chan->hcint & HCINTMSK_XACTERR) && -		   hsotg->core_params->dma_desc_enable <= 0) { +		   hsotg->params.dma_desc_enable <= 0) {  		if (out_nak_enh) {  			if (chan->hcint &  			    (HCINTMSK_NYET | HCINTMSK_NAK | HCINTMSK_ACK)) { @@ -1850,10 +1855,10 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg,  		 */  		dwc2_hc_xacterr_intr(hsotg, chan, chnum, qtd);  	} else if ((chan->hcint & HCINTMSK_XCS_XACT) && -		   hsotg->core_params->dma_desc_enable > 0) { +		   hsotg->params.dma_desc_enable > 0) {  		dwc2_hc_xacterr_intr(hsotg, chan, chnum, qtd);  	} else if ((chan->hcint & HCINTMSK_AHBERR) && -		   hsotg->core_params->dma_desc_enable > 0) { +		   hsotg->params.dma_desc_enable > 0) {  		dwc2_hc_ahberr_intr(hsotg, chan, chnum, qtd);  	} else if (chan->hcint & HCINTMSK_BBLERR) {  		dwc2_hc_babble_intr(hsotg, chan, chnum, qtd); @@ -1946,7 +1951,7 @@ static void dwc2_hc_chhltd_intr(struct dwc2_hsotg *hsotg,  		dev_vdbg(hsotg->dev, "--Host Channel %d Interrupt: Channel Halted--\n",  			 chnum); -	if (hsotg->core_params->dma_enable > 0) { +	if (hsotg->params.host_dma > 0) {  		dwc2_hc_chhltd_intr_dma(hsotg, chan, chnum, qtd);  	} else {  		if (!dwc2_halt_status_ok(hsotg, chan, chnum, qtd)) @@ -2023,7 +2028,7 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum)  		 * interrupt unmasked  		 */  		WARN_ON(hcint != HCINTMSK_CHHLTD); -		if (hsotg->core_params->dma_desc_enable > 0) +		if (hsotg->params.dma_desc_enable > 0)  			dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,  						    chan->halt_status);  		else @@ -2051,7 +2056,7 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum)  	qtd = list_first_entry(&chan->qh->qtd_list, struct dwc2_qtd,  			       qtd_list_entry); -	if (hsotg->core_params->dma_enable <= 0) { +	if (hsotg->params.host_dma <= 0) {  		if ((hcint & HCINTMSK_CHHLTD) && hcint != HCINTMSK_CHHLTD)  			hcint &= ~HCINTMSK_CHHLTD;  	} @@ -2156,7 +2161,7 @@ static void dwc2_hc_intr(struct dwc2_hsotg *hsotg)  		}  	} -	for (i = 0; i < hsotg->core_params->host_channels; i++) { +	for (i = 0; i < hsotg->params.host_channels; i++) {  		if (haint & (1 << i))  			dwc2_hc_n_intr(hsotg, i);  	}  |