All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc2: hcd: Fix host channel halt flow
@ 2017-12-06 14:58 ` Minas Harutyunyan
  0 siblings, 0 replies; 3+ messages in thread
From: Minas Harutyunyan @ 2017-12-06 14:58 UTC (permalink / raw)
  To: John Youn, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel
  Cc: Minas Harutyunyan

According databook in Buffer and External DMA mode
non-split periodic channels can't be halted.

Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
---
 drivers/usb/dwc2/hcd.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 614bb9603def..987122497408 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -985,6 +985,25 @@ void dwc2_hc_halt(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan,
 
 	if (dbg_hc(chan))
 		dev_vdbg(hsotg->dev, "%s()\n", __func__);
+
+	/*
+	 * In buffer DMA or external DMA mode channel can't be halted
+	 * for non-split periodic channels. At the end of the next
+	 * uframe/frame (in the worst case), the core generates a channel
+	 * halted and disables the channel automatically.
+	 */
+	if ((hsotg->core_params->dma_enable > 0 &&
+	     hsotg->core_params->dma_desc_enable <= 0) ||
+	     hsotg->hw_params.arch == GHWCFG2_EXT_DMA_ARCH) {
+		if (!chan->do_split &&
+		    (chan->ep_type == USB_ENDPOINT_XFER_ISOC ||
+		     chan->ep_type == USB_ENDPOINT_XFER_INT)) {
+			dev_err(hsotg->dev, "%s() Channel can't be halted\n",
+				__func__);
+			return;
+		}
+	}
+
 	if (halt_status == DWC2_HC_XFER_NO_HALT_STATUS)
 		dev_err(hsotg->dev, "!!! halt_status = %d !!!\n", halt_status);
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* usb: dwc2: hcd: Fix host channel halt flow
@ 2017-12-06 14:58 ` Minas Harutyunyan
  0 siblings, 0 replies; 3+ messages in thread
From: Minas Harutyunyan @ 2017-12-06 14:58 UTC (permalink / raw)
  To: John Youn, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel
  Cc: Minas Harutyunyan

According databook in Buffer and External DMA mode
non-split periodic channels can't be halted.

Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
---
 drivers/usb/dwc2/hcd.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 614bb9603def..987122497408 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -985,6 +985,25 @@ void dwc2_hc_halt(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan,
 
 	if (dbg_hc(chan))
 		dev_vdbg(hsotg->dev, "%s()\n", __func__);
+
+	/*
+	 * In buffer DMA or external DMA mode channel can't be halted
+	 * for non-split periodic channels. At the end of the next
+	 * uframe/frame (in the worst case), the core generates a channel
+	 * halted and disables the channel automatically.
+	 */
+	if ((hsotg->core_params->dma_enable > 0 &&
+	     hsotg->core_params->dma_desc_enable <= 0) ||
+	     hsotg->hw_params.arch == GHWCFG2_EXT_DMA_ARCH) {
+		if (!chan->do_split &&
+		    (chan->ep_type == USB_ENDPOINT_XFER_ISOC ||
+		     chan->ep_type == USB_ENDPOINT_XFER_INT)) {
+			dev_err(hsotg->dev, "%s() Channel can't be halted\n",
+				__func__);
+			return;
+		}
+	}
+
 	if (halt_status == DWC2_HC_XFER_NO_HALT_STATUS)
 		dev_err(hsotg->dev, "!!! halt_status = %d !!!\n", halt_status);
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: dwc2: hcd: Fix host channel halt flow
       [not found] <728f1476-6b48-f1f7-58ad-b3aaf091bd40@i2se.com>
@ 2017-12-07 17:14 ` Stefan Wahren
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Wahren @ 2017-12-07 17:14 UTC (permalink / raw)
  To: Minas Harutyunyan
  Cc: John Youn, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel

Hi Minas,

Am 07.12.2017 um 18:08 schrieb Stefan Wahren:
> According databook in Buffer and External DMA mode
> non-split periodic channels can't be halted.

do you know of any consequences not having this patch applied?

>
> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>

Please add a fixes tag.

Thanks
Stefan

> ---
>  drivers/usb/dwc2/hcd.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
> index 614bb9603def..987122497408 100644
> --- a/drivers/usb/dwc2/hcd.c
> +++ b/drivers/usb/dwc2/hcd.c
> @@ -985,6 +985,25 @@ void dwc2_hc_halt(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan,
>  
>  	if (dbg_hc(chan))
>  		dev_vdbg(hsotg->dev, "%s()\n", __func__);
> +
> +	/*
> +	 * In buffer DMA or external DMA mode channel can't be halted
> +	 * for non-split periodic channels. At the end of the next
> +	 * uframe/frame (in the worst case), the core generates a channel
> +	 * halted and disables the channel automatically.
> +	 */
> +	if ((hsotg->core_params->dma_enable > 0 &&
> +	     hsotg->core_params->dma_desc_enable <= 0) ||
> +	     hsotg->hw_params.arch == GHWCFG2_EXT_DMA_ARCH) {
> +		if (!chan->do_split &&
> +		    (chan->ep_type == USB_ENDPOINT_XFER_ISOC ||
> +		     chan->ep_type == USB_ENDPOINT_XFER_INT)) {
> +			dev_err(hsotg->dev, "%s() Channel can't be halted\n",
> +				__func__);
> +			return;
> +		}
> +	}
> +
>  	if (halt_status == DWC2_HC_XFER_NO_HALT_STATUS)
>  		dev_err(hsotg->dev, "!!! halt_status = %d !!!\n", halt_status);
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-07 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 14:58 [PATCH] usb: dwc2: hcd: Fix host channel halt flow Minas Harutyunyan
2017-12-06 14:58 ` Minas Harutyunyan
     [not found] <728f1476-6b48-f1f7-58ad-b3aaf091bd40@i2se.com>
2017-12-07 17:14 ` [PATCH] " Stefan Wahren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.