diff options
Diffstat (limited to 'drivers/usb/host/ehci-hub.c')
| -rw-r--r-- | drivers/usb/host/ehci-hub.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 4e065e556e4b..efffef64f59d 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
| @@ -28,7 +28,9 @@ | |||
| 28 | 28 | ||
| 29 | /*-------------------------------------------------------------------------*/ | 29 | /*-------------------------------------------------------------------------*/ |
| 30 | 30 | ||
| 31 | #ifdef CONFIG_USB_PERSIST | 31 | #define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E) |
| 32 | |||
| 33 | #ifdef CONFIG_PM | ||
| 32 | 34 | ||
| 33 | static int ehci_hub_control( | 35 | static int ehci_hub_control( |
| 34 | struct usb_hcd *hcd, | 36 | struct usb_hcd *hcd, |
| @@ -104,15 +106,6 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci) | |||
| 104 | ehci->owned_ports = 0; | 106 | ehci->owned_ports = 0; |
| 105 | } | 107 | } |
| 106 | 108 | ||
| 107 | #else /* CONFIG_USB_PERSIST */ | ||
| 108 | |||
| 109 | static inline void ehci_handover_companion_ports(struct ehci_hcd *ehci) | ||
| 110 | { } | ||
| 111 | |||
| 112 | #endif | ||
| 113 | |||
| 114 | #ifdef CONFIG_PM | ||
| 115 | |||
| 116 | static int ehci_bus_suspend (struct usb_hcd *hcd) | 109 | static int ehci_bus_suspend (struct usb_hcd *hcd) |
| 117 | { | 110 | { |
| 118 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 111 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
| @@ -158,10 +151,10 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
| 158 | } | 151 | } |
| 159 | 152 | ||
| 160 | /* enable remote wakeup on all ports */ | 153 | /* enable remote wakeup on all ports */ |
| 161 | if (device_may_wakeup(&hcd->self.root_hub->dev)) | 154 | if (hcd->self.root_hub->do_remote_wakeup) |
| 162 | t2 |= PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E; | 155 | t2 |= PORT_WAKE_BITS; |
| 163 | else | 156 | else |
| 164 | t2 &= ~(PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E); | 157 | t2 &= ~PORT_WAKE_BITS; |
| 165 | 158 | ||
| 166 | if (t1 != t2) { | 159 | if (t1 != t2) { |
| 167 | ehci_vdbg (ehci, "port %d, %08x -> %08x\n", | 160 | ehci_vdbg (ehci, "port %d, %08x -> %08x\n", |
| @@ -183,7 +176,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
| 183 | 176 | ||
| 184 | /* allow remote wakeup */ | 177 | /* allow remote wakeup */ |
| 185 | mask = INTR_MASK; | 178 | mask = INTR_MASK; |
| 186 | if (!device_may_wakeup(&hcd->self.root_hub->dev)) | 179 | if (!hcd->self.root_hub->do_remote_wakeup) |
| 187 | mask &= ~STS_PCD; | 180 | mask &= ~STS_PCD; |
| 188 | ehci_writel(ehci, mask, &ehci->regs->intr_enable); | 181 | ehci_writel(ehci, mask, &ehci->regs->intr_enable); |
| 189 | ehci_readl(ehci, &ehci->regs->intr_enable); | 182 | ehci_readl(ehci, &ehci->regs->intr_enable); |
| @@ -241,8 +234,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd) | |||
| 241 | i = HCS_N_PORTS (ehci->hcs_params); | 234 | i = HCS_N_PORTS (ehci->hcs_params); |
| 242 | while (i--) { | 235 | while (i--) { |
| 243 | temp = ehci_readl(ehci, &ehci->regs->port_status [i]); | 236 | temp = ehci_readl(ehci, &ehci->regs->port_status [i]); |
| 244 | temp &= ~(PORT_RWC_BITS | 237 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); |
| 245 | | PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E); | ||
| 246 | if (test_bit(i, &ehci->bus_suspended) && | 238 | if (test_bit(i, &ehci->bus_suspended) && |
| 247 | (temp & PORT_SUSPEND)) { | 239 | (temp & PORT_SUSPEND)) { |
| 248 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); | 240 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); |
| @@ -281,9 +273,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd) | |||
| 281 | ehci_writel(ehci, INTR_MASK, &ehci->regs->intr_enable); | 273 | ehci_writel(ehci, INTR_MASK, &ehci->regs->intr_enable); |
| 282 | 274 | ||
| 283 | spin_unlock_irq (&ehci->lock); | 275 | spin_unlock_irq (&ehci->lock); |
| 284 | 276 | ehci_handover_companion_ports(ehci); | |
| 285 | if (!power_okay) | ||
| 286 | ehci_handover_companion_ports(ehci); | ||
| 287 | return 0; | 277 | return 0; |
| 288 | } | 278 | } |
| 289 | 279 | ||
| @@ -545,8 +535,6 @@ ehci_hub_descriptor ( | |||
| 545 | 535 | ||
| 546 | /*-------------------------------------------------------------------------*/ | 536 | /*-------------------------------------------------------------------------*/ |
| 547 | 537 | ||
| 548 | #define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E) | ||
| 549 | |||
| 550 | static int ehci_hub_control ( | 538 | static int ehci_hub_control ( |
| 551 | struct usb_hcd *hcd, | 539 | struct usb_hcd *hcd, |
| 552 | u16 typeReq, | 540 | u16 typeReq, |
| @@ -778,7 +766,7 @@ static int ehci_hub_control ( | |||
| 778 | if (temp & PORT_POWER) | 766 | if (temp & PORT_POWER) |
| 779 | status |= 1 << USB_PORT_FEAT_POWER; | 767 | status |= 1 << USB_PORT_FEAT_POWER; |
| 780 | 768 | ||
| 781 | #ifndef EHCI_VERBOSE_DEBUG | 769 | #ifndef VERBOSE_DEBUG |
| 782 | if (status & ~0xffff) /* only if wPortChange is interesting */ | 770 | if (status & ~0xffff) /* only if wPortChange is interesting */ |
| 783 | #endif | 771 | #endif |
| 784 | dbg_port (ehci, "GetStatus", wIndex + 1, temp); | 772 | dbg_port (ehci, "GetStatus", wIndex + 1, temp); |
| @@ -812,8 +800,6 @@ static int ehci_hub_control ( | |||
| 812 | if ((temp & PORT_PE) == 0 | 800 | if ((temp & PORT_PE) == 0 |
| 813 | || (temp & PORT_RESET) != 0) | 801 | || (temp & PORT_RESET) != 0) |
| 814 | goto error; | 802 | goto error; |
| 815 | if (device_may_wakeup(&hcd->self.root_hub->dev)) | ||
| 816 | temp |= PORT_WAKE_BITS; | ||
| 817 | ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); | 803 | ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); |
| 818 | break; | 804 | break; |
| 819 | case USB_PORT_FEAT_POWER: | 805 | case USB_PORT_FEAT_POWER: |
