• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/usb/host/

Lines Matching refs:ehci

19 /* this file is part of ehci-hcd.c */
47 static void ehci_handover_companion_ports(struct ehci_hcd *ehci)
53 struct usb_hcd *hcd = ehci_to_hcd(ehci);
55 if (!ehci->owned_ports)
61 port = HCS_N_PORTS(ehci->hcs_params);
63 if (test_bit(port, &ehci->owned_ports)) {
64 reg = &ehci->regs->port_status[port];
65 status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
69 clear_bit(port, &ehci->owned_ports);
70 else if (test_bit(port, &ehci->companion_ports))
71 ehci_writel(ehci, status & ~PORT_PE, reg);
79 if (!ehci->owned_ports)
83 port = HCS_N_PORTS(ehci->hcs_params);
85 if (test_bit(port, &ehci->owned_ports)) {
94 reg = &ehci->regs->port_status[port];
95 status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
97 ehci_writel(ehci, status | PORT_CSC, reg);
99 ehci_dbg(ehci, "failed handover port %d: %x\n",
101 ehci_writel(ehci, status & ~PORT_PE, reg);
106 ehci->owned_ports = 0;
109 static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
121 if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup)
124 spin_lock_irqsave(&ehci->lock, flags);
127 if (ehci->has_hostpc) {
128 port = HCS_N_PORTS(ehci->hcs_params);
132 hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
134 temp = ehci_readl(ehci, hostpc_reg);
135 ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg);
137 spin_unlock_irqrestore(&ehci->lock, flags);
139 spin_lock_irqsave(&ehci->lock, flags);
142 port = HCS_N_PORTS(ehci->hcs_params);
144 u32 __iomem *reg = &ehci->regs->port_status[port];
145 u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
157 ehci_vdbg(ehci, "port %d, %08x -> %08x\n",
159 ehci_writel(ehci, t2, reg);
163 if (ehci->has_hostpc) {
164 port = HCS_N_PORTS(ehci->hcs_params);
168 hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
170 temp = ehci_readl(ehci, hostpc_reg);
171 ehci_writel(ehci, temp | HOSTPC_PHCD, hostpc_reg);
176 if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD))
177 usb_hcd_resume_root_hub(ehci_to_hcd(ehci));
179 spin_unlock_irqrestore(&ehci->lock, flags);
184 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
189 ehci_dbg(ehci, "suspend root hub\n");
191 if (time_before (jiffies, ehci->next_statechange))
193 del_timer_sync(&ehci->watchdog);
194 del_timer_sync(&ehci->iaa_watchdog);
196 spin_lock_irq (&ehci->lock);
204 port = HCS_N_PORTS(ehci->hcs_params);
206 if (ehci->reset_done[port] != 0) {
207 spin_unlock_irq(&ehci->lock);
208 ehci_dbg(ehci, "suspend failed because "
218 ehci_quiesce (ehci);
221 ehci->command = ehci_readl(ehci, &ehci->regs->command);
222 ehci_work(ehci);
229 ehci->bus_suspended = 0;
230 ehci->owned_ports = 0;
232 port = HCS_N_PORTS(ehci->hcs_params);
234 u32 __iomem *reg = &ehci->regs->port_status [port];
235 u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
240 set_bit(port, &ehci->owned_ports);
243 set_bit(port, &ehci->bus_suspended);
260 ehci_vdbg (ehci, "port %d, %08x -> %08x\n",
262 ehci_writel(ehci, t2, reg);
267 if (changed && ehci->has_hostpc) {
268 spin_unlock_irq(&ehci->lock);
270 spin_lock_irq(&ehci->lock);
272 port = HCS_N_PORTS(ehci->hcs_params);
277 hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
279 t3 = ehci_readl(ehci, hostpc_reg);
280 ehci_writel(ehci, t3 | HOSTPC_PHCD, hostpc_reg);
281 t3 = ehci_readl(ehci, hostpc_reg);
282 ehci_dbg(ehci, "Port %d phy low-power mode %s\n",
289 if (ehci->bus_suspended)
293 ehci_halt (ehci);
296 if (ehci->reclaim)
297 end_unlink_async(ehci);
303 ehci_writel(ehci, mask, &ehci->regs->intr_enable);
304 ehci_readl(ehci, &ehci->regs->intr_enable);
306 ehci->next_statechange = jiffies + msecs_to_jiffies(10);
307 spin_unlock_irq (&ehci->lock);
312 del_timer_sync(&ehci->watchdog);
320 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
326 if (time_before (jiffies, ehci->next_statechange))
328 spin_lock_irq (&ehci->lock);
330 spin_unlock_irq(&ehci->lock);
334 if (unlikely(ehci->debug)) {
336 ehci->debug = NULL;
347 power_okay = ehci_readl(ehci, &ehci->regs->intr_enable);
348 ehci_dbg(ehci, "resume root hub%s\n",
354 ehci_writel(ehci, 0, &ehci->regs->intr_enable);
357 ehci_writel(ehci, 0, &ehci->regs->segment);
358 ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list);
359 ehci_writel(ehci, (u32) ehci->async->qh_dma, &ehci->regs->async_next);
362 ehci_writel(ehci, ehci->command, &ehci->regs->command);
366 spin_unlock_irq(&ehci->lock);
368 spin_lock_irq(&ehci->lock);
371 if (ehci->bus_suspended && ehci->has_hostpc) {
372 i = HCS_N_PORTS(ehci->hcs_params);
374 if (test_bit(i, &ehci->bus_suspended)) {
377 hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
379 temp = ehci_readl(ehci, hostpc_reg);
380 ehci_writel(ehci, temp & ~HOSTPC_PHCD,
384 spin_unlock_irq(&ehci->lock);
386 spin_lock_irq(&ehci->lock);
390 i = HCS_N_PORTS (ehci->hcs_params);
392 temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
394 if (test_bit(i, &ehci->bus_suspended) &&
399 ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
404 spin_unlock_irq(&ehci->lock);
406 spin_lock_irq(&ehci->lock);
409 i = HCS_N_PORTS (ehci->hcs_params);
411 temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
412 if (test_bit(i, &ehci->bus_suspended) &&
415 ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
416 ehci_vdbg (ehci, "resumed port %d\n", i + 1);
419 (void) ehci_readl(ehci, &ehci->regs->command);
423 if (ehci->async->qh_next.qh)
425 if (ehci->periodic_sched)
428 ehci->command |= temp;
429 ehci_writel(ehci, ehci->command, &ehci->regs->command);
432 ehci->next_statechange = jiffies + msecs_to_jiffies(5);
436 ehci_writel(ehci, INTR_MASK, &ehci->regs->intr_enable);
438 spin_unlock_irq (&ehci->lock);
439 ehci_handover_companion_ports(ehci);
457 struct ehci_hcd *ehci;
462 ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
463 nports = HCS_N_PORTS(ehci->hcs_params);
466 if (test_bit(index, &ehci->companion_ports)) {
478 static void set_owner(struct ehci_hcd *ehci, int portnum, int new_owner)
484 status_reg = &ehci->regs->port_status[portnum];
492 spin_lock_irq(&ehci->lock);
493 port_status = ehci_readl(ehci, status_reg);
501 ehci_writel(ehci, port_status, status_reg);
503 spin_unlock_irq(&ehci->lock);
518 struct ehci_hcd *ehci;
521 ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
529 if (portnum <= 0 || portnum > HCS_N_PORTS(ehci->hcs_params))
533 set_bit(portnum, &ehci->companion_ports);
535 clear_bit(portnum, &ehci->companion_ports);
536 set_owner(ehci, portnum, new_owner);
541 static inline void create_companion_file(struct ehci_hcd *ehci)
546 if (!ehci_is_TDI(ehci))
547 i = device_create_file(ehci_to_hcd(ehci)->self.controller,
551 static inline void remove_companion_file(struct ehci_hcd *ehci)
554 if (!ehci_is_TDI(ehci))
555 device_remove_file(ehci_to_hcd(ehci)->self.controller,
563 struct ehci_hcd *ehci,
575 if (ehci_is_TDI(ehci)) {
576 ehci_dbg (ehci,
582 ehci_dbg (ehci, "port %d full speed --> companion\n",
588 ehci_writel(ehci, port_status, status_reg);
591 if (ehci->has_amcc_usb23)
592 set_ohci_hcfs(ehci, 1);
594 ehci_dbg (ehci, "port %d high speed\n", index + 1);
596 if (ehci->has_amcc_usb23)
597 set_ohci_hcfs(ehci, 0);
611 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
624 ports = HCS_N_PORTS (ehci->hcs_params);
645 spin_lock_irqsave (&ehci->lock, flags);
648 if (ehci->has_ppcd)
649 ppcd = ehci_readl(ehci, &ehci->regs->status) >> 16;
653 if (ehci->has_ppcd && !(ppcd & (1 << i)))
655 temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
664 if ((temp & mask) != 0 || test_bit(i, &ehci->port_c_suspend)
665 || (ehci->reset_done[i] && time_after_eq(
666 jiffies, ehci->reset_done[i]))) {
674 spin_unlock_irqrestore (&ehci->lock, flags);
682 struct ehci_hcd *ehci,
685 int ports = HCS_N_PORTS (ehci->hcs_params);
689 desc->bPwrOn2PwrGood = 10; /* ehci 1.0, 2.3.9 says 20ms max */
701 if (HCS_PPC (ehci->hcs_params))
718 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
719 int ports = HCS_N_PORTS (ehci->hcs_params);
720 u32 __iomem *status_reg = &ehci->regs->port_status[
729 if (ehci->has_hostpc)
730 hostpc_reg = (u32 __iomem *)((u8 *)ehci->regs
732 spin_lock_irqsave (&ehci->lock, flags);
748 temp = ehci_readl(ehci, status_reg);
759 ehci_writel(ehci, temp & ~PORT_PE, status_reg);
762 ehci_writel(ehci, (temp & ~PORT_RWC_BITS) | PORT_PEC,
768 if (ehci->no_selective_suspend)
777 temp1 = ehci_readl(ehci, hostpc_reg);
778 ehci_writel(ehci, temp1 & ~HOSTPC_PHCD,
780 spin_unlock_irqrestore(&ehci->lock, flags);
782 spin_lock_irqsave(&ehci->lock, flags);
786 ehci_writel(ehci, temp | PORT_RESUME, status_reg);
787 ehci->reset_done[wIndex] = jiffies
791 clear_bit(wIndex, &ehci->port_c_suspend);
794 if (HCS_PPC (ehci->hcs_params))
795 ehci_writel(ehci,
800 if (ehci->has_lpm) {
805 ehci_writel(ehci, (temp & ~PORT_RWC_BITS) | PORT_CSC,
809 ehci_writel(ehci, (temp & ~PORT_RWC_BITS) | PORT_OCC,
818 ehci_readl(ehci, &ehci->regs->command); /* unblock posted write */
821 ehci_hub_descriptor (ehci, (struct usb_hub_descriptor *)
834 temp = ehci_readl(ehci, status_reg);
852 if (HCS_PPC (ehci->hcs_params)){
853 ehci_writel(ehci,
863 if (!ehci->reset_done[wIndex]) {
865 ehci->reset_done[wIndex] = jiffies
868 mod_timer(&ehci_to_hcd(ehci)->rh_timer,
869 ehci->reset_done[wIndex]);
874 ehci->reset_done[wIndex])) {
875 clear_bit(wIndex, &ehci->suspended_ports);
876 set_bit(wIndex, &ehci->port_c_suspend);
877 ehci->reset_done[wIndex] = 0;
880 temp = ehci_readl(ehci, status_reg);
881 ehci_writel(ehci,
884 retval = handshake(ehci, status_reg,
887 ehci_err(ehci,
899 ehci->reset_done[wIndex])) {
901 ehci->reset_done [wIndex] = 0;
904 ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET),
909 retval = handshake(ehci, status_reg,
912 ehci_err (ehci, "port %d reset error %d\n",
918 temp = check_reset_complete (ehci, wIndex, status_reg,
919 ehci_readl(ehci, status_reg));
923 ehci->reset_done[wIndex] = 0;
927 test_bit(wIndex, &ehci->companion_ports)) {
930 ehci_writel(ehci, temp, status_reg);
931 ehci_dbg(ehci, "port %d --> companion\n", wIndex + 1);
932 temp = ehci_readl(ehci, status_reg);
944 if (ehci->has_hostpc) {
945 temp1 = ehci_readl(ehci, hostpc_reg);
946 status |= ehci_port_speed(ehci, temp1);
948 status |= ehci_port_speed(ehci, temp);
956 } else if (test_bit(wIndex, &ehci->suspended_ports)) {
957 clear_bit(wIndex, &ehci->suspended_ports);
958 ehci->reset_done[wIndex] = 0;
960 set_bit(wIndex, &ehci->port_c_suspend);
969 if (test_bit(wIndex, &ehci->port_c_suspend))
975 dbg_port (ehci, "GetStatus", wIndex + 1, temp);
991 if (unlikely(ehci->debug)) {
994 if (wIndex == HCS_DEBUG_PORT(ehci->hcs_params) &&
995 (readl(&ehci->debug->control) & DBGP_ENABLED)) {
1003 temp = ehci_readl(ehci, status_reg);
1010 if (ehci->no_selective_suspend)
1022 ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
1024 spin_unlock_irqrestore(&ehci->lock, flags);
1026 spin_lock_irqsave(&ehci->lock, flags);
1027 temp1 = ehci_readl(ehci, hostpc_reg);
1028 ehci_writel(ehci, temp1 | HOSTPC_PHCD,
1030 temp1 = ehci_readl(ehci, hostpc_reg);
1031 ehci_dbg(ehci, "Port%d phy low pwr mode %s\n",
1035 set_bit(wIndex, &ehci->suspended_ports);
1038 if (HCS_PPC (ehci->hcs_params))
1039 ehci_writel(ehci, temp | PORT_POWER,
1050 && !ehci_is_TDI(ehci)
1052 ehci_dbg (ehci,
1057 ehci_vdbg (ehci, "port %d reset\n", wIndex + 1);
1065 ehci->reset_done [wIndex] = jiffies
1068 ehci_writel(ehci, temp, status_reg);
1080 ehci_quiesce(ehci);
1081 ehci_halt(ehci);
1083 ehci_writel(ehci, temp, status_reg);
1089 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
1098 spin_unlock_irqrestore (&ehci->lock, flags);
1104 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
1106 if (ehci_is_TDI(ehci))
1108 set_owner(ehci, --portnum, PORT_OWNER);
1113 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
1116 if (ehci_is_TDI(ehci))
1118 reg = &ehci->regs->port_status[portnum - 1];
1119 return ehci_readl(ehci, reg) & PORT_OWNER;