usb: xhci: add the suspend/resume functionality

Adds power management support to xHCI platform driver.

This patch facilitates the transition of xHCI host controller
between S0 and S3/S4 power states, during suspend/resume cycles.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Vikas C Sajjan <vikas.sajjan@linaro.org>
CC: Doug Anderson <dianders@chromium.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
xhci: Refactor port status into a new function.

The hub control function is *way* too long.  Refactor it into a new
function, and document the side effects of calling that function.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
xhci: Report USB 2.1 link status for L1

USB 2.1 devices can go into a lower power link state, L1.  When they are
active, they are in the L0 state.  The L1 transition can be purely
driven by software, or some USB host controllers (including some xHCI
1.0 hosts) allow the host hardware to track idleness and automatically
place a port into L1.

The USB 2.1 Link Power Management ECN gives a way for USB 2.1 hubs that
support LPM to report that a port is in L1.  The port status bit 5 will
be set when the port is in L1.  The xHCI host reports the root port as
being in 'U2' when the devices is in L1, and as being in 'U0' when the
port is active (in L0).

Translate the xHCI USB 2.1 link status into the format external hubs
use, and pass the L1 status up to the USB core and tools like lsusb.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Intel xhci: refactor EHCI/xHCI port switching

Make the Linux xHCI driver automatically try to switchover the EHCI ports to
xHCI when an Intel xHCI host is detected, and it also finds an Intel EHCI host.

This means we will no longer have to add Intel xHCI hosts to a quirks list when
the PCI device IDs change.  Simply continuing to add new Intel xHCI PCI device
IDs to the quirks list is not sustainable.

During suspend ports may be swicthed back to EHCI by BIOS and not properly
restored to xHCI at resume. Previously both EHCI and xHCI resume functions
switched ports back to XHCI, but it's enough to do it in xHCI only
because the hub driver doesn't start running again until after both hosts are resumed.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
xhci: Correct misplaced newlines

Logging messages end in newlines, not have
them put in the middle of messages.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
USB: ldusb: remove custom dbg_info() macro

We want to get rid of CONFIG_USB_DEBUG, so remove the reliance of the
ldusb driver on it.  Don't use the custom macro, or a special module
parameter, instead, rely on the in-kernel dynamic debugging
infrastructure, which is much easier to use, and consistant across the
whole kernel.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: legotower: remove unneeded tracing macros

Remove the unneeded tracing macros in this driver.  The kernel has a
built-in trace function that can be used if this is really still needed.

Cc: Juergen Stuber <starblue@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: legousbtower: remove custom debug macro

Don't use a custom debug macro for just one driver, instead rely on the
in-kernel dynamic debugging logic, which can handle this much better.

Cc: Juergen Stuber <starblue@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: legotower: remove custom debug macro and module parameter

Now that we don't use the dbg() macro, remove it, and the module
parameter.  Also fix up the "dump_data" function to properly use the
dynamic debug core and the correct printk options, and don't call it
twice per function, as the data doesn't change from the beginning and
the end of the call.

Cc: Juergen Stuber <starblue@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: legotower: remove direct calls to printk()

Use the pr_* calls instead, which are much more descriptive.

Cc: Juergen Stuber <starblue@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: adutux: remove unneeded tracing macros

Remove the unneeded tracing macros in this driver.  The kernel has a
built-in trace function that can be used if this is really still needed.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: adutux: remove custom debug macro

Don't use a custom debug macro for just one driver, instead rely on the
in-kernel dynamic debugging logic, which can handle this much better.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: adutux: remove custom debug macro and module parameter

Now that we don't use the dbg() macro, remove it, and the module
parameter.  Also fix up the "dump_data" function to properly use the
dynamic debug core and the correct printk options, and don't call it
twice per function, as the data doesn't change from the beginning and
the end of the call.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: adutux: remove direct calls to printk()

Use the pr_* calls instead, which are much more descriptive.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: misc: remove CONFIG_USB_DEBUG from Makefile

Now that no usb misc driver is looking for CONFIG_USB_DEBUG, or DEBUG,
don't enable it in the Makefile, as that's pointless.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: serial: remove defensive test from set_termios

Remove defensive test from set_termios which is never called with a NULL
tty.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: serial: remove hupping check from tiocmiwait

Since commit 31ca020b ("TTY: wake up processes last at hangup") there no
longer any need to check the hupping flag in the generic tiocmiwait
implementation, so remove it.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: serial: clean up dtr_rts

Since commit 957dacae ("TTY: fix DTR not being dropped on hang up")
dtr_rts is no longer called for uninitialised ports (e.g. after
a disconnect), which removes the need to grab the disconnect mutex.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: serial: set drain delay at port probe

The port drain delay is constant and should be set at port probe rather
than open.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: console: use dev_dbg

Use dev_dbg for debugging.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>