[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.19 / 0052-USB-ohci-at91-add-a-reset-function-to-fix-race-condi.patch
1 From ac7728e7d633262cd020d764404abf381f282d12 Mon Sep 17 00:00:00 2001
2 From: Nicolas Ferre <nicolas.ferre@atmel.com>
3 Date: Wed, 9 May 2012 10:48:54 +0200
4 Subject: [PATCH 052/117] USB: ohci-at91: add a reset function to fix race
5 condition
7 commit 07e4e556eff4938eb2edf2591de3aa7d7fb82b52 upstream.
9 A possible race condition appears because we are not initializing
10 the ohci->regs before calling usb_hcd_request_irqs().
11 We move the call to ohci_init() in hcd->driver->reset() instead of
12 hcd->driver->start() to fix this.
13 This was experienced when we share the same IRQ line between OHCI and EHCI
14 controllers.
16 Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
17 Tested-by: Christian Eggers <christian.eggers@kathrein.de>
18 Acked-by: Alan Stern <stern@rowland.harvard.edu>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
21 ---
22 drivers/usb/host/ohci-at91.c | 11 ++++++++++-
23 1 file changed, 10 insertions(+), 1 deletion(-)
25 diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
26 index 95a9fec..a60c7aa 100644
27 --- a/drivers/usb/host/ohci-at91.c
28 +++ b/drivers/usb/host/ohci-at91.c
29 @@ -199,7 +199,7 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
30 /*-------------------------------------------------------------------------*/
32 static int __devinit
33 -ohci_at91_start (struct usb_hcd *hcd)
34 +ohci_at91_reset (struct usb_hcd *hcd)
35 {
36 struct at91_usbh_data *board = hcd->self.controller->platform_data;
37 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
38 @@ -209,6 +209,14 @@ ohci_at91_start (struct usb_hcd *hcd)
39 return ret;
41 ohci->num_ports = board->ports;
42 + return 0;
43 +}
44 +
45 +static int __devinit
46 +ohci_at91_start (struct usb_hcd *hcd)
47 +{
48 + struct ohci_hcd *ohci = hcd_to_ohci (hcd);
49 + int ret;
51 if ((ret = ohci_run(ohci)) < 0) {
52 err("can't start %s", hcd->self.bus_name);
53 @@ -390,6 +398,7 @@ static const struct hc_driver ohci_at91_hc_driver = {
54 /*
55 * basic lifecycle operations
56 */
57 + .reset = ohci_at91_reset,
58 .start = ohci_at91_start,
59 .stop = ohci_stop,
60 .shutdown = ohci_shutdown,
61 --
62 1.7.9.5