Commit b339a6f5 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: uhci-hcd, add uhci_reset()

This is a straightforward change matching ones sent in
for ehci (last month) and ohci (earlier this week).

It abstracts the reset operation into something that's
called before the pci glue does much to the hardware.

It also arranges to kick the BIOS off the hardware before
it resets it (not after) ... so there's no confusion at
any time about what driver "owns" that hardware.  (Again
matching what ehci and ohci drivers do.)
parent 92710f36
...@@ -2143,6 +2143,20 @@ static void release_uhci(struct uhci_hcd *uhci) ...@@ -2143,6 +2143,20 @@ static void release_uhci(struct uhci_hcd *uhci)
#endif #endif
} }
static int uhci_reset(struct usb_hcd *hcd)
{
struct uhci_hcd *uhci = hcd_to_uhci(hcd);
uhci->io_addr = (unsigned long) hcd->regs;
/* Maybe kick BIOS off this hardware. Then reset, so we won't get
* interrupts from any previous setup.
*/
pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT);
reset_hc(uhci);
return 0;
}
/* /*
* Allocate a frame list, and then setup the skeleton * Allocate a frame list, and then setup the skeleton
* *
...@@ -2159,7 +2173,7 @@ static void release_uhci(struct uhci_hcd *uhci) ...@@ -2159,7 +2173,7 @@ static void release_uhci(struct uhci_hcd *uhci)
* - The fourth queue is the bandwidth reclamation queue, which loops back * - The fourth queue is the bandwidth reclamation queue, which loops back
* to the high speed control queue. * to the high speed control queue.
*/ */
static int __devinit uhci_start(struct usb_hcd *hcd) static int uhci_start(struct usb_hcd *hcd)
{ {
struct uhci_hcd *uhci = hcd_to_uhci(hcd); struct uhci_hcd *uhci = hcd_to_uhci(hcd);
int retval = -EBUSY; int retval = -EBUSY;
...@@ -2171,7 +2185,6 @@ static int __devinit uhci_start(struct usb_hcd *hcd) ...@@ -2171,7 +2185,6 @@ static int __devinit uhci_start(struct usb_hcd *hcd)
struct proc_dir_entry *ent; struct proc_dir_entry *ent;
#endif #endif
uhci->io_addr = (unsigned long) hcd->regs;
io_size = pci_resource_len(hcd->pdev, hcd->region); io_size = pci_resource_len(hcd->pdev, hcd->region);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
...@@ -2188,10 +2201,6 @@ static int __devinit uhci_start(struct usb_hcd *hcd) ...@@ -2188,10 +2201,6 @@ static int __devinit uhci_start(struct usb_hcd *hcd)
uhci->proc_entry = ent; uhci->proc_entry = ent;
#endif #endif
/* Reset here so we don't get any interrupts from an old setup */
/* or broken setup */
reset_hc(uhci);
uhci->fsbr = 0; uhci->fsbr = 0;
uhci->fsbrtimeout = 0; uhci->fsbrtimeout = 0;
...@@ -2343,9 +2352,6 @@ static int __devinit uhci_start(struct usb_hcd *hcd) ...@@ -2343,9 +2352,6 @@ static int __devinit uhci_start(struct usb_hcd *hcd)
init_stall_timer(hcd); init_stall_timer(hcd);
/* disable legacy emulation */
pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT);
udev->speed = USB_SPEED_FULL; udev->speed = USB_SPEED_FULL;
if (usb_register_root_hub(udev, &hcd->pdev->dev) != 0) { if (usb_register_root_hub(udev, &hcd->pdev->dev) != 0) {
...@@ -2484,6 +2490,7 @@ static const struct hc_driver uhci_driver = { ...@@ -2484,6 +2490,7 @@ static const struct hc_driver uhci_driver = {
.flags = HCD_USB11, .flags = HCD_USB11,
/* Basic lifecycle operations */ /* Basic lifecycle operations */
.reset = uhci_reset,
.start = uhci_start, .start = uhci_start,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = uhci_suspend, .suspend = uhci_suspend,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment