• Home
  • Raw
  • Download

Lines Matching +full:full +full:- +full:pwr +full:- +full:cycle

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()
41 if (!ehci->owned_ports) 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()
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()
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()
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()
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()
349 ehci_writel(ehci, STS_IAA, &ehci->regs->status); in ehci_bus_suspend()
351 /* Any IAA cycle that started before the suspend is now invalid */ 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()
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()
399 * could instead be restoring a swsusp snapshot -- so that BIOS was in ehci_bus_resume()
403 power_okay = ehci_readl(ehci, &ehci->regs->intr_enable); 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()
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()
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()
590 ehci_dbg (ehci, "port %d full speed --> companion\n", in check_reset_complete()
599 if (ehci->has_amcc_usb23) 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()
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()
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 /*-------------------------------------------------------------------------*/
736 struct completion *done = urb->context; in usb_ehset_completion()
759 struct usb_hcd *hcd = bus_to_hcd(udev->bus); in request_single_step_set_feature_urb()
766 urb->pipe = usb_rcvctrlpipe(udev, 0); in request_single_step_set_feature_urb()
767 ep = (usb_pipein(urb->pipe) ? udev->ep_in : udev->ep_out) in request_single_step_set_feature_urb()
768 [usb_pipeendpoint(urb->pipe)]; in request_single_step_set_feature_urb()
774 urb->ep = ep; in request_single_step_set_feature_urb()
775 urb->dev = udev; in request_single_step_set_feature_urb()
776 urb->setup_packet = (void *)dr; in request_single_step_set_feature_urb()
777 urb->transfer_buffer = buf; in request_single_step_set_feature_urb()
778 urb->transfer_buffer_length = USB_DT_DEVICE_SIZE; in request_single_step_set_feature_urb()
779 urb->complete = usb_ehset_completion; in request_single_step_set_feature_urb()
780 urb->status = -EINPROGRESS; in request_single_step_set_feature_urb()
781 urb->actual_length = 0; in request_single_step_set_feature_urb()
782 urb->transfer_flags = URB_DIR_IN; in request_single_step_set_feature_urb()
784 atomic_inc(&urb->use_count); in request_single_step_set_feature_urb()
785 atomic_inc(&urb->dev->urbnum); in request_single_step_set_feature_urb()
786 urb->setup_dma = dma_map_single( in request_single_step_set_feature_urb()
787 hcd->self.sysdev, in request_single_step_set_feature_urb()
788 urb->setup_packet, in request_single_step_set_feature_urb()
791 urb->transfer_dma = dma_map_single( in request_single_step_set_feature_urb()
792 hcd->self.sysdev, in request_single_step_set_feature_urb()
793 urb->transfer_buffer, in request_single_step_set_feature_urb()
794 urb->transfer_buffer_length, in request_single_step_set_feature_urb()
796 urb->context = done; in request_single_step_set_feature_urb()
802 int retval = -ENOMEM; in ehset_single_step_set_feature()
811 udev = usb_hub_find_child(hcd->self.root_hub, port); in ehset_single_step_set_feature()
814 return -ENODEV; in ehset_single_step_set_feature()
818 return -ENOMEM; in ehset_single_step_set_feature()
823 return -ENOMEM; in ehset_single_step_set_feature()
827 dr->bRequestType = USB_DIR_IN; in ehset_single_step_set_feature()
828 dr->bRequest = USB_REQ_GET_DESCRIPTOR; in ehset_single_step_set_feature()
829 dr->wValue = cpu_to_le16(USB_DT_DEVICE << 8); in ehset_single_step_set_feature()
830 dr->wIndex = 0; in ehset_single_step_set_feature()
831 dr->wLength = cpu_to_le16(USB_DT_DEVICE_SIZE); in ehset_single_step_set_feature()
842 retval = -ETIMEDOUT; in ehset_single_step_set_feature()
849 urb->status = -EINPROGRESS; in ehset_single_step_set_feature()
851 atomic_inc(&urb->use_count); in ehset_single_step_set_feature()
852 atomic_inc(&urb->dev->urbnum); in ehset_single_step_set_feature()
857 retval = -ETIMEDOUT; in ehset_single_step_set_feature()
868 /*-------------------------------------------------------------------------*/
879 int ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_control()
887 * Avoid underflow while calculating (wIndex & 0xff) - 1. in ehci_hub_control()
892 temp -= (temp > 0); in ehci_hub_control()
893 status_reg = &ehci->regs->port_status[temp]; in ehci_hub_control()
894 hostpc_reg = &ehci->regs->hostpc[temp]; in ehci_hub_control()
903 spin_lock_irqsave (&ehci->lock, flags); in ehci_hub_control()
909 /* no hub-wide feature/status flags */ in ehci_hub_control()
918 wIndex--; in ehci_hub_control()
925 * the port-change status bits (especially in ehci_hub_control()
939 if (ehci->no_selective_suspend) in ehci_hub_control()
942 if ((hcd->self.otg_port == (wIndex + 1)) in ehci_hub_control()
943 && hcd->self.b_hnp_enable) { in ehci_hub_control()
944 otg_start_hnp(hcd->usb_phy->otg); in ehci_hub_control()
953 /* clear phy low-power mode before resume */ in ehci_hub_control()
954 if (ehci->has_tdi_phy_lpm) { in ehci_hub_control()
958 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
959 msleep(5);/* wait to leave low-power mode */ in ehci_hub_control()
960 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
965 ehci->reset_done[wIndex] = jiffies in ehci_hub_control()
967 set_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
968 usb_hcd_start_port_resume(&hcd->self, wIndex); in ehci_hub_control()
971 clear_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
974 if (HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
975 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
977 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
992 ehci_readl(ehci, &ehci->regs->command); /* unblock posted write */ in ehci_hub_control()
999 /* no hub-wide feature/status flags */ in ehci_hub_control()
1006 wIndex--; in ehci_hub_control()
1020 * Hubs should disable port power on over-current. in ehci_hub_control()
1022 * automatically, even if they _do_ support per-port in ehci_hub_control()
1026 if (((temp & PORT_OC) || (ehci->need_oc_pp_cycle)) in ehci_hub_control()
1027 && HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
1028 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1030 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1036 if (!ehci->reset_done[wIndex]) { in ehci_hub_control()
1041 ehci->reset_done[wIndex] = jiffies in ehci_hub_control()
1043 usb_hcd_start_port_resume(&hcd->self, wIndex); in ehci_hub_control()
1044 set_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
1046 mod_timer(&ehci_to_hcd(ehci)->rh_timer, in ehci_hub_control()
1047 ehci->reset_done[wIndex]); in ehci_hub_control()
1051 } else if (!time_after_eq(jiffies, ehci->reset_done[wIndex])) { in ehci_hub_control()
1055 } else if (test_bit(wIndex, &ehci->resuming_ports)) { in ehci_hub_control()
1056 clear_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
1057 set_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
1058 ehci->reset_done[wIndex] = 0; in ehci_hub_control()
1059 usb_hcd_end_port_resume(&hcd->self, wIndex); in ehci_hub_control()
1064 clear_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
1077 ehci->reset_done [wIndex] = 0; in ehci_hub_control()
1100 test_bit(wIndex, &ehci->companion_ports)) { in ehci_hub_control()
1104 ehci_dbg(ehci, "port %d --> companion\n", wIndex + 1); in ehci_hub_control()
1117 if (ehci->has_hostpc) { in ehci_hub_control()
1129 } else if (test_bit(wIndex, &ehci->suspended_ports)) { in ehci_hub_control()
1130 clear_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
1131 clear_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
1132 ehci->reset_done[wIndex] = 0; in ehci_hub_control()
1134 set_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
1135 usb_hcd_end_port_resume(&hcd->self, wIndex); in ehci_hub_control()
1144 if (test_bit(wIndex, &ehci->port_c_suspend)) in ehci_hub_control()
1155 /* no hub-wide feature/status flags */ in ehci_hub_control()
1164 if (unlikely(ehci->debug)) { in ehci_hub_control()
1167 if (wIndex == HCS_DEBUG_PORT(ehci->hcs_params) && in ehci_hub_control()
1168 (readl(&ehci->debug->control) & DBGP_ENABLED)) { in ehci_hub_control()
1169 retval = -ENODEV; in ehci_hub_control()
1175 wIndex--; in ehci_hub_control()
1183 if (ehci->no_selective_suspend) in ehci_hub_control()
1196 if (ehci->has_tdi_phy_lpm) { in ehci_hub_control()
1197 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1198 msleep(5);/* 5ms for HCD enter low pwr mode */ in ehci_hub_control()
1199 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1204 ehci_dbg(ehci, "Port%d phy low pwr mode %s\n", in ehci_hub_control()
1210 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1212 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1214 set_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
1217 if (HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
1218 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1220 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1234 "port %d low speed --> companion\n", in ehci_hub_control()
1245 ehci->reset_done [wIndex] = jiffies in ehci_hub_control()
1249 * Force full-speed connect for FSL high-speed in ehci_hub_control()
1262 * about the EHCI-specific stuff. in ehci_hub_control()
1267 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1270 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1276 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1278 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1281 while (ports--) { in ehci_hub_control()
1283 &ehci->regs->port_status[ports]; in ehci_hub_control()
1291 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1293 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1303 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ in ehci_hub_control()
1309 retval = -EPIPE; in ehci_hub_control()
1312 spin_unlock_irqrestore (&ehci->lock, flags); in ehci_hub_control()
1323 set_owner(ehci, --portnum, PORT_OWNER); in ehci_relinquish_port()
1333 reg = &ehci->regs->port_status[portnum - 1]; in ehci_port_handed_over()
1340 u32 __iomem *status_reg = &ehci->regs->port_status[portnum]; in ehci_port_power()
1348 if (hcd->driver->port_power) in ehci_port_power()
1349 hcd->driver->port_power(hcd, portnum, enable); in ehci_port_power()