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()
348 /* Any IAA cycle that started before the suspend is now invalid */ in ehci_bus_suspend()
356 if (!hcd->self.root_hub->do_remote_wakeup) in ehci_bus_suspend()
358 ehci_writel(ehci, mask, &ehci->regs->intr_enable); in ehci_bus_suspend()
359 ehci_readl(ehci, &ehci->regs->intr_enable); in ehci_bus_suspend()
362 ehci->next_statechange = jiffies + msecs_to_jiffies(10); in ehci_bus_suspend()
363 ehci->enabled_hrtimer_events = 0; in ehci_bus_suspend()
364 ehci->next_hrtimer_event = EHCI_HRTIMER_NO_EVENT; in ehci_bus_suspend()
365 spin_unlock_irq (&ehci->lock); in ehci_bus_suspend()
367 hrtimer_cancel(&ehci->hrtimer); in ehci_bus_suspend()
381 if (time_before (jiffies, ehci->next_statechange)) in ehci_bus_resume()
383 spin_lock_irq (&ehci->lock); in ehci_bus_resume()
384 if (!HCD_HW_ACCESSIBLE(hcd) || ehci->shutdown) in ehci_bus_resume()
387 if (unlikely(ehci->debug)) { in ehci_bus_resume()
389 ehci->debug = NULL; in ehci_bus_resume()
396 * could instead be restoring a swsusp snapshot -- so that BIOS was in ehci_bus_resume()
400 power_okay = ehci_readl(ehci, &ehci->regs->intr_enable); in ehci_bus_resume()
407 ehci_writel(ehci, 0, &ehci->regs->intr_enable); in ehci_bus_resume()
409 /* re-init operational registers */ in ehci_bus_resume()
410 ehci_writel(ehci, 0, &ehci->regs->segment); in ehci_bus_resume()
411 ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list); in ehci_bus_resume()
412 ehci_writel(ehci, (u32) ehci->async->qh_dma, &ehci->regs->async_next); in ehci_bus_resume()
415 ehci->command |= CMD_RUN; in ehci_bus_resume()
416 ehci_writel(ehci, ehci->command, &ehci->regs->command); in ehci_bus_resume()
417 ehci->rh_state = EHCI_RH_RUNNING; in ehci_bus_resume()
424 i = HCS_N_PORTS(ehci->hcs_params); in ehci_bus_resume()
425 while (i--) { in ehci_bus_resume()
426 temp = ehci_readl(ehci, &ehci->regs->port_status[i]); in ehci_bus_resume()
430 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
432 spin_lock_irq(&ehci->lock); in ehci_bus_resume()
437 if (ehci->shutdown) in ehci_bus_resume()
440 /* clear phy low-power mode before resume */ in ehci_bus_resume()
441 if (ehci->bus_suspended && ehci->has_tdi_phy_lpm) { in ehci_bus_resume()
442 i = HCS_N_PORTS(ehci->hcs_params); in ehci_bus_resume()
443 while (i--) { in ehci_bus_resume()
444 if (test_bit(i, &ehci->bus_suspended)) { in ehci_bus_resume()
446 &ehci->regs->hostpc[i]; in ehci_bus_resume()
453 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
455 spin_lock_irq(&ehci->lock); in ehci_bus_resume()
456 if (ehci->shutdown) in ehci_bus_resume()
461 i = HCS_N_PORTS (ehci->hcs_params); in ehci_bus_resume()
462 while (i--) { in ehci_bus_resume()
463 temp = ehci_readl(ehci, &ehci->regs->port_status [i]); in ehci_bus_resume()
465 if (test_bit(i, &ehci->bus_suspended) && in ehci_bus_resume()
470 ehci_writel(ehci, temp, &ehci->regs->port_status [i]); in ehci_bus_resume()
478 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
480 spin_lock_irq(&ehci->lock); in ehci_bus_resume()
481 if (ehci->shutdown) in ehci_bus_resume()
485 i = HCS_N_PORTS (ehci->hcs_params); in ehci_bus_resume()
486 while (i--) { in ehci_bus_resume()
487 temp = ehci_readl(ehci, &ehci->regs->port_status [i]); in ehci_bus_resume()
490 ehci_writel(ehci, temp, &ehci->regs->port_status [i]); in ehci_bus_resume()
494 ehci->next_statechange = jiffies + msecs_to_jiffies(5); in ehci_bus_resume()
495 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
499 /* Now we can safely re-enable irqs */ in ehci_bus_resume()
500 spin_lock_irq(&ehci->lock); in ehci_bus_resume()
501 if (ehci->shutdown) in ehci_bus_resume()
503 ehci_writel(ehci, INTR_MASK, &ehci->regs->intr_enable); in ehci_bus_resume()
504 (void) ehci_readl(ehci, &ehci->regs->intr_enable); in ehci_bus_resume()
505 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
510 spin_unlock_irq(&ehci->lock); in ehci_bus_resume()
511 return -ESHUTDOWN; in ehci_bus_resume()
518 return ehci->resuming_ports; in ehci_get_resuming_ports()
529 /*-------------------------------------------------------------------------*/
540 status_reg = &ehci->regs->port_status[portnum]; in set_owner()
547 for (try = 4; try > 0; --try) { in set_owner()
548 spin_lock_irq(&ehci->lock); in set_owner()
559 spin_unlock_irq(&ehci->lock); in set_owner()
565 /*-------------------------------------------------------------------------*/
576 /* if reset finished and it's still not enabled -- handoff */ in check_reset_complete()
587 ehci_dbg (ehci, "port %d full speed --> companion\n", in check_reset_complete()
596 if (ehci->has_amcc_usb23) in check_reset_complete()
602 if (ehci->has_amcc_usb23) in check_reset_complete()
609 /*-------------------------------------------------------------------------*/
624 /* init status to no-changes */ in ehci_hub_status_data()
626 ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_status_data()
632 /* Inform the core about resumes-in-progress by returning in ehci_hub_status_data()
633 * a non-zero value even if there are no status changes. in ehci_hub_status_data()
635 status = ehci->resuming_ports; in ehci_hub_status_data()
641 * PORT_POWER; that's surprising, but maybe within-spec. in ehci_hub_status_data()
652 spin_lock_irqsave (&ehci->lock, flags); in ehci_hub_status_data()
654 /* get per-port change detect bits */ in ehci_hub_status_data()
655 if (ehci->has_ppcd) in ehci_hub_status_data()
656 ppcd = ehci_readl(ehci, &ehci->regs->status) >> 16; in ehci_hub_status_data()
659 /* leverage per-port change bits feature */ in ehci_hub_status_data()
661 temp = ehci_readl(ehci, &ehci->regs->port_status[i]); in ehci_hub_status_data()
668 * high-speed device is switched over to the companion in ehci_hub_status_data()
672 if ((temp & mask) != 0 || test_bit(i, &ehci->port_c_suspend) in ehci_hub_status_data()
673 || (ehci->reset_done[i] && time_after_eq( in ehci_hub_status_data()
674 jiffies, ehci->reset_done[i]))) { in ehci_hub_status_data()
678 buf [1] |= 1 << (i - 7); in ehci_hub_status_data()
684 if (ehci->resuming_ports) in ehci_hub_status_data()
685 mod_timer(&hcd->rh_timer, jiffies + msecs_to_jiffies(25)); in ehci_hub_status_data()
687 spin_unlock_irqrestore (&ehci->lock, flags); in ehci_hub_status_data()
691 /*-------------------------------------------------------------------------*/
698 int ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_descriptor()
701 desc->bDescriptorType = USB_DT_HUB; in ehci_hub_descriptor()
702 desc->bPwrOn2PwrGood = 10; /* ehci 1.0, 2.3.9 says 20ms max */ in ehci_hub_descriptor()
703 desc->bHubContrCurrent = 0; in ehci_hub_descriptor()
705 desc->bNbrPorts = ports; in ehci_hub_descriptor()
707 desc->bDescLength = 7 + 2 * temp; in ehci_hub_descriptor()
710 memset(&desc->u.hs.DeviceRemovable[0], 0, temp); in ehci_hub_descriptor()
711 memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); in ehci_hub_descriptor()
713 temp = HUB_CHAR_INDV_PORT_OCPM; /* per-port overcurrent reporting */ in ehci_hub_descriptor()
714 if (HCS_PPC (ehci->hcs_params)) in ehci_hub_descriptor()
715 temp |= HUB_CHAR_INDV_PORT_LPSM; /* per-port power control */ in ehci_hub_descriptor()
719 // re-enable when we support USB_PORT_FEAT_INDICATOR below. in ehci_hub_descriptor()
720 if (HCS_INDICATOR (ehci->hcs_params)) in ehci_hub_descriptor()
721 temp |= HUB_CHAR_PORTIND; /* per-port indicators (LEDs) */ in ehci_hub_descriptor()
723 desc->wHubCharacteristics = cpu_to_le16(temp); in ehci_hub_descriptor()
726 /*-------------------------------------------------------------------------*/
733 struct completion *done = urb->context; in usb_ehset_completion()
756 struct usb_hcd *hcd = bus_to_hcd(udev->bus); in request_single_step_set_feature_urb()
763 urb->pipe = usb_rcvctrlpipe(udev, 0); in request_single_step_set_feature_urb()
764 ep = (usb_pipein(urb->pipe) ? udev->ep_in : udev->ep_out) in request_single_step_set_feature_urb()
765 [usb_pipeendpoint(urb->pipe)]; in request_single_step_set_feature_urb()
771 urb->ep = ep; in request_single_step_set_feature_urb()
772 urb->dev = udev; in request_single_step_set_feature_urb()
773 urb->setup_packet = (void *)dr; in request_single_step_set_feature_urb()
774 urb->transfer_buffer = buf; in request_single_step_set_feature_urb()
775 urb->transfer_buffer_length = USB_DT_DEVICE_SIZE; in request_single_step_set_feature_urb()
776 urb->complete = usb_ehset_completion; in request_single_step_set_feature_urb()
777 urb->status = -EINPROGRESS; in request_single_step_set_feature_urb()
778 urb->actual_length = 0; in request_single_step_set_feature_urb()
779 urb->transfer_flags = URB_DIR_IN; in request_single_step_set_feature_urb()
781 atomic_inc(&urb->use_count); in request_single_step_set_feature_urb()
782 atomic_inc(&urb->dev->urbnum); in request_single_step_set_feature_urb()
783 urb->setup_dma = dma_map_single( in request_single_step_set_feature_urb()
784 hcd->self.sysdev, in request_single_step_set_feature_urb()
785 urb->setup_packet, in request_single_step_set_feature_urb()
788 urb->transfer_dma = dma_map_single( in request_single_step_set_feature_urb()
789 hcd->self.sysdev, in request_single_step_set_feature_urb()
790 urb->transfer_buffer, in request_single_step_set_feature_urb()
791 urb->transfer_buffer_length, in request_single_step_set_feature_urb()
793 urb->context = done; in request_single_step_set_feature_urb()
799 int retval = -ENOMEM; in ehset_single_step_set_feature()
808 udev = usb_hub_find_child(hcd->self.root_hub, port); in ehset_single_step_set_feature()
811 return -ENODEV; in ehset_single_step_set_feature()
815 return -ENOMEM; in ehset_single_step_set_feature()
820 return -ENOMEM; in ehset_single_step_set_feature()
824 dr->bRequestType = USB_DIR_IN; in ehset_single_step_set_feature()
825 dr->bRequest = USB_REQ_GET_DESCRIPTOR; in ehset_single_step_set_feature()
826 dr->wValue = cpu_to_le16(USB_DT_DEVICE << 8); in ehset_single_step_set_feature()
827 dr->wIndex = 0; in ehset_single_step_set_feature()
828 dr->wLength = cpu_to_le16(USB_DT_DEVICE_SIZE); in ehset_single_step_set_feature()
839 retval = -ETIMEDOUT; in ehset_single_step_set_feature()
846 urb->status = -EINPROGRESS; in ehset_single_step_set_feature()
848 atomic_inc(&urb->use_count); in ehset_single_step_set_feature()
849 atomic_inc(&urb->dev->urbnum); in ehset_single_step_set_feature()
854 retval = -ETIMEDOUT; in ehset_single_step_set_feature()
865 /*-------------------------------------------------------------------------*/
876 int ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_control()
884 * Avoid underflow while calculating (wIndex & 0xff) - 1. in ehci_hub_control()
889 temp -= (temp > 0); in ehci_hub_control()
890 status_reg = &ehci->regs->port_status[temp]; in ehci_hub_control()
891 hostpc_reg = &ehci->regs->hostpc[temp]; in ehci_hub_control()
900 spin_lock_irqsave (&ehci->lock, flags); in ehci_hub_control()
906 /* no hub-wide feature/status flags */ in ehci_hub_control()
915 wIndex--; in ehci_hub_control()
922 * the port-change status bits (especially in ehci_hub_control()
936 if (ehci->no_selective_suspend) in ehci_hub_control()
939 if ((hcd->self.otg_port == (wIndex + 1)) in ehci_hub_control()
940 && hcd->self.b_hnp_enable) { in ehci_hub_control()
941 otg_start_hnp(hcd->usb_phy->otg); in ehci_hub_control()
950 /* clear phy low-power mode before resume */ in ehci_hub_control()
951 if (ehci->has_tdi_phy_lpm) { in ehci_hub_control()
955 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
956 msleep(5);/* wait to leave low-power mode */ in ehci_hub_control()
957 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
962 ehci->reset_done[wIndex] = jiffies in ehci_hub_control()
964 set_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
965 usb_hcd_start_port_resume(&hcd->self, wIndex); in ehci_hub_control()
968 clear_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
971 if (HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
972 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
974 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
989 ehci_readl(ehci, &ehci->regs->command); /* unblock posted write */ in ehci_hub_control()
996 /* no hub-wide feature/status flags */ in ehci_hub_control()
1003 wIndex--; in ehci_hub_control()
1017 * Hubs should disable port power on over-current. in ehci_hub_control()
1019 * automatically, even if they _do_ support per-port in ehci_hub_control()
1023 if (((temp & PORT_OC) || (ehci->need_oc_pp_cycle)) in ehci_hub_control()
1024 && HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
1025 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1027 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1033 if (!ehci->reset_done[wIndex]) { in ehci_hub_control()
1038 ehci->reset_done[wIndex] = jiffies in ehci_hub_control()
1040 usb_hcd_start_port_resume(&hcd->self, wIndex); in ehci_hub_control()
1041 set_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
1043 mod_timer(&ehci_to_hcd(ehci)->rh_timer, in ehci_hub_control()
1044 ehci->reset_done[wIndex]); in ehci_hub_control()
1048 } else if (!time_after_eq(jiffies, ehci->reset_done[wIndex])) { in ehci_hub_control()
1052 } else if (test_bit(wIndex, &ehci->resuming_ports)) { in ehci_hub_control()
1053 clear_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
1054 set_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
1055 ehci->reset_done[wIndex] = 0; in ehci_hub_control()
1056 usb_hcd_end_port_resume(&hcd->self, wIndex); in ehci_hub_control()
1061 clear_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
1074 ehci->reset_done [wIndex] = 0; in ehci_hub_control()
1097 test_bit(wIndex, &ehci->companion_ports)) { in ehci_hub_control()
1101 ehci_dbg(ehci, "port %d --> companion\n", wIndex + 1); in ehci_hub_control()
1114 if (ehci->has_hostpc) { in ehci_hub_control()
1126 } else if (test_bit(wIndex, &ehci->suspended_ports)) { in ehci_hub_control()
1127 clear_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
1128 clear_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
1129 ehci->reset_done[wIndex] = 0; in ehci_hub_control()
1131 set_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
1132 usb_hcd_end_port_resume(&hcd->self, wIndex); in ehci_hub_control()
1141 if (test_bit(wIndex, &ehci->port_c_suspend)) in ehci_hub_control()
1152 /* no hub-wide feature/status flags */ in ehci_hub_control()
1161 if (unlikely(ehci->debug)) { in ehci_hub_control()
1164 if (wIndex == HCS_DEBUG_PORT(ehci->hcs_params) && in ehci_hub_control()
1165 (readl(&ehci->debug->control) & DBGP_ENABLED)) { in ehci_hub_control()
1166 retval = -ENODEV; in ehci_hub_control()
1172 wIndex--; in ehci_hub_control()
1180 if (ehci->no_selective_suspend) in ehci_hub_control()
1193 if (ehci->has_tdi_phy_lpm) { in ehci_hub_control()
1194 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1195 msleep(5);/* 5ms for HCD enter low pwr mode */ in ehci_hub_control()
1196 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1201 ehci_dbg(ehci, "Port%d phy low pwr mode %s\n", in ehci_hub_control()
1207 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1209 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1211 set_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
1214 if (HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
1215 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1217 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1231 "port %d low speed --> companion\n", in ehci_hub_control()
1242 ehci->reset_done [wIndex] = jiffies in ehci_hub_control()
1246 * Force full-speed connect for FSL high-speed in ehci_hub_control()
1259 * about the EHCI-specific stuff. in ehci_hub_control()
1264 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1267 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1273 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1275 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1278 while (ports--) { in ehci_hub_control()
1280 &ehci->regs->port_status[ports]; in ehci_hub_control()
1288 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1290 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1300 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ in ehci_hub_control()
1306 retval = -EPIPE; in ehci_hub_control()
1309 spin_unlock_irqrestore (&ehci->lock, flags); in ehci_hub_control()
1320 set_owner(ehci, --portnum, PORT_OWNER); in ehci_relinquish_port()
1330 reg = &ehci->regs->port_status[portnum - 1]; in ehci_port_handed_over()
1337 u32 __iomem *status_reg = &ehci->regs->port_status[portnum]; in ehci_port_power()
1345 if (hcd->driver->port_power) in ehci_port_power()
1346 hcd->driver->port_power(hcd, portnum, enable); in ehci_port_power()