Skip to contentSkip to conversation

AT91 USB Serial Device

PATCH New Rob Emanuele 4 participants 7 messages Nov 11, 2010 – Dec 15, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 AT91 USB Serial Device

Hi Nicolas,

I came across a small bug while debugging my problems of getting the host interface and device interface to work at the same time but on different ports. I had compiled the atmel usb device support as a module and after unloading it and trying to reload it, the irq for vbus was not released. This little patch fixes that

(quoted diff) +0 -0

b/drivers/usb/gadget/atmel_usba_udc.c
index d6ef3d5..bc70e53 100644

drivers/usb/gadget/atmel_usba_udc.c +0 -0
@@ -2052,8 +2052,10 @@ static int __exit usba_udc_remove(struct

platform_device *pdev)

                usba_ep_cleanup_debugfs(&usba_ep[i]);
        usba_cleanup_debugfs(udc);

- if (gpio_is_valid(udc->vbus_pin))
+ if (gpio_is_valid(udc->vbus_pin)) {

+               free_irq(gpio_to_irq(udc->vbus_pin), udc);
                gpio_free(udc->vbus_pin);

+ }

        free_irq(udc->irq, udc);
        kfree(usba_ep);
Quoted 59 lines · Rob Emanuele

Nicolas et al,

Thank you for the information. ?For the moment I have a boot option to use either 2 host ports or a host and a device port. ?That would seem to fit my needs except for the case that I'm loading the usb serial gadget as a module and then specifying in the inittab that getty use it as ttyGS0. ?In that case connecting the device port to a host does not seem to ever register on the host. ?If I remove the getty line from inittab and then run getty manually after it boots, it works fine. ?To add insult to injury, then it will work after reboot also until a hard power down.

Anyone experience this?

Thank you,

Rob

Quoted 39 lines · Nicolas Ferre

Le 05/11/2010 22:09, Rob Emanuele :

Quoted 4 lines

Greetings,

We've been developing a at91sam9g45 product and it is finally available at:
https://www.crystalfontz.com/product/CFA910.html

Very nice platform!

Quoted 4 lines

We are looking into supporting USB OTG on this device as the 'g45 has the USB host/device port. ?As far at I can tell Atmel or anyone else working on this platform has not made full use of this as an OTG device.

Indeed, it is not done for the moment...

Quoted 2 lines

?I haven't found support in the USB or the OTG code for reading the USB ID line to determine host or device mode.

I am not sure USB ID is well supported by consumer cable providers and is a reliable way to determine host or device mode.

Quoted 1 line

Am I missing something or is that an area that needs some code written for it?

Anyway, using this port as host or device is a matter of
1/ driving or not VBUS pin
2/ dealing with loading the gadget driver (as the "Enable" of the usba IP is responsible for swithing to device mode).

I think that determining if the port shall be used in host or device mode can be asked through the GUI... But note that I am not an USB expert... --
Nicolas Ferre

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#1 lore raw

PATCH 1/1 AT91 USB Serial Device

Hi,

please send a patch

Best Regards,
J.

Quoted 93 lines · Rob Emanuele

Hi Nicolas,

I came across a small bug while debugging my problems of getting the host interface and device interface to work at the same time but on different ports. I had compiled the atmel usb device support as a module and after unloading it and trying to reload it, the irq for vbus was not released. This little patch fixes that

drivers/usb/gadget/atmel_usba_udc.c +3 -1
index d6ef3d5..bc70e53 100644
@@ -2052,8 +2052,10 @@ static int __exit usba_udc_remove(struct
 platform_device *pdev)
                usba_ep_cleanup_debugfs(&usba_ep[i]);
        usba_cleanup_debugfs(udc);
 
-       if (gpio_is_valid(udc->vbus_pin))
+       if (gpio_is_valid(udc->vbus_pin)) {
+               free_irq(gpio_to_irq(udc->vbus_pin), udc);
                gpio_free(udc->vbus_pin);
+       }
 
        free_irq(udc->irq, udc);
        kfree(usba_ep);
Quoted 12 lines · Rob Emanuele

Nicolas et al,

Thank you for the information. ?For the moment I have a boot option to use either 2 host ports or a host and a device port. ?That would seem to fit my needs except for the case that I'm loading the usb serial gadget as a module and then specifying in the inittab that getty use it as ttyGS0. ?In that case connecting the device port to a host does not seem to ever register on the host. ?If I remove the getty line from inittab and then run getty manually after it boots, it works fine. ?To add insult to injury, then it will work after reboot also until a hard power down.

Quoted 47 lines

Anyone experience this?

Thank you,

Rob

Quoted 39 lines · Nicolas Ferre

Le 05/11/2010 22:09, Rob Emanuele :

Quoted 4 lines

Greetings,

We've been developing a at91sam9g45 product and it is finally available at:
https://www.crystalfontz.com/product/CFA910.html

Very nice platform!

Quoted 4 lines

We are looking into supporting USB OTG on this device as the 'g45 has the USB host/device port. ?As far at I can tell Atmel or anyone else working on this platform has not made full use of this as an OTG device.

Indeed, it is not done for the moment...

Quoted 2 lines

?I haven't found support in the USB or the OTG code for reading the USB ID line to determine host or device mode.

I am not sure USB ID is well supported by consumer cable providers and is a reliable way to determine host or device mode.

Quoted 1 line

Am I missing something or is that an area that needs some code written for it?

Anyway, using this port as host or device is a matter of
1/ driving or not VBUS pin
2/ dealing with loading the gadget driver (as the "Enable" of the usba IP is responsible for swithing to device mode).

I think that determining if the port shall be used in host or device mode can be asked through the GUI... But note that I am not an USB expert... --
Nicolas Ferre

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw

PATCH 1/1 AT91 USB Serial Device

In reply to Rob Emanuele

Rob,

Le 11/11/2010 02:16, Rob Emanuele :

Quoted 7 lines

Hi Nicolas,

I came across a small bug while debugging my problems of getting the host interface and device interface to work at the same time but on different ports. I had compiled the atmel usb device support as a module and after unloading it and trying to reload it, the irq for vbus was not released. This little patch fixes that

I have created the patch. The only thing that is missing it your

Signed-off-by xxxxx xxx <xxxx@xxx>

line..

Can you please send it to me (even quickly replying to this email saying ok)? I will add it before I send your patch upstream (to usb maintainer).

Bye,

Quoted 81 lines
drivers/usb/gadget/atmel_usba_udc.c +3 -1
index d6ef3d5..bc70e53 100644
@@ -2052,8 +2052,10 @@ static int __exit usba_udc_remove(struct
 platform_device *pdev)
                usba_ep_cleanup_debugfs(&usba_ep[i]);
        usba_cleanup_debugfs(udc);
 
-       if (gpio_is_valid(udc->vbus_pin))
+       if (gpio_is_valid(udc->vbus_pin)) {
+               free_irq(gpio_to_irq(udc->vbus_pin), udc);
                gpio_free(udc->vbus_pin);
+       }
 
        free_irq(udc->irq, udc);
        kfree(usba_ep);
Quoted 59 lines · Rob Emanuele

Nicolas et al,

Thank you for the information. For the moment I have a boot option to use either 2 host ports or a host and a device port. That would seem to fit my needs except for the case that I'm loading the usb serial gadget as a module and then specifying in the inittab that getty use it as ttyGS0. In that case connecting the device port to a host does not seem to ever register on the host. If I remove the getty line from inittab and then run getty manually after it boots, it works fine. To add insult to injury, then it will work after reboot also until a hard power down.

Anyone experience this?

Thank you,

Rob

Quoted 39 lines · Nicolas Ferre

Le 05/11/2010 22:09, Rob Emanuele :

Quoted 4 lines

Greetings,

We've been developing a at91sam9g45 product and it is finally available at:
https://www.crystalfontz.com/product/CFA910.html

Very nice platform!

Quoted 4 lines

We are looking into supporting USB OTG on this device as the 'g45 has the USB host/device port. As far at I can tell Atmel or anyone else working on this platform has not made full use of this as an OTG device.

Indeed, it is not done for the moment...

Quoted 2 lines

I haven't found support in the USB or the OTG code for
reading the USB ID line to determine host or device mode.

I am not sure USB ID is well supported by consumer cable providers and is a reliable way to determine host or device mode.

Quoted 1 line

Am I missing something or is that an area that needs some code written for it?

Anyway, using this port as host or device is a matter of
1/ driving or not VBUS pin
2/ dealing with loading the gadget driver (as the "Enable" of the usba IP is responsible for swithing to device mode).

I think that determining if the port shall be used in host or device mode can be asked through the GUI... But note that I am not an USB expert... --
Nicolas Ferre

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 1 line
Nicolas Ferre
#3 lore raw

PATCH 1/1 AT91: usb gadget: fix freeing irq in _udc_remove()

In reply to Rob Emanuele

From: Rob Emanuele <[email protected]>

Add a free_irq() call on vbus gpio when we remove udc so that the vbus irq is properly released.

---
 drivers/usb/gadget/atmel_usba_udc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/usb/gadget/atmel_usba_udc.c +3 -1
index 717ff65..e7c65a4 100644
@@ -2057,8 +2057,10 @@ static int __exit usba_udc_remove(struct platform_device *pdev)
 		usba_ep_cleanup_debugfs(&usba_ep[i]);
 	usba_cleanup_debugfs(udc);
 
-	if (gpio_is_valid(udc->vbus_pin))
+	if (gpio_is_valid(udc->vbus_pin)) {
+		free_irq(gpio_to_irq(udc->vbus_pin), udc);
 		gpio_free(udc->vbus_pin);
+	}
 
 	free_irq(udc->irq, udc);
 	kfree(usba_ep);
Signature · 1 line
1.7.3
#4 lore raw

Re: [PATCH] AT91: usb gadget: fix freeing irq in _udc_remove()

You _do_ know that $SUBJECT references
an entirely different driver than $PATCH ...

#5 lore raw

PATCH v2 1/1 USB: atmel_usba_udc: fix freeing irq in usba_udc_remove()

From: Rob Emanuele <[email protected]>

Add a free_irq() call on vbus gpio when we remove udc so that the vbus irq is properly released.

---
David,

I modified $SUBJECT to be more explicit about which driver is modified. Hope that makes sense now...

Bye,

 drivers/usb/gadget/atmel_usba_udc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/usb/gadget/atmel_usba_udc.c +3 -1
index 717ff65..e7c65a4 100644
@@ -2057,8 +2057,10 @@ static int __exit usba_udc_remove(struct platform_device *pdev)
 		usba_ep_cleanup_debugfs(&usba_ep[i]);
 	usba_cleanup_debugfs(udc);
 
-	if (gpio_is_valid(udc->vbus_pin))
+	if (gpio_is_valid(udc->vbus_pin)) {
+		free_irq(gpio_to_irq(udc->vbus_pin), udc);
 		gpio_free(udc->vbus_pin);
+	}
 
 	free_irq(udc->irq, udc);
 	kfree(usba_ep);
Signature · 1 line
1.7.3
#6 lore raw

Re: [PATCH v2] USB: atmel_usba_udc: fix freeing irq in usba_udc_remove()

Quoted 8 lines · Nicolas Ferre

From: Rob Emanuele <[email protected]>

Add a free_irq() call on vbus gpio when we remove udc so that the vbus irq is properly released.

---

Best Regards,
J.