public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Fix an Atmel USBA UDC issue introducted in 4.17-rc1
@ 2018-05-11 10:19 Romain Izard
  2018-05-11 10:19 ` [PATCH v2 1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod Romain Izard
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Romain Izard @ 2018-05-11 10:19 UTC (permalink / raw)
  To: Nicolas Ferre, Felipe Balbi, Greg Kroah-Hartman,
	Alexandre Belloni, Ludovic Desroches
  Cc: linux-kernel, linux-arm-kernel, linux-usb, Romain Izard

The use of GPIO descriptors takes care of inversion flags declared in
the device tree. The conversion of the Atmel USBA UDC driver introduced
in 4.17-rc1 missed it, and as a result the inversion will not work.

In addition, cleanup the code to remove an include left behind after
the suppression of the support of platform_data to declare USBA
controllers.

These changes have not been tested on any hardware, as I do not have
a board that needs to use inverted GPIOs.

--
Changes in v2:
- Use the correct format for the "Fixes:" tag
- Collect "Acked-by:" tags


Romain Izard (3):
  usb: gadget: udc: atmel: GPIO inversion is handled by gpiod
  usb: gadget: udc: atmel: Remove obsolete include
  usb: gadget: udc: atmel: Fix indenting

 drivers/usb/gadget/udc/atmel_usba_udc.c | 22 ++++++++++------------
 drivers/usb/gadget/udc/atmel_usba_udc.h |  1 -
 include/linux/usb/atmel_usba_udc.h      | 24 ------------------------
 3 files changed, 10 insertions(+), 37 deletions(-)
 delete mode 100644 include/linux/usb/atmel_usba_udc.h

-- 
2.14.1


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

* [PATCH v2 1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod
  2018-05-11 10:19 [PATCH v2 0/3] Fix an Atmel USBA UDC issue introducted in 4.17-rc1 Romain Izard
@ 2018-05-11 10:19 ` Romain Izard
  2018-05-11 10:19 ` [PATCH v2 2/3] usb: gadget: udc: atmel: Remove obsolete include Romain Izard
  2018-05-11 10:19 ` [PATCH v2 3/3] usb: gadget: udc: atmel: Fix indenting Romain Izard
  2 siblings, 0 replies; 4+ messages in thread
From: Romain Izard @ 2018-05-11 10:19 UTC (permalink / raw)
  To: Nicolas Ferre, Felipe Balbi, Greg Kroah-Hartman,
	Alexandre Belloni, Ludovic Desroches
  Cc: linux-kernel, linux-arm-kernel, linux-usb, Romain Izard

When converting to GPIO descriptors, gpiod_get_value automatically
handles the line inversion flags from the device tree.

Do not invert the line twice.

Fixes: 3df034081021 ("usb: gadget: udc: atmel: convert to use GPIO descriptors")
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 3 +--
 drivers/usb/gadget/udc/atmel_usba_udc.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 27c16399c7e8..0fe3d0feb8f7 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -417,7 +417,7 @@ static inline void usba_int_enb_set(struct usba_udc *udc, u32 val)
 static int vbus_is_present(struct usba_udc *udc)
 {
 	if (udc->vbus_pin)
-		return gpiod_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted;
+		return gpiod_get_value(udc->vbus_pin);
 
 	/* No Vbus detection: Assume always present */
 	return 1;
@@ -2076,7 +2076,6 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
 
 	udc->vbus_pin = devm_gpiod_get_optional(&pdev->dev, "atmel,vbus",
 						GPIOD_IN);
-	udc->vbus_pin_inverted = gpiod_is_active_low(udc->vbus_pin);
 
 	if (fifo_mode == 0) {
 		pp = NULL;
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h
index 969ce8f3c3e2..d7eb7cf4fd5c 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.h
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
@@ -326,7 +326,6 @@ struct usba_udc {
 	const struct usba_udc_errata *errata;
 	int irq;
 	struct gpio_desc *vbus_pin;
-	int vbus_pin_inverted;
 	int num_ep;
 	int configured_ep;
 	struct usba_fifo_cfg *fifo_cfg;
-- 
2.14.1


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

* [PATCH v2 2/3] usb: gadget: udc: atmel: Remove obsolete include
  2018-05-11 10:19 [PATCH v2 0/3] Fix an Atmel USBA UDC issue introducted in 4.17-rc1 Romain Izard
  2018-05-11 10:19 ` [PATCH v2 1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod Romain Izard
@ 2018-05-11 10:19 ` Romain Izard
  2018-05-11 10:19 ` [PATCH v2 3/3] usb: gadget: udc: atmel: Fix indenting Romain Izard
  2 siblings, 0 replies; 4+ messages in thread
From: Romain Izard @ 2018-05-11 10:19 UTC (permalink / raw)
  To: Nicolas Ferre, Felipe Balbi, Greg Kroah-Hartman,
	Alexandre Belloni, Ludovic Desroches
  Cc: linux-kernel, linux-arm-kernel, linux-usb, Romain Izard

The include defines the private platform_data structure used with AVR
platforms. It has no user since 7c55984e191f. Remove it.

Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c |  1 -
 include/linux/usb/atmel_usba_udc.h      | 24 ------------------------
 2 files changed, 25 deletions(-)
 delete mode 100644 include/linux/usb/atmel_usba_udc.h

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 0fe3d0feb8f7..b9623e228609 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -20,7 +20,6 @@
 #include <linux/ctype.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
-#include <linux/usb/atmel_usba_udc.h>
 #include <linux/delay.h>
 #include <linux/of.h>
 #include <linux/irq.h>
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h
deleted file mode 100644
index 9bb00df3b53f..000000000000
--- a/include/linux/usb/atmel_usba_udc.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Platform data definitions for Atmel USBA gadget driver.
- */
-#ifndef __LINUX_USB_USBA_H
-#define __LINUX_USB_USBA_H
-
-struct usba_ep_data {
-	char	*name;
-	int	index;
-	int	fifo_size;
-	int	nr_banks;
-	int	can_dma;
-	int	can_isoc;
-};
-
-struct usba_platform_data {
-	int			vbus_pin;
-	int			vbus_pin_inverted;
-	int			num_ep;
-	struct usba_ep_data	ep[0];
-};
-
-#endif /* __LINUX_USB_USBA_H */
-- 
2.14.1


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

* [PATCH v2 3/3] usb: gadget: udc: atmel: Fix indenting
  2018-05-11 10:19 [PATCH v2 0/3] Fix an Atmel USBA UDC issue introducted in 4.17-rc1 Romain Izard
  2018-05-11 10:19 ` [PATCH v2 1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod Romain Izard
  2018-05-11 10:19 ` [PATCH v2 2/3] usb: gadget: udc: atmel: Remove obsolete include Romain Izard
@ 2018-05-11 10:19 ` Romain Izard
  2 siblings, 0 replies; 4+ messages in thread
From: Romain Izard @ 2018-05-11 10:19 UTC (permalink / raw)
  To: Nicolas Ferre, Felipe Balbi, Greg Kroah-Hartman,
	Alexandre Belloni, Ludovic Desroches
  Cc: linux-kernel, linux-arm-kernel, linux-usb, Romain Izard

Fix the fallout of the conversion to GPIO descriptors in 3df034081021.

Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index b9623e228609..2f586f2bda7e 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2277,15 +2277,15 @@ static int usba_udc_probe(struct platform_device *pdev)
 	if (udc->vbus_pin) {
 		irq_set_status_flags(gpiod_to_irq(udc->vbus_pin), IRQ_NOAUTOEN);
 		ret = devm_request_threaded_irq(&pdev->dev,
-					gpiod_to_irq(udc->vbus_pin), NULL,
-					usba_vbus_irq_thread, USBA_VBUS_IRQFLAGS,
-					"atmel_usba_udc", udc);
-			if (ret) {
-				udc->vbus_pin = NULL;
-				dev_warn(&udc->pdev->dev,
-					 "failed to request vbus irq; "
-					 "assuming always on\n");
-			}
+				gpiod_to_irq(udc->vbus_pin), NULL,
+				usba_vbus_irq_thread, USBA_VBUS_IRQFLAGS,
+				"atmel_usba_udc", udc);
+		if (ret) {
+			udc->vbus_pin = NULL;
+			dev_warn(&udc->pdev->dev,
+				 "failed to request vbus irq; "
+				 "assuming always on\n");
+		}
 	}
 
 	ret = usb_add_gadget_udc(&pdev->dev, &udc->gadget);
-- 
2.14.1


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

end of thread, other threads:[~2018-05-11 10:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-11 10:19 [PATCH v2 0/3] Fix an Atmel USBA UDC issue introducted in 4.17-rc1 Romain Izard
2018-05-11 10:19 ` [PATCH v2 1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod Romain Izard
2018-05-11 10:19 ` [PATCH v2 2/3] usb: gadget: udc: atmel: Remove obsolete include Romain Izard
2018-05-11 10:19 ` [PATCH v2 3/3] usb: gadget: udc: atmel: Fix indenting Romain Izard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox