Commit graph

45 commits

Author SHA1 Message Date
Rafael J. Wysocki 3494252d56 USB/PCI: Fix resume breakage of controllers behind cardbus bridges
If a USB PCI controller is behind a cardbus bridge, we are trying to
restore its configuration registers too early, before the cardbus
bridge is operational.  To fix this, call pci_restore_state() from
usb_hcd_pci_resume() and remove usb_hcd_pci_resume_early() which is
no longer necessary (the configuration spaces of USB controllers that
are not behind cardbus bridges will be restored by the PCI PM core
with interrupts disabled anyway).

This patch fixes the regression from 2.6.28 tracked as
http://bugzilla.kernel.org/show_bug.cgi?id=12659

[ Side note: the proper long-term fix is probably to just force the
  unplug event at suspend time instead of doing a plug/unplug at resume
  time, but this patch is fine regardless  - Linus ]

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-by: Miles Lane <miles.lane@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-02-17 16:56:31 -08:00
Rafael J. Wysocki a15d95a003 USB: Fix suspend-resume of PCI USB controllers
Commit a0d4922da2
(USB: fix up suspend and resume for PCI host controllers) attempted
to fix the suspend-resume of PCI USB controllers, but unfortunately
it did that incorrectly and interrupts are left enabled by the USB
controllers' ->suspend_late() callback as a result.  This leads to
serious problems during suspend which are very difficult to debug.

Fix the issue by removing the ->suspend_late() callback of PCI
USB controllers and moving the code from there to the ->suspend()
callback executed with interrupts enabled.  Additionally, make
the ->resume() callback of PCI USB controllers execute
pci_enable_wake(dev, PCI_D0, false) to disable wake-up from the
full power state (PCI_D0).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Tested-by: Andrey Borzenkov <arvidjaar@mail.ru>
Tested-by: "Jeff Chua" <jeff.chua.linux@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: "Zdenek Kabelac" <zdenek.kabelac@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-01-27 16:15:32 -08:00
Alan Stern bcca06efea USB: don't enable wakeup by default for PCI host controllers
This patch (as1199) changes the initial wakeup settings for PCI USB
host controllers.  The controllers are marked as capable of waking the
system, but wakeup is not enabled by default.

It turns out that enabling wakeup for USB host controllers has a lot
of bad consequences.  As the simplest example, if a USB mouse or
keyboard is unplugged immediately after the computer is put to sleep,
the unplug will cause the system to wake back up again!  We are better
off marking them as wakeup-capable and leaving wakeup disabled.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Rafael J. Wysocki <rjw@sisk.pl>
CC: David Brownell <david-b@pacbell.net>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-01-27 16:15:32 -08:00
Alan Stern 6fd9086a51 USB: automatically enable wakeup for PCI host controllers
This patch (as1193b) enables wakeup during initialization for all PCI
host controllers, and it removes some code (and comments!) that are no
longer needed now that the PCI core automatically initializes wakeup
settings for all new devices.

The idea is that the bus should initialize wakeup, and the bus glue
or controller driver should enable it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-01-07 10:00:12 -08:00
Alan Stern a0d4922da2 USB: fix up suspend and resume for PCI host controllers
This patch (as1192) rearranges the USB PCI host controller suspend and
resume and resume routines:

	Use pci_wake_from_d3() for enabling and disabling wakeup,
	instead of pci_enable_wake().

	Carry out the actual state change while interrupts are
	disabled.

	Change the order of the preparations to agree with the
	general recommendation for PCI devices, instead of
	messing around with the wakeup settings while the device
	is in D3.

		In .suspend:
			Call the underlying driver to disable IRQ
				generation;
			pci_wake_from_d3(device_may_wakeup());
			pci_disable_device();

		In .suspend_late:
			pci_save_state();
			pci_set_power_state(D3hot);
			(for PPC_PMAC) Disable ASIC clocks

		In .resume_early:
			(for PPC_PMAC) Enable ASIC clocks
			pci_set_power_state(D0);
			pci_restore_state();

		In .resume:
			pci_enable_device();
			pci_set_master();
			pci_wake_from_d3(0);
			Call the underlying driver to reenable IRQ
				generation

	Add the necessary .suspend_late and .resume_early method
	pointers to the PCI host controller drivers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-01-07 10:00:12 -08:00
Shane Huang 0a99e8ac43 USB: fix SB600 USB subsystem hang bug
This patch is required for all AMD SB600 revisions to avoid USB subsystem hang
symptom. The USB subsystem hang symptom is observed when the system has
multiple USB devices connected to it. In some cases a USB hub may be required
to observe this symptom.

Reported in bugzilla as #11599, the similar patch for SB700 old revision is:
commit b09bc6cbae

Reported-by: raffaele <ralfconn@tele2.it>
Tested-by: Roman Mamedov <roman@rm.pp.ru>
Signed-off-by: Shane Huang <shane.huang@amd.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-11-30 22:24:02 -08:00
Andiry Xu b09bc6cbae USB: fix SB700 usb subsystem hang bug
This patch is required for AMD SB700 south bridge revision A12 and A13 to avoid
USB subsystem hang symptom. The USB subsystem hang symptom is observed when the
system has multiple USB devices connected to it. In some cases a USB hub may be
required to observe this symptom.

This patch works around the problem by correcting the internal register setting
that will help by changing the behavior of the internal logic to avoid the
USB subsystem hang issue. The change in the behavior of the logic does not
impact the normal operation of the USB subsystem.

Reported-by: Volker Armin Hemmann <volker.armin.hemmann@tu-clausthal.de>
Tested-by: Volker Armin Hemmann <volker.armin.hemmann@tu-clausthal.de>
Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Libin Yang <libin.yang@amd.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-11-19 22:01:34 -08:00
Alan Stern 3a31155cff USB: EHCI: suppress unwanted error messages
This patch (as1096) fixes an annoying problem: When a full-speed or
low-speed device is plugged into an EHCI controller, it fails to
enumerate at high speed and then is handed over to the companion
controller.  But usbcore logs a misleading and unwanted error message
when the high-speed enumeration fails.

The patch adds a new HCD method, port_handed_over, which asks whether
a port has been handed over to a companion controller.  If it has, the
error message is suppressed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-29 13:59:03 -07:00
Alan Stern a8e5177583 USB: EHCI: fix up root-hub TT mess
This patch (as1095) cleans up the HCD glue and several of the EHCI
bus-glue files.  The ehci->is_tdi_rh_tt flag is redundant, since it
means the same thing as the hcd->has_tt flag, so it is removed and the
other flag used in its place.

Some of the bus-glue files didn't get the relinquish_port method added
to their hc_driver structures.  Although that routine currently
doesn't do anything for controllers with an integrated TT, in the
future it might.  So the patch adds it where it is missing.

Lastly, some of the bus-glue files have erroneous entries for their
hc_driver's suspend and resume methods.  These method pointers are
specific to PCI and shouldn't be used otherwise.

(The patch also includes an invisible whitespace fix.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
2008-05-29 13:59:03 -07:00
Alan Stern aff6d18f95 USB: fix compile problems in ehci-hcd
This patch (as1072) fixes some recently-introduced compile problems
that show up in ehci-hcd when CONFIG_PM is turned off.

	PORT_WAKE_BITS needs to be defined always.

	ehci_port_power() is called during initialization by all the
	EHCI variants other than the PCI version, in which it is
	"defined but not used".  So add a call to it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-04-24 21:16:54 -07:00
Alan Stern 58a97ffeb2 USB: HCDs use the do_remote_wakeup flag
When a USB device is suspended, whether or not it is enabled for
remote wakeup depends on the device_may_wakeup() setting.  The setting
is then saved in the do_remote_wakeup flag.

Later on, however, the device_may_wakeup() value can change because of
user activity.  So when testing whether a suspended device is or
should be enabled for remote wakeup, we should always test
do_remote_wakeup instead of device_may_wakeup().  This patch (as1076)
makes that change for root hubs in several places.

The patch also adjusts uhci-hcd so that when an autostopped controller
is suspended, the remote wakeup setting agrees with the value recorded
in the root hub's do_remote_wakeup flag.

And the patch adjusts ehci-hcd so that wakeup events on selectively
suspended ports (i.e., the bus itself isn't suspended) don't turn on
the PME# wakeup signal.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-04-24 21:16:53 -07:00
Alan Stern 7be7d74187 USB: clarify usage of hcd->suspend/resume methods
The .suspend and .resume method pointers in struct usb_hcd have not
been fully understood by host-controller driver writers.  They are
meant for use with PCI controllers; other platform-specific drivers
generally should not refer to them.

To try and clarify matters, this patch (as1065) renames those methods
to .pci_suspend and .pci_resume.  It eliminates corresponding dead code
and bogus references in the ohci-ssb and u132-hcd drivers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-04-24 21:16:48 -07:00
Alan Stern 7329e211b9 USB: root hubs don't lie about their number of TTs
Currently EHCI root hubs enumerate with a bDeviceProtocol code
indicating that they possess a Transaction Translator.  However the
vast majority of controllers do not; they rely on a companion
controller to handle full- and low-speed communications.  This patch
(as1064) changes the root-hub device descriptor to match the actual
situation.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-04-24 21:16:48 -07:00
Alan Stern 3bb1af5243 USB: EHCI: carry out port handover during each root-hub resume
This patch (as1044) causes EHCI port handover for non-high-speed
devices to occur during every root-hub resume, not just in cases where
the controller lost power or was reset.  This is necessary because:

	When some machines go into suspend, they remove power from
	on-board USB devices while retaining suspend current for USB
	controllers.

	The user might well unplug a USB device while the system is
	suspended and then plug it back in before resuming.

A corresponding change is made to the core resume routine; now
high-speed root hubs will always be resumed when the system wakes up,
even if they were suspended before the system went to sleep.  If this
weren't done then EHCI port handover wouldn't work, since it is called
when the EHCI root hub is resumed.

Finally, a comment is added to the hub driver explaining the khubd has
to be freezable; if it weren't frozen then it could interfere with
port handover.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-04-24 21:16:32 -07:00
Rene Herman 055b93c9e3 USB: ehci: stop vt6212 bus hogging
The VIA VT6212 defaults to only waiting 1us between passes over EHCI's
async ring, which hammers PCI badly ... and by preventing other devices
from accessing the bus, causes problems like drops in IDE throughput,
a problem that's been bugging users of those chips for several years.

A (partial) datasheet for this chip eventually turned up, letting us
see how to make it use a VIA-specific register to switch over to the
the normal 10us value instead, as suggested by the EHCI specification
Solution noted by Lev A. Melnikovsky.

It's not clear whether this register exists on other VIA chips; we
know that it's ineffective on the vt8235.  So this patch only applies
to chips that seem to be incarnations of the (discrete) vt6212.

Signed-off-by: Rene Herman <rene.herman@gmail.com>
Tested-by: Lev A. Melnikovsky <melnikovsky@mail.ru>
Tested-by: Alessandro Suardi <alessandro.suardi@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-03-24 22:26:15 -07:00
Alan Stern 07d29b63ef USB: EHCI: add separate IAA watchdog timer
This patch (as1028) was mostly written by David Brownell; I made only
a few changes (extra log info and a small bug fix -- which might
account for why David's version had to be reverted).  It adds a new
watchdog timer to the ehci-hcd driver to be used exclusively for
detecting lost or missing IAA notifications.

Previously a shared timer had been used, which may have led to some
problems as reported by Christian Hoffmann.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-02-01 14:34:55 -08:00
Balaji Rao 90da096ee4 USB: force handover port to companion when hub_port_connect_change fails
This patch hands over the port to the companion when the
hub_port_connect_change fails.

Signed-off-by: Balaji Rao <balajirrao@gmail.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-02-01 14:34:52 -08:00
Marcelo Tosatti af1c51fcb2 USB: EHCI restart speedup
It is not necessary to powerdown the ports on ehci_pci_reinit() when the
chip reset already did that.  Removing this saves 20ms during restart
after poweroff paths (which OLPC uses a lot).

To ensure driver startup then behaves consistently, force a reset during
driver startup.  (Not doing this was an accident of some previous changes
to the init sequence.)

Make the corresponding change in the PS3 support.  It's not clear what
ehci-fsl should do here; it has similar code to the PS3.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: <rvinson@mvista.com>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:18 -07:00
Alan Stern 383975d765 USB: EHCI, OHCI: handover changes
This patch (as887) changes the way ehci-hcd and ohci-hcd handle a loss
of VBUS power during suspend.  In order for the USB-persist facility
to work correctly, it is necessary for low- and full-speed devices
attached to a high-speed port to be handed back to the companion
controller during resume processing.

This entails three changes: adding code to ehci-hcd to perform the
handover, removing code from ohci-hcd to turn off ports during
root-hub reinit, and adding code to ohci-hcd to turn on ports during
PCI controller resume.  (Other bus glue resume methods for platforms
supporting high-speed controllers would need a similar change, if any
existed.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:47 -07:00
Auke Kok 44c10138fd PCI: Change all drivers to use pci_device->revision
Instead of all drivers reading pci config space to get the revision
ID, they can now use the pci_device->revision member.

This exposes some issues where drivers where reading a word or a dword
for the revision number, and adding useless error-handling around the
read. Some drivers even just read it for no purpose of all.

In devices where the revision ID is being copied over and used in what
appears to be the equivalent of hotpath, I have left the copy code
and the cached copy as not to influence the driver's performance.

Compile tested with make all{yes,mod}config on x86_64 and i386.

Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Acked-by: Dave Jones <davej@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-11 16:02:10 -07:00
Benjamin Herrenschmidt 083522d766 USB: Implement support for EHCI with big endian MMIO
This patch implements supports for EHCI controllers whose MMIO
registers are big endian and enables that functionality for
the Toshiba SCC chip. It does _not_ add support for big endian
in-memory data structures as this is not needed for that chip
and I hope it will never be.

The guts of the patch are to convert readl(...) to
ehci_readl(ehci, ...) and similarly for register writes.

Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07 15:44:32 -08:00
Alan Stern 8c03356a55 EHCI: Fix root-hub and port suspend/resume problems
This patch (as738b) fixes numerous problems in the controller/root-hub
suspend/resume/remote-wakeup support in ehci-hcd:

	The bus_resume() routine should wake up only the ports that
	were suspended by bus_suspend().  Ports that were already
	suspended should remain that way.

	The interrupt mask is used to detect loss of power in the
	bus_resume() routine (if the mask is 0 then power was lost).
	However bus_suspend() always sets the mask to 0.  Instead the
	mask should retain its normal value, with port-change-detect
	interrupts disabled if remote wakeup is turned off.

	The interrupt mask should be reset to its correct value at the
	end of bus_resume() regardless of whether power was lost.

	bus_resume() reinitializes the operational registers if power
	was lost.  However those registers are not in the aux power
	well, hence they can lose their values whenever the controller
	is put into D3.  They should always be reinitialized.

	When a port-change interrupt occurs and the root hub is
	suspended, the interrupt handler should request a root-hub
	resume instead of starting up the controller all by itself.

	There's no need for the interrupt handler to request a
	root-hub resume every time a suspended port sends a
	remote-wakeup request.

	The pci_resume() method doesn't need to check for connected
	ports when deciding whether or not to reset the controller.
	It can make that decision based on whether Vaux power was
	maintained.

	Even when the controller does not need to be reset,
	pci_resume() must undo the effect of pci_suspend() by
	re-enabling the interrupt mask.

	If power was lost, pci_resume() must not call ehci_run().
	At this point the root hub is still supposed to be suspended,
	not running.  It's enough to rewrite the command register and
	set the configured_flag.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-12-01 14:25:52 -08:00
Greg Kroah-Hartman 64f89798da USB: revert EHCI VIA workaround patch
This reverts 26f953fd88 which caused
resume problems on the mac mini.

Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-10-17 13:57:18 -07:00
David Howells 7d12e780e0 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around.  On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable.  On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions.  Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller.  A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs.  Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

	struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

	set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

	-	update_process_times(user_mode(regs));
	-	profile_tick(CPU_PROFILING, regs);
	+	update_process_times(user_mode(get_irq_regs()));
	+	profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

 (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
     the input_dev struct.

 (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
     something different depending on whether it's been supplied with a regs
     pointer or not.

 (*) Various IRQ handler function pointers have been moved to type
     irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 15:10:12 +01:00
David Brownell 26f953fd88 USB: EHCI update VIA workaround
This revamps handling of the hardware "async advance" IRQ, and its watchdog
timer.  Basically it dis-entangles that important timeout from the others,
simplifying the associated state and code to make it more robust.

This reportedly improves behavior of EHCI on some systems with VIA chips,
and AFAIK won't affect non-VIA hardware.  VIA systems need this code to
recover from silcon bugs whereby the "async advance" IRQ isn't issued.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27 11:59:00 -07:00
Aleksey Gorelov 64a21d025d 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>
2006-09-27 11:58:54 -07:00
David Brownell 185849991d PM: USB HCDs use PM_EVENT_PRETHAW
This teaches several USB host controller drivers to treat PRETHAW as a chip
reset since the controller, and all devices connected to it, are no longer in
states compatible with how the snapshotted suspend() left them.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-25 21:08:37 -07:00
Kumar Gala 01cced2507 [PATCH] USB: allow multiple types of EHCI controllers to be built as modules
In some systems we may have both a platform EHCI controller and PCI EHCI
controller.  Previously we couldn't build the EHCI support as a module due
to conflicting module_init() calls in the code.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:09 -07:00
Paul Serice c32ba30f76 [PATCH] USB: EHCI works again on NVidia controllers with >2GB RAM
From: Paul Serice <paul@serice.net>

The workaround in commit f7201c3dcd
broke.  The work around requires memory for DMA transfers for some
NVidia EHCI controllers to be below 2GB, but recent changes have
caused some DMA memory to be allocated before the DMA mask is set.

Signed-off-by: Paul Serice <paul@serice.net>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:08 -07:00
Jean Delvare c67808eee6 [PATCH] USB: Use new PCI_CLASS_SERIAL_USB_* defines
We could use the recently added PCI_CLASS_SERIAL_USB_UHCI,
PCI_CLASS_SERIAL_USB_OHCI and PCI_CLASS_SERIAL_USB_EHCI defines in
more places, for slightly shorter and clearer code.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-04-27 10:28:59 -07:00
David Brownell f8aeb3bb86 [PATCH] USB: EHCI and NF2 quirk
This teaches the EHCI driver about a quirk seen in older NForce2 chips,
adding a workaround to ignore selective suspend requests.  Bus-wide
(so-called "global") suspend still works, as does USB wakeup of a
root hub that's globally suspended.

There's still a hole in this support though.  Strictly speaking, this
should _fail_ selective suspend requests, rather than ignoring them,
since doing it this way means that devices which should be able to issue
remote wakeup are not going to be able to do that.  For now, we'll just
live with that problem ... since usbcore expects to do selective suspend
on the way towards a full bus suspend, and usbcore needs to be able to
do full bus suspend.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:49:55 -08:00
Andrew Morton b6daf7f508 [PATCH] USB: fix ehci early handoff issues warning
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-31 17:23:36 -08:00
David Brownell 401feafa62 [PATCH] USB: fix EHCI early handoff issues
This moves the previously widely-used ehci-pci.c BIOS handoff
code into the pci-quirks.c file, replacing the less widely used
"early handoff" version that seems to cause problems lately.

One notable change:  the "early handoff" version always enabled
an SMI IRQ ... and did so even if the pre-Linux code said it was
not using EHCI (and not expecting EHCI SMIs).  Looks like a goof
in a workaround for some unknown BIOS version.

This merged version only forcibly enables those IRQs when pre-Linux
code says it's using EHCI.  And now it always forces them off "just
in case".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-31 17:23:35 -08:00
Alan Stern 1c50c317e2 [PATCH] USB: central handling for host controllers that were reset during suspend/resume
This patch (as515b) adds a routine to usbcore to simplify handling of
host controllers that lost power or were reset during suspend/resume.
The new core routine marks all the child devices of the root hub as
NOTATTACHED and tells khubd to disconnect the device structures as soon
as possible.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:31 -08:00
David Brownell 2c1c3c4cd5 [PATCH] USB: EHCI updates (4/4) driver model wakeup flags
This teaches the EHCI driver to use the new driver model wakeup flags,
replacing the similar ones in the HCD glue.  It also adds a workaround
for the current glitch whereby PCI init doesn't init the wakeup flags
from the PCI PM capabilities.  (EHCI controllers don't worry about
legacy mode; the PCI PM capability would always do the job.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:30 -08:00
David Brownell 8926bfa746 [PATCH] USB: ehci fixups
Rename the EHCI "reset" routine so it better matches what it does (setup);
and move the one-time data structure setup earlier, before doing anything
that implicitly relies on it having been completed already.

From: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-29 21:39:23 -08:00
Benjamin Herrenschmidt 8de9840265 [PATCH] USB: Fix USB suspend/resume crasher (#2)
This patch closes the IRQ race and makes various other OHCI & EHCI code
path safer vs. suspend/resume.
I've been able to (finally !) successfully suspend and resume various
Mac models, with or without USB mouse plugged, or plugging while asleep,
or unplugging while asleep etc... all without a crash.

Alan, please verify the UHCI bit I did, I only verified that it builds.
It's very simple so I wouldn't expect any issue there. If you aren't
confident, then just drop the hunks that change uhci-hcd.c

I also made the patch a little bit more "safer" by making sure the store
to the interrupt register that disables interrupts is not posted before
I set the flag and drop the spinlock.

Without this patch, you cannot reliably sleep/wakeup any recent Mac, and
I suspect PCs have some more sneaky issues too (they don't frankly crash
with machine checks because x86 tend to silently swallow PCI errors but
that won't last afaik, at least PCI Express will blow up in those
situations, but the USB code may still misbehave).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-29 21:39:23 -08:00
David Brownell 188075211c [PATCH] USB: EHCI updates split init/reinit logic for resume
Moving the PCI-specific parts of the EHCI driver into their own file
created a few issues ... notably on resume paths which (like swsusp)
require re-initializing the controller.  This patch:

 - Splits the EHCI startup code into run-once HCD setup code and
   separate "init the hardware" reinit code.  (That reinit code is
   a superset of the "early usb handoff" code.)

 - Then it makes the PCI init code run both, and the resume code only
   run the reinit code.

 - It also removes needless pci wrappers around EHCI start/stop methods.

 - Removes a byteswap issue that would be seen on big-endian hardware.

The HCD glue still doesn't actually provide a good way to do all this
run-one init stuff in one place though.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-23 23:04:28 -08:00
David Brownell abcc944806 [PATCH] USB: EHCI updates mostly whitespace cleanups
This cleans up the recent updates to EHCI PCI support:

  - Gets rid of checks for "is this a PCI device", they're no
    longer needed since this is now all PCI-only code.

  - Reduce log spamming:  MWI is only interesting in the atypical
    case that it can actually be used.

  - Whitespace cleanup, as appropriate for a new file with no
    other pending patches.

So other than that minor logging change, no functional updates.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-23 23:04:28 -08:00
David Brownell f03c17fc9a [PATCH] USB: EHCI updates
This fixes some bugs in EHCI suspend/resume that joined us over the past
few releases (as usbcore, PCI, pmcore, and other components evolved):

  - Removes suspend and resume recursion from the EHCI driver, getting
    rid of the USB_SUSPEND special casing.

  - Updates the wakeup mechanism to work again; there's a newish usbcore
    call it needs to use.

  - Provide simpler tests for "do we need to restart from scratch", to
    address another case where PCI Vaux was lost.  (In this case it was
    restoring a swsusp snapshot, but there could be others.)

Un-exports a symbol that was temporarily exported.

A notable change from previous version is that this doesn't move
the spinlock init, so there's still a resume/reinit path bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-23 23:04:28 -08:00
Greg Kroah-Hartman 249bb070f5 [PATCH] PCI: removed unneeded .owner field from struct pci_driver
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-10 16:09:17 -08:00
Greg Kroah-Hartman 4303fc6f05 USB: fix up some odd parts due to partial merges
Thanks to Andrew for doing the hard work on this.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 19:59:31 -07:00
Ben Dooks efa400db53 [PATCH] USB: add owner initialisation to host drivers
Add .owner initialisation to the device drivers
in drivers/usb/host so that when built as module
the device_driver refers to the owning module

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:45 -07:00
Alan Stern 0c0382e32d [PATCH] USB: Rename hcd->hub_suspend to hcd->bus_suspend
This patch (as580) is perhaps the only result from the long discussion I
had with David about his changes to the root-hub suspend/resume code.  It
renames the hub_suspend and hub_resume methods in struct usb_hcd to
bus_suspend and bus_resume.  These are more descriptive names, since the
methods really do suspend or resume an entire USB bus, and less likely to
be confused with the hub_suspend and hub_resume routines in hub.c.

It also takes David's advice about removing the layer of bus glue, where
those methods are called.  And it implements a related change that David
made to the other HCDs but forgot to put into dummy_hcd.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:44 -07:00
Matt Porter 7ff71d6adf [PATCH] EHCI, split out PCI glue
This splits BIOS and PCI specific support out of ehci-hcd.c into
ehci-pci.c.  It follows the model already used in the OHCI driver
so support for non-PCI EHCI controllers can be more easily added.

Signed-off-by: Matt Porter <mporter@kernel.crashing.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/host/ehci-hcd.c |  543 ++++++--------------------------------------
 drivers/usb/host/ehci-pci.c |  414 +++++++++++++++++++++++++++++++++
 drivers/usb/host/ehci.h     |    1
 3 files changed, 492 insertions(+), 466 deletions(-)
2005-10-28 16:47:39 -07:00