Lines Matching +full:needs +full:- +full:reset +full:- +full:on +full:- +full:resume

1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2001-2004 by David Brownell
6 /* this file is part of ehci-hcd.c */
8 /*-------------------------------------------------------------------------*/
16 /*-------------------------------------------------------------------------*/
26 return !udev->maxchild && udev->persist_enabled && in persist_enabled_on_companion()
27 udev->bus->root_hub->speed < USB_SPEED_HIGH; in persist_enabled_on_companion()
31 * reset so that the companion can still own them.
41 if (!ehci->owned_ports) in ehci_handover_companion_ports()
48 * we can skip this and avoid slowing resume down. Devices without in ehci_handover_companion_ports()
49 * persist will just get reenumerated shortly after resume anyway. in ehci_handover_companion_ports()
55 port = HCS_N_PORTS(ehci->hcs_params); in ehci_handover_companion_ports()
56 while (port--) { in ehci_handover_companion_ports()
57 if (test_bit(port, &ehci->owned_ports)) { in ehci_handover_companion_ports()
58 reg = &ehci->regs->port_status[port]; in ehci_handover_companion_ports()
68 spin_lock_irq(&ehci->lock); in ehci_handover_companion_ports()
69 port = HCS_N_PORTS(ehci->hcs_params); in ehci_handover_companion_ports()
70 while (port--) { in ehci_handover_companion_ports()
71 if (test_bit(port, &ehci->owned_ports)) { in ehci_handover_companion_ports()
72 reg = &ehci->regs->port_status[port]; in ehci_handover_companion_ports()
77 clear_bit(port, &ehci->owned_ports); in ehci_handover_companion_ports()
78 else if (test_bit(port, &ehci->companion_ports)) in ehci_handover_companion_ports()
81 spin_unlock_irq(&ehci->lock); in ehci_handover_companion_ports()
85 spin_lock_irq(&ehci->lock); in ehci_handover_companion_ports()
89 spin_unlock_irq(&ehci->lock); in ehci_handover_companion_ports()
91 if (!ehci->owned_ports) in ehci_handover_companion_ports()
95 spin_lock_irq(&ehci->lock); in ehci_handover_companion_ports()
96 port = HCS_N_PORTS(ehci->hcs_params); in ehci_handover_companion_ports()
97 while (port--) { in ehci_handover_companion_ports()
98 if (test_bit(port, &ehci->owned_ports)) { in ehci_handover_companion_ports()
99 spin_unlock_irq(&ehci->lock); in ehci_handover_companion_ports()
103 spin_lock_irq(&ehci->lock); in ehci_handover_companion_ports()
109 reg = &ehci->regs->port_status[port]; in ehci_handover_companion_ports()
121 ehci->owned_ports = 0; in ehci_handover_companion_ports()
122 spin_unlock_irq(&ehci->lock); in ehci_handover_companion_ports()
127 int i = HCS_N_PORTS(ehci->hcs_params); in ehci_port_change()
131 if (ehci_readl(ehci, &ehci->regs->status) & STS_PCD) in ehci_port_change()
139 while (i--) in ehci_port_change()
140 if (ehci_readl(ehci, &ehci->regs->port_status[i]) & PORT_CSC) in ehci_port_change()
157 if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup) in ehci_adjust_port_wakeup_flags()
160 spin_lock_irq(&ehci->lock); in ehci_adjust_port_wakeup_flags()
162 /* clear phy low-power mode before changing wakeup flags */ in ehci_adjust_port_wakeup_flags()
163 if (ehci->has_tdi_phy_lpm) { in ehci_adjust_port_wakeup_flags()
164 port = HCS_N_PORTS(ehci->hcs_params); in ehci_adjust_port_wakeup_flags()
165 while (port--) { in ehci_adjust_port_wakeup_flags()
166 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port]; in ehci_adjust_port_wakeup_flags()
171 spin_unlock_irq(&ehci->lock); in ehci_adjust_port_wakeup_flags()
173 spin_lock_irq(&ehci->lock); in ehci_adjust_port_wakeup_flags()
176 port = HCS_N_PORTS(ehci->hcs_params); in ehci_adjust_port_wakeup_flags()
177 while (port--) { in ehci_adjust_port_wakeup_flags()
178 u32 __iomem *reg = &ehci->regs->port_status[port]; in ehci_adjust_port_wakeup_flags()
194 /* enter phy low-power mode again */ in ehci_adjust_port_wakeup_flags()
195 if (ehci->has_tdi_phy_lpm) { in ehci_adjust_port_wakeup_flags()
196 port = HCS_N_PORTS(ehci->hcs_params); in ehci_adjust_port_wakeup_flags()
197 while (port--) { in ehci_adjust_port_wakeup_flags()
198 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port]; in ehci_adjust_port_wakeup_flags()
209 spin_unlock_irq(&ehci->lock); in ehci_adjust_port_wakeup_flags()
223 if (time_before (jiffies, ehci->next_statechange)) in ehci_bus_suspend()
229 spin_lock_irq (&ehci->lock); in ehci_bus_suspend()
230 if (ehci->rh_state < EHCI_RH_RUNNING) in ehci_bus_suspend()
235 * for the root hub and any ports are in the middle of a resume or in ehci_bus_suspend()
238 if (hcd->self.root_hub->do_remote_wakeup) { in ehci_bus_suspend()
239 if (ehci->resuming_ports) { in ehci_bus_suspend()
240 spin_unlock_irq(&ehci->lock); in ehci_bus_suspend()
242 return -EBUSY; in ehci_bus_suspend()
247 * any notion of "global" or bus-wide suspend. The driver has in ehci_bus_suspend()
249 * then manually resume them in the bus_resume() routine. in ehci_bus_suspend()
251 ehci->bus_suspended = 0; in ehci_bus_suspend()
252 ehci->owned_ports = 0; in ehci_bus_suspend()
255 port = HCS_N_PORTS(ehci->hcs_params); in ehci_bus_suspend()
256 while (port--) { in ehci_bus_suspend()
257 u32 __iomem *reg = &ehci->regs->port_status [port]; in ehci_bus_suspend()
263 set_bit(port, &ehci->owned_ports); in ehci_bus_suspend()
266 set_bit(port, &ehci->bus_suspended); in ehci_bus_suspend()
269 /* enable remote wakeup on all ports, if told to do so */ in ehci_bus_suspend()
270 if (hcd->self.root_hub->do_remote_wakeup) { in ehci_bus_suspend()
284 * On some controllers, Wake-On-Disconnect will in ehci_bus_suspend()
286 * switches over to full-speed idle. For their in ehci_bus_suspend()
297 spin_unlock_irq(&ehci->lock); in ehci_bus_suspend()
302 * enter the suspend status before initiating a port resume in ehci_bus_suspend()
303 * using the Force Port Resume bit (Not-EHCI compatible). in ehci_bus_suspend()
307 if ((changed && ehci->has_tdi_phy_lpm) || fs_idle_delay) { in ehci_bus_suspend()
309 * Wait for HCD to enter low-power mode or for the bus in ehci_bus_suspend()
310 * to switch to full-speed idle. in ehci_bus_suspend()
315 if (changed && ehci->has_tdi_phy_lpm) { in ehci_bus_suspend()
316 spin_lock_irq(&ehci->lock); in ehci_bus_suspend()
317 port = HCS_N_PORTS(ehci->hcs_params); in ehci_bus_suspend()
318 while (port--) { in ehci_bus_suspend()
319 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port]; in ehci_bus_suspend()
325 ehci_dbg(ehci, "Port %d phy low-power mode %s\n", in ehci_bus_suspend()
329 spin_unlock_irq(&ehci->lock); in ehci_bus_suspend()
332 /* Apparently some devices need a >= 1-uframe delay here */ in ehci_bus_suspend()
333 if (ehci->bus_suspended) in ehci_bus_suspend()
336 /* turn off now-idle HC */ in ehci_bus_suspend()
339 spin_lock_irq(&ehci->lock); in ehci_bus_suspend()
340 if (ehci->enabled_hrtimer_events & BIT(EHCI_HRTIMER_POLL_DEAD)) in ehci_bus_suspend()
342 if (ehci->rh_state != EHCI_RH_RUNNING) in ehci_bus_suspend()
344 ehci->rh_state = EHCI_RH_SUSPENDED; in ehci_bus_suspend()
348 /* Some Synopsys controllers mistakenly leave IAA turned on */ in ehci_bus_suspend()
349 ehci_writel(ehci, STS_IAA, &ehci->regs->status); in ehci_bus_suspend()
359 if (!hcd->self.root_hub->do_remote_wakeup) in ehci_bus_suspend()
361 ehci_writel(ehci, mask, &ehci->regs->intr_enable); in ehci_bus_suspend()
362 ehci_readl(ehci, &ehci->regs->intr_enable); in ehci_bus_suspend()
365 ehci->next_statechange = jiffies + msecs_to_jiffies(10); in ehci_bus_suspend()
366 ehci->enabled_hrtimer_events = 0; in ehci_bus_suspend()
367 ehci->next_hrtimer_event = EHCI_HRTIMER_NO_EVENT; in ehci_bus_suspend()
368 spin_unlock_irq (&ehci->lock); in ehci_bus_suspend()
370 hrtimer_cancel(&ehci->hrtimer); in ehci_bus_suspend()
375 /* caller has locked the root hub, and should reset/reinit on error */
384 if (time_before (jiffies, ehci->next_statechange)) in ehci_bus_resume()
386 spin_lock_irq (&ehci->lock); in ehci_bus_resume()
387 if (!HCD_HW_ACCESSIBLE(hcd) || ehci->shutdown) in ehci_bus_resume()
390 if (unlikely(ehci->debug)) { in ehci_bus_resume()
392 ehci->debug = NULL; in ehci_bus_resume()
397 /* Ideally and we've got a real resume here, and no port's power in ehci_bus_resume()
399 * could instead be restoring a swsusp snapshot -- so that BIOS was in ehci_bus_resume()
400 * the last user of the controller, not reset/pm hardware keeping in ehci_bus_resume()
403 power_okay = ehci_readl(ehci, &ehci->regs->intr_enable); in ehci_bus_resume()
404 ehci_dbg(ehci, "resume root hub%s\n", in ehci_bus_resume()
410 ehci_writel(ehci, 0, &ehci->regs->intr_enable); in ehci_bus_resume()
412 /* re-init operational registers */ in ehci_bus_resume()
413 ehci_writel(ehci, 0, &ehci->regs->segment); in ehci_bus_resume()
414 ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list); in ehci_bus_resume()
415 ehci_writel(ehci, (u32) ehci->async->qh_dma, &ehci->regs->async_next); in ehci_bus_resume()
418 ehci->command |= CMD_RUN; in ehci_bus_resume()
419 ehci_writel(ehci, ehci->command, &ehci->regs->command); in ehci_bus_resume()
420 ehci->rh_state = EHCI_RH_RUNNING; in ehci_bus_resume()
427 i = HCS_N_PORTS(ehci->hcs_params); in ehci_bus_resume()
428 while (i--) { in ehci_bus_resume()
429 temp = ehci_readl(ehci, &ehci->regs->port_status[i]); in ehci_bus_resume()
433 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
435 spin_lock_irq(&ehci->lock); in ehci_bus_resume()
440 if (ehci->shutdown) in ehci_bus_resume()
443 /* clear phy low-power mode before resume */ in ehci_bus_resume()
444 if (ehci->bus_suspended && ehci->has_tdi_phy_lpm) { in ehci_bus_resume()
445 i = HCS_N_PORTS(ehci->hcs_params); in ehci_bus_resume()
446 while (i--) { in ehci_bus_resume()
447 if (test_bit(i, &ehci->bus_suspended)) { in ehci_bus_resume()
449 &ehci->regs->hostpc[i]; in ehci_bus_resume()
456 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
458 spin_lock_irq(&ehci->lock); in ehci_bus_resume()
459 if (ehci->shutdown) in ehci_bus_resume()
463 /* manually resume the ports we suspended during bus_suspend() */ in ehci_bus_resume()
464 i = HCS_N_PORTS (ehci->hcs_params); in ehci_bus_resume()
465 while (i--) { in ehci_bus_resume()
466 temp = ehci_readl(ehci, &ehci->regs->port_status [i]); in ehci_bus_resume()
468 if (test_bit(i, &ehci->bus_suspended) && in ehci_bus_resume()
473 ehci_writel(ehci, temp, &ehci->regs->port_status [i]); in ehci_bus_resume()
477 * msleep for USB_RESUME_TIMEOUT ms only if code is trying to resume in ehci_bus_resume()
481 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
483 spin_lock_irq(&ehci->lock); in ehci_bus_resume()
484 if (ehci->shutdown) in ehci_bus_resume()
488 i = HCS_N_PORTS (ehci->hcs_params); in ehci_bus_resume()
489 while (i--) { in ehci_bus_resume()
490 temp = ehci_readl(ehci, &ehci->regs->port_status [i]); in ehci_bus_resume()
493 ehci_writel(ehci, temp, &ehci->regs->port_status [i]); in ehci_bus_resume()
497 ehci->next_statechange = jiffies + msecs_to_jiffies(5); in ehci_bus_resume()
498 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
502 /* Now we can safely re-enable irqs */ in ehci_bus_resume()
503 spin_lock_irq(&ehci->lock); in ehci_bus_resume()
504 if (ehci->shutdown) in ehci_bus_resume()
506 ehci_writel(ehci, INTR_MASK, &ehci->regs->intr_enable); in ehci_bus_resume()
507 (void) ehci_readl(ehci, &ehci->regs->intr_enable); in ehci_bus_resume()
508 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
513 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
514 return -ESHUTDOWN; in ehci_bus_resume()
521 return ehci->resuming_ports; in ehci_get_resuming_ports()
532 /*-------------------------------------------------------------------------*/
543 status_reg = &ehci->regs->port_status[portnum]; in set_owner()
550 for (try = 4; try > 0; --try) { in set_owner()
551 spin_lock_irq(&ehci->lock); in set_owner()
562 spin_unlock_irq(&ehci->lock); in set_owner()
568 /*-------------------------------------------------------------------------*/
579 /* if reset finished and it's still not enabled -- handoff */ in check_reset_complete()
585 "Failed to enable port %d on root hub TT\n", in check_reset_complete()
590 ehci_dbg (ehci, "port %d full speed --> companion\n", in check_reset_complete()
599 if (ehci->has_amcc_usb23) in check_reset_complete()
602 ehci_dbg(ehci, "port %d reset complete, port enabled\n", in check_reset_complete()
605 if (ehci->has_amcc_usb23) in check_reset_complete()
612 /*-------------------------------------------------------------------------*/
627 /* init status to no-changes */ in ehci_hub_status_data()
629 ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_status_data()
635 /* Inform the core about resumes-in-progress by returning in ehci_hub_status_data()
636 * a non-zero value even if there are no status changes. in ehci_hub_status_data()
638 status = ehci->resuming_ports; in ehci_hub_status_data()
644 * PORT_POWER; that's surprising, but maybe within-spec. in ehci_hub_status_data()
646 if (!ignore_oc && !ehci->spurious_oc) in ehci_hub_status_data()
655 spin_lock_irqsave (&ehci->lock, flags); in ehci_hub_status_data()
657 /* get per-port change detect bits */ in ehci_hub_status_data()
658 if (ehci->has_ppcd) in ehci_hub_status_data()
659 ppcd = ehci_readl(ehci, &ehci->regs->status) >> 16; in ehci_hub_status_data()
662 /* leverage per-port change bits feature */ in ehci_hub_status_data()
664 temp = ehci_readl(ehci, &ehci->regs->port_status[i]); in ehci_hub_status_data()
671 * high-speed device is switched over to the companion in ehci_hub_status_data()
675 if ((temp & mask) != 0 || test_bit(i, &ehci->port_c_suspend) in ehci_hub_status_data()
676 || (ehci->reset_done[i] && time_after_eq( in ehci_hub_status_data()
677 jiffies, ehci->reset_done[i]))) { in ehci_hub_status_data()
681 buf [1] |= 1 << (i - 7); in ehci_hub_status_data()
686 /* If a resume is in progress, make sure it can finish */ in ehci_hub_status_data()
687 if (ehci->resuming_ports) in ehci_hub_status_data()
688 mod_timer(&hcd->rh_timer, jiffies + msecs_to_jiffies(25)); in ehci_hub_status_data()
690 spin_unlock_irqrestore (&ehci->lock, flags); in ehci_hub_status_data()
694 /*-------------------------------------------------------------------------*/
701 int ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_descriptor()
704 desc->bDescriptorType = USB_DT_HUB; in ehci_hub_descriptor()
705 desc->bPwrOn2PwrGood = 10; /* ehci 1.0, 2.3.9 says 20ms max */ in ehci_hub_descriptor()
706 desc->bHubContrCurrent = 0; in ehci_hub_descriptor()
708 desc->bNbrPorts = ports; in ehci_hub_descriptor()
710 desc->bDescLength = 7 + 2 * temp; in ehci_hub_descriptor()
713 memset(&desc->u.hs.DeviceRemovable[0], 0, temp); in ehci_hub_descriptor()
714 memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); in ehci_hub_descriptor()
716 temp = HUB_CHAR_INDV_PORT_OCPM; /* per-port overcurrent reporting */ in ehci_hub_descriptor()
717 if (HCS_PPC (ehci->hcs_params)) in ehci_hub_descriptor()
718 temp |= HUB_CHAR_INDV_PORT_LPSM; /* per-port power control */ in ehci_hub_descriptor()
722 // re-enable when we support USB_PORT_FEAT_INDICATOR below. in ehci_hub_descriptor()
723 if (HCS_INDICATOR (ehci->hcs_params)) in ehci_hub_descriptor()
724 temp |= HUB_CHAR_PORTIND; /* per-port indicators (LEDs) */ in ehci_hub_descriptor()
726 desc->wHubCharacteristics = cpu_to_le16(temp); in ehci_hub_descriptor()
729 /*-------------------------------------------------------------------------*/
740 int ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_control()
748 * Avoid underflow while calculating (wIndex & 0xff) - 1. in ehci_hub_control()
753 temp -= (temp > 0); in ehci_hub_control()
754 status_reg = &ehci->regs->port_status[temp]; in ehci_hub_control()
755 hostpc_reg = &ehci->regs->hostpc[temp]; in ehci_hub_control()
764 spin_lock_irqsave (&ehci->lock, flags); in ehci_hub_control()
770 /* no hub-wide feature/status flags */ in ehci_hub_control()
779 wIndex--; in ehci_hub_control()
785 * companion controller, hub_wq needs to be able to clear in ehci_hub_control()
786 * the port-change status bits (especially in ehci_hub_control()
800 if (ehci->no_selective_suspend) in ehci_hub_control()
803 if ((hcd->self.otg_port == (wIndex + 1)) in ehci_hub_control()
804 && hcd->self.b_hnp_enable) { in ehci_hub_control()
805 otg_start_hnp(hcd->usb_phy->otg); in ehci_hub_control()
814 /* clear phy low-power mode before resume */ in ehci_hub_control()
815 if (ehci->has_tdi_phy_lpm) { in ehci_hub_control()
819 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
820 msleep(5);/* wait to leave low-power mode */ in ehci_hub_control()
821 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
823 /* resume signaling for 20 msec */ in ehci_hub_control()
826 ehci->reset_done[wIndex] = jiffies in ehci_hub_control()
828 set_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
829 usb_hcd_start_port_resume(&hcd->self, wIndex); in ehci_hub_control()
832 clear_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
835 if (HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
836 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
838 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
848 /* GetPortStatus clears reset */ in ehci_hub_control()
853 ehci_readl(ehci, &ehci->regs->command); /* unblock posted write */ in ehci_hub_control()
860 /* no hub-wide feature/status flags */ in ehci_hub_control()
867 wIndex--; in ehci_hub_control()
877 if ((temp & PORT_OCC) && (!ignore_oc && !ehci->spurious_oc)){ in ehci_hub_control()
881 * Hubs should disable port power on over-current. in ehci_hub_control()
883 * automatically, even if they _do_ support per-port in ehci_hub_control()
885 * current. hub_wq will turn the power back on. in ehci_hub_control()
887 if (((temp & PORT_OC) || (ehci->need_oc_pp_cycle)) in ehci_hub_control()
888 && HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
889 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
891 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
896 /* no reset or resume pending */ in ehci_hub_control()
897 if (!ehci->reset_done[wIndex]) { in ehci_hub_control()
901 /* resume signaling for 20 msec */ in ehci_hub_control()
902 ehci->reset_done[wIndex] = jiffies in ehci_hub_control()
904 usb_hcd_start_port_resume(&hcd->self, wIndex); in ehci_hub_control()
905 set_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
907 mod_timer(&ehci_to_hcd(ehci)->rh_timer, in ehci_hub_control()
908 ehci->reset_done[wIndex]); in ehci_hub_control()
911 /* reset or resume not yet complete */ in ehci_hub_control()
912 } else if (!time_after_eq(jiffies, ehci->reset_done[wIndex])) { in ehci_hub_control()
915 /* resume completed */ in ehci_hub_control()
916 } else if (test_bit(wIndex, &ehci->resuming_ports)) { in ehci_hub_control()
917 clear_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
918 set_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
919 ehci->reset_done[wIndex] = 0; in ehci_hub_control()
920 usb_hcd_end_port_resume(&hcd->self, wIndex); in ehci_hub_control()
922 /* stop resume signaling */ in ehci_hub_control()
925 clear_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
929 ehci_err(ehci, "port %d resume error %d\n", in ehci_hub_control()
938 ehci->reset_done [wIndex] = 0; in ehci_hub_control()
940 /* force reset to complete */ in ehci_hub_control()
943 /* REVISIT: some hardware needs 550+ usec to clear in ehci_hub_control()
949 ehci_err (ehci, "port %d reset error %d\n", in ehci_hub_control()
961 test_bit(wIndex, &ehci->companion_ports)) { in ehci_hub_control()
965 ehci_dbg(ehci, "port %d --> companion\n", wIndex + 1); in ehci_hub_control()
978 if (ehci->has_hostpc) { in ehci_hub_control()
990 } else if (test_bit(wIndex, &ehci->suspended_ports)) { in ehci_hub_control()
991 clear_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
992 clear_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
993 ehci->reset_done[wIndex] = 0; in ehci_hub_control()
995 set_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
996 usb_hcd_end_port_resume(&hcd->self, wIndex); in ehci_hub_control()
1005 if (test_bit(wIndex, &ehci->port_c_suspend)) in ehci_hub_control()
1016 /* no hub-wide feature/status flags */ in ehci_hub_control()
1025 if (unlikely(ehci->debug)) { in ehci_hub_control()
1028 if (wIndex == HCS_DEBUG_PORT(ehci->hcs_params) && in ehci_hub_control()
1029 (readl(&ehci->debug->control) & DBGP_ENABLED)) { in ehci_hub_control()
1030 retval = -ENODEV; in ehci_hub_control()
1036 wIndex--; in ehci_hub_control()
1044 if (ehci->no_selective_suspend) in ehci_hub_control()
1057 if (ehci->has_tdi_phy_lpm) { in ehci_hub_control()
1058 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1060 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1071 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1073 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1075 set_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
1078 if (HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
1079 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1081 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1095 "port %d low speed --> companion\n", in ehci_hub_control()
1104 * usb 2.0 spec says 50 ms resets on root in ehci_hub_control()
1106 ehci->reset_done [wIndex] = jiffies in ehci_hub_control()
1110 * Force full-speed connect for FSL high-speed in ehci_hub_control()
1121 * must be reset (which for root hub now means rmmod+modprobe, in ehci_hub_control()
1123 * about the EHCI-specific stuff. in ehci_hub_control()
1128 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1131 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1137 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1139 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1142 while (ports--) { in ehci_hub_control()
1144 &ehci->regs->port_status[ports]; in ehci_hub_control()
1152 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1154 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1164 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ in ehci_hub_control()
1169 /* "stall" on error */ in ehci_hub_control()
1170 retval = -EPIPE; in ehci_hub_control()
1173 spin_unlock_irqrestore (&ehci->lock, flags); in ehci_hub_control()
1184 set_owner(ehci, --portnum, PORT_OWNER); in ehci_relinquish_port()
1194 reg = &ehci->regs->port_status[portnum - 1]; in ehci_port_handed_over()
1201 u32 __iomem *status_reg = &ehci->regs->port_status[portnum]; in ehci_port_power()
1209 if (hcd->driver->port_power) in ehci_port_power()
1210 hcd->driver->port_power(hcd, portnum, enable); in ehci_port_power()