Lines Matching full:ehci
6 /* this file is part of ehci-hcd.c */
11 * EHCI Root Hub ... the nonsharable stuff
22 static void unlink_empty_async_suspended(struct ehci_hcd *ehci);
33 static void ehci_handover_companion_ports(struct ehci_hcd *ehci) in ehci_handover_companion_ports() argument
39 struct usb_hcd *hcd = ehci_to_hcd(ehci); in ehci_handover_companion_ports()
41 if (!ehci->owned_ports) in ehci_handover_companion_ports()
55 port = HCS_N_PORTS(ehci->hcs_params); 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()
59 status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; in ehci_handover_companion_ports()
61 ehci_port_power(ehci, port, true); 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()
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()
73 status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; 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()
79 ehci_writel(ehci, status & ~PORT_PE, reg); 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()
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()
110 status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; in ehci_handover_companion_ports()
112 ehci_writel(ehci, status | PORT_CSC, reg); in ehci_handover_companion_ports()
114 ehci_dbg(ehci, "failed handover port %d: %x\n", in ehci_handover_companion_ports()
116 ehci_writel(ehci, status & ~PORT_PE, reg); 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()
125 static int ehci_port_change(struct ehci_hcd *ehci) in ehci_port_change() argument
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()
140 if (ehci_readl(ehci, &ehci->regs->port_status[i]) & PORT_CSC) in ehci_port_change()
146 void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, in ehci_adjust_port_wakeup_flags() argument
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()
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()
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()
178 u32 __iomem *reg = &ehci->regs->port_status[port]; in ehci_adjust_port_wakeup_flags()
179 u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; in ehci_adjust_port_wakeup_flags()
191 ehci_writel(ehci, t2, reg); 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()
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()
206 if (!suspending && ehci_port_change(ehci)) in ehci_adjust_port_wakeup_flags()
207 usb_hcd_resume_root_hub(ehci_to_hcd(ehci)); in ehci_adjust_port_wakeup_flags()
209 spin_unlock_irq(&ehci->lock); in ehci_adjust_port_wakeup_flags()
215 struct ehci_hcd *ehci = hcd_to_ehci (hcd); in ehci_bus_suspend() local
221 ehci_dbg(ehci, "suspend root hub\n"); in ehci_bus_suspend()
223 if (time_before (jiffies, ehci->next_statechange)) in ehci_bus_suspend()
227 ehci_quiesce(ehci); 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()
239 if (ehci->resuming_ports) { in ehci_bus_suspend()
240 spin_unlock_irq(&ehci->lock); in ehci_bus_suspend()
241 ehci_dbg(ehci, "suspend failed because a port is resuming\n"); in ehci_bus_suspend()
246 /* Unlike other USB host controller types, EHCI doesn't have 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()
257 u32 __iomem *reg = &ehci->regs->port_status [port]; in ehci_bus_suspend()
258 u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; 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()
290 ehci_port_speed(ehci, t2) == in ehci_bus_suspend()
293 ehci_writel(ehci, t2, reg); in ehci_bus_suspend()
297 spin_unlock_irq(&ehci->lock); in ehci_bus_suspend()
299 if (changed && ehci_has_fsl_susp_errata(ehci)) 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()
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()
319 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port]; in ehci_bus_suspend()
322 t3 = ehci_readl(ehci, hostpc_reg); in ehci_bus_suspend()
323 ehci_writel(ehci, t3 | HOSTPC_PHCD, hostpc_reg); in ehci_bus_suspend()
324 t3 = ehci_readl(ehci, hostpc_reg); 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()
333 if (ehci->bus_suspended) in ehci_bus_suspend()
337 ehci_halt (ehci); 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()
341 ehci_handle_controller_death(ehci); 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()
346 unlink_empty_async_suspended(ehci); in ehci_bus_suspend()
349 ehci_writel(ehci, STS_IAA, &ehci->regs->status); in ehci_bus_suspend()
352 end_iaa_cycle(ehci); in ehci_bus_suspend()
353 ehci_handle_start_intr_unlinks(ehci); in ehci_bus_suspend()
354 ehci_handle_intr_unlinks(ehci); in ehci_bus_suspend()
355 end_free_itds(ehci); 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()
378 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 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()
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()
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()
429 temp = ehci_readl(ehci, &ehci->regs->port_status[i]); 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()
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()
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()
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()
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()
500 ehci_handover_companion_ports(ehci); 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()
519 struct ehci_hcd *ehci = hcd_to_ehci(hcd); in ehci_get_resuming_ports() local
521 return ehci->resuming_ports; in ehci_get_resuming_ports()
537 static void set_owner(struct ehci_hcd *ehci, int portnum, int new_owner) in set_owner() argument
543 status_reg = &ehci->regs->port_status[portnum]; in set_owner()
551 spin_lock_irq(&ehci->lock); in set_owner()
552 port_status = ehci_readl(ehci, status_reg); in set_owner()
560 ehci_writel(ehci, port_status, status_reg); in set_owner()
562 spin_unlock_irq(&ehci->lock); in set_owner()
571 struct ehci_hcd *ehci, in check_reset_complete() argument
583 if (ehci_is_TDI(ehci)) { in check_reset_complete()
584 ehci_dbg (ehci, in check_reset_complete()
590 ehci_dbg (ehci, "port %d full speed --> companion\n", in check_reset_complete()
596 ehci_writel(ehci, port_status, status_reg); in check_reset_complete()
599 if (ehci->has_amcc_usb23) in check_reset_complete()
600 set_ohci_hcfs(ehci, 1); 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()
606 set_ohci_hcfs(ehci, 0); in check_reset_complete()
620 struct ehci_hcd *ehci = hcd_to_ehci (hcd); in ehci_hub_status_data() local
629 ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_status_data()
638 status = ehci->resuming_ports; 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()
658 if (ehci->has_ppcd) in ehci_hub_status_data()
659 ppcd = ehci_readl(ehci, &ehci->regs->status) >> 16; in ehci_hub_status_data()
664 temp = ehci_readl(ehci, &ehci->regs->port_status[i]); 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()
688 if (ehci->resuming_ports) in ehci_hub_status_data()
691 spin_unlock_irqrestore (&ehci->lock, flags); in ehci_hub_status_data()
699 struct ehci_hcd *ehci, in ehci_hub_descriptor() argument
702 int ports = HCS_N_PORTS (ehci->hcs_params); in ehci_hub_descriptor()
706 desc->bPwrOn2PwrGood = 10; /* ehci 1.0, 2.3.9 says 20ms max */ in ehci_hub_descriptor()
718 if (HCS_PPC (ehci->hcs_params)) in ehci_hub_descriptor()
724 if (HCS_INDICATOR (ehci->hcs_params)) in ehci_hub_descriptor()
740 struct ehci_hcd *ehci = hcd_to_ehci (hcd); in ehci_hub_control() local
741 int ports = HCS_N_PORTS (ehci->hcs_params); 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()
763 * power, "this is the one", etc. EHCI spec supports this. in ehci_hub_control()
766 spin_lock_irqsave (&ehci->lock, flags); in ehci_hub_control()
782 temp = ehci_readl(ehci, status_reg); 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()
802 if (ehci->no_selective_suspend) in ehci_hub_control()
817 if (ehci->has_tdi_phy_lpm) { in ehci_hub_control()
818 temp1 = ehci_readl(ehci, hostpc_reg); in ehci_hub_control()
819 ehci_writel(ehci, temp1 & ~HOSTPC_PHCD, in ehci_hub_control()
821 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
823 spin_lock_irqsave(&ehci->lock, flags); 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()
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()
839 ehci_port_power(ehci, wIndex, false); 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()
858 ehci_hub_descriptor (ehci, (struct usb_hub_descriptor *) in ehci_hub_control()
871 temp = ehci_readl(ehci, status_reg); in ehci_hub_control()
879 if (ehci_has_ci_pec_bug(ehci, temp)) { in ehci_hub_control()
881 ehci_info(ehci, in ehci_hub_control()
886 if ((temp & PORT_OCC) && (!ignore_oc && !ehci->spurious_oc)){ in ehci_hub_control()
891 * However, not all EHCI implementations do this 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()
899 ehci_port_power(ehci, wIndex, false); 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()
906 if (!ehci->reset_done[wIndex]) { in ehci_hub_control()
911 ehci->reset_done[wIndex] = jiffies 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()
933 ehci_writel(ehci, temp, status_reg); in ehci_hub_control()
934 clear_bit(wIndex, &ehci->resuming_ports); in ehci_hub_control()
935 retval = ehci_handshake(ehci, status_reg, in ehci_hub_control()
938 ehci_err(ehci, "port %d resume error %d\n", 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()
955 retval = ehci_handshake(ehci, status_reg, in ehci_hub_control()
958 ehci_err (ehci, "port %d reset error %d\n", in ehci_hub_control()
964 temp = check_reset_complete (ehci, wIndex, status_reg, in ehci_hub_control()
965 ehci_readl(ehci, status_reg)); in ehci_hub_control()
970 test_bit(wIndex, &ehci->companion_ports)) { 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()
987 if (ehci->has_hostpc) { in ehci_hub_control()
988 temp1 = ehci_readl(ehci, hostpc_reg); in ehci_hub_control()
989 status |= ehci_port_speed(ehci, temp1); in ehci_hub_control()
991 status |= ehci_port_speed(ehci, temp); 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()
1004 set_bit(wIndex, &ehci->port_c_suspend); 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()
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()
1046 temp = ehci_readl(ehci, status_reg); in ehci_hub_control()
1053 if (ehci->no_selective_suspend) 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()
1070 temp1 = ehci_readl(ehci, hostpc_reg); in ehci_hub_control()
1071 ehci_writel(ehci, temp1 | HOSTPC_PHCD, in ehci_hub_control()
1073 temp1 = ehci_readl(ehci, hostpc_reg); in ehci_hub_control()
1074 ehci_dbg(ehci, "Port%d phy low pwr mode %s\n", in ehci_hub_control()
1078 if (ehci_has_fsl_susp_errata(ehci)) { 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()
1089 ehci_port_power(ehci, wIndex, true); in ehci_hub_control()
1090 spin_lock_irqsave(&ehci->lock, flags); in ehci_hub_control()
1101 && !ehci_is_TDI(ehci) in ehci_hub_control()
1103 ehci_dbg (ehci, in ehci_hub_control()
1115 ehci->reset_done [wIndex] = jiffies in ehci_hub_control()
1122 if (ehci_has_fsl_hs_errata(ehci)) in ehci_hub_control()
1125 ehci_writel(ehci, temp, status_reg); in ehci_hub_control()
1131 * or else system reboot). See EHCI 2.3.9 and 4.14 for info 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()
1147 ehci_quiesce(ehci); in ehci_hub_control()
1148 spin_lock_irqsave(&ehci->lock, flags); 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()
1157 ehci_writel(ehci, temp | PORT_SUSPEND, in ehci_hub_control()
1161 spin_unlock_irqrestore(&ehci->lock, flags); in ehci_hub_control()
1162 ehci_halt(ehci); 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()
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()
1182 spin_unlock_irqrestore (&ehci->lock, flags); in ehci_hub_control()
1189 struct ehci_hcd *ehci = hcd_to_ehci(hcd); in ehci_relinquish_port() local
1191 if (ehci_is_TDI(ehci)) in ehci_relinquish_port()
1193 set_owner(ehci, --portnum, PORT_OWNER); in ehci_relinquish_port()
1198 struct ehci_hcd *ehci = hcd_to_ehci(hcd); in ehci_port_handed_over() local
1201 if (ehci_is_TDI(ehci)) in ehci_port_handed_over()
1203 reg = &ehci->regs->port_status[portnum - 1]; in ehci_port_handed_over()
1204 return ehci_readl(ehci, reg) & PORT_OWNER; in ehci_port_handed_over()
1207 static int ehci_port_power(struct ehci_hcd *ehci, int portnum, bool enable) in ehci_port_power() argument
1209 struct usb_hcd *hcd = ehci_to_hcd(ehci); in ehci_port_power()
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()
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()