Fix an Atmel USBA UDC issue introducted in 4.17-rc1
Subsystems (3)
cover Fix an Atmel USBA UDC issue introducted in 4.17-rc1
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.
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
Signature · 1 line
2.14.1
PATCH 1/3 usb: gadget: udc: atmel: GPIO inversion is handled by gpiod
When converting to GPIO descriptors, gpiod_get_value automatically handles the line inversion flags from the device tree.
Do not invert the line twice.
--- 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(-)
drivers/usb/gadget/udc/atmel_usba_udc.c +1 -2
@@ -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 ;
drivers/usb/gadget/udc/atmel_usba_udc.h +0 -1
@@ -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;
Signature · 1 line
2.14.1
PATCH 2/3 usb: gadget: udc: atmel: Remove obsolete include
In reply to Romain IzardThe include defines the private platform_data structure used with AVR platforms. It has no user since 7c55984e191f. Remove it.
--- 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
drivers/usb/gadget/udc/atmel_usba_udc.c +0 -1
@@ -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>
include/linux/usb/atmel_usba_udc.h deleted +0 -24
@@ -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 */
Signature · 1 line
2.14.1
PATCH 3/3 usb: gadget: udc: atmel: Fix indenting
In reply to Romain IzardFix the fallout of the conversion to GPIO descriptors in 3df034081021.
--- drivers/usb/gadget/udc/atmel_usba_udc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/usb/gadget/udc/atmel_usba_udc.c +9 -9
@@ -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);
Signature · 1 line
2.14.1
Re: [PATCH 1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod
In reply to Romain IzardQuoted 2 lines · Romain Izard
When converting to GPIO descriptors,
gpiod_get_valueautomatically handles the line inversion flags from the device tree.
Thanks, I totally missed it.
Regards
Quoted 6 lines
Do not invert the line twice.
Fixes 3df034081021fa4b6967ce3364bc7d867ec1c870Signed-off-by Romain Izard <[email protected]>
Quoted 41 lines
--- 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(-)drivers/usb/gadget/udc/atmel_usba_udc.c +1
-2@@ -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 ;drivers/usb/gadget/udc/atmel_usba_udc.h +0
-1@@ -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;Signature · 1 line
2.14.1
Re: [PATCH 2/3] usb: gadget: udc: atmel: Remove obsolete include
In reply to Romain IzardQuoted 4 lines · Romain Izard
The include defines the private
platform_datastructure used with AVR platforms. It has no user since7c55984e191f. Remove it.Signed-off-by Romain Izard <[email protected]>
Quoted 51 lines
--- 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.hdrivers/usb/gadget/udc/atmel_usba_udc.c +0
-1@@ -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> include/linux/usb/atmel_usba_udc.h deleted +0
-24@@ -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 */ Signature · 1 line
2.14.1
Re: [PATCH 3/3] usb: gadget: udc: atmel: Fix indenting
In reply to Romain IzardQuoted 3 lines · Romain Izard
Fix the fallout of the conversion to GPIO descriptors in
3df034081021.Signed-off-by Romain Izard <[email protected]>
Quoted 41 lines
--- drivers/usb/gadget/udc/atmel_usba_udc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)drivers/usb/gadget/udc/atmel_usba_udc.c +9
-9@@ -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);Signature · 7 lines
2.14.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 8 lines · 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_datato declare USBA controllers.
Quoted 7 lines
These changes have not been tested on any hardware, as I do not have a board that needs to use inverted GPIOs.
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
To the whole series:
Thank you Romain.
Best regards,
Nicolas
Quoted 7 lines
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
Signature · 1 line
Nicolas Ferre
Re: [PATCH 1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod
In reply to Romain IzardQuoted 6 lines · Romain Izard
When converting to GPIO descriptors,
gpiod_get_valueautomatically handles the line inversion flags from the device tree.Do not invert the line twice.
Fixes 3df034081021fa4b6967ce3364bc7d867ec1c870
your fixes line is incorrect. Please fix and resend. While at that, please collect Acked-bys and Tested-bys, etc.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180425/d7365672/attachment.sig>