History log of /linux-master/drivers/usb/host/ohci.h
Revision Date Author Comments
# d5ae1c3b 15-Sep-2023 Kees Cook <keescook@chromium.org>

usb: Annotate struct urb_priv with __counted_by

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct urb_priv.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mathias Nyman <mathias.nyman@intel.com>
Cc: linux-usb@vger.kernel.org
Link: https://lore.kernel.org/r/20230915195812.never.371-kees@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>


# 9dac16e4 02-Jul-2020 Lee Jones <lee.jones@linaro.org>

usb: host: ohci: Mark cc_to_error as __maybe_unused

drivers/usb/host/ohci.h in included by a whole much of different
sourcefiles. Not all of them make use of cc_to_error. So mark
it as __maybe_used to convey that this behaviour is not only
acceptable it's expected.

Fixes the following kernel build warning(s):

In file included from drivers/usb/host/ohci-pci.c:25:
drivers/usb/host/ohci.h:165:18: warning: ‘cc_to_error’ defined but not used [-Wunused-const-variable=]
165 | static const int cc_to_error 1 = {
| ^~~~~~~~~~~
In file included from drivers/usb/host/ohci-platform.c:32:
drivers/usb/host/ohci.h:165:18: warning: ‘cc_to_error’ defined but not used [-Wunused-const-variable=]
165 | static const int cc_to_error 1 = {
| ^~~~~~~~~~~
In file included from drivers/usb/host/ohci-exynos.c:20:
drivers/usb/host/ohci.h:165:18: warning: ‘cc_to_error’ defined but not used [-Wunused-const-variable=]
165 | static const int cc_to_error 1 = {
| ^~~~~~~~~~~
In file included from drivers/usb/host/ohci-spear.c:22:
drivers/usb/host/ohci.h:165:18: warning: ‘cc_to_error’ defined but not used [-Wunused-const-variable=]
165 | static const int cc_to_error 1 = {
| ^~~~~~~~~~~
In file included from drivers/usb/host/ohci-st.c:26:
drivers/usb/host/ohci.h:165:18: warning: ‘cc_to_error’ defined but not used [-Wunused-const-variable=]
165 | static const int cc_to_error 1 = {
| ^~~~~~~~~~~
In file included from drivers/usb/host/ohci-at91.c:31:
drivers/usb/host/ohci.h:165:18: warning: ‘cc_to_error’ defined but not used [-Wunused-const-variable=]
165 | static const int cc_to_error 1 = {
| ^~~~~~~~~~~
In file included from drivers/usb/host/ohci-s3c2410.c:32:
drivers/usb/host/ohci.h:165:18: warning: ‘cc_to_error’ defined but not used [-Wunused-const-variable=]
165 | static const int cc_to_error 1 = {
| ^~~~~~~~~~~

Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Roman Weissgaerber <weissg@vienna.at>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200702144625.2533530-22-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3e45ed3c 04-Apr-2020 Nishad Kamdar <nishadkamdar@gmail.com>

USB: host: Use the correct style for SPDX License Identifier

This patch corrects the SPDX License Identifier style in
header files related to USB host controller drivers.
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used).

Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Link: https://lore.kernel.org/r/20200404092135.GA4522@nishad
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6bc3f397 20-Feb-2020 Gustavo A. R. Silva <gustavo@embeddedor.com>

USB: Replace zero-length array with flexible-array member

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
int stuff;
struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200220132017.GA29262@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b0310c2f 29-May-2019 Laurentiu Tudor <laurentiu.tudor@nxp.com>

USB: use genalloc for USB HCs with local memory

For HCs that have local memory, replace the current DMA API usage with
a genalloc generic allocator to manage the mappings for these devices.
To help users, introduce a new HCD API, usb_hcd_setup_local_mem() that
will setup up the genalloc backing up the device local memory. It will
be used in subsequent patches. This is in preparation for dropping
the existing "coherent" dma mem declaration APIs. The current
implementation was relying on a short circuit in the DMA API that in
the end, was acting as an allocator for these type of devices.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Tested-by: Fredrik Noring <noring@nocrew.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>


# 63c4c0d8 29-May-2018 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: ohci: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the host controller structure.

Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5fd54ace 03-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: add SPDX identifiers to all remaining files in drivers/usb/

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/usb/ and include/linux/usb* files with the correct
SPDX license identifier based on the license text in the file itself.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 21a60f6e 20-Mar-2017 Gerd Hoffmann <kraxel@redhat.com>

ohci-pci: add qemu quirk

On a loaded virtualization host (dozen guests booting at the same time)
it may happen that the ohci controller emulation doesn't manage to do
timely frame processing, with the result that the io watchdog fires and
considers the controller being dead, even though it's only the emulation
being unusual slow due to the load peak.

So, add a quirk for qemu and don't use the watchdog in case we figure we
are running on emulated ohci. The virtual ohci controller masquerades
as apple ohci controller, but we can identify it by subsystem id.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2c93e790 25-Feb-2017 yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>

usb: add CONFIG_USB_PCI for system have both PCI HW and non-PCI based USB HW

a lot of embeded system SOC (e.g. freescale T2080) have both
PCI and USB modules. But USB module is controlled by registers directly,
it have no relationship with PCI module.

when say N here it will not build PCI related code in USB driver.

Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c88d4df2 02-Mar-2016 Arnd Bergmann <arnd@arndb.de>

usb: host: unhide suspend/resume declarations

There is no need to hide function declarations, and making
these visible to the SoC specific host drivers lets us
use __maybe_unused and IS_ENABLED() checks to control
their use, rather than having to use #ifdef to hide all
callers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a4760b34 11-Oct-2014 Kevin Cernekee <cernekee@gmail.com>

USB: OHCI: Eliminate platform-specific test in ohci.h

The bcm63xx and bcm3384 platforms need to set OHCI_QUIRK_FRAME_NO, but
they are non-PPC platforms and don't enable CONFIG_PPC_MPC52xx.
Therefore this patch changes the code that uses OHCI_QUIRK_FRAME_NO,
making it not depend on CONFIG_PPC_MPC52xx.

Also, rephrase the comments describing OHCI_QUIRK_FRAME_NO and the
related PSW endian swap.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 499b3803 18-Jul-2014 Alan Stern <stern@rowland.harvard.edu>

USB: OHCI: add check for stopped frame counter

This patch adds an extra check to ohci-hcd's I/O watchdog routine. If
the controller stops updating the frame counter, we will assume it is
dead. But there has to be an exception: Some controllers stop the
frame counter when no ports are connected. Check to make sure there
is at least one active port before deciding the controller is dead.

(This test may appear racy, but it isn't. Enabling a newly connected
port takes several milliseconds, during which time the frame counter
must advance.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Dennis New <dennisn@dennisn.linuxd.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 81e38333 18-Jul-2014 Alan Stern <stern@rowland.harvard.edu>

USB: OHCI: add I/O watchdog for orphan TDs

Some OHCI controllers have a bug: They fail to add completed TDs to
the done queue. Examining this queue is the only method ohci-hcd has
for telling when a transfer is complete; failure to add a TD can
result in an URB that never completes and cannot be unlinked.

This patch adds a watchdog routine to ohci-hcd. The routine
periodically scans the active ED and TD lists, looking for TDs which
are finished but not on the done queue. When one is found, and it is
certain that the controller hardware will never add the TD to the done
queue, the watchdog routine manually puts the TD on the done list so
that it can be handled normally.

The watchdog routine also checks for a condition indicating the
controller has died. If the done queue is non-empty but the
HccaDoneHead pointer hasn't been updated for a few hundred
milliseconds, we assume the controller will never update it and
therefore is dead.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cdb4dd15 18-Jul-2014 Alan Stern <stern@rowland.harvard.edu>

USB: OHCI: make URB completions single-threaded

URBs for a particular endpoint should complete sequentially. That is,
we shouldn't call the completion handler for one URB until the handler
for the previous URB has returned.

When the OHCI watchdog routine is added, there will be two paths for
completing URBs: interrupt handler and watchdog routine. Their
activities have to be synchronized so that completions don't occur in
multiple threads concurrently.

For that purpose, this patch creates an ohci_work() routine which will
be responsible for calling process_done_list() and finish_unlinks(),
the two routines that detect when an URB is complete. Everything will
funnel through ohci_work(), and it will be careful not to run in more
than one thread at a time.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c6fcb85e 18-Jul-2014 Alan Stern <stern@rowland.harvard.edu>

USB: OHCI: redesign the TD done list

This patch changes the way ohci-hcd handles the TD done list. In
addition to relying on the TD pointers stored by the controller
hardware, we need to handle TDs that the hardware has forgotten about.

This means the list has to exist even while the dl_done_list() routine
isn't running. That function essentially gets split in two:
update_done_list() reads the TD pointers stored by the hardware and
adds the TDs to the done list, and process_done_list() scans through
the list to handle URB completions. When we detect a TD that the
hardware forgot about, we will be able to add it to the done list
manually and then process it normally.

Since the list is really a queue, and because there can be a lot of
TDs, keep the existing singly linked implementation. To insure that
URBs are given back in order of submission, whenever a TD is added to
the done list, all the preceding TDs for the same endpoint must be
added as well (going back to the first one that isn't already on the
done list).

The done list manipulations must all be protected by the private
lock. The scope of the lock is expanded in preparation for the
watchdog routine to be added in a later patch.

We have to be more careful about giving back unlinked URBs. Since TDs
may be added to the done list by the watchdog routine and not in
response to a controller interrupt, we have to check explicitly to
make sure all the URB's TDs that were added to the done list have been
processed before giving back the URB.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 95d9a01d 18-Jul-2014 Alan Stern <stern@rowland.harvard.edu>

USB: OHCI: revert the ZF Micro orphan-TD quirk

This patch reverts the important parts of commit 89a0fd18a96e (USB:
OHCI handles more ZFMicro quirks), namely, the parts related to
handling orphan TDs for interrupt endpoints. A later patch in this
series will introduce a more general mechanism that applies to all
endpoint types and all controllers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c1db30a2 01-May-2014 Alan Stern <stern@rowland.harvard.edu>

USB: OHCI: fix problem with global suspend on ATI controllers

Some OHCI controllers from ATI/AMD seem to have difficulty with
"global" USB suspend, that is, suspending an entire USB bus without
setting the suspend feature for each port connected to a device. When
we try to resume the child devices, the controller gives timeout
errors on the unsuspended ports, requiring resets, and can even cause
ohci-hcd to hang; see

http://marc.info/?l=linux-usb&m=139514332820398&w=2

and the following messages.

This patch fixes the problem by adding a new quirk flag to ohci-hcd.
The flag causes the ohci_rh_suspend() routine to suspend each
unsuspended, enabled port before suspending the root hub. This
effectively converts the "global" suspend to an ordinary root-hub
suspend. There is no need to unsuspend these ports when the root hub
is resumed, because the child devices will be resumed anyway in the
course of a normal system resume ("global" suspend is never used for
runtime PM).

This patch should be applied to all stable kernels which include
commit 0aa2832dd0d9 (USB: use "global suspend" for system sleep on
USB-2 buses) or a backported version thereof.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Peter Münster <pmlists@free.fr>
Tested-by: Peter Münster <pmlists@free.fr>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 42b59eba 16-Apr-2014 Laurent Pinchart <laurent.pinchart@ideasonboard.com>

USB: OHCI: Export the OHCI hub control and status_data functions

Platform drivers sometimes need to perform specific handling of hub
control requests and status data. Make this possible by exporting the
ohci_hub_control() and ohci_hub_status_data() functions which can then
be called from custom hub operations in the default case.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d2c4254f 18-Nov-2013 Oliver Neukum <oneukum@suse.de>

ohci: kill ohci_vdbg

With the introduction of dynamic debugging it has become redundant.
Collapse it with ohci_dbg()

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5c2a1801 18-Nov-2013 Oliver Neukum <oneukum@suse.de>

ohci: remove conditional compilation

Conditional compilation for debugging is removed in favor of
dynamic debugging. To do so

1. the support for debugfs is always compiled
2. the support for the ancient print_urb debugging aid is removed

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 31fc518b 03-Jun-2013 Manjunath Goudar <manjunath.goudar@linaro.org>

USB: OHCI: add a name for the platform-private field

This patch adds an ohci->priv field for private use by OHCI
platform drivers.

Until now none of the platform drivers has used this private space,
but that's about to change in the next patch of this series.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 95e44d44 28-May-2013 Manjunath Goudar <manjunath.goudar@linaro.org>

USB: OHCI: prepare to make ohci-hcd a library module

This patch prepares ohci-hcd for being split up into a core
library and separate platform driver modules. A generic
ohci_hc_driver structure is created, containing all the "standard"
values, and a new mechanism is added whereby a driver module can
specify a set of overrides to those values. In addition the
ohci_restart(),ohci_suspend() and ohci_resume() routines need
to be EXPORTed for use by the drivers.

Added ohci_setip(() and ohci_start() routine for to start the generic
controller rather than each having its own idiosyncratic approach.
This allow to clean duplicated code in most of SOC driver

In V2:
-ohci_hcd_init() ohci_run() and ohci_stop() are not made non-static.
-Adds the ohci_setup() and ohci_start() routine.

In V3:
-purpose of ohci_setup() and ohci_start() function description written in the patch
description.
-ohci_init() are not made non-static but now called beginning of the ohci_restart().
-ohci_run() signature change reverted back.
-unrelated changes removed.
-duplicate comment line removed.
-inline ohci_suspend() and ohci_resume() is not needed so removed from ohci.h file.

In V4:
-ohci-init() EXPORTed because it is called by all bus glue modules.
-ohci-setup() removed from 1/2 added into 2/2 patch.

In V5:
-Again ohci_setup() is added and EXPORTed because to replace the ohci_init() from
all bus glues.
-ohci_init() is not made non-static function.

In V6:
-ohci_init() call is removed from ohci_quirk_nec_worker(), because it is already called in ohci_restart().

In V8:
-ohci_hcd_init() is called by ohci_setup() to make generic ohci initialization in all ohci drivers.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c2e935a7 13-Jun-2012 Richard Zhao <richard.zhao@freescale.com>

USB: move transceiver from ehci_hcd and ohci_hcd to hcd and rename it as phy

- to decrease redundant since both ehci_hcd and ohci_hcd have the same variable
- it helps access phy in usb core code
- phy is more meaningful than transceiver

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 86753811 13-Feb-2012 Heikki Krogerus <heikki.krogerus@linux.intel.com>

usb: otg: Rename otg_transceiver to usb_phy

This is the first step in separating USB transceivers from
USB OTG utilities.

Includes fixes to IMX code from Sascha Hauer.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Acked-by: Li Yang <leoli@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# c6187597 17-Nov-2011 Alan Stern <stern@rowland.harvard.edu>

OHCI: final fix for NVIDIA problems (I hope)

Problems with NVIDIA's OHCI host controllers persist. After looking
carefully through the spec, I finally realized that when a controller
is reset it then automatically goes into a SUSPEND state in which it
is completely quiescent (no DMA and no IRQs) and from which it will
not awaken until the system puts it into the OPERATIONAL state.

Therefore there's no need to worry about controllers being in the
RESET state for extended periods, or remaining in the OPERATIONAL
state during system shutdown. The proper action for device
initialization is to put the controller into the RESET state (if it's
not there already) and then to issue a software reset. Similarly, the
proper action for device shutdown is simply to do a software reset.

This patch (as1499) implements such an approach. It simplifies
initialization and shutdown, and allows the NVIDIA shutdown-quirk code
to be removed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Andre "Osku" Schmidt <andre.osku.schmidt@googlemail.com>
Tested-by: Arno Augustin <Arno.Augustin@web.de>
Cc: stable <stable@vger.kernel.org> [after tested in 3.2 for a while]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# b7463c71 17-Nov-2011 Alan Stern <stern@rowland.harvard.edu>

OHCI: remove uses of hcd->state

This patch (as1500) removes all uses of the objectionable hcd->state
variable from the ohci-hcd family of drivers. It is replaced by a
private ohci->rh_state field, just as in uhci-hcd and ehci-hcd.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# ad93562b 28-Feb-2011 Andiry Xu <andiry.xu@amd.com>

USB host: Move AMD PLL quirk to pci-quirks.c

This patch moves the AMD PLL quirk code in OHCI/EHCI driver to pci-quirks.c,
and exports the functions to be used by xHCI driver later.

AMD PLL quirk disable the optional PM feature inside specific
SB700/SB800/Hudson-2/3 platforms under the following conditions:

1. If an isochronous device is connected to OHCI/EHCI/xHCI port and is active;
2. Optional PM feature that powers down the internal Bus PLL when the link is
in low power state is enabled.

Without AMD PLL quirk, USB isochronous stream may stutter or have breaks
occasionally, which greatly impair the performance of audio/video streams.

Currently AMD PLL quirk is implemented in OHCI and EHCI driver, and will be
added to xHCI driver too. They are doing similar things actually, so move
the quirk code to pci-quirks.c, which has several advantages:

1. Remove duplicate defines and functions in OHCI/EHCI (and xHCI) driver and
make them cleaner;
2. AMD chipset information will be probed only once and then stored.
Currently they're probed during every OHCI/EHCI initialization, move
the detect code to pci-quirks.c saves the repeat detect cost;
3. Build up synchronization among OHCI/EHCI/xHCI driver. In current
code, every host controller enable/disable PLL only according to
its own status, and may enable PLL while there is still isoc transfer on
other HCs. Move the quirk to pci-quirks.c prevents this issue.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alex He <alex.he@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 479b46b5 17-Feb-2011 Greg Kroah-Hartman <gregkh@suse.de>

Revert "USB host: Move AMD PLL quirk to pci-quirks.c"

This reverts commit b7d5b439b7a40dd0a0202fe1c118615a3fcc3b25.
It conflicts with commit baab93afc2844b68d57b0dcca5e1d34c5d7cf411 "USB:
EHCI: ASPM quirk of ISOC on AMD Hudson" and merging the two just doesn't
work properly.

Cc: Andiry Xu <andiry.xu@amd.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alex He <alex.he@amd.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# b7d5b439 25-Jan-2011 Andiry Xu <andiry.xu@amd.com>

USB host: Move AMD PLL quirk to pci-quirks.c

This patch moves the AMD PLL quirk code in OHCI/EHCI driver to pci-quirks.c,
and exports the functions to be used by xHCI driver later.

AMD PLL quirk disable the optional PM feature inside specific
SB700/SB800/Hudson-2/3 platforms under the following conditions:

1. If an isochronous device is connected to OHCI/EHCI/xHCI port and is active;
2. Optional PM feature that powers down the internal Bus PLL when the link is
in low power state is enabled.

Without AMD PLL quirk, USB isochronous stream may stutter or have breaks
occasionally, which greatly impair the performance of audio/video streams.

Currently AMD PLL quirk is implemented in OHCI and EHCI driver, and will be
added to xHCI driver too. They are doing similar things actually, so move
the quirk code to pci-quirks.c, which has several advantages:

1. Remove duplicate defines and functions in OHCI/EHCI (and xHCI) driver and
make them cleaner;
2. AMD chipset information will be probed only once and then stored.
Currently they're probed during every OHCI/EHCI initialization, move
the detect code to pci-quirks.c saves the repeat detect cost;
3. Build up synchronization among OHCI/EHCI/xHCI driver. In current
code, every host controller enable/disable PLL only according to
its own status, and may enable PLL while there is still isoc transfer on
other HCs. Move the quirk to pci-quirks.c prevents this issue.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alex He <alex.he@amd.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 82e6923e 21-Jan-2011 Russell King <rmk+kernel@arm.linux.org.uk>

ARM: lh7a40x: remove unmaintained platform support

lh7a40x has only been receiving updates for updates to generic code.
The last involvement from the maintainer according to the git logs was
in 2006. As such, it is a maintainence burden with no benefit.

This gets rid of two defconfigs.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>


# 3df7169e 10-Sep-2010 Alan Stern <stern@rowland.harvard.edu>

OHCI: work around for nVidia shutdown problem

This patch (as1417) fixes a problem affecting some (or all) nVidia
chipsets. When the computer is shut down, the OHCI controllers
continue to power the USB buses and evidently they drive a Reset
signal out all their ports. This prevents attached devices from going
to low power. Mouse LEDs stay on, for example, which is disconcerting
for users and a drain on laptop batteries.

The fix involves leaving each OHCI controller in the OPERATIONAL state
during system shutdown rather than putting it in the RESET state.
Although this nominally means the controller is running, in fact it's
not doing very much since all the schedules are all disabled. However
there is ongoing DMA to the Host Controller Communications Area, so
the patch also disables the bus-master capability of all PCI USB
controllers after the shutdown routine runs.

The fix is applied only to nVidia-based PCI OHCI controllers, so it
shouldn't cause problems on systems using other hardware. As an added
safety measure, in case the kernel encounters one of these running
controllers during boot, the patch changes quirk_usb_handoff_ohci()
(which runs early on during PCI discovery) to reset the controller
before anything bad can happen.

Reported-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
Tested-by: Pali Rohár <pali.rohar@gmail.com>
CC: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# a1f17a87 03-Nov-2009 Libin Yang <libin.yang@amd.com>

USB: ohci: quirk AMD prefetch for USB 1.1 ISO transfer

The following patch in the driver is required to avoid USB 1.1 device
failures that may occur due to requests from USB OHCI controllers may
be overwritten if the latency for any pending request by the USB
controller is very long (in the range of milliseconds).

Signed-off-by: Libin Yang <libin.yang@amd.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# cede969f 22-Sep-2008 Kumar Gala <galak@kernel.crashing.org>

usb: remove code associated with !CONFIG_PPC_MERGE

Now that arch/ppc is gone we don't need CONFIG_PPC_MERGE anymore remove
the dead code associated with !CONFIG_PPC_MERGE.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# ab1666c1 08-Aug-2008 Libin Yang <Libin.Yang@amd.com>

USB: quirk PLL power down mode

On some AMD 700 series southbridges, ISO OUT transfers (such as audio
playback through speakers) on the USB OHCI controller may be corrupted
when an A-Link express power saving feature is active.

PLL power down mode in conjunction with link power management feature
L1 being enabled is the bad combination ... this patch prevents them
from being enabled when ISO transfers are pending.

Signed-off-by: Crane Cai <crane.cai@amd.com>
Signed-off-by: Libin Yang <libin.yang@amd.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# e8b24450 06-Jul-2008 Dmitry Baryshkov <dbaryshkov@gmail.com>

USB: Hook start_hnp into ohci struct

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1133cd8a 06-Jul-2008 Dmitry Baryshkov <dbaryshkov@gmail.com>

USB: ohci: make distrust_firmware a quirk

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 684c19e0 11-Sep-2007 Tony Jones <tonyj@suse.de>

USB: convert ohci debug files to use debugfs instead of sysfs

We should not have multiple line files in sysfs, this moves the data to
debugfs instead, like the UHCI driver.

Signed-off-by: Tony Jones <tonyj@suse.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 4f45426c 09-Oct-2007 Valentine Barshak <vbarshak@ru.mvista.com>

USB: add runtime frame_no quirk for big-endian OHCI

Add OHCI big endian frame_no quirk. The frame_no value stored in the
HCCA is a 16 bit field at a specific offset, but since not all CPUs can
do 16-bit memory accesses it's used as a 32 bit field. And that's why
big-endian OHCI must shift 16 bits ... unless the spec is not followed.

Currently there's one MPC52xx platform that doesn't need the shift. This
patch adds a new "big endian frame_no" quirk to control that at runtime.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Acked-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 89a0fd18 01-Aug-2007 Mike Nuss <mike@terascala.com>

USB: OHCI handles more ZFMicro quirks

The ZF Micro OHCI controller exhibits unexpected behavior that seems to be
related to high load. Under certain conditions, the controller will
complete a TD, remove it from the endpoint's queue, and fail to add it to
the donelist. This causes the endpoint to appear to stop responding. Worse,
if the device is removed while in that state, OHCI will hang while waiting
for the orphaned TD to complete. The situation is not recoverable without
rebooting.

This fix enhances the scope of the existing OHCI_QUIRK_ZFMICRO flag:

1. A watchdog routine periodically scans the OHCI structures to check
for orphaned TDs. In these cases the TD is taken back from the
controller and completed normally.

2. If a device is removed while the endpoint is hung but before the
watchdog catches the situation, any outstanding TDs are taken back
from the controller in the 'sanitize' phase.

The ohci-hcd driver used to print "INTR_SF lossage" in this situation;
this changes it to the universally accurate "ED unlink timeout". Other
instances of this message presumably have different root causes.

Both this Compaq quirk and a NEC quirk are now properly compiled out for
non-PCI builds of this driver.

Signed-off-by: Mike Nuss <mike@terascala.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# d576bb9f 31-May-2007 Michael Hanselmann <linux-kernel@hansmi.ch>

USB: Fix NEC OHCI chip silicon bug

This patch fixes a silicon bug in some NEC OHCI chips. The bug appears
at random times and is very, very difficult to reproduce. Without the
following patch, Linux would shut the chip and its associated devices
down. In Apple PowerBooks this leads to an unusable keyboard and mouse
(SSH still working). The idea of restarting the chip is taken from
public Darwin code.

Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 68f50e52 09-Feb-2007 Al Viro <viro@ftp.linux.org.uk>

[PATCH] hci_{read,write}l() does force casts to wrong type for no reason

readl() et.al. expect iomem pointer, so WTF force-cast it to normal one???

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# b32e904d 27-Dec-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>

USB: Fix OHCI warning

This patch fixes a warning introduces by the split endian OHCI support
patch on platforms that don't have readl_be/writel_be variants (though
mostly harmless as those are called in an if (0) statement, but gcc
still warns).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 11d1a4aa 14-Dec-2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>

USB: Implement support for "split" endian OHCI

This patch separates support for big endian MMIO register access
and big endian descriptors in order to support the Toshiba SCC
implementation which has big endian registers but little endian
in-memory descriptors.

It simplifies the access functions a bit in ohci.h while at it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# dd9048af 05-Dec-2006 David Brownell <david-b@pacbell.net>

USB: ohci whitespace/comment fixups

This is an OHCI cleanup patch ... it removes a lot of erroneous whitespace
(space before tab, at end of line) as well as the obsolete inline changelog.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# abc9404b 03-Dec-2006 Jeff Garzik <jeff@garzik.org>

USB: fix ohci.h over-use warnings

When u132-hcd is built, it includes local header ohci.h, which appears
to have been intended only for use by ohci-hcd.

This throws warnings about functions which are defined and not used.
The warnings thrown are because three small functions are implemented in
the header, but not declared 'inline', a rather strange affair.

Since these functions are small, let's go ahead and define them as
'inline', just like the inline functions surrounding them. This makes
things more consistent, and kills the warnings.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 8d1a243b 26-Sep-2006 Alan Stern <stern@rowland.harvard.edu>

OHCI: add auto-stop support

This patch (as790b) adds "autostop" support to ohci-hcd: the driver
will automatically stop the host controller when no devices have been
connected for at least one second. This feature is useful when the
USB autosuspend facility isn't available, such as when
CONFIG_USB_SUSPEND hasn't been set.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 38e2bfc9 18-Sep-2006 Pete Zaitcev <zaitcev@redhat.com>

USB: Dealias -110 code (more complete)

The purpose of this patch is to split off the case when a device does
not reply on the lower level (which is reported by HC hardware), and
a case when the device accepted the request, but does not reply at
upper level. This redefinition allows to diagnose issues easier,
without asking the user if the -110 happened "immediately".

The usbmon splits such cases already thanks to its timestamp, but
it's not always available.

I adjusted all drivers which I found affected (by searching for "urb").
Out of tree drivers may suffer a little bit, but I do not expect much
breakage. At worst they may print a few messages.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 64a21d02 08-Aug-2006 Aleksey Gorelov <dared1st@yahoo.com>

USB: Properly unregister reboot notifier in case of failure in ehci hcd

If some problem occurs during ehci startup, for instance, request_irq fails,
echi hcd driver tries it best to cleanup, but fails to unregister reboot
notifier, which in turn leads to crash on reboot/poweroff.

The following patch resolves this problem by not using reboot notifiers
anymore, but instead making ehci/ohci driver get its own shutdown method. For
PCI, it is done through pci glue, for everything else through platform driver
glue.

One downside: sa1111 does not use platform driver stuff, and does not have its
own shutdown hook, so no 'shutdown' is called for it now. I'm not sure if it
is really necessary on that platform, though.

Signed-off-by: Aleks Gorelov <dared1st@yahoo.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# f197b2c5 22-Sep-2005 David Brownell <david-b@pacbell.net>

[PATCH] OHCI PM updates

This simplifies the OHCI root hub suspend logic:

- Uses new usbcore root hub calls to make autosuspend work again:
* Uses a newish usbcore root hub wakeup mechanism,
making requests to khubd not keventd.
* Uses an even newer sibling suspend hook.

- Expect someone always made usbcore call ohci_hub_suspend() before bus
glue fires; and that ohci_hub_resume() is only called after that bus
glue ran. Previously, only CONFIG_USB_SUSPEND promised those things.
(Includes updates to PCI and OMAP bus glue.)

- Handle a not-noticed-before special case during resume from one of
the swsusp snapshots when using "usb-handoff": the controller isn't
left in RESET state. (A bug to fix in the usb-handoff code...)

Also cleans up a minor debug printk glitch, and switches an mdelay over
to an msleep (how did that stick around for so long?).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

drivers/usb/host/ohci-dbg.c | 4 ----
drivers/usb/host/ohci-hcd.c | 2 +-
drivers/usb/host/ohci-hub.c | 42 ++++++++++++------------------------------
drivers/usb/host/ohci-mem.c | 1 -
drivers/usb/host/ohci-omap.c | 36 ++++++++++++------------------------
drivers/usb/host/ohci-pci.c | 40 ++++++++--------------------------------
drivers/usb/host/ohci.h | 1 -
7 files changed, 33 insertions(+), 93 deletions(-)


# fdd13b36 31-Aug-2005 David Brownell <david-b@pacbell.net>

[PATCH] USB: OHCI relies less on NDP register

Some OHCI implementations have differences in the way the NDP register
(in roothub_a) reports the number of ports present. This patch allows the
platform specific code to optionally supply the number of ports. The
driver just reads the value at init (if not supplied) instead of reading
it every time its needed (except for an AMD756 bug workaround).

It also sets the value correctly for the ARM pxa27x architecture.

Signed-Off-By: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# bc96c0ad 25-Apr-2005 Alan Stern <stern@rowland.harvard.edu>

[PATCH] ohci-omap, sl811, dummy: remove hub_set_power_budget

This patch changes the HCDs that used the old hub_set_power_budget call,
making them use the new hcd->power_budget field instead.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# f4df0e33 23-Apr-2005 David Brownell <david-b@pacbell.net>

[PATCH] USB: add reboot notifier to ohci

Adds a reboot notifier to OHCI, mostly to benefit kexec; plus
minor #include tweaks.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 0e498763 18-Apr-2005 David Brownell <david-b@pacbell.net>

[PATCH] USB: OHCI on Compaq Aramada 7400

This adds a quirk to the OHCI driver that lets it work with an old
Compaq implementation. It also removes some needless strings from
the non-debug version of the driver.

Signed-off-by: Chris Clayton <chris_clayton@f1internet.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!