All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] usb: dwc3: core: Add quirk for enabling AutoRetry feature in the controller
@ 2018-07-26 12:37 ` Anurag Kumar Vulisha
  0 siblings, 0 replies; 6+ messages in thread
From: Anurag Kumar Vulisha @ 2018-07-26 12:37 UTC (permalink / raw)
  To: balbi, gregkh
  Cc: v.anuragkumar, linux-usb, linux-kernel, Anurag Kumar Vulisha

By default when core sees any transaction error(CRC or overflow)
it replies with terminating retry ACK (Retry=1 and Nump == 0).
Enabling this Auto Retry feature in controller, on seeing any
transaction errors makes the core to send a non-terminating ACK
transaction packet (that is, ACK TP with Retry=1 and Nump != 0).
Doing so will give controller a chance to recover from the error
condition.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
---
 Changes in v2:
	1. As suggested by Rob Herring & Felipe Balbi removed the
	   quirk logic and setting the AutoRetry bits unconditionally
	   for hostmode
---
 drivers/usb/dwc3/core.c | 14 ++++++++++++++
 drivers/usb/dwc3/core.h |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 1038075..478c8a6 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -883,6 +883,20 @@ static int dwc3_core_init(struct dwc3 *dwc)
 		dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
 	}
 
+	if (dwc->dr_mode == USB_DR_MODE_HOST) {
+		reg = dwc3_readl(dwc->regs, DWC3_GUCTL);
+
+		/* Enable Auto retry Feature to make the controller operating in
+		 * Host mode on seeing transaction errors(CRC errors or internal
+		 * overrun scenerios) on IN transfers to reply to the device
+		 * with a non-terminating retry ACK (i.e, an ACK transcation
+		 * packet with Retry=1 & Nump != 0)
+		 */
+		reg |= DWC3_GUCTL_HSTINAUTORETRY;
+
+		dwc3_writel(dwc->regs, DWC3_GUCTL, reg);
+	}
+
 	/*
 	 * Must config both number of packets and max burst settings to enable
 	 * RX and/or TX threshold.
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 285ce0e..92a1077 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -227,6 +227,9 @@
 #define DWC3_GCTL_GBLHIBERNATIONEN	BIT(1)
 #define DWC3_GCTL_DSBLCLKGTNG		BIT(0)
 
+/* Global User Control Register */
+#define DWC3_GUCTL_HSTINAUTORETRY	BIT(14)
+
 /* Global User Control 1 Register */
 #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS	BIT(28)
 #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW	BIT(24)
-- 
2.1.1


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

* [v2] usb: dwc3: core: Add quirk for enabling AutoRetry feature in the controller
@ 2018-07-26 12:37 ` Anurag Kumar Vulisha
  0 siblings, 0 replies; 6+ messages in thread
From: Anurag Kumar Vulisha @ 2018-07-26 12:37 UTC (permalink / raw)
  To: balbi, gregkh
  Cc: v.anuragkumar, linux-usb, linux-kernel, Anurag Kumar Vulisha

By default when core sees any transaction error(CRC or overflow)
it replies with terminating retry ACK (Retry=1 and Nump == 0).
Enabling this Auto Retry feature in controller, on seeing any
transaction errors makes the core to send a non-terminating ACK
transaction packet (that is, ACK TP with Retry=1 and Nump != 0).
Doing so will give controller a chance to recover from the error
condition.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
---
 Changes in v2:
	1. As suggested by Rob Herring & Felipe Balbi removed the
	   quirk logic and setting the AutoRetry bits unconditionally
	   for hostmode
---
 drivers/usb/dwc3/core.c | 14 ++++++++++++++
 drivers/usb/dwc3/core.h |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 1038075..478c8a6 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -883,6 +883,20 @@ static int dwc3_core_init(struct dwc3 *dwc)
 		dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
 	}
 
+	if (dwc->dr_mode == USB_DR_MODE_HOST) {
+		reg = dwc3_readl(dwc->regs, DWC3_GUCTL);
+
+		/* Enable Auto retry Feature to make the controller operating in
+		 * Host mode on seeing transaction errors(CRC errors or internal
+		 * overrun scenerios) on IN transfers to reply to the device
+		 * with a non-terminating retry ACK (i.e, an ACK transcation
+		 * packet with Retry=1 & Nump != 0)
+		 */
+		reg |= DWC3_GUCTL_HSTINAUTORETRY;
+
+		dwc3_writel(dwc->regs, DWC3_GUCTL, reg);
+	}
+
 	/*
 	 * Must config both number of packets and max burst settings to enable
 	 * RX and/or TX threshold.
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 285ce0e..92a1077 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -227,6 +227,9 @@
 #define DWC3_GCTL_GBLHIBERNATIONEN	BIT(1)
 #define DWC3_GCTL_DSBLCLKGTNG		BIT(0)
 
+/* Global User Control Register */
+#define DWC3_GUCTL_HSTINAUTORETRY	BIT(14)
+
 /* Global User Control 1 Register */
 #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS	BIT(28)
 #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW	BIT(24)

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

* Re: [PATCH v2] usb: dwc3: core: Add quirk for enabling AutoRetry feature in the controller
@ 2018-07-26 12:41   ` Felipe Balbi
  0 siblings, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2018-07-26 12:41 UTC (permalink / raw)
  To: Anurag Kumar Vulisha, gregkh
  Cc: v.anuragkumar, linux-usb, linux-kernel, Anurag Kumar Vulisha

[-- Attachment #1: Type: text/plain, Size: 1572 bytes --]


Hi,

Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com> writes:
> By default when core sees any transaction error(CRC or overflow)
> it replies with terminating retry ACK (Retry=1 and Nump == 0).
> Enabling this Auto Retry feature in controller, on seeing any
> transaction errors makes the core to send a non-terminating ACK
> transaction packet (that is, ACK TP with Retry=1 and Nump != 0).
> Doing so will give controller a chance to recover from the error
> condition.
>
> Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
> ---
>  Changes in v2:
> 	1. As suggested by Rob Herring & Felipe Balbi removed the
> 	   quirk logic and setting the AutoRetry bits unconditionally
> 	   for hostmode
> ---
>  drivers/usb/dwc3/core.c | 14 ++++++++++++++
>  drivers/usb/dwc3/core.h |  3 +++
>  2 files changed, 17 insertions(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 1038075..478c8a6 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -883,6 +883,20 @@ static int dwc3_core_init(struct dwc3 *dwc)
>  		dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
>  	}
>  
> +	if (dwc->dr_mode == USB_DR_MODE_HOST) {

almost there. You also wanna check for dr_mode == OTG. OTG
configurations can switch between device and host mode at will.

> +		reg = dwc3_readl(dwc->regs, DWC3_GUCTL);
> +
> +		/* Enable Auto retry Feature to make the controller operating in

match the multi-line comment style already in this file:

	/*
         * Enable Auto ....

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [v2] usb: dwc3: core: Add quirk for enabling AutoRetry feature in the controller
@ 2018-07-26 12:41   ` Felipe Balbi
  0 siblings, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2018-07-26 12:41 UTC (permalink / raw)
  To: Anurag Kumar Vulisha, gregkh; +Cc: v.anuragkumar, linux-usb, linux-kernel

Hi,

Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com> writes:
> By default when core sees any transaction error(CRC or overflow)
> it replies with terminating retry ACK (Retry=1 and Nump == 0).
> Enabling this Auto Retry feature in controller, on seeing any
> transaction errors makes the core to send a non-terminating ACK
> transaction packet (that is, ACK TP with Retry=1 and Nump != 0).
> Doing so will give controller a chance to recover from the error
> condition.
>
> Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
> ---
>  Changes in v2:
> 	1. As suggested by Rob Herring & Felipe Balbi removed the
> 	   quirk logic and setting the AutoRetry bits unconditionally
> 	   for hostmode
> ---
>  drivers/usb/dwc3/core.c | 14 ++++++++++++++
>  drivers/usb/dwc3/core.h |  3 +++
>  2 files changed, 17 insertions(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 1038075..478c8a6 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -883,6 +883,20 @@ static int dwc3_core_init(struct dwc3 *dwc)
>  		dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
>  	}
>  
> +	if (dwc->dr_mode == USB_DR_MODE_HOST) {

almost there. You also wanna check for dr_mode == OTG. OTG
configurations can switch between device and host mode at will.

> +		reg = dwc3_readl(dwc->regs, DWC3_GUCTL);
> +
> +		/* Enable Auto retry Feature to make the controller operating in

match the multi-line comment style already in this file:

	/*
         * Enable Auto ....

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

* RE: [PATCH v2] usb: dwc3: core: Add quirk for enabling AutoRetry feature in the controller
@ 2018-07-27  7:29     ` Anurag Kumar Vulisha
  0 siblings, 0 replies; 6+ messages in thread
From: Anurag Kumar Vulisha @ 2018-07-27  7:29 UTC (permalink / raw)
  To: Felipe Balbi, gregkh; +Cc: v.anuragkumar, linux-usb, linux-kernel


Hi Felipe,

Thanks again for reviewing the patch. Will make the suggested changes and send v3.

Thanks,
Anurag Kumar Vulisha

>-----Original Message-----
>From: Felipe Balbi [mailto:balbi@kernel.org]
>Sent: Thursday, July 26, 2018 6:12 PM
>To: Anurag Kumar Vulisha <anuragku@xilinx.com>; gregkh@linuxfoundation.org
>Cc: v.anuragkumar@gmail.com; linux-usb@vger.kernel.org; linux-
>kernel@vger.kernel.org; Anurag Kumar Vulisha <anuragku@xilinx.com>
>Subject: Re: [PATCH v2] usb: dwc3: core: Add quirk for enabling AutoRetry feature in
>the controller
>
>
>Hi,
>
>Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com> writes:
>> By default when core sees any transaction error(CRC or overflow) it
>> replies with terminating retry ACK (Retry=1 and Nump == 0).
>> Enabling this Auto Retry feature in controller, on seeing any
>> transaction errors makes the core to send a non-terminating ACK
>> transaction packet (that is, ACK TP with Retry=1 and Nump != 0).
>> Doing so will give controller a chance to recover from the error
>> condition.
>>
>> Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
>> ---
>>  Changes in v2:
>> 	1. As suggested by Rob Herring & Felipe Balbi removed the
>> 	   quirk logic and setting the AutoRetry bits unconditionally
>> 	   for hostmode
>> ---
>>  drivers/usb/dwc3/core.c | 14 ++++++++++++++  drivers/usb/dwc3/core.h
>> |  3 +++
>>  2 files changed, 17 insertions(+)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index
>> 1038075..478c8a6 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -883,6 +883,20 @@ static int dwc3_core_init(struct dwc3 *dwc)
>>  		dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
>>  	}
>>
>> +	if (dwc->dr_mode == USB_DR_MODE_HOST) {
>
>almost there. You also wanna check for dr_mode == OTG. OTG configurations can
>switch between device and host mode at will.
>
>> +		reg = dwc3_readl(dwc->regs, DWC3_GUCTL);
>> +
>> +		/* Enable Auto retry Feature to make the controller operating in
>
>match the multi-line comment style already in this file:
>
>	/*
>         * Enable Auto ....
>
>--
>balbi

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

* [v2] usb: dwc3: core: Add quirk for enabling AutoRetry feature in the controller
@ 2018-07-27  7:29     ` Anurag Kumar Vulisha
  0 siblings, 0 replies; 6+ messages in thread
From: Anurag Kumar Vulisha @ 2018-07-27  7:29 UTC (permalink / raw)
  To: Felipe Balbi, gregkh; +Cc: v.anuragkumar, linux-usb, linux-kernel

Hi Felipe,

Thanks again for reviewing the patch. Will make the suggested changes and send v3.

Thanks,
Anurag Kumar Vulisha

>-----Original Message-----
>From: Felipe Balbi [mailto:balbi@kernel.org]
>Sent: Thursday, July 26, 2018 6:12 PM
>To: Anurag Kumar Vulisha <anuragku@xilinx.com>; gregkh@linuxfoundation.org
>Cc: v.anuragkumar@gmail.com; linux-usb@vger.kernel.org; linux-
>kernel@vger.kernel.org; Anurag Kumar Vulisha <anuragku@xilinx.com>
>Subject: Re: [PATCH v2] usb: dwc3: core: Add quirk for enabling AutoRetry feature in
>the controller
>
>
>Hi,
>
>Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com> writes:
>> By default when core sees any transaction error(CRC or overflow) it
>> replies with terminating retry ACK (Retry=1 and Nump == 0).
>> Enabling this Auto Retry feature in controller, on seeing any
>> transaction errors makes the core to send a non-terminating ACK
>> transaction packet (that is, ACK TP with Retry=1 and Nump != 0).
>> Doing so will give controller a chance to recover from the error
>> condition.
>>
>> Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
>> ---
>>  Changes in v2:
>> 	1. As suggested by Rob Herring & Felipe Balbi removed the
>> 	   quirk logic and setting the AutoRetry bits unconditionally
>> 	   for hostmode
>> ---
>>  drivers/usb/dwc3/core.c | 14 ++++++++++++++  drivers/usb/dwc3/core.h
>> |  3 +++
>>  2 files changed, 17 insertions(+)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index
>> 1038075..478c8a6 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -883,6 +883,20 @@ static int dwc3_core_init(struct dwc3 *dwc)
>>  		dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
>>  	}
>>
>> +	if (dwc->dr_mode == USB_DR_MODE_HOST) {
>
>almost there. You also wanna check for dr_mode == OTG. OTG configurations can
>switch between device and host mode at will.
>
>> +		reg = dwc3_readl(dwc->regs, DWC3_GUCTL);
>> +
>> +		/* Enable Auto retry Feature to make the controller operating in
>
>match the multi-line comment style already in this file:
>
>	/*
>         * Enable Auto ....
>
>--
>balbi
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2018-07-27  7:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-26 12:37 [PATCH v2] usb: dwc3: core: Add quirk for enabling AutoRetry feature in the controller Anurag Kumar Vulisha
2018-07-26 12:37 ` [v2] " Anurag Kumar Vulisha
2018-07-26 12:41 ` [PATCH v2] " Felipe Balbi
2018-07-26 12:41   ` [v2] " Felipe Balbi
2018-07-27  7:29   ` [PATCH v2] " Anurag Kumar Vulisha
2018-07-27  7:29     ` [v2] " Anurag Kumar Vulisha

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.