Lines Matching +full:no +full:- +full:temp +full:- +full:support

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()
150 u32 temp; in ehci_adjust_port_wakeup_flags() local
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()
168 temp = ehci_readl(ehci, hostpc_reg); in ehci_adjust_port_wakeup_flags()
169 ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg); 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()
200 temp = ehci_readl(ehci, hostpc_reg); in ehci_adjust_port_wakeup_flags()
201 ehci_writel(ehci, temp | HOSTPC_PHCD, hostpc_reg); 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()
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()
379 u32 temp; in ehci_bus_resume() local
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()
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()
430 if ((temp & PORT_PE) && in ehci_bus_resume()
431 !(temp & (PORT_SUSPEND | PORT_RESUME))) { in ehci_bus_resume()
432 ehci_dbg(ehci, "Port status(0x%x) is wrong\n", temp); 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()
451 temp = ehci_readl(ehci, hostpc_reg); in ehci_bus_resume()
452 ehci_writel(ehci, temp & ~HOSTPC_PHCD, 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()
467 temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); in ehci_bus_resume()
468 if (test_bit(i, &ehci->bus_suspended) && in ehci_bus_resume()
469 (temp & PORT_SUSPEND)) { in ehci_bus_resume()
470 temp |= PORT_RESUME; 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()
492 temp &= ~(PORT_RWC_BITS | PORT_SUSPEND | PORT_RESUME); 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 /*-------------------------------------------------------------------------*/
621 u32 temp, status; in ehci_hub_status_data() local
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()
652 /* no hub change reports (bit 0) for now (power, ...) */ 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()
666 temp = 0; 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()
678 || ehci_has_ci_pec_bug(ehci, temp)) { in ehci_hub_status_data()
682 buf [1] |= 1 << (i - 7); in ehci_hub_status_data()
688 if (ehci->resuming_ports) in ehci_hub_status_data()
689 mod_timer(&hcd->rh_timer, jiffies + msecs_to_jiffies(25)); in ehci_hub_status_data()
691 spin_unlock_irqrestore (&ehci->lock, flags); in ehci_hub_status_data()
695 /*-------------------------------------------------------------------------*/
702 int ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_descriptor()
703 u16 temp; in ehci_hub_descriptor() local
705 desc->bDescriptorType = USB_DT_HUB; in ehci_hub_descriptor()
706 desc->bPwrOn2PwrGood = 10; /* ehci 1.0, 2.3.9 says 20ms max */ in ehci_hub_descriptor()
707 desc->bHubContrCurrent = 0; in ehci_hub_descriptor()
709 desc->bNbrPorts = ports; in ehci_hub_descriptor()
710 temp = 1 + (ports / 8); in ehci_hub_descriptor()
711 desc->bDescLength = 7 + 2 * temp; in ehci_hub_descriptor()
714 memset(&desc->u.hs.DeviceRemovable[0], 0, temp); in ehci_hub_descriptor()
715 memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp); in ehci_hub_descriptor()
717 temp = HUB_CHAR_INDV_PORT_OCPM; /* per-port overcurrent reporting */ in ehci_hub_descriptor()
718 if (HCS_PPC (ehci->hcs_params)) in ehci_hub_descriptor()
719 temp |= HUB_CHAR_INDV_PORT_LPSM; /* per-port power control */ in ehci_hub_descriptor()
721 temp |= HUB_CHAR_NO_LPSM; /* no power switching */ in ehci_hub_descriptor()
723 // re-enable when we support USB_PORT_FEAT_INDICATOR below. in ehci_hub_descriptor()
724 if (HCS_INDICATOR (ehci->hcs_params)) in ehci_hub_descriptor()
725 temp |= HUB_CHAR_PORTIND; /* per-port indicators (LEDs) */ in ehci_hub_descriptor()
727 desc->wHubCharacteristics = cpu_to_le16(temp); in ehci_hub_descriptor()
730 /*-------------------------------------------------------------------------*/
741 int ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_control()
743 u32 temp, temp1, status; in ehci_hub_control() local
749 * Avoid out-of-bounds values while calculating the port index in ehci_hub_control()
753 temp = (wIndex - 1) & 0xff; in ehci_hub_control()
754 if (temp >= HCS_N_PORTS_MAX) in ehci_hub_control()
755 temp = 0; in ehci_hub_control()
756 status_reg = &ehci->regs->port_status[temp]; in ehci_hub_control()
757 hostpc_reg = &ehci->regs->hostpc[temp]; in ehci_hub_control()
760 * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR. in ehci_hub_control()
766 spin_lock_irqsave (&ehci->lock, flags); in ehci_hub_control()
772 /* no hub-wide feature/status flags */ in ehci_hub_control()
781 wIndex--; in ehci_hub_control()
782 temp = ehci_readl(ehci, status_reg); in ehci_hub_control()
783 temp &= ~PORT_RWC_BITS; in ehci_hub_control()
788 * the port-change status bits (especially in ehci_hub_control()
794 ehci_writel(ehci, temp & ~PORT_PE, status_reg); in ehci_hub_control()
797 ehci_writel(ehci, temp | PORT_PEC, status_reg); in ehci_hub_control()
800 if (temp & PORT_RESET) in ehci_hub_control()
802 if (ehci->no_selective_suspend) in ehci_hub_control()
805 if ((hcd->self.otg_port == (wIndex + 1)) in ehci_hub_control()
806 && hcd->self.b_hnp_enable) { in ehci_hub_control()
807 otg_start_hnp(hcd->usb_phy->otg); in ehci_hub_control()
811 if (!(temp & PORT_SUSPEND)) in ehci_hub_control()
813 if ((temp & PORT_PE) == 0) in ehci_hub_control()
816 /* clear phy low-power mode before resume */ in ehci_hub_control()
817 if (ehci->has_tdi_phy_lpm) { in ehci_hub_control()
821 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
822 msleep(5);/* wait to leave low-power mode */ in ehci_hub_control()
823 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
826 temp &= ~PORT_WAKE_BITS; in ehci_hub_control()
827 ehci_writel(ehci, temp | PORT_RESUME, status_reg); in ehci_hub_control()
828 ehci->reset_done[wIndex] = jiffies in ehci_hub_control()
830 set_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
831 usb_hcd_start_port_resume(&hcd->self, wIndex); in ehci_hub_control()
834 clear_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
837 if (HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
838 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
840 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
844 ehci_writel(ehci, temp | PORT_CSC, status_reg); in ehci_hub_control()
847 ehci_writel(ehci, temp | PORT_OCC, status_reg); in ehci_hub_control()
855 ehci_readl(ehci, &ehci->regs->command); /* unblock posted write */ in ehci_hub_control()
862 /* no hub-wide feature/status flags */ in ehci_hub_control()
869 wIndex--; in ehci_hub_control()
871 temp = ehci_readl(ehci, status_reg); in ehci_hub_control()
874 if (temp & PORT_CSC) in ehci_hub_control()
876 if (temp & PORT_PEC) in ehci_hub_control()
879 if (ehci_has_ci_pec_bug(ehci, temp)) { in ehci_hub_control()
883 wIndex + 1, temp); in ehci_hub_control()
886 if ((temp & PORT_OCC) && (!ignore_oc && !ehci->spurious_oc)){ in ehci_hub_control()
890 * Hubs should disable port power on over-current. in ehci_hub_control()
892 * automatically, even if they _do_ support per-port in ehci_hub_control()
896 if (((temp & PORT_OC) || (ehci->need_oc_pp_cycle)) in ehci_hub_control()
897 && HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
898 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
900 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
901 temp = ehci_readl(ehci, status_reg); in ehci_hub_control()
905 /* no reset or resume pending */ in ehci_hub_control()
906 if (!ehci->reset_done[wIndex]) { in ehci_hub_control()
909 if (temp & PORT_RESUME) { in ehci_hub_control()
911 ehci->reset_done[wIndex] = jiffies in ehci_hub_control()
913 usb_hcd_start_port_resume(&hcd->self, wIndex); in ehci_hub_control()
914 set_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
916 mod_timer(&ehci_to_hcd(ehci)->rh_timer, in ehci_hub_control()
917 ehci->reset_done[wIndex]); in ehci_hub_control()
921 } else if (!time_after_eq(jiffies, ehci->reset_done[wIndex])) { in ehci_hub_control()
925 } else if (test_bit(wIndex, &ehci->resuming_ports)) { in ehci_hub_control()
926 clear_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
927 set_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
928 ehci->reset_done[wIndex] = 0; in ehci_hub_control()
929 usb_hcd_end_port_resume(&hcd->self, wIndex); in ehci_hub_control()
932 temp &= ~(PORT_RWC_BITS | PORT_SUSPEND | PORT_RESUME); in ehci_hub_control()
933 ehci_writel(ehci, temp, status_reg); in ehci_hub_control()
934 clear_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
942 temp = ehci_readl(ehci, status_reg); in ehci_hub_control()
947 ehci->reset_done [wIndex] = 0; in ehci_hub_control()
950 ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), in ehci_hub_control()
964 temp = check_reset_complete (ehci, wIndex, status_reg, in ehci_hub_control()
969 if ((temp & PORT_CONNECT) && in ehci_hub_control()
970 test_bit(wIndex, &ehci->companion_ports)) { in ehci_hub_control()
971 temp &= ~PORT_RWC_BITS; in ehci_hub_control()
972 temp |= PORT_OWNER; in ehci_hub_control()
973 ehci_writel(ehci, temp, status_reg); in ehci_hub_control()
974 ehci_dbg(ehci, "port %d --> companion\n", wIndex + 1); in ehci_hub_control()
975 temp = ehci_readl(ehci, status_reg); in ehci_hub_control()
979 * Even if OWNER is set, there's no harm letting hub_wq in ehci_hub_control()
984 if (temp & PORT_CONNECT) { in ehci_hub_control()
987 if (ehci->has_hostpc) { in ehci_hub_control()
991 status |= ehci_port_speed(ehci, temp); in ehci_hub_control()
993 if (temp & PORT_PE) in ehci_hub_control()
997 if (temp & (PORT_SUSPEND|PORT_RESUME)) { in ehci_hub_control()
999 } else if (test_bit(wIndex, &ehci->suspended_ports)) { in ehci_hub_control()
1000 clear_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
1001 clear_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
1002 ehci->reset_done[wIndex] = 0; in ehci_hub_control()
1003 if (temp & PORT_PE) in ehci_hub_control()
1004 set_bit(wIndex, &ehci->port_c_suspend); in ehci_hub_control()
1005 usb_hcd_end_port_resume(&hcd->self, wIndex); in ehci_hub_control()
1008 if (temp & PORT_OC) in ehci_hub_control()
1010 if (temp & PORT_RESET) in ehci_hub_control()
1012 if (temp & PORT_POWER) in ehci_hub_control()
1014 if (test_bit(wIndex, &ehci->port_c_suspend)) in ehci_hub_control()
1018 dbg_port(ehci, "GetStatus", wIndex + 1, temp); in ehci_hub_control()
1025 /* no hub-wide feature/status flags */ in ehci_hub_control()
1034 if (unlikely(ehci->debug)) { in ehci_hub_control()
1037 if (wIndex == HCS_DEBUG_PORT(ehci->hcs_params) && in ehci_hub_control()
1038 (readl(&ehci->debug->control) & DBGP_ENABLED)) { in ehci_hub_control()
1039 retval = -ENODEV; in ehci_hub_control()
1045 wIndex--; in ehci_hub_control()
1046 temp = ehci_readl(ehci, status_reg); in ehci_hub_control()
1047 if (temp & PORT_OWNER) in ehci_hub_control()
1050 temp &= ~PORT_RWC_BITS; in ehci_hub_control()
1053 if (ehci->no_selective_suspend) in ehci_hub_control()
1055 if ((temp & PORT_PE) == 0 in ehci_hub_control()
1056 || (temp & PORT_RESET) != 0) in ehci_hub_control()
1063 temp &= ~PORT_WKCONN_E; in ehci_hub_control()
1064 temp |= PORT_WKDISC_E | PORT_WKOC_E; in ehci_hub_control()
1065 ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); in ehci_hub_control()
1066 if (ehci->has_tdi_phy_lpm) { in ehci_hub_control()
1067 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1069 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1080 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1082 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1084 set_bit(wIndex, &ehci->suspended_ports); in ehci_hub_control()
1087 if (HCS_PPC(ehci->hcs_params)) { in ehci_hub_control()
1088 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1090 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1094 if (temp & (PORT_SUSPEND|PORT_RESUME)) in ehci_hub_control()
1100 if ((temp & (PORT_PE|PORT_CONNECT)) == PORT_CONNECT in ehci_hub_control()
1102 && PORT_USB11 (temp)) { in ehci_hub_control()
1104 "port %d low speed --> companion\n", in ehci_hub_control()
1106 temp |= PORT_OWNER; in ehci_hub_control()
1108 temp |= PORT_RESET; in ehci_hub_control()
1109 temp &= ~PORT_PE; in ehci_hub_control()
1115 ehci->reset_done [wIndex] = jiffies in ehci_hub_control()
1119 * Force full-speed connect for FSL high-speed in ehci_hub_control()
1123 temp |= (1 << PORTSC_FSL_PFSC); in ehci_hub_control()
1125 ehci_writel(ehci, temp, status_reg); in ehci_hub_control()
1132 * about the EHCI-specific stuff. in ehci_hub_control()
1137 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1140 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1146 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1148 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1151 while (ports--) { in ehci_hub_control()
1153 &ehci->regs->port_status[ports]; in ehci_hub_control()
1155 temp = ehci_readl(ehci, sreg) & ~PORT_RWC_BITS; in ehci_hub_control()
1156 if (temp & PORT_PE) in ehci_hub_control()
1157 ehci_writel(ehci, temp | PORT_SUSPEND, in ehci_hub_control()
1161 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1163 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1165 temp = ehci_readl(ehci, status_reg); in ehci_hub_control()
1166 temp |= selector << 16; in ehci_hub_control()
1167 ehci_writel(ehci, temp, status_reg); in ehci_hub_control()
1173 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ in ehci_hub_control()
1179 retval = -EPIPE; in ehci_hub_control()
1182 spin_unlock_irqrestore (&ehci->lock, flags); in ehci_hub_control()
1193 set_owner(ehci, --portnum, PORT_OWNER); in ehci_relinquish_port()
1203 reg = &ehci->regs->port_status[portnum - 1]; in ehci_port_handed_over()
1210 u32 __iomem *status_reg = &ehci->regs->port_status[portnum]; in ehci_port_power()
1211 u32 temp = ehci_readl(ehci, status_reg) & ~PORT_RWC_BITS; in ehci_port_power() local
1214 ehci_writel(ehci, temp | PORT_POWER, status_reg); in ehci_port_power()
1216 ehci_writel(ehci, temp & ~PORT_POWER, status_reg); in ehci_port_power()
1218 if (hcd->driver->port_power) in ehci_port_power()
1219 hcd->driver->port_power(hcd, portnum, enable); in ehci_port_power()