diff options
author | David Brownell <david-b@pacbell.net> | 2006-06-05 12:16:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 18:04:16 -0400 |
commit | be3cbc5f87d4b1fbd714644b6824ce4eb229f372 (patch) | |
tree | cea9e1dd8bc67ae65cb25dd7d46235234da7730f | |
parent | ae671813affd947d2f21ff8e3cd329e466ee85b2 (diff) |
[PATCH] UHCI: various updates
This patch (as705) contains a small set of updates for uhci-hcd written
mostly by Dave Brownell:
* Root hub suspend messages come out labeled as root hub messages;
PCI messages should only come out when the pci device suspends.
* Rename the reset() method to better match its init() role
* Behave more like the other HCDs by returning -ESHUTDOWN for root-hub
suspend/resume errors.
* When an URB fails, associate the message with the usb device not
the host controller (it still hides endpoint and direction)
From: David Brownell <david-b@pacbell.net>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/host/uhci-hcd.c | 37 | ||||
-rw-r--r-- | drivers/usb/host/uhci-q.c | 2 |
2 files changed, 22 insertions, 17 deletions
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 5e75ad6dc29f..dc9ed29c6175 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -124,8 +124,9 @@ static void hc_died(struct uhci_hcd *uhci) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | /* | 126 | /* |
127 | * Initialize a controller that was newly discovered or has just been | 127 | * Initialize a controller that was newly discovered or has lost power |
128 | * resumed. In either case we can't be sure of its previous state. | 128 | * or otherwise been reset while it was suspended. In none of these cases |
129 | * can we be sure of its previous state. | ||
129 | */ | 130 | */ |
130 | static void check_and_reset_hc(struct uhci_hcd *uhci) | 131 | static void check_and_reset_hc(struct uhci_hcd *uhci) |
131 | { | 132 | { |
@@ -198,7 +199,8 @@ __acquires(uhci->lock) | |||
198 | int int_enable; | 199 | int int_enable; |
199 | 200 | ||
200 | auto_stop = (new_state == UHCI_RH_AUTO_STOPPED); | 201 | auto_stop = (new_state == UHCI_RH_AUTO_STOPPED); |
201 | dev_dbg(uhci_dev(uhci), "%s%s\n", __FUNCTION__, | 202 | dev_dbg(&uhci_to_hcd(uhci)->self.root_hub->dev, |
203 | "%s%s\n", __FUNCTION__, | ||
202 | (auto_stop ? " (auto-stop)" : "")); | 204 | (auto_stop ? " (auto-stop)" : "")); |
203 | 205 | ||
204 | /* If we get a suspend request when we're already auto-stopped | 206 | /* If we get a suspend request when we're already auto-stopped |
@@ -236,7 +238,8 @@ __acquires(uhci->lock) | |||
236 | return; | 238 | return; |
237 | } | 239 | } |
238 | if (!(inw(uhci->io_addr + USBSTS) & USBSTS_HCH)) | 240 | if (!(inw(uhci->io_addr + USBSTS) & USBSTS_HCH)) |
239 | dev_warn(uhci_dev(uhci), "Controller not stopped yet!\n"); | 241 | dev_warn(&uhci_to_hcd(uhci)->self.root_hub->dev, |
242 | "Controller not stopped yet!\n"); | ||
240 | 243 | ||
241 | uhci_get_current_frame_number(uhci); | 244 | uhci_get_current_frame_number(uhci); |
242 | 245 | ||
@@ -268,7 +271,8 @@ static void wakeup_rh(struct uhci_hcd *uhci) | |||
268 | __releases(uhci->lock) | 271 | __releases(uhci->lock) |
269 | __acquires(uhci->lock) | 272 | __acquires(uhci->lock) |
270 | { | 273 | { |
271 | dev_dbg(uhci_dev(uhci), "%s%s\n", __FUNCTION__, | 274 | dev_dbg(&uhci_to_hcd(uhci)->self.root_hub->dev, |
275 | "%s%s\n", __FUNCTION__, | ||
272 | uhci->rh_state == UHCI_RH_AUTO_STOPPED ? | 276 | uhci->rh_state == UHCI_RH_AUTO_STOPPED ? |
273 | " (auto-start)" : ""); | 277 | " (auto-start)" : ""); |
274 | 278 | ||
@@ -406,7 +410,7 @@ static void release_uhci(struct uhci_hcd *uhci) | |||
406 | uhci->frame, uhci->frame_dma_handle); | 410 | uhci->frame, uhci->frame_dma_handle); |
407 | } | 411 | } |
408 | 412 | ||
409 | static int uhci_reset(struct usb_hcd *hcd) | 413 | static int uhci_init(struct usb_hcd *hcd) |
410 | { | 414 | { |
411 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); | 415 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); |
412 | unsigned io_size = (unsigned) hcd->rsrc_len; | 416 | unsigned io_size = (unsigned) hcd->rsrc_len; |
@@ -672,12 +676,15 @@ static void uhci_stop(struct usb_hcd *hcd) | |||
672 | static int uhci_rh_suspend(struct usb_hcd *hcd) | 676 | static int uhci_rh_suspend(struct usb_hcd *hcd) |
673 | { | 677 | { |
674 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); | 678 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); |
679 | int rc = 0; | ||
675 | 680 | ||
676 | spin_lock_irq(&uhci->lock); | 681 | spin_lock_irq(&uhci->lock); |
677 | if (!uhci->hc_inaccessible) /* Not dead */ | 682 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) |
683 | rc = -ESHUTDOWN; | ||
684 | else if (!uhci->hc_inaccessible) | ||
678 | suspend_rh(uhci, UHCI_RH_SUSPENDED); | 685 | suspend_rh(uhci, UHCI_RH_SUSPENDED); |
679 | spin_unlock_irq(&uhci->lock); | 686 | spin_unlock_irq(&uhci->lock); |
680 | return 0; | 687 | return rc; |
681 | } | 688 | } |
682 | 689 | ||
683 | static int uhci_rh_resume(struct usb_hcd *hcd) | 690 | static int uhci_rh_resume(struct usb_hcd *hcd) |
@@ -686,13 +693,10 @@ static int uhci_rh_resume(struct usb_hcd *hcd) | |||
686 | int rc = 0; | 693 | int rc = 0; |
687 | 694 | ||
688 | spin_lock_irq(&uhci->lock); | 695 | spin_lock_irq(&uhci->lock); |
689 | if (uhci->hc_inaccessible) { | 696 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { |
690 | if (uhci->rh_state == UHCI_RH_SUSPENDED) { | 697 | dev_warn(&hcd->self.root_hub->dev, "HC isn't running!\n"); |
691 | dev_warn(uhci_dev(uhci), "HC isn't running!\n"); | 698 | rc = -ESHUTDOWN; |
692 | rc = -ENODEV; | 699 | } else if (!uhci->hc_inaccessible) |
693 | } | ||
694 | /* Otherwise the HC is dead */ | ||
695 | } else | ||
696 | wakeup_rh(uhci); | 700 | wakeup_rh(uhci); |
697 | spin_unlock_irq(&uhci->lock); | 701 | spin_unlock_irq(&uhci->lock); |
698 | return rc; | 702 | return rc; |
@@ -746,6 +750,7 @@ static int uhci_resume(struct usb_hcd *hcd) | |||
746 | 750 | ||
747 | if (uhci->rh_state == UHCI_RH_RESET) /* Dead */ | 751 | if (uhci->rh_state == UHCI_RH_RESET) /* Dead */ |
748 | return 0; | 752 | return 0; |
753 | |||
749 | spin_lock_irq(&uhci->lock); | 754 | spin_lock_irq(&uhci->lock); |
750 | 755 | ||
751 | /* FIXME: Disable non-PME# remote wakeup? */ | 756 | /* FIXME: Disable non-PME# remote wakeup? */ |
@@ -828,7 +833,7 @@ static const struct hc_driver uhci_driver = { | |||
828 | .flags = HCD_USB11, | 833 | .flags = HCD_USB11, |
829 | 834 | ||
830 | /* Basic lifecycle operations */ | 835 | /* Basic lifecycle operations */ |
831 | .reset = uhci_reset, | 836 | .reset = uhci_init, |
832 | .start = uhci_start, | 837 | .start = uhci_start, |
833 | #ifdef CONFIG_PM | 838 | #ifdef CONFIG_PM |
834 | .suspend = uhci_suspend, | 839 | .suspend = uhci_suspend, |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index cbbaa4c1740f..b173d914d748 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -910,7 +910,7 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb) | |||
910 | uhci_packetout(td_token(td))); | 910 | uhci_packetout(td_token(td))); |
911 | if ((debug == 1 && ret != -EPIPE) || debug > 1) { | 911 | if ((debug == 1 && ret != -EPIPE) || debug > 1) { |
912 | /* Some debugging code */ | 912 | /* Some debugging code */ |
913 | dev_dbg(uhci_dev(uhci), | 913 | dev_dbg(&urb->dev->dev, |
914 | "%s: failed with status %x\n", | 914 | "%s: failed with status %x\n", |
915 | __FUNCTION__, status); | 915 | __FUNCTION__, status); |
916 | 916 | ||