Merge 3.15-rc5 into usb-next
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 May 2014 00:49:41 +0000 (09:49 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 May 2014 00:49:41 +0000 (09:49 +0900)
We need these USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1  2 
drivers/usb/host/ohci-hub.c
drivers/usb/host/ohci.h
drivers/usb/phy/phy-fsm-usb.c

index 3d53208278b30e5ab2b7acc123f1dc6a342f653e,cd871b89501325407af3ab3ebf0eb56ab0814a79..b4940de1eba34b4bb3dabc2eecf4533f01076678
@@@ -90,6 -90,24 +90,24 @@@ __acquires(ohci->lock
        dl_done_list (ohci);
        finish_unlinks (ohci, ohci_frame_no(ohci));
  
+       /*
+        * Some controllers don't handle "global" suspend properly if
+        * there are unsuspended ports.  For these controllers, put all
+        * the enabled ports into suspend before suspending the root hub.
+        */
+       if (ohci->flags & OHCI_QUIRK_GLOBAL_SUSPEND) {
+               __hc32 __iomem  *portstat = ohci->regs->roothub.portstatus;
+               int             i;
+               unsigned        temp;
+               for (i = 0; i < ohci->num_ports; (++i, ++portstat)) {
+                       temp = ohci_readl(ohci, portstat);
+                       if ((temp & (RH_PS_PES | RH_PS_PSS)) ==
+                                       RH_PS_PES)
+                               ohci_writel(ohci, RH_PS_PSS, portstat);
+               }
+       }
        /* maybe resume can wake root hub */
        if (ohci_to_hcd(ohci)->self.root_hub->do_remote_wakeup || autostop) {
                ohci->hc_control |= OHCI_CTRL_RWE;
@@@ -438,7 -456,8 +456,7 @@@ static int ohci_root_hub_state_changes(
  
  /* build "status change" packet (one or two bytes) from HC registers */
  
 -static int
 -ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
 +int ohci_hub_status_data(struct usb_hcd *hcd, char *buf)
  {
        struct ohci_hcd *ohci = hcd_to_ohci (hcd);
        int             i, changed = 0, length = 1;
@@@ -503,7 -522,6 +521,7 @@@ done
  
        return changed ? length : 0;
  }
 +EXPORT_SYMBOL_GPL(ohci_hub_status_data);
  
  /*-------------------------------------------------------------------------*/
  
@@@ -646,7 -664,7 +664,7 @@@ static inline int root_port_reset (stru
        return 0;
  }
  
 -static int ohci_hub_control (
 +int ohci_hub_control(
        struct usb_hcd  *hcd,
        u16             typeReq,
        u16             wValue,
@@@ -772,4 -790,4 +790,4 @@@ error
        }
        return retval;
  }
 -
 +EXPORT_SYMBOL_GPL(ohci_hub_control);
diff --combined drivers/usb/host/ohci.h
index a116583732092e6ffa81b5a803a3027fa04e7883,4550ce05af7fa1d1b96c03dc2590c5c0cc943615..05e02a709d4f110c4a3570eaec4025f097acaa86
@@@ -405,6 -405,8 +405,8 @@@ struct ohci_hcd 
  #define       OHCI_QUIRK_HUB_POWER    0x100                   /* distrust firmware power/oc setup */
  #define       OHCI_QUIRK_AMD_PLL      0x200                   /* AMD PLL quirk*/
  #define       OHCI_QUIRK_AMD_PREFETCH 0x400                   /* pre-fetch for ISO transfer */
+ #define       OHCI_QUIRK_GLOBAL_SUSPEND       0x800           /* must suspend ports */
        // there are also chip quirks/bugs in init logic
  
        struct work_struct      nec_work;       /* Worker for NEC quirk */
@@@ -727,6 -729,3 +729,6 @@@ extern int ohci_setup(struct usb_hcd *h
  extern int    ohci_suspend(struct usb_hcd *hcd, bool do_wakeup);
  extern int    ohci_resume(struct usb_hcd *hcd, bool hibernated);
  #endif
 +extern int    ohci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 +                               u16 wIndex, char *buf, u16 wLength);
 +extern int    ohci_hub_status_data(struct usb_hcd *hcd, char *buf);
index a62d8c82e8b7739808ab75fd2f4d50e8403f71aa,d03fadd2629f1419b00a60ef9d842913c5ae6183..98e8340a5bb1a8b0e90b5e1c905dd6a978f55325
@@@ -303,17 -303,18 +303,18 @@@ int otg_statemachine(struct otg_fsm *fs
                        otg_set_state(fsm, OTG_STATE_A_WAIT_VRISE);
                break;
        case OTG_STATE_A_WAIT_VRISE:
-               if (fsm->id || fsm->a_bus_drop || fsm->a_vbus_vld ||
-                               fsm->a_wait_vrise_tmout) {
+               if (fsm->a_vbus_vld)
                        otg_set_state(fsm, OTG_STATE_A_WAIT_BCON);
-               }
+               else if (fsm->id || fsm->a_bus_drop ||
+                               fsm->a_wait_vrise_tmout)
+                       otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL);
                break;
        case OTG_STATE_A_WAIT_BCON:
                if (!fsm->a_vbus_vld)
                        otg_set_state(fsm, OTG_STATE_A_VBUS_ERR);
                else if (fsm->b_conn)
                        otg_set_state(fsm, OTG_STATE_A_HOST);
-               else if (fsm->id | fsm->a_bus_drop | fsm->a_wait_bcon_tmout)
+               else if (fsm->id || fsm->a_bus_drop || fsm->a_wait_bcon_tmout)
                        otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL);
                break;
        case OTG_STATE_A_HOST:
        VDBG("quit statemachine, changed = %d\n", state_changed);
        return state_changed;
  }
 +EXPORT_SYMBOL_GPL(otg_statemachine);