* [PATCH] usb: gadget: udc: atmel: set vbus irqflags explicitly
@ 2017-08-31 12:48 Nicolas Ferre
2017-08-31 12:51 ` [PATCH RESEND new email address] " Nicolas Ferre
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Ferre @ 2017-08-31 12:48 UTC (permalink / raw)
To: Alexandre Belloni, linux-arm-kernel, balbi, linux-usb
Cc: Boris BREZILLON, Quentin Schulz, Ludovic Desroches, linux-kernel,
gregkh, Nicolas Ferre, stable # v4 . 4+
From: Nicolas Ferre <nicolas.ferre@atmel.com>
The driver triggers actions on both edges of the vbus signal.
The former PIO controller was triggering IRQs on both falling and rising edges
by default. Newer PIO controller don't, so it's better to set it explicitly to
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING.
Without this patch we may trigger the connection with host but only on some
bouncing signal conditions and thus lose connecting events.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: stable <stable@vger.kernel.org> # v4.4+
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 98d71400f8a1..a884c022df7a 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -29,6 +29,8 @@
#include <linux/of_gpio.h>
#include "atmel_usba_udc.h"
+#define USBA_VBUS_IRQFLAGS (IRQF_ONESHOT \
+ | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING)
#ifdef CONFIG_USB_GADGET_DEBUG_FS
#include <linux/debugfs.h>
@@ -2361,7 +2363,7 @@ static int usba_udc_probe(struct platform_device *pdev)
IRQ_NOAUTOEN);
ret = devm_request_threaded_irq(&pdev->dev,
gpio_to_irq(udc->vbus_pin), NULL,
- usba_vbus_irq_thread, IRQF_ONESHOT,
+ usba_vbus_irq_thread, USBA_VBUS_IRQFLAGS,
"atmel_usba_udc", udc);
if (ret) {
udc->vbus_pin = -ENODEV;
--
2.9.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH RESEND new email address] usb: gadget: udc: atmel: set vbus irqflags explicitly
2017-08-31 12:48 [PATCH] usb: gadget: udc: atmel: set vbus irqflags explicitly Nicolas Ferre
@ 2017-08-31 12:51 ` Nicolas Ferre
2017-08-31 13:02 ` Ludovic Desroches
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Ferre @ 2017-08-31 12:51 UTC (permalink / raw)
To: Alexandre Belloni, linux-arm-kernel, balbi, linux-usb
Cc: Boris BREZILLON, Quentin Schulz, Ludovic Desroches, linux-kernel,
gregkh, Nicolas Ferre, stable # v4 . 4+
The driver triggers actions on both edges of the vbus signal.
The former PIO controller was triggering IRQs on both falling and rising edges
by default. Newer PIO controller don't, so it's better to set it explicitly to
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING.
Without this patch we may trigger the connection with host but only on some
bouncing signal conditions and thus lose connecting events.
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: stable <stable@vger.kernel.org> # v4.4+
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 98d71400f8a1..a884c022df7a 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -29,6 +29,8 @@
#include <linux/of_gpio.h>
#include "atmel_usba_udc.h"
+#define USBA_VBUS_IRQFLAGS (IRQF_ONESHOT \
+ | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING)
#ifdef CONFIG_USB_GADGET_DEBUG_FS
#include <linux/debugfs.h>
@@ -2361,7 +2363,7 @@ static int usba_udc_probe(struct platform_device *pdev)
IRQ_NOAUTOEN);
ret = devm_request_threaded_irq(&pdev->dev,
gpio_to_irq(udc->vbus_pin), NULL,
- usba_vbus_irq_thread, IRQF_ONESHOT,
+ usba_vbus_irq_thread, USBA_VBUS_IRQFLAGS,
"atmel_usba_udc", udc);
if (ret) {
udc->vbus_pin = -ENODEV;
--
2.9.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND new email address] usb: gadget: udc: atmel: set vbus irqflags explicitly
2017-08-31 12:51 ` [PATCH RESEND new email address] " Nicolas Ferre
@ 2017-08-31 13:02 ` Ludovic Desroches
0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Desroches @ 2017-08-31 13:02 UTC (permalink / raw)
To: Nicolas Ferre
Cc: Alexandre Belloni, linux-arm-kernel, balbi, linux-usb,
Boris BREZILLON, Quentin Schulz, Ludovic Desroches, linux-kernel,
gregkh, stable # v4 . 4+
On Thu, Aug 31, 2017 at 02:51:40PM +0200, Nicolas Ferre wrote:
> The driver triggers actions on both edges of the vbus signal.
>
> The former PIO controller was triggering IRQs on both falling and rising edges
> by default. Newer PIO controller don't, so it's better to set it explicitly to
> IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING.
>
> Without this patch we may trigger the connection with host but only on some
> bouncing signal conditions and thus lose connecting events.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> Cc: stable <stable@vger.kernel.org> # v4.4+
> ---
> drivers/usb/gadget/udc/atmel_usba_udc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index 98d71400f8a1..a884c022df7a 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -29,6 +29,8 @@
> #include <linux/of_gpio.h>
>
> #include "atmel_usba_udc.h"
> +#define USBA_VBUS_IRQFLAGS (IRQF_ONESHOT \
> + | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING)
>
> #ifdef CONFIG_USB_GADGET_DEBUG_FS
> #include <linux/debugfs.h>
> @@ -2361,7 +2363,7 @@ static int usba_udc_probe(struct platform_device *pdev)
> IRQ_NOAUTOEN);
> ret = devm_request_threaded_irq(&pdev->dev,
> gpio_to_irq(udc->vbus_pin), NULL,
> - usba_vbus_irq_thread, IRQF_ONESHOT,
> + usba_vbus_irq_thread, USBA_VBUS_IRQFLAGS,
> "atmel_usba_udc", udc);
> if (ret) {
> udc->vbus_pin = -ENODEV;
> --
> 2.9.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-31 13:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-31 12:48 [PATCH] usb: gadget: udc: atmel: set vbus irqflags explicitly Nicolas Ferre
2017-08-31 12:51 ` [PATCH RESEND new email address] " Nicolas Ferre
2017-08-31 13:02 ` Ludovic Desroches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®