--- /dev/null
+From jejb@kernel.org Fri Oct 17 16:19:35 2008
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 17 Oct 2008 23:10:23 GMT
+Subject: OHCI: Allow broken controllers to auto-stop
+To: jejb@kernel.org, stable@kernel.org
+Message-ID: <200810172310.m9HNANgO009044@hera.kernel.org>
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit 4a511bc3f5829bc18428bcf11c25417a79d09396 upstream
+
+This patch (as1134) attempts to improve the way we handle OHCI
+controllers with broken Root Hub Status Change interrupt support. In
+these controllers the RHSC interrupt bit essentially never turns off,
+making RHSC interrupts useless -- they have to remain permanently
+disabled.
+
+Such controllers should still be allowed to turn off their root hubs
+when no devices are attached. Polling for new connections can
+continue while the root hub is suspended. The patch implements this
+feature. (It won't have much effect unless CONFIG_PM is enabled and
+CONFIG_USB_SUSPEND is disabled, but since the overhead is very small
+we may as well do it.)
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/ohci-hub.c | 60 +++++++++++++++++++++++---------------------
+ 1 file changed, 32 insertions(+), 28 deletions(-)
+
+--- a/drivers/usb/host/ohci-hub.c
++++ b/drivers/usb/host/ohci-hub.c
+@@ -362,18 +362,23 @@ static int ohci_root_hub_state_changes(s
+ int any_connected)
+ {
+ int poll_rh = 1;
+- int rhsc;
++ int rhsc_status, rhsc_enable;
+
+- rhsc = ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC;
+- switch (ohci->hc_control & OHCI_CTRL_HCFS) {
++ /* Some broken controllers never turn off RHCS in the interrupt
++ * status register. For their sake we won't re-enable RHSC
++ * interrupts if the interrupt bit is already active.
++ */
++ rhsc_status = ohci_readl(ohci, &ohci->regs->intrstatus) &
++ OHCI_INTR_RHSC;
++ rhsc_enable = ohci_readl(ohci, &ohci->regs->intrenable) &
++ OHCI_INTR_RHSC;
+
++ switch (ohci->hc_control & OHCI_CTRL_HCFS) {
+ case OHCI_USB_OPER:
+- /* If no status changes are pending, enable status-change
+- * interrupts.
+- */
+- if (!rhsc && !changed) {
+- rhsc = OHCI_INTR_RHSC;
+- ohci_writel(ohci, rhsc, &ohci->regs->intrenable);
++ /* If no status changes are pending, enable RHSC interrupts. */
++ if (!rhsc_enable && !rhsc_status && !changed) {
++ rhsc_enable = OHCI_INTR_RHSC;
++ ohci_writel(ohci, rhsc_enable, &ohci->regs->intrenable);
+ }
+
+ /* Keep on polling until we know a device is connected
+@@ -383,7 +388,7 @@ static int ohci_root_hub_state_changes(s
+ if (any_connected ||
+ !device_may_wakeup(&ohci_to_hcd(ohci)
+ ->self.root_hub->dev)) {
+- if (rhsc)
++ if (rhsc_enable)
+ poll_rh = 0;
+ } else {
+ ohci->autostop = 1;
+@@ -396,34 +401,36 @@ static int ohci_root_hub_state_changes(s
+ ohci->autostop = 0;
+ ohci->next_statechange = jiffies +
+ STATECHANGE_DELAY;
+- } else if (rhsc && time_after_eq(jiffies,
++ } else if (time_after_eq(jiffies,
+ ohci->next_statechange)
+ && !ohci->ed_rm_list
+ && !(ohci->hc_control &
+ OHCI_SCHED_ENABLES)) {
+ ohci_rh_suspend(ohci, 1);
+- poll_rh = 0;
++ if (rhsc_enable)
++ poll_rh = 0;
+ }
+ }
+ break;
+
+- /* if there is a port change, autostart or ask to be resumed */
+ case OHCI_USB_SUSPEND:
+ case OHCI_USB_RESUME:
++ /* if there is a port change, autostart or ask to be resumed */
+ if (changed) {
+ if (ohci->autostop)
+ ohci_rh_resume(ohci);
+ else
+ usb_hcd_resume_root_hub(ohci_to_hcd(ohci));
+ } else {
+- if (!rhsc && (ohci->autostop ||
++ if (!rhsc_enable && !rhsc_status && (ohci->autostop ||
+ ohci_to_hcd(ohci)->self.root_hub->
+- do_remote_wakeup))
+- ohci_writel(ohci, OHCI_INTR_RHSC,
++ do_remote_wakeup)) {
++ rhsc_enable = OHCI_INTR_RHSC;
++ ohci_writel(ohci, rhsc_enable,
+ &ohci->regs->intrenable);
+-
+- /* everything is idle, no need for polling */
+- poll_rh = 0;
++ }
++ if (rhsc_enable)
++ poll_rh = 0;
+ }
+ break;
+ }
+@@ -443,12 +450,16 @@ static inline int ohci_rh_resume(struct
+ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
+ int any_connected)
+ {
++ int rhsc_status;
++
+ /* If RHSC is enabled, don't poll */
+ if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC)
+ return 0;
+
+- /* If no status changes are pending, enable status-change interrupts */
+- if (!changed) {
++ /* If no status changes are pending, enable RHSC interrupts */
++ rhsc_status = ohci_readl(ohci, &ohci->regs->intrstatus) &
++ OHCI_INTR_RHSC;
++ if (!changed && !rhsc_status) {
+ ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
+ return 0;
+ }
+@@ -492,13 +503,6 @@ ohci_hub_status_data (struct usb_hcd *hc
+ length++;
+ }
+
+- /* Some broken controllers never turn off RHCS in the interrupt
+- * status register. For their sake we won't re-enable RHSC
+- * interrupts if the flag is already set.
+- */
+- if (ohci_readl(ohci, &ohci->regs->intrstatus) & OHCI_INTR_RHSC)
+- changed = 1;
+-
+ /* look at each port */
+ for (i = 0; i < ohci->num_ports; i++) {
+ u32 status = roothub_portstatus (ohci, i);
md-fix-rdev_size_store-with-size-0.patch
xfs-fix-remount-rw-with-unrecognized-options.patch
ath9k-fix-oops-on-trying-to-hold-the-wrong-spinlock.patch
+ohci-allow-broken-controllers-to-auto-stop.patch
+usb-ohci-fix-endless-polling-behavior.patch
+usb-fix-s3c2410_udc-usb-speed-handling.patch
+usb-ehci-log-a-warning-if-ehci-hcd-is-not-loaded-first.patch
+usb-gadget-cdc-ethernet-notification-bugfix.patch
+usb-musb_hdrc-build-fixes.patch
--- /dev/null
+From jejb@kernel.org Fri Oct 17 16:21:21 2008
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 17 Oct 2008 23:10:07 GMT
+Subject: USB: EHCI: log a warning if ehci-hcd is not loaded first
+To: jejb@kernel.org, stable@kernel.org
+Message-ID: <200810172310.m9HNA7v9008672@hera.kernel.org>
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit 9beeee6584b9aa4f9192055512411484a2a624df upstream
+
+This patch (as1139) adds a warning to the system log whenever ehci-hcd
+is loaded after ohci-hcd or uhci-hcd. Nowadays most distributions are
+pretty good about not doing this; maybe the warning will help convince
+anyone still doing it wrong.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/hcd.c | 4 ++++
+ drivers/usb/core/hcd.h | 6 ++++++
+ drivers/usb/host/ehci-hcd.c | 15 +++++++++++++--
+ drivers/usb/host/ohci-hcd.c | 3 +++
+ drivers/usb/host/uhci-hcd.c | 3 +++
+ 5 files changed, 29 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/core/hcd.c
++++ b/drivers/usb/core/hcd.c
+@@ -81,6 +81,10 @@
+
+ /*-------------------------------------------------------------------------*/
+
++/* Keep track of which host controller drivers are loaded */
++unsigned long usb_hcds_loaded;
++EXPORT_SYMBOL_GPL(usb_hcds_loaded);
++
+ /* host controllers we manage */
+ LIST_HEAD (usb_bus_list);
+ EXPORT_SYMBOL_GPL (usb_bus_list);
+--- a/drivers/usb/core/hcd.h
++++ b/drivers/usb/core/hcd.h
+@@ -482,4 +482,10 @@ static inline void usbmon_urb_complete(s
+ */
+ extern struct rw_semaphore ehci_cf_port_reset_rwsem;
+
++/* Keep track of which host controller drivers are loaded */
++#define USB_UHCI_LOADED 0
++#define USB_OHCI_LOADED 1
++#define USB_EHCI_LOADED 2
++extern unsigned long usb_hcds_loaded;
++
+ #endif /* __KERNEL__ */
+--- a/drivers/usb/host/ehci-hcd.c
++++ b/drivers/usb/host/ehci-hcd.c
+@@ -1049,6 +1049,12 @@ static int __init ehci_hcd_init(void)
+ {
+ int retval = 0;
+
++ set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
++ if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
++ test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
++ printk(KERN_WARNING "Warning! ehci_hcd should always be loaded"
++ " before uhci_hcd and ohci_hcd, not after\n");
++
+ pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
+ hcd_name,
+ sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
+@@ -1056,8 +1062,10 @@ static int __init ehci_hcd_init(void)
+
+ #ifdef DEBUG
+ ehci_debug_root = debugfs_create_dir("ehci", NULL);
+- if (!ehci_debug_root)
+- return -ENOENT;
++ if (!ehci_debug_root) {
++ retval = -ENOENT;
++ goto err_debug;
++ }
+ #endif
+
+ #ifdef PLATFORM_DRIVER
+@@ -1104,7 +1112,9 @@ clean0:
+ #ifdef DEBUG
+ debugfs_remove(ehci_debug_root);
+ ehci_debug_root = NULL;
++err_debug:
+ #endif
++ clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
+ return retval;
+ }
+ module_init(ehci_hcd_init);
+@@ -1126,6 +1136,7 @@ static void __exit ehci_hcd_cleanup(void
+ #ifdef DEBUG
+ debugfs_remove(ehci_debug_root);
+ #endif
++ clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
+ }
+ module_exit(ehci_hcd_cleanup);
+
+--- a/drivers/usb/host/ohci-hcd.c
++++ b/drivers/usb/host/ohci-hcd.c
+@@ -1098,6 +1098,7 @@ static int __init ohci_hcd_mod_init(void
+ printk (KERN_DEBUG "%s: " DRIVER_INFO "\n", hcd_name);
+ pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
+ sizeof (struct ed), sizeof (struct td));
++ set_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
+
+ #ifdef DEBUG
+ ohci_debug_root = debugfs_create_dir("ohci", NULL);
+@@ -1184,6 +1185,7 @@ static int __init ohci_hcd_mod_init(void
+ error_debug:
+ #endif
+
++ clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
+ return retval;
+ }
+ module_init(ohci_hcd_mod_init);
+@@ -1214,6 +1216,7 @@ static void __exit ohci_hcd_mod_exit(voi
+ #ifdef DEBUG
+ debugfs_remove(ohci_debug_root);
+ #endif
++ clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
+ }
+ module_exit(ohci_hcd_mod_exit);
+
+--- a/drivers/usb/host/uhci-hcd.c
++++ b/drivers/usb/host/uhci-hcd.c
+@@ -953,6 +953,7 @@ static int __init uhci_hcd_init(void)
+
+ printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION "%s\n",
+ ignore_oc ? ", overcurrent ignored" : "");
++ set_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
+
+ if (usb_disabled())
+ return -ENODEV;
+@@ -988,6 +989,7 @@ debug_failed:
+
+ errbuf_failed:
+
++ clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
+ return retval;
+ }
+
+@@ -997,6 +999,7 @@ static void __exit uhci_hcd_cleanup(void
+ kmem_cache_destroy(uhci_up_cachep);
+ debugfs_remove(uhci_debugfs_root);
+ kfree(errbuf);
++ clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
+ }
+
+ module_init(uhci_hcd_init);
--- /dev/null
+From jejb@kernel.org Fri Oct 17 16:20:51 2008
+From: Yauhen Kharuzhy <jekhor@gmail.com>
+Date: Fri, 17 Oct 2008 23:10:20 GMT
+Subject: USB: Fix s3c2410_udc usb speed handling
+To: jejb@kernel.org, stable@kernel.org
+Message-ID: <200810172310.m9HNAKFR008968@hera.kernel.org>
+
+From: Yauhen Kharuzhy <jekhor@gmail.com>
+
+commit f9e9cff613b8239ce9159735aa662c9c85b478bf upstream
+
+The new composite framework revealed a weakness in the
+s3c2410_udc driver gadget register function. Instead of
+checking if speed asked for was USB_LOW_SPEED upon
+usb_gadget_register() to deny service, it checked only
+for USB_FULL_SPEED, thus denying service to usb high
+speed capable gadgets (like g_ether).
+
+Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
+Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/s3c2410_udc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/gadget/s3c2410_udc.c
++++ b/drivers/usb/gadget/s3c2410_udc.c
+@@ -1651,7 +1651,7 @@ int usb_gadget_register_driver(struct us
+ return -EBUSY;
+
+ if (!driver->bind || !driver->setup
+- || driver->speed != USB_SPEED_FULL) {
++ || driver->speed < USB_SPEED_FULL) {
+ printk(KERN_ERR "Invalid driver: bind %p setup %p speed %d\n",
+ driver->bind, driver->setup, driver->speed);
+ return -EINVAL;
--- /dev/null
+From jejb@kernel.org Fri Oct 17 16:26:47 2008
+From: David Brownell <dbrownell@users.sourceforge.net>
+Date: Fri, 17 Oct 2008 23:10:12 GMT
+Subject: usb gadget: cdc ethernet notification bugfix
+To: jejb@kernel.org, stable@kernel.org
+Message-ID: <200810172310.m9HNACds008778@hera.kernel.org>
+
+From: David Brownell <dbrownell@users.sourceforge.net>
+
+commit 29bac7b7661bbbdbbd32bc1e6cedca22f260da7f upstream
+
+Bugfix for the new CDC Ethernet code: as part of activating the
+network interface's USB link, make sure its link management code
+knows whether the interface is open or not.
+
+Without this fix, the link won't work right when it's brought up
+before the link is active ... because the initial notification it
+sends will have the wrong link state (down, not up). Makes it
+hard to bridge these links (on the host side), among other things.
+
+Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/u_ether.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/usb/gadget/u_ether.c
++++ b/drivers/usb/gadget/u_ether.c
+@@ -873,6 +873,13 @@ struct net_device *gether_connect(struct
+ spin_lock(&dev->lock);
+ dev->port_usb = link;
+ link->ioport = dev;
++ if (netif_running(dev->net)) {
++ if (link->open)
++ link->open(link);
++ } else {
++ if (link->close)
++ link->close(link);
++ }
+ spin_unlock(&dev->lock);
+
+ netif_carrier_on(dev->net);
--- /dev/null
+From jejb@kernel.org Fri Oct 17 16:27:27 2008
+From: David Brownell <dbrownell@users.sourceforge.net>
+Date: Fri, 17 Oct 2008 23:10:16 GMT
+Subject: usb: musb_hdrc build fixes
+To: jejb@kernel.org, stable@kernel.org
+Message-ID: <200810172310.m9HNAGZm008869@hera.kernel.org>
+
+From: David Brownell <dbrownell@users.sourceforge.net>
+
+commit c767c1c6f1febbd1351cc152bba6e37889322d17 upstream
+
+Minor musb_hdrc updates:
+
+ - so it'll build on DaVinci, given relevant platform updates;
+ * remove support for an un-shipped OTG prototype
+ * rely on gpiolib framework conversion for the I2C GPIOs
+ * the <asm/arch/hdrc_cnf.h> mechanism has been removed
+
+ - catch comments up to the recent removal of the per-SOC header
+ with the silicon configuration data;
+
+ - and remove two inappropriate "inline" declarations which
+ just bloat host side code.
+
+There are still some more <asm/arch/XYZ.h> ==> <mach/XYZ.h>
+changes needed in this driver, catching up to the relocation
+of most of the include/asm-arm/arch-* contents.
+
+Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/musb/Kconfig | 4 ----
+ drivers/usb/musb/cppi_dma.h | 4 ++--
+ drivers/usb/musb/davinci.c | 20 ++++----------------
+ drivers/usb/musb/musb_core.c | 8 ++++----
+ drivers/usb/musb/musb_host.c | 6 +++---
+ 5 files changed, 13 insertions(+), 29 deletions(-)
+
+--- a/drivers/usb/musb/cppi_dma.h
++++ b/drivers/usb/musb/cppi_dma.h
+@@ -119,8 +119,8 @@ struct cppi {
+ void __iomem *mregs; /* Mentor regs */
+ void __iomem *tibase; /* TI/CPPI regs */
+
+- struct cppi_channel tx[MUSB_C_NUM_EPT - 1];
+- struct cppi_channel rx[MUSB_C_NUM_EPR - 1];
++ struct cppi_channel tx[4];
++ struct cppi_channel rx[4];
+
+ struct dma_pool *pool;
+
+--- a/drivers/usb/musb/davinci.c
++++ b/drivers/usb/musb/davinci.c
+@@ -30,6 +30,7 @@
+ #include <linux/delay.h>
+ #include <linux/clk.h>
+ #include <linux/io.h>
++#include <linux/gpio.h>
+
+ #include <asm/arch/hardware.h>
+ #include <asm/arch/memory.h>
+@@ -39,7 +40,7 @@
+ #include "musb_core.h"
+
+ #ifdef CONFIG_MACH_DAVINCI_EVM
+-#include <asm/arch/i2c-client.h>
++#define GPIO_nVBUS_DRV 87
+ #endif
+
+ #include "davinci.h"
+@@ -138,7 +139,6 @@ static int vbus_state = -1;
+ /* VBUS SWITCHING IS BOARD-SPECIFIC */
+
+ #ifdef CONFIG_MACH_DAVINCI_EVM
+-#ifndef CONFIG_MACH_DAVINCI_EVM_OTG
+
+ /* I2C operations are always synchronous, and require a task context.
+ * With unloaded systems, using the shared workqueue seems to suffice
+@@ -146,12 +146,11 @@ static int vbus_state = -1;
+ */
+ static void evm_deferred_drvvbus(struct work_struct *ignored)
+ {
+- davinci_i2c_expander_op(0x3a, USB_DRVVBUS, vbus_state);
++ gpio_set_value_cansleep(GPIO_nVBUS_DRV, vbus_state);
+ vbus_state = !vbus_state;
+ }
+ static DECLARE_WORK(evm_vbus_work, evm_deferred_drvvbus);
+
+-#endif /* modified board */
+ #endif /* EVM */
+
+ static void davinci_source_power(struct musb *musb, int is_on, int immediate)
+@@ -165,21 +164,10 @@ static void davinci_source_power(struct
+
+ #ifdef CONFIG_MACH_DAVINCI_EVM
+ if (machine_is_davinci_evm()) {
+-#ifdef CONFIG_MACH_DAVINCI_EVM_OTG
+- /* modified EVM board switching VBUS with GPIO(6) not I2C
+- * NOTE: PINMUX0.RGB888 (bit23) must be clear
+- */
+- if (is_on)
+- gpio_set(GPIO(6));
+- else
+- gpio_clear(GPIO(6));
+- immediate = 1;
+-#else
+ if (immediate)
+- davinci_i2c_expander_op(0x3a, USB_DRVVBUS, !is_on);
++ gpio_set_value_cansleep(GPIO_nVBUS_DRV, vbus_state);
+ else
+ schedule_work(&evm_vbus_work);
+-#endif
+ }
+ #endif
+ if (immediate)
+--- a/drivers/usb/musb/Kconfig
++++ b/drivers/usb/musb/Kconfig
+@@ -33,10 +33,6 @@ config USB_MUSB_SOC
+ default y if ARCH_DAVINCI
+ default y if ARCH_OMAP2430
+ default y if ARCH_OMAP34XX
+- help
+- Use a static <asm/arch/hdrc_cnf.h> file to describe how the
+- controller is configured (endpoints, mechanisms, etc) on the
+- current iteration of a given system-on-chip.
+
+ comment "DaVinci 644x USB support"
+ depends on USB_MUSB_HDRC && ARCH_DAVINCI
+--- a/drivers/usb/musb/musb_core.c
++++ b/drivers/usb/musb/musb_core.c
+@@ -82,9 +82,9 @@
+ /*
+ * This gets many kinds of configuration information:
+ * - Kconfig for everything user-configurable
+- * - <asm/arch/hdrc_cnf.h> for SOC or family details
+ * - platform_device for addressing, irq, and platform_data
+ * - platform_data is mostly for board-specific informarion
++ * (plus recentrly, SOC or family details)
+ *
+ * Most of the conditional compilation will (someday) vanish.
+ */
+@@ -974,9 +974,9 @@ static void musb_shutdown(struct platfor
+ /*
+ * The silicon either has hard-wired endpoint configurations, or else
+ * "dynamic fifo" sizing. The driver has support for both, though at this
+- * writing only the dynamic sizing is very well tested. We use normal
+- * idioms to so both modes are compile-tested, but dead code elimination
+- * leaves only the relevant one in the object file.
++ * writing only the dynamic sizing is very well tested. Since we switched
++ * away from compile-time hardware parameters, we can no longer rely on
++ * dead code elimination to leave only the relevant one in the object file.
+ *
+ * We don't currently use dynamic fifo setup capability to do anything
+ * more than selecting one of a bunch of predefined configurations.
+--- a/drivers/usb/musb/musb_host.c
++++ b/drivers/usb/musb/musb_host.c
+@@ -108,7 +108,7 @@ static void musb_ep_program(struct musb
+ /*
+ * Clear TX fifo. Needed to avoid BABBLE errors.
+ */
+-static inline void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
++static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
+ {
+ void __iomem *epio = ep->regs;
+ u16 csr;
+@@ -436,7 +436,7 @@ musb_advance_schedule(struct musb *musb,
+ }
+ }
+
+-static inline u16 musb_h_flush_rxfifo(struct musb_hw_ep *hw_ep, u16 csr)
++static u16 musb_h_flush_rxfifo(struct musb_hw_ep *hw_ep, u16 csr)
+ {
+ /* we don't want fifo to fill itself again;
+ * ignore dma (various models),
+@@ -1005,7 +1005,7 @@ static bool musb_h_ep0_continue(struct m
+
+ /*
+ * Handle default endpoint interrupt as host. Only called in IRQ time
+- * from the LinuxIsr() interrupt service routine.
++ * from musb_interrupt().
+ *
+ * called with controller irqlocked
+ */
--- /dev/null
+From jejb@kernel.org Fri Oct 17 16:20:11 2008
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 17 Oct 2008 23:10:03 GMT
+Subject: USB: OHCI: fix endless polling behavior
+To: jejb@kernel.org, stable@kernel.org
+Message-ID: <200810172310.m9HNA3Ch008542@hera.kernel.org>
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit 71b7497c078a97e2afb774ad7c1f8ff5bdda8a60 upstream
+
+This patch (as1149) fixes an obscure problem in OHCI polling. In the
+current code, if the RHSC interrupt status flag turns on at a time
+when RHSC interrupts are disabled, it will remain on forever:
+
+ The interrupt handler is the only place where RHSC status
+ gets turned back off;
+
+ The interrupt handler won't turn RHSC status off because it
+ doesn't turn off status flags if the corresponding interrupt
+ isn't enabled;
+
+ RHSC interrupts will never get enabled because
+ ohci_root_hub_state_changes() doesn't reenable RHSC if RHSC
+ status is on!
+
+As a result we will continue polling indefinitely instead of reverting
+to interrupt-driven operation, and the root hub will not autosuspend.
+This particular sequence of events is not at all unusual; in fact
+plugging a USB device into an OHCI controller will usually cause it to
+occur.
+
+Of course, this is a bug. The proper thing to do is to turn off RHSC
+status just before reading the actual port status values. That way
+either a port status change will be detected (if it occurs before the
+status read) or it will turn RHSC back on. Possibly both, but that
+won't hurt anything.
+
+We can still check for systems in which RHSC is totally broken, by
+re-reading RHSC after clearing it and before reading the port
+statuses. (This re-read has to be done anyway, to post the earlier
+write.) If RHSC is on but no port-change statuses are set, then we
+know that RHSC is broken and we can avoid re-enabling it.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/ohci-hub.c | 51 +++++++++++++++++++++++++++-----------------
+ 1 file changed, 32 insertions(+), 19 deletions(-)
+
+--- a/drivers/usb/host/ohci-hub.c
++++ b/drivers/usb/host/ohci-hub.c
+@@ -359,17 +359,15 @@ static void ohci_finish_controller_resum
+
+ /* Carry out polling-, autostop-, and autoresume-related state changes */
+ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
+- int any_connected)
++ int any_connected, int rhsc_status)
+ {
+ int poll_rh = 1;
+- int rhsc_status, rhsc_enable;
++ int rhsc_enable;
+
+ /* Some broken controllers never turn off RHCS in the interrupt
+ * status register. For their sake we won't re-enable RHSC
+ * interrupts if the interrupt bit is already active.
+ */
+- rhsc_status = ohci_readl(ohci, &ohci->regs->intrstatus) &
+- OHCI_INTR_RHSC;
+ rhsc_enable = ohci_readl(ohci, &ohci->regs->intrenable) &
+ OHCI_INTR_RHSC;
+
+@@ -421,14 +419,23 @@ static int ohci_root_hub_state_changes(s
+ ohci_rh_resume(ohci);
+ else
+ usb_hcd_resume_root_hub(ohci_to_hcd(ohci));
++
++ /* If remote wakeup is disabled, stop polling */
++ } else if (!ohci->autostop &&
++ !ohci_to_hcd(ohci)->self.root_hub->
++ do_remote_wakeup) {
++ poll_rh = 0;
++
+ } else {
+- if (!rhsc_enable && !rhsc_status && (ohci->autostop ||
+- ohci_to_hcd(ohci)->self.root_hub->
+- do_remote_wakeup)) {
++ /* If no status changes are pending,
++ * enable RHSC interrupts
++ */
++ if (!rhsc_enable && !rhsc_status) {
+ rhsc_enable = OHCI_INTR_RHSC;
+ ohci_writel(ohci, rhsc_enable,
+ &ohci->regs->intrenable);
+ }
++ /* Keep polling until RHSC is enabled */
+ if (rhsc_enable)
+ poll_rh = 0;
+ }
+@@ -448,22 +455,22 @@ static inline int ohci_rh_resume(struct
+ * autostop isn't used when CONFIG_PM is turned off.
+ */
+ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
+- int any_connected)
++ int any_connected, int rhsc_status)
+ {
+- int rhsc_status;
+-
+ /* If RHSC is enabled, don't poll */
+ if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC)
+ return 0;
+
+- /* If no status changes are pending, enable RHSC interrupts */
+- rhsc_status = ohci_readl(ohci, &ohci->regs->intrstatus) &
+- OHCI_INTR_RHSC;
+- if (!changed && !rhsc_status) {
+- ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
+- return 0;
+- }
+- return 1;
++ /* If status changes are pending, continue polling.
++ * Conversely, if no status changes are pending but the RHSC
++ * status bit was set, then RHSC may be broken so continue polling.
++ */
++ if (changed || rhsc_status)
++ return 1;
++
++ /* It's safe to re-enable RHSC interrupts */
++ ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
++ return 0;
+ }
+
+ #endif /* CONFIG_PM */
+@@ -478,6 +485,7 @@ ohci_hub_status_data (struct usb_hcd *hc
+ struct ohci_hcd *ohci = hcd_to_ohci (hcd);
+ int i, changed = 0, length = 1;
+ int any_connected = 0;
++ int rhsc_status;
+ unsigned long flags;
+
+ spin_lock_irqsave (&ohci->lock, flags);
+@@ -503,6 +511,11 @@ ohci_hub_status_data (struct usb_hcd *hc
+ length++;
+ }
+
++ /* Clear the RHSC status flag before reading the port statuses */
++ ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrstatus);
++ rhsc_status = ohci_readl(ohci, &ohci->regs->intrstatus) &
++ OHCI_INTR_RHSC;
++
+ /* look at each port */
+ for (i = 0; i < ohci->num_ports; i++) {
+ u32 status = roothub_portstatus (ohci, i);
+@@ -521,7 +534,7 @@ ohci_hub_status_data (struct usb_hcd *hc
+ }
+
+ hcd->poll_rh = ohci_root_hub_state_changes(ohci, changed,
+- any_connected);
++ any_connected, rhsc_status);
+
+ done:
+ spin_unlock_irqrestore (&ohci->lock, flags);