linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: at91_udc: correct hanging while disconnecting usb cable
@ 2007-12-06 11:07 Nicolas Ferre
  2007-12-06 16:02 ` David Brownell
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Ferre @ 2007-12-06 11:07 UTC (permalink / raw)
  To: David Brownell
  Cc: Andrew Victor, Patrice VILCHEZ, ARM Linux Mailing List,
	Linux Kernel list

Correct hanging while disconnecting the USB device 
cable. Prevent a race between vbus and UDP interrupts.
This bug was tracked on at91sam9260ek boards.

Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com> 
---

A usb resume interrupt was firing after the vbus 
interrupt : the IP was then already stoped and not able 
to deal with it (no more clock). A simple interrupt disabling 
is ok as the "end of bus reset" irq is non maskable and ok 
to resume the USB device IP.

--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -908,6 +908,7 @@ static void pullup(struct at91_udc *udc,
 
 	if (is_on) {
 		clk_on(udc);
+		at91_udp_write(udc, AT91_UDP_ICR, AT91_UDP_RXRSM);
 		at91_udp_write(udc, AT91_UDP_TXVC, 0);
 		if (cpu_is_at91rm9200())
 			at91_set_gpio_value(udc->board.pullup_pin, 1);
@@ -925,6 +926,7 @@ static void pullup(struct at91_udc *udc,
 		}
 	} else {
 		stop_activity(udc);
+		at91_udp_write(udc, AT91_UDP_IDR, AT91_UDP_RXRSM);
 		at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
 		if (cpu_is_at91rm9200())
 			at91_set_gpio_value(udc->board.pullup_pin, 0);


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

* Re: [PATCH] usb: at91_udc: correct hanging while disconnecting usb cable
  2007-12-06 11:07 [PATCH] usb: at91_udc: correct hanging while disconnecting usb cable Nicolas Ferre
@ 2007-12-06 16:02 ` David Brownell
  0 siblings, 0 replies; 2+ messages in thread
From: David Brownell @ 2007-12-06 16:02 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Andrew Victor, Patrice VILCHEZ, ARM Linux Mailing List,
	Linux Kernel list

On Thursday 06 December 2007, Nicolas Ferre wrote:
> Correct hanging while disconnecting the USB device 
> cable. Prevent a race between vbus and UDP interrupts.
> This bug was tracked on at91sam9260ek boards.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com> 
> ---
> 
> A usb resume interrupt was firing after the vbus 
> interrupt : the IP was then already stoped and not able 
> to deal with it (no more clock). A simple interrupt disabling 
> is ok as the "end of bus reset" irq is non maskable and ok 
> to resume the USB device IP.

Good, thanks for finding this.  The bug was reported
recently, and obviously can't be reproduced except on
boards which *have* a VBUS interrupt!

I've signed off on this and suggested Greg merge it
before the 2.6.24-final freeze.

- Dave

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

end of thread, other threads:[~2007-12-06 17:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-06 11:07 [PATCH] usb: at91_udc: correct hanging while disconnecting usb cable Nicolas Ferre
2007-12-06 16:02 ` David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).