Searched refs:ohci (Results 1 - 118 of 118) sorted by relevance

/linux-4.4.14/drivers/usb/host/
H A Dohci-hub.c46 static int ohci_rh_suspend (struct ohci_hcd *ohci, int autostop)
47 __releases(ohci->lock)
48 __acquires(ohci->lock)
52 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
53 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
55 ohci_dbg (ohci, "resume/suspend?\n");
56 ohci->hc_control &= ~OHCI_CTRL_HCFS;
57 ohci->hc_control |= OHCI_USB_RESET;
58 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
59 (void) ohci_readl (ohci, &ohci->regs->control);
63 ohci_dbg (ohci, "needs reinit!\n");
66 if (!ohci->autostop) {
67 ohci_dbg (ohci, "already suspended\n");
71 ohci_dbg (ohci, "%s root hub\n",
75 if (!autostop && (ohci->hc_control & OHCI_SCHED_ENABLES)) {
76 ohci->hc_control &= ~OHCI_SCHED_ENABLES;
77 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
78 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
79 ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrstatus);
84 ohci_dbg (ohci, "stopping schedules ...\n");
85 ohci->autostop = 0;
86 spin_unlock_irq (&ohci->lock);
88 spin_lock_irq (&ohci->lock);
90 update_done_list(ohci); variable
91 ohci_work(ohci); variable
98 if (ohci->flags & OHCI_QUIRK_GLOBAL_SUSPEND) {
99 __hc32 __iomem *portstat = ohci->regs->roothub.portstatus;
103 for (i = 0; i < ohci->num_ports; (++i, ++portstat)) {
104 temp = ohci_readl(ohci, portstat);
107 ohci_writel(ohci, RH_PS_PSS, portstat);
112 if (ohci_to_hcd(ohci)->self.root_hub->do_remote_wakeup || autostop) {
113 ohci->hc_control |= OHCI_CTRL_RWE;
115 ohci_writel(ohci, OHCI_INTR_RHSC | OHCI_INTR_RD,
116 &ohci->regs->intrdisable);
117 ohci->hc_control &= ~OHCI_CTRL_RWE;
123 ohci->hc_control &= ~OHCI_CTRL_HCFS;
124 ohci->hc_control |= OHCI_USB_SUSPEND;
125 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
126 (void) ohci_readl (ohci, &ohci->regs->control);
130 ohci->next_statechange = jiffies + msecs_to_jiffies (5);
131 ohci->autostop = 0;
132 ohci->rh_state = OHCI_RH_SUSPENDED;
148 static int ohci_rh_resume (struct ohci_hcd *ohci)
149 __releases(ohci->lock)
150 __acquires(ohci->lock)
152 struct usb_hcd *hcd = ohci_to_hcd (ohci);
155 int autostopped = ohci->autostop;
157 ohci->autostop = 0;
158 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
160 if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
162 if (ohci->rh_state != OHCI_RH_RUNNING) {
163 ohci_dbg (ohci, "BIOS/SMM active, control %03x\n",
164 ohci->hc_control);
168 ohci_dbg (ohci, "duplicate resume\n");
171 } else switch (ohci->hc_control & OHCI_CTRL_HCFS) {
173 ohci->hc_control &= ~(OHCI_CTRL_HCFS|OHCI_SCHED_ENABLES);
174 ohci->hc_control |= OHCI_USB_RESUME;
175 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
176 (void) ohci_readl (ohci, &ohci->regs->control);
177 ohci_dbg (ohci, "%s root hub\n",
182 ohci_dbg(ohci, "%swakeup root hub\n",
187 ohci_dbg (ohci, "snapshot resume? reinit\n");
191 ohci_dbg (ohci, "lost power\n");
196 spin_unlock_irq (&ohci->lock);
197 status = ohci_restart (ohci);
201 spin_lock_irq (&ohci->lock);
209 spin_unlock_irq (&ohci->lock);
214 temp = ohci_readl (ohci, &ohci->regs->control);
217 ohci_err (ohci, "controller won't resume\n");
218 spin_lock_irq(&ohci->lock);
223 ohci_writel (ohci, 0, &ohci->regs->ed_controlhead);
224 ohci_writel (ohci, 0, &ohci->regs->ed_controlcurrent);
225 ohci_writel (ohci, 0, &ohci->regs->ed_bulkhead);
226 ohci_writel (ohci, 0, &ohci->regs->ed_bulkcurrent);
227 ohci_writel (ohci, 0, &ohci->regs->ed_periodcurrent);
228 ohci_writel (ohci, (u32) ohci->hcca_dma, &ohci->regs->hcca);
231 periodic_reinit (ohci); variable
234 * The following code is executed with ohci->lock held and
240 ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
241 if (ohci->ed_rm_list)
242 ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable);
245 ohci_writel (ohci, OHCI_USB_OPER, &ohci->regs->control);
246 (void) ohci_readl (ohci, &ohci->regs->control);
250 temp = ohci->hc_control;
253 ohci->hc_control = temp;
254 ohci_writel (ohci, temp, &ohci->regs->control);
255 (void) ohci_readl (ohci, &ohci->regs->control);
260 spin_lock_irq (&ohci->lock);
262 /* now ohci->lock is always held and irqs are always disabled */
265 ohci->next_statechange = jiffies + STATECHANGE_DELAY;
270 if (!ohci->ed_rm_list) {
271 if (ohci->ed_controltail) {
272 ohci_writel (ohci,
273 find_head (ohci->ed_controltail)->dma,
274 &ohci->regs->ed_controlhead);
278 if (ohci->ed_bulktail) {
279 ohci_writel (ohci, find_head (ohci->ed_bulktail)->dma,
280 &ohci->regs->ed_bulkhead);
288 ohci_dbg (ohci, "restarting schedules ... %08x\n", enables);
289 ohci->hc_control |= enables;
290 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
292 ohci_writel (ohci, temp, &ohci->regs->cmdstatus);
293 (void) ohci_readl (ohci, &ohci->regs->control);
296 ohci->rh_state = OHCI_RH_RUNNING;
302 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_bus_suspend() local
305 spin_lock_irq (&ohci->lock); ohci_bus_suspend()
310 rc = ohci_rh_suspend (ohci, 0); ohci_bus_suspend()
311 spin_unlock_irq (&ohci->lock); ohci_bus_suspend()
314 del_timer_sync(&ohci->io_watchdog); ohci_bus_suspend()
320 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_bus_resume() local
323 if (time_before (jiffies, ohci->next_statechange)) ohci_bus_resume()
326 spin_lock_irq (&ohci->lock); ohci_bus_resume()
331 rc = ohci_rh_resume (ohci); ohci_bus_resume()
332 spin_unlock_irq (&ohci->lock); ohci_bus_resume()
341 static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, ohci_root_hub_state_changes() argument
351 rhsc_enable = ohci_readl(ohci, &ohci->regs->intrenable) & ohci_root_hub_state_changes()
354 switch (ohci->hc_control & OHCI_CTRL_HCFS) { ohci_root_hub_state_changes()
359 ohci_writel(ohci, rhsc_enable, &ohci->regs->intrenable); ohci_root_hub_state_changes()
365 if (!ohci->autostop) { ohci_root_hub_state_changes()
367 !device_may_wakeup(&ohci_to_hcd(ohci) ohci_root_hub_state_changes()
372 ohci->autostop = 1; ohci_root_hub_state_changes()
373 ohci->next_statechange = jiffies + HZ; ohci_root_hub_state_changes()
379 ohci->autostop = 0; ohci_root_hub_state_changes()
380 ohci->next_statechange = jiffies + ohci_root_hub_state_changes()
383 ohci->next_statechange) ohci_root_hub_state_changes()
384 && !ohci->ed_rm_list ohci_root_hub_state_changes()
385 && !(ohci->hc_control & ohci_root_hub_state_changes()
387 ohci_rh_suspend(ohci, 1); ohci_root_hub_state_changes()
398 if (ohci->autostop) ohci_root_hub_state_changes()
399 ohci_rh_resume(ohci); ohci_root_hub_state_changes()
401 usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); ohci_root_hub_state_changes()
404 } else if (!ohci->autostop && ohci_root_hub_state_changes()
405 !ohci_to_hcd(ohci)->self.root_hub-> ohci_root_hub_state_changes()
415 ohci_writel(ohci, rhsc_enable, ohci_root_hub_state_changes()
416 &ohci->regs->intrenable); ohci_root_hub_state_changes()
429 static inline int ohci_rh_resume(struct ohci_hcd *ohci) ohci_rh_resume() argument
437 static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, ohci_root_hub_state_changes() argument
441 if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) ohci_root_hub_state_changes()
452 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); ohci_root_hub_state_changes()
464 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_hub_status_data() local
470 spin_lock_irqsave (&ohci->lock, flags); ohci_hub_status_data()
475 if ((ohci->flags & OHCI_QUIRK_AMD756) ohci_hub_status_data()
476 && (roothub_a (ohci) & RH_A_NDP) > MAX_ROOT_PORTS) { ohci_hub_status_data()
477 ohci_warn (ohci, "bogus NDP, rereads as NDP=%d\n", ohci_hub_status_data()
478 ohci_readl (ohci, &ohci->regs->roothub.a) & RH_A_NDP); ohci_hub_status_data()
484 if (roothub_status (ohci) & (RH_HS_LPSC | RH_HS_OCIC)) ohci_hub_status_data()
488 if (ohci->num_ports > 7) { ohci_hub_status_data()
494 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrstatus); ohci_hub_status_data()
495 rhsc_status = ohci_readl(ohci, &ohci->regs->intrstatus) & ohci_hub_status_data()
499 for (i = 0; i < ohci->num_ports; i++) { ohci_hub_status_data()
500 u32 status = roothub_portstatus (ohci, i); ohci_hub_status_data()
515 if (ohci_root_hub_state_changes(ohci, changed, ohci_hub_status_data()
523 spin_unlock_irqrestore (&ohci->lock, flags); ohci_hub_status_data()
533 struct ohci_hcd *ohci, ohci_hub_descriptor()
536 u32 rh = roothub_a (ohci); ohci_hub_descriptor()
543 desc->bNbrPorts = ohci->num_ports; ohci_hub_descriptor()
544 temp = 1 + (ohci->num_ports / 8); ohci_hub_descriptor()
559 rh = roothub_b (ohci); ohci_hub_descriptor()
563 if (ohci->num_ports > 7) { ohci_hub_descriptor()
576 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_start_port_reset() local
584 status = ohci_readl(ohci, &ohci->regs->roothub.portstatus [port]); ohci_start_port_reset()
589 ohci_writel(ohci, RH_PS_PRS, &ohci->regs->roothub.portstatus [port]); ohci_start_port_reset()
614 static inline int root_port_reset (struct ohci_hcd *ohci, unsigned port) root_port_reset() argument
616 __hc32 __iomem *portstat = &ohci->regs->roothub.portstatus [port]; root_port_reset()
618 u16 now = ohci_readl(ohci, &ohci->regs->fmnumber); root_port_reset()
632 temp = ohci_readl (ohci, portstat); root_port_reset()
646 ohci_dbg(ohci, root_port_reset()
655 ohci_writel (ohci, RH_PS_PRSC, portstat); root_port_reset()
658 ohci_writel (ohci, RH_PS_PRS, portstat); root_port_reset()
660 now = ohci_readl(ohci, &ohci->regs->fmnumber); root_port_reset()
678 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_hub_control() local
679 int ports = ohci->num_ports; ohci_hub_control()
690 ohci_writel (ohci, RH_HS_OCIC, ohci_hub_control()
691 &ohci->regs->roothub.status); ohci_hub_control()
731 ohci_writel (ohci, temp, ohci_hub_control()
732 &ohci->regs->roothub.portstatus [wIndex]); ohci_hub_control()
733 // ohci_readl (ohci, &ohci->regs->roothub.portstatus [wIndex]); ohci_hub_control()
736 ohci_hub_descriptor (ohci, (struct usb_hub_descriptor *) buf); ohci_hub_control()
739 temp = roothub_status (ohci) & ~(RH_HS_CRWE | RH_HS_DRWE); ohci_hub_control()
746 temp = roothub_portstatus (ohci, wIndex); ohci_hub_control()
750 dbg_port(ohci, "GetStatus", wIndex, temp); ohci_hub_control()
771 ohci->start_hnp(ohci); ohci_hub_control()
774 ohci_writel (ohci, RH_PS_PSS, ohci_hub_control()
775 &ohci->regs->roothub.portstatus [wIndex]); ohci_hub_control()
778 ohci_writel (ohci, RH_PS_PPS, ohci_hub_control()
779 &ohci->regs->roothub.portstatus [wIndex]); ohci_hub_control()
782 retval = root_port_reset (ohci, wIndex); ohci_hub_control()
532 ohci_hub_descriptor( struct ohci_hcd *ohci, struct usb_hub_descriptor *desc ) ohci_hub_descriptor() argument
H A Dohci-hcd.c10 * [ uhci code and gregs ohci fragments ]
77 #include "ohci.h"
80 static void ohci_dump(struct ohci_hcd *ohci);
84 #include "ohci-hub.c"
85 #include "ohci-dbg.c"
86 #include "ohci-mem.c"
87 #include "ohci-q.c"
149 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_urb_enqueue() local
158 ed = ed_get(ohci, urb->ep, urb->dev, pipe, urb->interval); ohci_urb_enqueue()
201 urb_priv->td [i] = td_alloc (ohci, mem_flags); ohci_urb_enqueue()
204 urb_free_priv (ohci, urb_priv); ohci_urb_enqueue()
209 spin_lock_irqsave (&ohci->lock, flags); ohci_urb_enqueue()
216 if (ohci->rh_state != OHCI_RH_RUNNING) { ohci_urb_enqueue()
226 retval = ed_schedule (ohci, ed); ohci_urb_enqueue()
233 if (!timer_pending(&ohci->io_watchdog) && ohci_urb_enqueue()
234 list_empty(&ohci->eds_in_use)) { ohci_urb_enqueue()
235 ohci->prev_frame_no = ohci_frame_no(ohci); ohci_urb_enqueue()
236 mod_timer(&ohci->io_watchdog, ohci_urb_enqueue()
239 list_add(&ed->in_use_list, &ohci->eds_in_use); ohci_urb_enqueue()
242 u16 frame = ohci_frame_no(ohci); ohci_urb_enqueue()
252 u16 next = ohci_frame_no(ohci) + 1; ohci_urb_enqueue()
281 ohci_dbg(ohci, "iso underrun %p (%u+%u < %u)\n", ohci_urb_enqueue()
296 td_submit_urb (ohci, urb); ohci_urb_enqueue()
300 urb_free_priv (ohci, urb_priv); ohci_urb_enqueue()
301 spin_unlock_irqrestore (&ohci->lock, flags); ohci_urb_enqueue()
313 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_urb_dequeue() local
318 spin_lock_irqsave (&ohci->lock, flags); ohci_urb_dequeue()
328 start_ed_unlink(ohci, urb_priv->ed); ohci_urb_dequeue()
330 if (ohci->rh_state != OHCI_RH_RUNNING) { ohci_urb_dequeue()
332 ohci_work(ohci); ohci_urb_dequeue()
335 spin_unlock_irqrestore (&ohci->lock, flags); ohci_urb_dequeue()
348 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_endpoint_disable() local
360 spin_lock_irqsave (&ohci->lock, flags); ohci_endpoint_disable()
362 if (ohci->rh_state != OHCI_RH_RUNNING) { ohci_endpoint_disable()
365 ohci_work(ohci); ohci_endpoint_disable()
372 ohci_warn(ohci, "ED unlink timeout\n"); ohci_endpoint_disable()
375 spin_unlock_irqrestore (&ohci->lock, flags); ohci_endpoint_disable()
380 td_free (ohci, ed->dummy); ohci_endpoint_disable()
381 ed_free (ohci, ed); ohci_endpoint_disable()
389 ohci_err (ohci, "leak ed %p (#%02x) state %d%s\n", ohci_endpoint_disable()
392 td_free (ohci, ed->dummy); ohci_endpoint_disable()
396 spin_unlock_irqrestore (&ohci->lock, flags); ohci_endpoint_disable()
401 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_get_frame() local
403 return ohci_frame_no(ohci); ohci_get_frame()
406 static void ohci_usb_reset (struct ohci_hcd *ohci) ohci_usb_reset() argument
408 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); ohci_usb_reset()
409 ohci->hc_control &= OHCI_CTRL_RWC; ohci_usb_reset()
410 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); ohci_usb_reset()
411 ohci->rh_state = OHCI_RH_HALTED; ohci_usb_reset()
421 struct ohci_hcd *ohci; ohci_shutdown() local
423 ohci = hcd_to_ohci (hcd); ohci_shutdown()
424 ohci_writel(ohci, (u32) ~0, &ohci->regs->intrdisable); ohci_shutdown()
427 ohci_writel(ohci, OHCI_HCR, &ohci->regs->cmdstatus); ohci_shutdown()
428 ohci_readl(ohci, &ohci->regs->cmdstatus); /* flush the writes */ ohci_shutdown()
431 ohci_writel(ohci, ohci->fminterval, &ohci->regs->fminterval); ohci_shutdown()
432 ohci->rh_state = OHCI_RH_HALTED; ohci_shutdown()
441 static int ohci_init (struct ohci_hcd *ohci) ohci_init() argument
444 struct usb_hcd *hcd = ohci_to_hcd(ohci); ohci_init()
450 ohci->flags |= OHCI_QUIRK_HUB_POWER; ohci_init()
452 ohci->rh_state = OHCI_RH_HALTED; ohci_init()
453 ohci->regs = hcd->regs; ohci_init()
461 if (!no_handshake && ohci_readl (ohci, ohci_init()
462 &ohci->regs->control) & OHCI_CTRL_IR) { ohci_init()
465 ohci_dbg (ohci, "USB HC TakeOver from BIOS/SMM\n"); ohci_init()
473 ohci_writel (ohci, OHCI_INTR_OC, &ohci->regs->intrenable); ohci_init()
474 ohci_writel (ohci, OHCI_OCR, &ohci->regs->cmdstatus); ohci_init()
475 while (ohci_readl (ohci, &ohci->regs->control) & OHCI_CTRL_IR) { ohci_init()
478 ohci_err (ohci, "USB HC takeover failed!" ohci_init()
483 ohci_usb_reset (ohci); ohci_init()
488 ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); ohci_init()
491 if (ohci_readl (ohci, &ohci->regs->control) & OHCI_CTRL_RWC) ohci_init()
492 ohci->hc_control |= OHCI_CTRL_RWC; ohci_init()
495 if (ohci->num_ports == 0) ohci_init()
496 ohci->num_ports = roothub_a(ohci) & RH_A_NDP; ohci_init()
498 if (ohci->hcca) ohci_init()
501 setup_timer(&ohci->io_watchdog, io_watchdog_func, ohci_init()
502 (unsigned long) ohci); ohci_init()
503 set_timer_slack(&ohci->io_watchdog, msecs_to_jiffies(20)); ohci_init()
505 ohci->hcca = dma_alloc_coherent (hcd->self.controller, ohci_init()
506 sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_KERNEL); ohci_init()
507 if (!ohci->hcca) ohci_init()
510 if ((ret = ohci_mem_init (ohci)) < 0) ohci_init()
513 create_debug_files (ohci); ohci_init()
525 static int ohci_run (struct ohci_hcd *ohci) ohci_run() argument
528 int first = ohci->fminterval == 0; ohci_run()
529 struct usb_hcd *hcd = ohci_to_hcd(ohci); ohci_run()
531 ohci->rh_state = OHCI_RH_HALTED; ohci_run()
536 val = ohci_readl (ohci, &ohci->regs->fminterval); ohci_run()
537 ohci->fminterval = val & 0x3fff; ohci_run()
538 if (ohci->fminterval != FI) ohci_run()
539 ohci_dbg (ohci, "fminterval delta %d\n", ohci_run()
540 ohci->fminterval - FI); ohci_run()
541 ohci->fminterval |= FSMP (ohci->fminterval) << 16; ohci_run()
551 if ((ohci->hc_control & OHCI_CTRL_RWC) != 0) ohci_run()
554 switch (ohci->hc_control & OHCI_CTRL_HCFS) { ohci_run()
560 ohci->hc_control &= OHCI_CTRL_RWC; ohci_run()
561 ohci->hc_control |= OHCI_USB_RESUME; ohci_run()
566 ohci->hc_control &= OHCI_CTRL_RWC; ohci_run()
567 ohci->hc_control |= OHCI_USB_RESET; ohci_run()
571 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); ohci_run()
573 (void) ohci_readl (ohci, &ohci->regs->control); ohci_run()
576 memset (ohci->hcca, 0, sizeof (struct ohci_hcca)); ohci_run()
579 spin_lock_irq (&ohci->lock); ohci_run()
583 ohci_writel (ohci, OHCI_HCR, &ohci->regs->cmdstatus); ohci_run()
585 while ((ohci_readl (ohci, &ohci->regs->cmdstatus) & OHCI_HCR) != 0) { ohci_run()
587 spin_unlock_irq (&ohci->lock); ohci_run()
588 ohci_err (ohci, "USB HC reset timed out!\n"); ohci_run()
603 if (ohci->flags & OHCI_QUIRK_INITRESET) { ohci_run()
604 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); ohci_run()
606 (void) ohci_readl (ohci, &ohci->regs->control); ohci_run()
611 ohci_writel (ohci, 0, &ohci->regs->ed_controlhead); ohci_run()
612 ohci_writel (ohci, 0, &ohci->regs->ed_bulkhead); ohci_run()
615 ohci_writel (ohci, (u32) ohci->hcca_dma, &ohci->regs->hcca); ohci_run()
617 periodic_reinit (ohci); ohci_run()
622 if ((ohci_readl (ohci, &ohci->regs->fminterval) & 0x3fff0000) == 0 ohci_run()
623 || !ohci_readl (ohci, &ohci->regs->periodicstart)) { ohci_run()
624 if (!(ohci->flags & OHCI_QUIRK_INITRESET)) { ohci_run()
625 ohci->flags |= OHCI_QUIRK_INITRESET; ohci_run()
626 ohci_dbg (ohci, "enabling initreset quirk\n"); ohci_run()
629 spin_unlock_irq (&ohci->lock); ohci_run()
630 ohci_err (ohci, "init err (%08x %04x)\n", ohci_run()
631 ohci_readl (ohci, &ohci->regs->fminterval), ohci_run()
632 ohci_readl (ohci, &ohci->regs->periodicstart)); ohci_run()
641 ohci->hc_control &= OHCI_CTRL_RWC; ohci_run()
642 ohci->hc_control |= OHCI_CONTROL_INIT | OHCI_USB_OPER; ohci_run()
643 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); ohci_run()
644 ohci->rh_state = OHCI_RH_RUNNING; ohci_run()
647 ohci_writel (ohci, RH_HS_DRWE, &ohci->regs->roothub.status); ohci_run()
651 ohci_writel (ohci, ~0, &ohci->regs->intrstatus); ohci_run()
652 ohci_writel (ohci, mask, &ohci->regs->intrenable); ohci_run()
655 val = roothub_a (ohci); ohci_run()
657 if (ohci->flags & OHCI_QUIRK_SUPERIO) { ohci_run()
661 ohci_writel (ohci, val, &ohci->regs->roothub.a); ohci_run()
662 } else if ((ohci->flags & OHCI_QUIRK_AMD756) || ohci_run()
663 (ohci->flags & OHCI_QUIRK_HUB_POWER)) { ohci_run()
668 ohci_writel (ohci, val, &ohci->regs->roothub.a); ohci_run()
670 ohci_writel (ohci, RH_HS_LPSC, &ohci->regs->roothub.status); ohci_run()
671 ohci_writel (ohci, (val & RH_A_NPS) ? 0 : RH_B_PPCM, ohci_run()
672 &ohci->regs->roothub.b); ohci_run()
674 (void) ohci_readl (ohci, &ohci->regs->control); ohci_run()
676 ohci->next_statechange = jiffies + STATECHANGE_DELAY; ohci_run()
677 spin_unlock_irq (&ohci->lock); ohci_run()
682 ohci_dump(ohci); ohci_run()
691 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_setup() local
693 ohci_hcd_init(ohci); ohci_setup()
695 return ohci_init(ohci); ohci_setup()
702 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_start() local
705 ret = ohci_run(ohci); ohci_start()
707 ohci_err(ohci, "can't start\n"); ohci_start()
727 struct ohci_hcd *ohci = (struct ohci_hcd *) _ohci; io_watchdog_func() local
736 spin_lock_irqsave(&ohci->lock, flags); io_watchdog_func()
745 status = ohci_readl(ohci, &ohci->regs->intrstatus); io_watchdog_func()
746 if (!(status & OHCI_INTR_WDH) && ohci->wdh_cnt == ohci->prev_wdh_cnt) { io_watchdog_func()
747 if (ohci->prev_donehead) { io_watchdog_func()
748 ohci_err(ohci, "HcDoneHead not written back; disabled\n"); io_watchdog_func()
750 usb_hc_died(ohci_to_hcd(ohci)); io_watchdog_func()
751 ohci_dump(ohci); io_watchdog_func()
752 ohci_shutdown(ohci_to_hcd(ohci)); io_watchdog_func()
761 list_for_each_entry(ed, &ohci->eds_in_use, in_use_list) { io_watchdog_func()
764 OKAY_TO_TAKEBACK(ohci, ed)) { io_watchdog_func()
765 unsigned tmp = hc32_to_cpu(ohci, ed->hwINFO); io_watchdog_func()
767 ohci_dbg(ohci, "takeback pending TD for dev %d ep 0x%x\n", io_watchdog_func()
771 add_to_done_list(ohci, ed->pending_td); io_watchdog_func()
788 head = hc32_to_cpu(ohci, ACCESS_ONCE(ed->hwHeadP)) & TD_MASK; io_watchdog_func()
802 ed->takeback_wdh_cnt = ohci->wdh_cnt + 2; io_watchdog_func()
807 ohci_work(ohci); io_watchdog_func()
809 if (ohci->rh_state == OHCI_RH_RUNNING) { io_watchdog_func()
819 frame_no = ohci_frame_no(ohci); io_watchdog_func()
820 if (frame_no == ohci->prev_frame_no) { io_watchdog_func()
825 for (i = 0; i < ohci->num_ports; ++i) { io_watchdog_func()
826 tmp = roothub_portstatus(ohci, i); io_watchdog_func()
833 ohci_err(ohci, "frame counter not updating; disabled\n"); io_watchdog_func()
837 if (!list_empty(&ohci->eds_in_use)) { io_watchdog_func()
838 ohci->prev_frame_no = frame_no; io_watchdog_func()
839 ohci->prev_wdh_cnt = ohci->wdh_cnt; io_watchdog_func()
840 ohci->prev_donehead = ohci_readl(ohci, io_watchdog_func()
841 &ohci->regs->donehead); io_watchdog_func()
842 mod_timer(&ohci->io_watchdog, io_watchdog_func()
848 spin_unlock_irqrestore(&ohci->lock, flags); io_watchdog_func()
855 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_irq() local
856 struct ohci_regs __iomem *regs = ohci->regs; ohci_irq()
863 ints = ohci_readl(ohci, &regs->intrstatus); ohci_irq()
869 ohci->rh_state = OHCI_RH_HALTED; ohci_irq()
870 ohci_dbg (ohci, "device removed!\n"); ohci_irq()
876 ints &= ohci_readl(ohci, &regs->intrenable); ohci_irq()
879 if (ints == 0 || unlikely(ohci->rh_state == OHCI_RH_HALTED)) ohci_irq()
884 if (quirk_nec(ohci)) { ohci_irq()
888 ohci_err (ohci, "OHCI Unrecoverable Error, scheduling NEC chip restart\n"); ohci_irq()
890 ohci_writel (ohci, OHCI_INTR_UE, &regs->intrdisable); ohci_irq()
892 schedule_work (&ohci->nec_work); ohci_irq()
894 ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n"); ohci_irq()
895 ohci->rh_state = OHCI_RH_HALTED; ohci_irq()
899 ohci_dump(ohci); ohci_irq()
900 ohci_usb_reset (ohci); ohci_irq()
904 ohci_dbg(ohci, "rhsc\n"); ohci_irq()
905 ohci->next_statechange = jiffies + STATECHANGE_DELAY; ohci_irq()
906 ohci_writel(ohci, OHCI_INTR_RD | OHCI_INTR_RHSC, ohci_irq()
917 ohci_writel(ohci, OHCI_INTR_RHSC, &regs->intrdisable); ohci_irq()
926 ohci_dbg(ohci, "resume detect\n"); ohci_irq()
927 ohci_writel(ohci, OHCI_INTR_RD, &regs->intrstatus); ohci_irq()
929 if (ohci->autostop) { ohci_irq()
930 spin_lock (&ohci->lock); ohci_irq()
931 ohci_rh_resume (ohci); ohci_irq()
932 spin_unlock (&ohci->lock); ohci_irq()
937 spin_lock(&ohci->lock); ohci_irq()
939 update_done_list(ohci); ohci_irq()
946 ohci_work(ohci); ohci_irq()
947 if ((ints & OHCI_INTR_SF) != 0 && !ohci->ed_rm_list ohci_irq()
948 && ohci->rh_state == OHCI_RH_RUNNING) ohci_irq()
949 ohci_writel (ohci, OHCI_INTR_SF, &regs->intrdisable); ohci_irq()
951 if (ohci->rh_state == OHCI_RH_RUNNING) { ohci_irq()
952 ohci_writel (ohci, ints, &regs->intrstatus); ohci_irq()
954 ++ohci->wdh_cnt; ohci_irq()
956 ohci_writel (ohci, OHCI_INTR_MIE, &regs->intrenable); ohci_irq()
958 (void) ohci_readl (ohci, &ohci->regs->control); ohci_irq()
960 spin_unlock(&ohci->lock); ohci_irq()
969 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_stop() local
971 ohci_dump(ohci); ohci_stop()
973 if (quirk_nec(ohci)) ohci_stop()
974 flush_work(&ohci->nec_work); ohci_stop()
975 del_timer_sync(&ohci->io_watchdog); ohci_stop()
977 ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); ohci_stop()
978 ohci_usb_reset(ohci); ohci_stop()
982 if (quirk_amdiso(ohci)) ohci_stop()
985 remove_debug_files (ohci); ohci_stop()
986 ohci_mem_cleanup (ohci); ohci_stop()
987 if (ohci->hcca) { ohci_stop()
989 sizeof *ohci->hcca, ohci_stop()
990 ohci->hcca, ohci->hcca_dma); ohci_stop()
991 ohci->hcca = NULL; ohci_stop()
992 ohci->hcca_dma = 0; ohci_stop()
1001 int ohci_restart(struct ohci_hcd *ohci) ohci_restart() argument
1007 ohci_init(ohci); ohci_restart()
1008 spin_lock_irq(&ohci->lock); ohci_restart()
1009 ohci->rh_state = OHCI_RH_HALTED; ohci_restart()
1012 if (!list_empty (&ohci->pending)) ohci_restart()
1013 ohci_dbg(ohci, "abort schedule...\n"); ohci_restart()
1014 list_for_each_entry (priv, &ohci->pending, pending) { ohci_restart()
1021 ed->hwINFO |= cpu_to_hc32(ohci, ED_DEQUEUE); ohci_restart()
1022 ed_deschedule (ohci, ed); ohci_restart()
1024 ed->ed_next = ohci->ed_rm_list; ohci_restart()
1026 ohci->ed_rm_list = ed; ohci_restart()
1031 ohci_dbg(ohci, "bogus ed %p state %d\n", ohci_restart()
1038 ohci_work(ohci); ohci_restart()
1039 spin_unlock_irq(&ohci->lock); ohci_restart()
1044 for (i = 0; i < NUM_INTS; i++) ohci->load [i] = 0; ohci_restart()
1045 for (i = 0; i < NUM_INTS; i++) ohci->hcca->int_table [i] = 0; ohci_restart()
1048 ohci->ed_rm_list = NULL; ohci_restart()
1051 ohci->ed_controltail = NULL; ohci_restart()
1052 ohci->ed_bulktail = NULL; ohci_restart()
1054 if ((temp = ohci_run (ohci)) < 0) { ohci_restart()
1055 ohci_err (ohci, "can't restart, %d\n", temp); ohci_restart()
1058 ohci_dbg(ohci, "restart complete\n"); ohci_restart()
1069 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_suspend() local
1077 spin_lock_irqsave (&ohci->lock, flags); ohci_suspend()
1078 ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); ohci_suspend()
1079 (void)ohci_readl(ohci, &ohci->regs->intrdisable); ohci_suspend()
1082 spin_unlock_irqrestore (&ohci->lock, flags); ohci_suspend()
1097 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_resume() local
1105 ohci_usb_reset(ohci); ohci_resume()
1108 ohci->hc_control = ohci_readl(ohci, &ohci->regs->control); ohci_resume()
1109 if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { ohci_resume()
1112 switch (ohci->hc_control & OHCI_CTRL_HCFS) { ohci_resume()
1121 spin_lock_irq(&ohci->lock); ohci_resume()
1122 ohci_rh_resume(ohci); ohci_resume()
1123 ohci_rh_suspend(ohci, 0); ohci_resume()
1124 spin_unlock_irq(&ohci->lock); ohci_resume()
1129 ohci_dbg(ohci, "powerup ports\n"); ohci_resume()
1130 for (port = 0; port < ohci->num_ports; port++) ohci_resume()
1131 ohci_writel(ohci, RH_PS_PPS, ohci_resume()
1132 &ohci->regs->roothub.portstatus[port]); ohci_resume()
1134 ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable); ohci_resume()
1135 ohci_readl(ohci, &ohci->regs->intrenable); ohci_resume()
1219 #include "ohci-sa1111.c"
1224 #include "ohci-da8xx.c"
1229 #include "ohci-ppc-of.c"
1234 #include "ohci-ps3.c"
1239 #include "ohci-sm501.c"
1244 #include "ohci-tmio.c"
1249 #include "ohci-jz4740.c"
1254 #include "ohci-tilegx.c"
1270 ohci_debug_root = debugfs_create_dir("ohci", usb_debug_root); ohci_hcd_mod_init()
H A Dohci-q.c37 * PRECONDITION: ohci lock held, irqs blocked.
40 finish_urb(struct ohci_hcd *ohci, struct urb *urb, int status)
41 __releases(ohci->lock)
42 __acquires(ohci->lock)
44 struct device *dev = ohci_to_hcd(ohci)->self.controller;
51 urb_free_priv (ohci, urb->hcpriv);
58 ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs--;
59 if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0) {
60 if (quirk_amdiso(ohci))
62 if (quirk_amdprefetch(ohci))
67 ohci_to_hcd(ohci)->self.bandwidth_int_reqs--;
72 usb_hcd_unlink_urb_from_ep(ohci_to_hcd(ohci), urb);
73 spin_unlock (&ohci->lock);
74 usb_hcd_giveback_urb(ohci_to_hcd(ohci), urb, status);
75 spin_lock (&ohci->lock);
78 if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0
79 && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0) {
80 ohci->hc_control &= ~(OHCI_CTRL_PLE|OHCI_CTRL_IE);
81 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
108 static int balance (struct ohci_hcd *ohci, int interval, int load) balance() argument
120 if (branch < 0 || ohci->load [branch] > ohci->load [i]) { balance()
125 if ((ohci->load [j] + load) > 900) balance()
142 static void periodic_link (struct ohci_hcd *ohci, struct ed *ed) periodic_link() argument
146 ohci_dbg(ohci, "link %sed %p branch %d [%dus.], interval %d\n", periodic_link()
147 (ed->hwINFO & cpu_to_hc32 (ohci, ED_ISO)) ? "iso " : "", periodic_link()
151 struct ed **prev = &ohci->periodic [i]; periodic_link()
152 __hc32 *prev_p = &ohci->hcca->int_table [i]; periodic_link()
172 *prev_p = cpu_to_hc32(ohci, ed->dma); periodic_link()
175 ohci->load [i] += ed->load; periodic_link()
177 ohci_to_hcd(ohci)->self.bandwidth_allocated += ed->load / ed->interval; periodic_link()
182 static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) ed_schedule() argument
198 * periodic schedule encodes a tree like figure 3-5 in the ohci ed_schedule()
204 if (ohci->ed_controltail == NULL) { ed_schedule()
205 WARN_ON (ohci->hc_control & OHCI_CTRL_CLE); ed_schedule()
206 ohci_writel (ohci, ed->dma, ed_schedule()
207 &ohci->regs->ed_controlhead); ed_schedule()
209 ohci->ed_controltail->ed_next = ed; ed_schedule()
210 ohci->ed_controltail->hwNextED = cpu_to_hc32 (ohci, ed_schedule()
213 ed->ed_prev = ohci->ed_controltail; ed_schedule()
214 if (!ohci->ed_controltail && !ohci->ed_rm_list) { ed_schedule()
216 ohci->hc_control |= OHCI_CTRL_CLE; ed_schedule()
217 ohci_writel (ohci, 0, &ohci->regs->ed_controlcurrent); ed_schedule()
218 ohci_writel (ohci, ohci->hc_control, ed_schedule()
219 &ohci->regs->control); ed_schedule()
221 ohci->ed_controltail = ed; ed_schedule()
225 if (ohci->ed_bulktail == NULL) { ed_schedule()
226 WARN_ON (ohci->hc_control & OHCI_CTRL_BLE); ed_schedule()
227 ohci_writel (ohci, ed->dma, &ohci->regs->ed_bulkhead); ed_schedule()
229 ohci->ed_bulktail->ed_next = ed; ed_schedule()
230 ohci->ed_bulktail->hwNextED = cpu_to_hc32 (ohci, ed_schedule()
233 ed->ed_prev = ohci->ed_bulktail; ed_schedule()
234 if (!ohci->ed_bulktail && !ohci->ed_rm_list) { ed_schedule()
236 ohci->hc_control |= OHCI_CTRL_BLE; ed_schedule()
237 ohci_writel (ohci, 0, &ohci->regs->ed_bulkcurrent); ed_schedule()
238 ohci_writel (ohci, ohci->hc_control, ed_schedule()
239 &ohci->regs->control); ed_schedule()
241 ohci->ed_bulktail = ed; ed_schedule()
247 branch = balance (ohci, ed->interval, ed->load); ed_schedule()
249 ohci_dbg (ohci, ed_schedule()
256 periodic_link (ohci, ed); ed_schedule()
268 static void periodic_unlink (struct ohci_hcd *ohci, struct ed *ed) periodic_unlink() argument
274 struct ed **prev = &ohci->periodic [i]; periodic_unlink()
275 __hc32 *prev_p = &ohci->hcca->int_table [i]; periodic_unlink()
285 ohci->load [i] -= ed->load; periodic_unlink()
287 ohci_to_hcd(ohci)->self.bandwidth_allocated -= ed->load / ed->interval; periodic_unlink()
289 ohci_dbg(ohci, "unlink %sed %p branch %d [%dus.], interval %d\n", periodic_unlink()
290 (ed->hwINFO & cpu_to_hc32 (ohci, ED_ISO)) ? "iso " : "", periodic_unlink()
315 static void ed_deschedule (struct ohci_hcd *ohci, struct ed *ed) ed_deschedule() argument
317 ed->hwINFO |= cpu_to_hc32 (ohci, ED_SKIP); ed_deschedule()
336 ohci->hc_control &= ~OHCI_CTRL_CLE; ed_deschedule()
337 ohci_writel (ohci, ohci->hc_control, ed_deschedule()
338 &ohci->regs->control); ed_deschedule()
341 ohci_writel (ohci, ed_deschedule()
342 hc32_to_cpup (ohci, &ed->hwNextED), ed_deschedule()
343 &ohci->regs->ed_controlhead); ed_deschedule()
349 if (ohci->ed_controltail == ed) { ed_deschedule()
350 ohci->ed_controltail = ed->ed_prev; ed_deschedule()
351 if (ohci->ed_controltail) ed_deschedule()
352 ohci->ed_controltail->ed_next = NULL; ed_deschedule()
362 ohci->hc_control &= ~OHCI_CTRL_BLE; ed_deschedule()
363 ohci_writel (ohci, ohci->hc_control, ed_deschedule()
364 &ohci->regs->control); ed_deschedule()
367 ohci_writel (ohci, ed_deschedule()
368 hc32_to_cpup (ohci, &ed->hwNextED), ed_deschedule()
369 &ohci->regs->ed_bulkhead); ed_deschedule()
375 if (ohci->ed_bulktail == ed) { ed_deschedule()
376 ohci->ed_bulktail = ed->ed_prev; ed_deschedule()
377 if (ohci->ed_bulktail) ed_deschedule()
378 ohci->ed_bulktail->ed_next = NULL; ed_deschedule()
387 periodic_unlink (ohci, ed); ed_deschedule()
399 struct ohci_hcd *ohci, ed_get()
408 spin_lock_irqsave (&ohci->lock, flags); ed_get()
416 ed = ed_alloc (ohci, GFP_ATOMIC); ed_get()
423 td = td_alloc (ohci, GFP_ATOMIC); ed_get()
426 ed_free (ohci, ed); ed_get()
431 ed->hwTailP = cpu_to_hc32 (ohci, td->td_dma); ed_get()
464 ed->hwINFO = cpu_to_hc32(ohci, info); ed_get()
470 spin_unlock_irqrestore (&ohci->lock, flags); ed_get()
482 static void start_ed_unlink (struct ohci_hcd *ohci, struct ed *ed) start_ed_unlink() argument
484 ed->hwINFO |= cpu_to_hc32 (ohci, ED_DEQUEUE); start_ed_unlink()
485 ed_deschedule (ohci, ed); start_ed_unlink()
488 ed->ed_next = ohci->ed_rm_list; start_ed_unlink()
490 ohci->ed_rm_list = ed; start_ed_unlink()
493 ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrstatus); start_ed_unlink()
494 ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable); start_ed_unlink()
496 (void) ohci_readl (ohci, &ohci->regs->control); start_ed_unlink()
503 ed->tick = ohci_frame_no(ohci) + 1; start_ed_unlink()
514 td_fill (struct ohci_hcd *ohci, u32 info, td_fill() argument
555 td->hwINFO = cpu_to_hc32 (ohci, info); td_fill()
557 td->hwCBP = cpu_to_hc32 (ohci, data & 0xFFFFF000); td_fill()
558 *ohci_hwPSWp(ohci, td, 0) = cpu_to_hc16 (ohci, td_fill()
561 td->hwCBP = cpu_to_hc32 (ohci, data); td_fill()
564 td->hwBE = cpu_to_hc32 (ohci, data + len - 1); td_fill()
567 td->hwNextTD = cpu_to_hc32 (ohci, td_pt->td_dma); td_fill()
574 td->td_hash = ohci->td_hash [hash]; td_fill()
575 ohci->td_hash [hash] = td; td_fill()
590 struct ohci_hcd *ohci, td_submit_urb()
594 struct device *dev = ohci_to_hcd(ohci)->self.controller; td_submit_urb()
611 urb_priv->ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_C); td_submit_urb()
614 list_add (&urb_priv->pending, &ohci->pending); td_submit_urb()
646 periodic = ohci_to_hcd(ohci)->self.bandwidth_int_reqs++ == 0 td_submit_urb()
647 && ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0; td_submit_urb()
662 td_fill(ohci, info, data, n, urb, cnt); td_submit_urb()
679 td_fill (ohci, info, 0, 0, urb, cnt); td_submit_urb()
685 ohci_writel (ohci, OHCI_BLF, &ohci->regs->cmdstatus); td_submit_urb()
694 td_fill (ohci, info, urb->setup_dma, 8, urb, cnt++); td_submit_urb()
699 td_fill (ohci, info, data, data_len, urb, cnt++); td_submit_urb()
704 td_fill (ohci, info, data, 0, urb, cnt++); td_submit_urb()
707 ohci_writel (ohci, OHCI_CLF, &ohci->regs->cmdstatus); td_submit_urb()
724 td_fill (ohci, TD_CC | TD_ISO | frame, td_submit_urb()
728 if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0) { td_submit_urb()
729 if (quirk_amdiso(ohci)) td_submit_urb()
731 if (quirk_amdprefetch(ohci)) td_submit_urb()
734 periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0 td_submit_urb()
735 && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0; td_submit_urb()
742 ohci->hc_control |= OHCI_CTRL_PLE|OHCI_CTRL_IE; td_submit_urb()
743 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); td_submit_urb()
754 static int td_done(struct ohci_hcd *ohci, struct urb *urb, struct td *td) td_done() argument
756 u32 tdINFO = hc32_to_cpup (ohci, &td->hwINFO); td_done()
764 u16 tdPSW = ohci_hwPSW(ohci, td, 0); td_done()
788 ohci_dbg(ohci, td_done()
798 u32 tdBE = hc32_to_cpup (ohci, &td->hwBE); td_done()
815 hc32_to_cpup (ohci, &td->hwCBP) td_done()
820 ohci_dbg(ohci, td_done()
831 static void ed_halted(struct ohci_hcd *ohci, struct td *td, int cc) ed_halted() argument
837 __hc32 toggle = ed->hwHeadP & cpu_to_hc32 (ohci, ED_C); ed_halted()
842 ed->hwINFO |= cpu_to_hc32 (ohci, ED_SKIP); ed_halted()
844 ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_H); ed_halted()
886 ohci_dbg (ohci, ed_halted()
891 hc32_to_cpu (ohci, td->hwINFO), ed_halted()
897 static void add_to_done_list(struct ohci_hcd *ohci, struct td *td) add_to_done_list() argument
915 if (ohci->dl_end) add_to_done_list()
916 ohci->dl_end->next_dl_td = td_prev; add_to_done_list()
918 ohci->dl_start = td_prev; add_to_done_list()
924 ohci->dl_end = td->next_dl_td = td; add_to_done_list()
933 static void update_done_list(struct ohci_hcd *ohci) update_done_list() argument
938 td_dma = hc32_to_cpup (ohci, &ohci->hcca->done_head); update_done_list()
939 ohci->hcca->done_head = 0; update_done_list()
948 td = dma_to_td (ohci, td_dma); update_done_list()
950 ohci_err (ohci, "bad entry %8x\n", td_dma); update_done_list()
954 td->hwINFO |= cpu_to_hc32 (ohci, TD_DONE); update_done_list()
955 cc = TD_CC_GET (hc32_to_cpup (ohci, &td->hwINFO)); update_done_list()
962 && (td->ed->hwHeadP & cpu_to_hc32 (ohci, ED_H))) update_done_list()
963 ed_halted(ohci, td, cc); update_done_list()
965 td_dma = hc32_to_cpup (ohci, &td->hwNextTD); update_done_list()
966 add_to_done_list(ohci, td); update_done_list()
973 static void finish_unlinks(struct ohci_hcd *ohci) finish_unlinks() argument
975 unsigned tick = ohci_frame_no(ohci); finish_unlinks()
979 for (last = &ohci->ed_rm_list, ed = *last; ed != NULL; ed = *last) { finish_unlinks()
987 if (likely(ohci->rh_state == OHCI_RH_RUNNING) && finish_unlinks()
1000 head = hc32_to_cpu(ohci, ed->hwHeadP) & TD_MASK; finish_unlinks()
1002 ohci->rh_state == OHCI_RH_RUNNING) finish_unlinks()
1011 ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H); finish_unlinks()
1014 ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE); finish_unlinks()
1050 savebits = *prev & ~cpu_to_hc32 (ohci, TD_MASK); finish_unlinks()
1058 tdINFO = hc32_to_cpup(ohci, &td->hwINFO); finish_unlinks()
1060 ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_C); finish_unlinks()
1062 ed->hwHeadP |= cpu_to_hc32(ohci, ED_C); finish_unlinks()
1065 td_done (ohci, urb, td); finish_unlinks()
1071 finish_urb(ohci, urb, 0); finish_unlinks()
1087 } else if (ohci->rh_state == OHCI_RH_RUNNING) { finish_unlinks()
1090 ed_schedule(ohci, ed); finish_unlinks()
1100 if (ohci->rh_state == OHCI_RH_RUNNING && !ohci->ed_rm_list) { finish_unlinks()
1103 if (ohci->ed_controltail) { finish_unlinks()
1105 if (quirk_zfmicro(ohci)) finish_unlinks()
1107 if (!(ohci->hc_control & OHCI_CTRL_CLE)) { finish_unlinks()
1109 ohci_writel (ohci, 0, finish_unlinks()
1110 &ohci->regs->ed_controlcurrent); finish_unlinks()
1113 if (ohci->ed_bulktail) { finish_unlinks()
1115 if (quirk_zfmicro(ohci)) finish_unlinks()
1117 if (!(ohci->hc_control & OHCI_CTRL_BLE)) { finish_unlinks()
1119 ohci_writel (ohci, 0, finish_unlinks()
1120 &ohci->regs->ed_bulkcurrent); finish_unlinks()
1126 ohci->hc_control |= control; finish_unlinks()
1127 if (quirk_zfmicro(ohci)) finish_unlinks()
1129 ohci_writel (ohci, ohci->hc_control, finish_unlinks()
1130 &ohci->regs->control); finish_unlinks()
1133 if (quirk_zfmicro(ohci)) finish_unlinks()
1135 ohci_writel (ohci, command, &ohci->regs->cmdstatus); finish_unlinks()
1145 static void takeback_td(struct ohci_hcd *ohci, struct td *td) takeback_td() argument
1153 status = td_done(ohci, urb, td); takeback_td()
1158 finish_urb(ohci, urb, status); takeback_td()
1163 start_ed_unlink(ohci, ed); takeback_td()
1166 } else if ((ed->hwINFO & cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE)) takeback_td()
1167 == cpu_to_hc32(ohci, ED_SKIP)) { takeback_td()
1169 if (!(td->hwINFO & cpu_to_hc32(ohci, TD_DONE))) { takeback_td()
1170 ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP); takeback_td()
1174 ohci_writel(ohci, OHCI_CLF, takeback_td()
1175 &ohci->regs->cmdstatus); takeback_td()
1178 ohci_writel(ohci, OHCI_BLF, takeback_td()
1179 &ohci->regs->cmdstatus); takeback_td()
1193 static void process_done_list(struct ohci_hcd *ohci) process_done_list() argument
1197 while (ohci->dl_start) { process_done_list()
1198 td = ohci->dl_start; process_done_list()
1199 if (td == ohci->dl_end) process_done_list()
1200 ohci->dl_start = ohci->dl_end = NULL; process_done_list()
1202 ohci->dl_start = td->next_dl_td; process_done_list()
1204 takeback_td(ohci, td); process_done_list()
1212 static void ohci_work(struct ohci_hcd *ohci) ohci_work() argument
1214 if (ohci->working) { ohci_work()
1215 ohci->restart_work = 1; ohci_work()
1218 ohci->working = 1; ohci_work()
1221 process_done_list(ohci); ohci_work()
1222 if (ohci->ed_rm_list) ohci_work()
1223 finish_unlinks(ohci); ohci_work()
1225 if (ohci->restart_work) { ohci_work()
1226 ohci->restart_work = 0; ohci_work()
1229 ohci->working = 0; ohci_work()
398 ed_get( struct ohci_hcd *ohci, struct usb_host_endpoint *ep, struct usb_device *udev, unsigned int pipe, int interval ) ed_get() argument
589 td_submit_urb( struct ohci_hcd *ohci, struct urb *urb ) td_submit_urb() argument
H A Dohci-mem.c26 static void ohci_hcd_init (struct ohci_hcd *ohci) ohci_hcd_init() argument
28 ohci->next_statechange = jiffies; ohci_hcd_init()
29 spin_lock_init (&ohci->lock); ohci_hcd_init()
30 INIT_LIST_HEAD (&ohci->pending); ohci_hcd_init()
31 INIT_LIST_HEAD(&ohci->eds_in_use); ohci_hcd_init()
36 static int ohci_mem_init (struct ohci_hcd *ohci) ohci_mem_init() argument
38 ohci->td_cache = dma_pool_create ("ohci_td", ohci_mem_init()
39 ohci_to_hcd(ohci)->self.controller, ohci_mem_init()
43 if (!ohci->td_cache) ohci_mem_init()
45 ohci->ed_cache = dma_pool_create ("ohci_ed", ohci_mem_init()
46 ohci_to_hcd(ohci)->self.controller, ohci_mem_init()
50 if (!ohci->ed_cache) { ohci_mem_init()
51 dma_pool_destroy (ohci->td_cache); ohci_mem_init()
57 static void ohci_mem_cleanup (struct ohci_hcd *ohci) ohci_mem_cleanup() argument
59 if (ohci->td_cache) { ohci_mem_cleanup()
60 dma_pool_destroy (ohci->td_cache); ohci_mem_cleanup()
61 ohci->td_cache = NULL; ohci_mem_cleanup()
63 if (ohci->ed_cache) { ohci_mem_cleanup()
64 dma_pool_destroy (ohci->ed_cache); ohci_mem_cleanup()
65 ohci->ed_cache = NULL; ohci_mem_cleanup()
71 /* ohci "done list" processing needs this mapping */
H A Dohci-dbg.c22 #define ohci_dbg_sw(ohci, next, size, format, arg...) \
29 ohci_dbg(ohci,format, ## arg ); \
33 #define ohci_dbg_nosw(ohci, next, size, format, arg...) \
42 struct ohci_hcd *ohci, ohci_dump_intr_mask()
48 ohci_dbg_sw (ohci, next, size, "%s 0x%08x%s%s%s%s%s%s%s%s%s\n", ohci_dump_intr_mask()
64 struct ohci_hcd *ohci, maybe_print_eds()
71 ohci_dbg_sw (ohci, next, size, "%s %08x\n", label, value); maybe_print_eds()
85 static const char *rh_state_string(struct ohci_hcd *ohci) rh_state_string() argument
87 switch (ohci->rh_state) { rh_state_string()
254 static void ohci_dump_td (const struct ohci_hcd *ohci, const char *label, ohci_dump_td() argument
257 u32 tmp = hc32_to_cpup (ohci, &td->hwINFO); ohci_dump_td()
259 ohci_dbg (ohci, "%s td %p%s; urb %p index %d; hw next td %08x\n", ohci_dump_td()
263 hc32_to_cpup (ohci, &td->hwNextTD)); ohci_dump_td()
280 ohci_dbg (ohci, " info %08x CC=%x %s DI=%d %s %s\n", tmp, ohci_dump_td()
284 cbp = hc32_to_cpup (ohci, &td->hwCBP); ohci_dump_td()
285 be = hc32_to_cpup (ohci, &td->hwBE); ohci_dump_td()
286 ohci_dbg (ohci, " cbp %08x be %08x (len %d)\n", cbp, be, ohci_dump_td()
290 ohci_dbg (ohci, " info %08x CC=%x FC=%d DI=%d SF=%04x\n", tmp, ohci_dump_td()
295 ohci_dbg (ohci, " bp0 %08x be %08x\n", ohci_dump_td()
296 hc32_to_cpup (ohci, &td->hwCBP) & ~0x0fff, ohci_dump_td()
297 hc32_to_cpup (ohci, &td->hwBE)); ohci_dump_td()
299 u16 psw = ohci_hwPSW (ohci, td, i); ohci_dump_td()
301 ohci_dbg (ohci, " psw [%d] = %2x, CC=%x %s=%d\n", i, ohci_dump_td()
311 ohci_dump_ed (const struct ohci_hcd *ohci, const char *label, ohci_dump_ed() argument
314 u32 tmp = hc32_to_cpu (ohci, ed->hwINFO); ohci_dump_ed()
317 ohci_dbg (ohci, "%s, ed %p state 0x%x type %s; next ed %08x\n", ohci_dump_ed()
320 hc32_to_cpup (ohci, &ed->hwNextED)); ohci_dump_ed()
326 ohci_dbg (ohci, ohci_dump_ed()
336 tmp = hc32_to_cpup (ohci, &ed->hwHeadP); ohci_dump_ed()
337 ohci_dbg (ohci, " tds: head %08x %s%s tail %08x%s\n", ohci_dump_ed()
341 hc32_to_cpup (ohci, &ed->hwTailP), ohci_dump_ed()
352 ohci_dump_td (ohci, " ->", td); ohci_dump_ed()
392 struct ohci_hcd *ohci; member in struct:debug_buffer
399 show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed) show_list() argument
412 u32 info = hc32_to_cpu (ohci, ed->hwINFO); show_list()
413 u32 headp = hc32_to_cpu (ohci, ed->hwHeadP); show_list()
436 info = hc32_to_cpup (ohci, &td->hwINFO); show_list()
437 cbp = hc32_to_cpup (ohci, &td->hwCBP); show_list()
438 be = hc32_to_cpup (ohci, &td->hwBE); show_list()
466 struct ohci_hcd *ohci; fill_async_buffer() local
470 ohci = buf->ohci; fill_async_buffer()
474 spin_lock_irqsave (&ohci->lock, flags); fill_async_buffer()
475 temp = show_list(ohci, buf->page, size, ohci->ed_controltail); fill_async_buffer()
476 temp += show_list(ohci, buf->page + temp, size - temp, fill_async_buffer()
477 ohci->ed_bulktail); fill_async_buffer()
478 spin_unlock_irqrestore (&ohci->lock, flags); fill_async_buffer()
487 struct ohci_hcd *ohci; fill_periodic_buffer() local
499 ohci = buf->ohci; fill_periodic_buffer()
508 spin_lock_irqsave (&ohci->lock, flags); fill_periodic_buffer()
510 ed = ohci->periodic[i]; fill_periodic_buffer()
514 temp = scnprintf (next, size, "%2d [%3d]:", i, ohci->load [i]); fill_periodic_buffer()
530 u32 info = hc32_to_cpu (ohci, ed->hwINFO); fill_periodic_buffer()
551 cpu_to_hc32(ohci, ED_H)) ? fill_periodic_buffer()
573 spin_unlock_irqrestore (&ohci->lock, flags); fill_periodic_buffer()
583 struct ohci_hcd *ohci; fill_registers_buffer() local
590 ohci = buf->ohci; fill_registers_buffer()
591 hcd = ohci_to_hcd(ohci); fill_registers_buffer()
592 regs = ohci->regs; fill_registers_buffer()
596 spin_lock_irqsave (&ohci->lock, flags); fill_registers_buffer()
600 ohci_dbg_nosw(ohci, &next, &size, fill_registers_buffer()
615 ohci_dump_status(ohci, &next, &size); fill_registers_buffer()
618 if (ohci->hcca) fill_registers_buffer()
619 ohci_dbg_nosw(ohci, &next, &size, fill_registers_buffer()
620 "hcca frame 0x%04x\n", ohci_frame_no(ohci)); fill_registers_buffer()
623 rdata = ohci_readl (ohci, &regs->fminterval); fill_registers_buffer()
631 rdata = ohci_readl (ohci, &regs->fmremaining); fill_registers_buffer()
638 rdata = ohci_readl (ohci, &regs->periodicstart); fill_registers_buffer()
644 rdata = ohci_readl (ohci, &regs->lsthresh); fill_registers_buffer()
651 HCD_POLL_RH(ohci_to_hcd(ohci)) ? "ON" : "off"); fill_registers_buffer()
656 ohci_dump_roothub (ohci, 1, &next, &size); fill_registers_buffer()
659 spin_unlock_irqrestore (&ohci->lock, flags); fill_registers_buffer()
664 static struct debug_buffer *alloc_buffer(struct ohci_hcd *ohci, alloc_buffer() argument
672 buf->ohci = ohci; alloc_buffer()
761 static inline void create_debug_files (struct ohci_hcd *ohci) create_debug_files() argument
763 struct usb_bus *bus = &ohci_to_hcd(ohci)->self; create_debug_files()
765 ohci->debug_dir = debugfs_create_dir(bus->bus_name, ohci_debug_root); create_debug_files()
766 if (!ohci->debug_dir) create_debug_files()
769 ohci->debug_async = debugfs_create_file("async", S_IRUGO, create_debug_files()
770 ohci->debug_dir, ohci, create_debug_files()
772 if (!ohci->debug_async) create_debug_files()
775 ohci->debug_periodic = debugfs_create_file("periodic", S_IRUGO, create_debug_files()
776 ohci->debug_dir, ohci, create_debug_files()
778 if (!ohci->debug_periodic) create_debug_files()
781 ohci->debug_registers = debugfs_create_file("registers", S_IRUGO, create_debug_files()
782 ohci->debug_dir, ohci, create_debug_files()
784 if (!ohci->debug_registers) create_debug_files()
787 ohci_dbg (ohci, "created debug files\n"); create_debug_files()
791 debugfs_remove(ohci->debug_periodic); create_debug_files()
793 debugfs_remove(ohci->debug_async); create_debug_files()
795 debugfs_remove(ohci->debug_dir); create_debug_files()
797 ohci->debug_periodic = NULL; create_debug_files()
798 ohci->debug_async = NULL; create_debug_files()
799 ohci->debug_dir = NULL; create_debug_files()
802 static inline void remove_debug_files (struct ohci_hcd *ohci) remove_debug_files() argument
804 debugfs_remove(ohci->debug_registers); remove_debug_files()
805 debugfs_remove(ohci->debug_periodic); remove_debug_files()
806 debugfs_remove(ohci->debug_async); remove_debug_files()
807 debugfs_remove(ohci->debug_dir); remove_debug_files()
41 ohci_dump_intr_mask( struct ohci_hcd *ohci, char *label, u32 mask, char **next, unsigned *size) ohci_dump_intr_mask() argument
63 maybe_print_eds( struct ohci_hcd *ohci, char *label, u32 value, char **next, unsigned *size) maybe_print_eds() argument
H A Dohci-ppc-of.c11 * Modified for of_platform bus from ohci-sa1111.c
27 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_ppc_of_start() local
30 if ((ret = ohci_init(ohci)) < 0) ohci_ppc_of_start()
33 if ((ret = ohci_run(ohci)) < 0) { ohci_ppc_of_start()
90 struct ohci_hcd *ohci; ohci_hcd_ppc_of_probe() local
102 of_device_is_compatible(dn, "ohci-bigendian") || ohci_hcd_ppc_of_probe()
103 of_device_is_compatible(dn, "ohci-be"); ohci_hcd_ppc_of_probe()
132 ohci = hcd_to_ohci(hcd); ohci_hcd_ppc_of_probe()
134 ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC; ohci_hcd_ppc_of_probe()
135 if (of_device_is_compatible(dn, "fsl,mpc5200-ohci")) ohci_hcd_ppc_of_probe()
136 ohci->flags |= OHCI_QUIRK_FRAME_NO; ohci_hcd_ppc_of_probe()
137 if (of_device_is_compatible(dn, "mpc5200-ohci")) ohci_hcd_ppc_of_probe()
138 ohci->flags |= OHCI_QUIRK_FRAME_NO; ohci_hcd_ppc_of_probe()
141 ohci_hcd_init(ohci); ohci_hcd_ppc_of_probe()
154 * set up. If the ehci driver is loaded, put the ohci core in ohci_hcd_ppc_of_probe()
164 writel_be((readl_be(&ohci->regs->control) | ohci_hcd_ppc_of_probe()
165 OHCI_USB_SUSPEND), &ohci->regs->control); ohci_hcd_ppc_of_probe()
166 (void) readl_be(&ohci->regs->control); ohci_hcd_ppc_of_probe()
199 .compatible = "ohci-bigendian",
203 .compatible = "ohci-be",
209 .compatible = "ohci-littledian",
213 .compatible = "ohci-le",
222 #error "No endianness selected for ppc-of-ohci"
231 .name = "ppc-of-ohci",
H A DMakefile49 obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o
50 obj-$(CONFIG_USB_OHCI_HCD_PCI) += ohci-pci.o
51 obj-$(CONFIG_USB_OHCI_HCD_PLATFORM) += ohci-platform.o
52 obj-$(CONFIG_USB_OHCI_EXYNOS) += ohci-exynos.o
53 obj-$(CONFIG_USB_OHCI_HCD_OMAP1) += ohci-omap.o
54 obj-$(CONFIG_USB_OHCI_HCD_OMAP3) += ohci-omap3.o
55 obj-$(CONFIG_USB_OHCI_HCD_SPEAR) += ohci-spear.o
56 obj-$(CONFIG_USB_OHCI_HCD_STI) += ohci-st.o
57 obj-$(CONFIG_USB_OHCI_HCD_AT91) += ohci-at91.o
58 obj-$(CONFIG_USB_OHCI_HCD_S3C2410) += ohci-s3c2410.o
59 obj-$(CONFIG_USB_OHCI_HCD_LPC32XX) += ohci-nxp.o
60 obj-$(CONFIG_USB_OHCI_HCD_PXA27X) += ohci-pxa27x.o
H A Dohci-pci.c8 * [ uhci code and gregs ohci fragments ]
24 #include "ohci.h"
29 static const char hcd_name[] = "ohci-pci";
45 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_quirk_amd756() local
47 ohci->flags = OHCI_QUIRK_AMD756; ohci_quirk_amd756()
48 ohci_dbg (ohci, "AMD756 erratum 4 workaround\n"); ohci_quirk_amd756()
60 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_quirk_opti() local
62 ohci_dbg (ohci, "WARNING: OPTi workarounds unavailable\n"); ohci_quirk_opti()
79 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_quirk_ns() local
81 ohci->flags |= OHCI_QUIRK_SUPERIO; ohci_quirk_ns()
82 ohci_dbg (ohci, "Using NSC SuperIO setup\n"); ohci_quirk_ns()
95 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_quirk_zfmicro() local
97 ohci->flags |= OHCI_QUIRK_ZFMICRO; ohci_quirk_zfmicro()
98 ohci_dbg(ohci, "enabled Compaq ZFMicro chipset quirks\n"); ohci_quirk_zfmicro()
108 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_quirk_toshiba_scc() local
116 ohci->flags |= OHCI_QUIRK_BE_MMIO; ohci_quirk_toshiba_scc()
117 ohci_dbg (ohci, "enabled big endian Toshiba quirk\n"); ohci_quirk_toshiba_scc()
120 ohci_err (ohci, "unsupported big endian Toshiba quirk\n"); ohci_quirk_toshiba_scc()
130 struct ohci_hcd *ohci = container_of(work, struct ohci_hcd, nec_work); ohci_quirk_nec_worker() local
133 status = ohci_restart(ohci); ohci_quirk_nec_worker()
135 ohci_err(ohci, "Restarting NEC controller failed in %s, %d\n", ohci_quirk_nec_worker()
141 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_quirk_nec() local
143 ohci->flags |= OHCI_QUIRK_NEC; ohci_quirk_nec()
144 INIT_WORK(&ohci->nec_work, ohci_quirk_nec_worker); ohci_quirk_nec()
145 ohci_dbg (ohci, "enabled NEC chipset lost interrupt quirk\n"); ohci_quirk_nec()
152 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_quirk_amd700() local
155 ohci->flags |= OHCI_QUIRK_AMD_PLL; ohci_quirk_amd700()
159 ohci->flags |= OHCI_QUIRK_AMD_PREFETCH; ohci_quirk_amd700()
160 ohci_dbg(ohci, "enabled AMD prefetch quirk\n"); ohci_quirk_amd700()
163 ohci->flags |= OHCI_QUIRK_GLOBAL_SUSPEND; ohci_quirk_amd700()
227 struct ohci_hcd *ohci = hcd_to_ohci (hcd); ohci_pci_reset() local
236 int (*quirk)(struct usb_hcd *ohci); ohci_pci_reset()
245 * After ohci setup RWC may not be set for add-in PCI cards. ohci_pci_reset()
249 ohci->hc_control |= OHCI_CTRL_RWC; ohci_pci_reset()
H A Dohci.h74 #define OKAY_TO_TAKEBACK(ohci, ed) \
75 ((int) (ohci->wdh_cnt - ed->takeback_wdh_cnt) >= 0)
349 * This is the full ohci controller description
383 void (*start_hnp)(struct ohci_hcd *ohci);
442 static inline int quirk_nec(struct ohci_hcd *ohci) quirk_nec() argument
444 return ohci->flags & OHCI_QUIRK_NEC; quirk_nec()
446 static inline int quirk_zfmicro(struct ohci_hcd *ohci) quirk_zfmicro() argument
448 return ohci->flags & OHCI_QUIRK_ZFMICRO; quirk_zfmicro()
450 static inline int quirk_amdiso(struct ohci_hcd *ohci) quirk_amdiso() argument
452 return ohci->flags & OHCI_QUIRK_AMD_PLL; quirk_amdiso()
454 static inline int quirk_amdprefetch(struct ohci_hcd *ohci) quirk_amdprefetch() argument
456 return ohci->flags & OHCI_QUIRK_AMD_PREFETCH; quirk_amdprefetch()
459 static inline int quirk_nec(struct ohci_hcd *ohci) quirk_nec() argument
463 static inline int quirk_zfmicro(struct ohci_hcd *ohci) quirk_zfmicro() argument
467 static inline int quirk_amdiso(struct ohci_hcd *ohci) quirk_amdiso() argument
471 static inline int quirk_amdprefetch(struct ohci_hcd *ohci) quirk_amdprefetch() argument
482 static inline struct usb_hcd *ohci_to_hcd (const struct ohci_hcd *ohci) ohci_to_hcd() argument
484 return container_of ((void *) ohci, struct usb_hcd, hcd_priv); ohci_to_hcd()
489 #define ohci_dbg(ohci, fmt, args...) \
490 dev_dbg (ohci_to_hcd(ohci)->self.controller , fmt , ## args )
491 #define ohci_err(ohci, fmt, args...) \
492 dev_err (ohci_to_hcd(ohci)->self.controller , fmt , ## args )
493 #define ohci_info(ohci, fmt, args...) \
494 dev_info (ohci_to_hcd(ohci)->self.controller , fmt , ## args )
495 #define ohci_warn(ohci, fmt, args...) \
496 dev_warn (ohci_to_hcd(ohci)->self.controller , fmt , ## args )
537 #define big_endian_desc(ohci) (ohci->flags & OHCI_QUIRK_BE_DESC)
539 #define big_endian_desc(ohci) 1 /* only big endian */
542 #define big_endian_desc(ohci) 0 /* only little endian */
547 #define big_endian_mmio(ohci) (ohci->flags & OHCI_QUIRK_BE_MMIO)
549 #define big_endian_mmio(ohci) 1 /* only big endian */
552 #define big_endian_mmio(ohci) 0 /* only little endian */
560 static inline unsigned int _ohci_readl (const struct ohci_hcd *ohci, _ohci_readl() argument
564 return big_endian_mmio(ohci) ? _ohci_readl()
572 static inline void _ohci_writel (const struct ohci_hcd *ohci, _ohci_writel() argument
576 big_endian_mmio(ohci) ? _ohci_writel()
590 /* cpu to ohci */ cpu_to_hc16()
591 static inline __hc16 cpu_to_hc16 (const struct ohci_hcd *ohci, const u16 x) cpu_to_hc16() argument
593 return big_endian_desc(ohci) ? cpu_to_hc16()
598 static inline __hc16 cpu_to_hc16p (const struct ohci_hcd *ohci, const u16 *x) cpu_to_hc16p() argument
600 return big_endian_desc(ohci) ? cpu_to_hc16p()
605 static inline __hc32 cpu_to_hc32 (const struct ohci_hcd *ohci, const u32 x) cpu_to_hc32() argument
607 return big_endian_desc(ohci) ? cpu_to_hc32()
612 static inline __hc32 cpu_to_hc32p (const struct ohci_hcd *ohci, const u32 *x) cpu_to_hc32p() argument
614 return big_endian_desc(ohci) ? cpu_to_hc32p()
619 /* ohci to cpu */ hc16_to_cpu()
620 static inline u16 hc16_to_cpu (const struct ohci_hcd *ohci, const __hc16 x) hc16_to_cpu() argument
622 return big_endian_desc(ohci) ? hc16_to_cpu()
627 static inline u16 hc16_to_cpup (const struct ohci_hcd *ohci, const __hc16 *x) hc16_to_cpup() argument
629 return big_endian_desc(ohci) ? hc16_to_cpup()
634 static inline u32 hc32_to_cpu (const struct ohci_hcd *ohci, const __hc32 x) hc32_to_cpu() argument
636 return big_endian_desc(ohci) ? hc32_to_cpu()
641 static inline u32 hc32_to_cpup (const struct ohci_hcd *ohci, const __hc32 *x) hc32_to_cpup() argument
643 return big_endian_desc(ohci) ? hc32_to_cpup()
660 static inline u16 ohci_frame_no(const struct ohci_hcd *ohci) ohci_frame_no() argument
663 if (big_endian_desc(ohci)) { ohci_frame_no()
664 tmp = be32_to_cpup((__force __be32 *)&ohci->hcca->frame_no); ohci_frame_no()
665 if (!(ohci->flags & OHCI_QUIRK_FRAME_NO)) ohci_frame_no()
668 tmp = le32_to_cpup((__force __le32 *)&ohci->hcca->frame_no); ohci_frame_no()
673 static inline __hc16 *ohci_hwPSWp(const struct ohci_hcd *ohci, ohci_hwPSWp() argument
676 return (__hc16 *)(big_endian_desc(ohci) ? ohci_hwPSWp()
680 static inline u16 ohci_hwPSW(const struct ohci_hcd *ohci, ohci_hwPSW() argument
683 return hc16_to_cpup(ohci, ohci_hwPSWp(ohci, td, index)); ohci_hwPSW()
693 static inline void periodic_reinit (struct ohci_hcd *ohci) periodic_reinit() argument
695 u32 fi = ohci->fminterval & 0x03fff; periodic_reinit()
696 u32 fit = ohci_readl(ohci, &ohci->regs->fminterval) & FIT; periodic_reinit()
698 ohci_writel (ohci, (fit ^ FIT) | ohci->fminterval, periodic_reinit()
699 &ohci->regs->fminterval); periodic_reinit()
700 ohci_writel (ohci, ((9 * fi) / 10) & 0x3fff, periodic_reinit()
701 &ohci->regs->periodicstart); periodic_reinit()
726 /* Declarations of things exported for use by ohci platform drivers */
736 extern int ohci_restart(struct ohci_hcd *ohci);
H A Dohci-spear.c7 * Based on various ohci-*.c drivers
25 #include "ohci.h"
29 static const char hcd_name[] = "SPEAr-ohci";
41 struct ohci_hcd *ohci; spear_ohci_hcd_drv_probe() local
91 ohci = hcd_to_ohci(hcd); spear_ohci_hcd_drv_probe()
126 struct ohci_hcd *ohci = hcd_to_ohci(hcd); spear_ohci_hcd_drv_suspend() local
131 if (time_before(jiffies, ohci->next_statechange)) spear_ohci_hcd_drv_suspend()
133 ohci->next_statechange = jiffies; spear_ohci_hcd_drv_suspend()
147 struct ohci_hcd *ohci = hcd_to_ohci(hcd); spear_ohci_hcd_drv_resume() local
150 if (time_before(jiffies, ohci->next_statechange)) spear_ohci_hcd_drv_resume()
152 ohci->next_statechange = jiffies; spear_ohci_hcd_drv_resume()
161 { .compatible = "st,spear600-ohci", },
175 .name = "spear-ohci",
204 MODULE_ALIAS("platform:spear-ohci");
H A Dohci-platform.c2 * Generic platform ohci driver
32 #include "ohci.h"
45 static const char hcd_name[] = "ohci-platform";
119 struct ohci_hcd *ohci; ohci_platform_probe() local
150 ohci = hcd_to_ohci(hcd); ohci_platform_probe()
154 ohci->flags |= OHCI_QUIRK_BE_MMIO; ohci_platform_probe()
157 ohci->flags |= OHCI_QUIRK_BE_DESC; ohci_platform_probe()
160 ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC; ohci_platform_probe()
163 ohci->flags |= OHCI_QUIRK_FRAME_NO; ohci_platform_probe()
166 &ohci->num_ports); ohci_platform_probe()
214 ohci->flags |= OHCI_QUIRK_BE_DESC; ohci_platform_probe()
216 ohci->flags |= OHCI_QUIRK_BE_MMIO; ohci_platform_probe()
218 ohci->flags |= OHCI_QUIRK_FRAME_NO; ohci_platform_probe()
220 ohci->num_ports = pdata->num_ports; ohci_platform_probe()
223 if (ohci->flags & OHCI_QUIRK_BE_MMIO) { ohci_platform_probe()
231 if (ohci->flags & OHCI_QUIRK_BE_DESC) { ohci_platform_probe()
347 { .compatible = "generic-ohci", },
348 { .compatible = "cavium,octeon-6335-ohci", },
354 { "ohci-platform", 0 },
368 .name = "ohci-platform",
H A Dohci-omap.c12 * and on ohci-sa1111.c by Christopher Hoover <ch@hpl.hp.com>
31 #include "ohci.h"
78 static const char hcd_name[] = "ohci-omap";
176 static void start_hnp(struct ohci_hcd *ohci) start_hnp() argument
178 struct usb_hcd *hcd = ohci_to_hcd(ohci); start_hnp()
187 writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]); start_hnp()
200 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_omap_reset() local
226 &ohci_to_hcd(ohci)->self); ohci_omap_reset()
237 ohci->start_hnp = start_hnp; ohci_omap_reset()
253 ohci->hc_control = OHCI_CTRL_RWC; ohci_omap_reset()
254 writel(OHCI_CTRL_RWC, &ohci->regs->control); ohci_omap_reset()
259 u32 rh = roothub_a (ohci); ohci_omap_reset()
266 ohci_to_hcd(ohci)->power_budget = 250; ohci_omap_reset()
278 ohci_writel(ohci, rh, &ohci->regs->roothub.a); ohci_omap_reset()
279 ohci->flags &= ~OHCI_QUIRK_HUB_POWER; ohci_omap_reset()
283 ohci_to_hcd(ohci)->power_budget = 0; ohci_omap_reset()
438 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_omap_suspend() local
442 if (time_before(jiffies, ohci->next_statechange)) ohci_omap_suspend()
444 ohci->next_statechange = jiffies; ohci_omap_suspend()
457 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_omap_resume() local
459 if (time_before(jiffies, ohci->next_statechange)) ohci_omap_resume()
461 ohci->next_statechange = jiffies; ohci_omap_resume()
484 .name = "ohci",
512 MODULE_ALIAS("platform:ohci");
H A Dohci-ps3.c26 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ps3_ohci_hc_reset() local
28 ohci->flags |= OHCI_QUIRK_BE_MMIO; ps3_ohci_hc_reset()
29 ohci_hcd_init(ohci); ps3_ohci_hc_reset()
30 return ohci_init(ohci); ps3_ohci_hc_reset()
36 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ps3_ohci_hc_start() local
41 ohci_writel(ohci, 0x7f000000 | RH_A_PSM | RH_A_OCPM, ps3_ohci_hc_start()
42 &ohci->regs->roothub.a); ps3_ohci_hc_start()
43 ohci_writel(ohci, 0x00060000, &ohci->regs->roothub.b); ps3_ohci_hc_start()
45 result = ohci_run(ohci); ps3_ohci_hc_start()
245 .core.name = "ps3-ohci-driver",
H A Dohci-tmio.c20 * usb-ohci-tc6393.c(C) Copyright 2004 Lineo Solutions, Inc.
95 struct ohci_hcd *ohci = hcd_to_ohci(hcd); tmio_stop_hc() local
100 switch (ohci->num_ports) { tmio_stop_hc()
102 dev_err(&dev->dev, "Unsupported amount of ports: %d\n", ohci->num_ports); tmio_stop_hc()
136 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_tmio_start() local
139 if ((ret = ohci_init(ohci)) < 0) ohci_tmio_start()
142 if ((ret = ohci_run(ohci)) < 0) { ohci_tmio_start()
195 struct ohci_hcd *ohci; ohci_hcd_tmio_drv_probe() local
245 ohci = hcd_to_ohci(hcd); ohci_hcd_tmio_drv_probe()
246 ohci_hcd_init(ohci); ohci_hcd_tmio_drv_probe()
298 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_hcd_tmio_drv_suspend() local
304 if (time_before(jiffies, ohci->next_statechange)) ohci_hcd_tmio_drv_suspend()
306 ohci->next_statechange = jiffies; ohci_hcd_tmio_drv_suspend()
328 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_hcd_tmio_drv_resume() local
334 if (time_before(jiffies, ohci->next_statechange)) ohci_hcd_tmio_drv_resume()
336 ohci->next_statechange = jiffies; ohci_hcd_tmio_drv_resume()
370 .name = "tmio-ohci",
H A Dohci-omap3.c2 * ohci-omap3.c - driver for OHCI on OMAP3 and later processors
12 * Based on ehci-omap.c and some other ohci glue layers
42 #include "ohci.h"
46 static const char hcd_name[] = "ohci-omap3";
64 struct ohci_hcd *ohci; ohci_hcd_omap3_probe() local
121 ohci = hcd_to_ohci(hcd); ohci_hcd_omap3_probe()
126 ohci->hc_control = OHCI_CTRL_RWC; ohci_hcd_omap3_probe()
174 { .compatible = "ti,ohci-omap3" },
185 .name = "ohci-omap3",
209 MODULE_ALIAS("platform:ohci-omap3");
H A Dohci-da8xx.c6 * Derived from: ohci-omap.c and ohci-s3c2410.c
89 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_da8xx_init() local
101 ohci->num_ports = 1; ohci_da8xx_init()
103 result = ohci_init(ohci); ohci_da8xx_init()
113 rh_a = ohci_readl(ohci, &ohci->regs->roothub.a); ohci_da8xx_init()
124 ohci_writel(ohci, rh_a, &ohci->regs->roothub.a); ohci_da8xx_init()
137 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_da8xx_start() local
140 result = ohci_run(ohci); ohci_da8xx_start()
387 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_da8xx_suspend() local
392 if (time_before(jiffies, ohci->next_statechange)) ohci_da8xx_suspend()
394 ohci->next_statechange = jiffies; ohci_da8xx_suspend()
409 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_da8xx_resume() local
411 if (time_before(jiffies, ohci->next_statechange)) ohci_da8xx_resume()
413 ohci->next_statechange = jiffies; ohci_da8xx_resume()
434 .name = "ohci",
438 MODULE_ALIAS("platform:ohci");
H A Dehci-ppc-of.c10 * and "ohci-ppc-of.c" by Sylvain Munaut <tnt@246tNt.com>
135 np = of_find_compatible_node(NULL, NULL, "ibm,usb-ohci-440epx"); ehci_hcd_ppc_of_probe()
144 pr_debug("%s: no ohci offset in fdt\n", __FILE__); ehci_hcd_ppc_of_probe()
146 pr_debug("%s: ioremap for ohci hcctrl failed\n", __FILE__); ehci_hcd_ppc_of_probe()
199 /* use request_mem_region to test if the ohci driver is loaded. if so ehci_hcd_ppc_of_remove()
200 * ensure the ohci core is operational. ehci_hcd_ppc_of_remove()
203 np = of_find_compatible_node(NULL, NULL, "ibm,usb-ohci-440epx"); ehci_hcd_ppc_of_remove()
212 pr_debug("%s: no ohci offset in fdt\n", __FILE__); ehci_hcd_ppc_of_remove()
H A Dohci-sa1111.c60 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_sa1111_reset() local
62 ohci_hcd_init(ohci); ohci_sa1111_reset()
63 return ohci_init(ohci); ohci_sa1111_reset()
68 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_sa1111_start() local
71 ret = ohci_run(ohci); ohci_sa1111_start()
73 ohci_err(ohci, "can't start\n"); ohci_sa1111_start()
258 .name = "sa1111-ohci",
H A Dohci-at91.c10 * Based on ohci-omap.c
29 #include "ohci.h"
61 static const char hcd_name[] = "ohci-atmel";
155 struct ohci_hcd *ohci; usb_hcd_at91_probe() local
203 ohci = hcd_to_ohci(hcd); usb_hcd_at91_probe()
204 ohci->num_ports = board->ports; usb_hcd_at91_probe()
446 { .compatible = "atmel,at91rm9200-ohci" },
592 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_hcd_at91_drv_suspend() local
620 ohci->hc_control = ohci_readl(ohci, &ohci->regs->control); ohci_hcd_at91_drv_suspend()
621 ohci->hc_control &= OHCI_CTRL_RWC; ohci_hcd_at91_drv_suspend()
622 ohci_writel(ohci, ohci->hc_control, &ohci->regs->control); ohci_hcd_at91_drv_suspend()
623 ohci->rh_state = OHCI_RH_HALTED; ohci_hcd_at91_drv_suspend()
626 (void) ohci_readl (ohci, &ohci->regs->control); ohci_hcd_at91_drv_suspend()
H A Dohci-pxa27x.c13 * Modified for LH7A404 from ohci-sa1111.c
16 * Modified for pxa27x from ohci-lh7a404.c
30 #include <linux/platform_data/usb-ohci-pxa27x.h>
41 #include "ohci.h"
117 static const char hcd_name[] = "ohci-pxa27x";
340 { .compatible = "marvell,pxa-ohci" },
421 struct ohci_hcd *ohci; usb_hcd_pxa27x_probe() local
486 ohci = hcd_to_ohci(hcd); usb_hcd_pxa27x_probe()
487 ohci->num_ports = 3; usb_hcd_pxa27x_probe()
554 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_hcd_pxa27x_drv_suspend() local
559 if (time_before(jiffies, ohci->next_statechange)) ohci_hcd_pxa27x_drv_suspend()
561 ohci->next_statechange = jiffies; ohci_hcd_pxa27x_drv_suspend()
576 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_hcd_pxa27x_drv_resume() local
579 if (time_before(jiffies, ohci->next_statechange)) ohci_hcd_pxa27x_drv_resume()
581 ohci->next_statechange = jiffies; ohci_hcd_pxa27x_drv_resume()
605 .name = "pxa27x-ohci",
639 MODULE_ALIAS("platform:pxa27x-ohci");
H A Dohci-jz4740.c39 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_jz4740_start() local
42 ret = ohci_init(ohci); ohci_jz4740_start()
46 ohci->num_ports = 1; ohci_jz4740_start()
48 ret = ohci_run(ohci); ohci_jz4740_start()
241 .name = "jz4740-ohci",
245 MODULE_ALIAS("platform:jz4740-ohci");
H A Dohci-tilegx.c39 struct ohci_hcd *ohci = hcd_to_ohci(hcd); tilegx_ohci_start() local
42 ret = ohci_init(ohci); tilegx_ohci_start()
46 ret = ohci_run(ohci); tilegx_ohci_start()
201 .name = "tilegx-ohci",
205 MODULE_ALIAS("platform:tilegx-ohci");
H A Dohci-exynos.c25 #include "ohci.h"
29 static const char hcd_name[] = "ohci-exynos";
137 "samsung,exynos5440-ohci")) exynos_ohci_probe()
275 { .compatible = "samsung,exynos4210-ohci" },
276 { .compatible = "samsung,exynos5440-ohci" },
287 .name = "exynos-ohci",
309 MODULE_ALIAS("platform:exynos-ohci");
H A Dohci-sm501.c9 * SM501 Bus Glue - based on ohci-omap.c
221 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_sm501_suspend() local
225 if (time_before(jiffies, ohci->next_statechange)) ohci_sm501_suspend()
227 ohci->next_statechange = jiffies; ohci_sm501_suspend()
241 struct ohci_hcd *ohci = hcd_to_ohci(hcd); ohci_sm501_resume() local
243 if (time_before(jiffies, ohci->next_statechange)) ohci_sm501_resume()
245 ohci->next_statechange = jiffies; ohci_sm501_resume()
H A Dohci-st.c8 * Derived from ohci-platform.c
29 #include "ohci.h"
46 static const char hcd_name[] = "ohci-st";
138 struct ohci_hcd *ohci; st_ohci_platform_probe() local
164 ohci = hcd_to_ohci(hcd); st_ohci_platform_probe()
311 { .compatible = "st,st-ohci-300x", },
321 .name = "st-ohci",
H A Dohci-s3c2410.c13 * Modified for S3C2410 from ohci-sa1111.c, ohci-omap.c and ohci-lh7a40.c
27 #include <linux/platform_data/usb-ohci-s3c2410.h>
31 #include "ohci.h"
41 static const char hcd_name[] = "ohci-s3c2410";
465 .name = "s3c2410-ohci",
502 MODULE_ALIAS("platform:s3c2410-ohci");
H A Dohci-nxp.c33 #include "ohci.h"
71 static const char hcd_name[] = "ohci-nxp";
312 MODULE_ALIAS("platform:usb-ohci");
316 { .compatible = "nxp,ohci-nxp" },
324 .name = "usb-ohci",
H A Dssb-hcd.c7 * Based on ssb-ohci driver
104 static struct platform_device *ssb_hcd_create_pdev(struct ssb_device *dev, bool ohci, u32 addr, u32 len) ssb_hcd_create_pdev() argument
119 hci_dev = platform_device_alloc(ohci ? "ohci-platform" : ssb_hcd_create_pdev()
131 if (ohci) ssb_hcd_create_pdev()
H A Dbcma-hcd.c8 * Based on ssb-ohci driver
252 static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev, bool ohci, u32 addr) bcma_hcd_create_pdev() argument
267 hci_dev = platform_device_alloc(ohci ? "ohci-platform" : bcma_hcd_create_pdev()
279 if (ohci) bcma_hcd_create_pdev()
H A Duhci-grlib.c15 * support from usb-ohci.c by Adam Richter, adam@yggdrasil.com).
16 * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c)
H A Dehci-sh.c6 * Based on ohci-sh.c and ehci-atmel.c.
H A Duhci-pci.c15 * support from usb-ohci.c by Adam Richter, adam@yggdrasil.com).
16 * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c)
H A Dehci-grlib.c11 * and "ohci-ppc-of.c" by Sylvain Munaut <tnt@246tNt.com>
H A Dehci-platform.c8 * Derived from the ohci-ssb driver
14 * Derived from the ohci-pci driver
H A Dehci-xilinx-of.c10 * and "ohci-ppc-of.c" by Sylvain Munaut <tnt@246tNt.com>
H A Dehci-hub.c589 /* ensure 440EPX ohci controller state is operational */ check_reset_complete()
595 /* ensure 440EPx ohci controller state is suspended */ check_reset_complete()
H A Disp1362.h115 * Bitmasks for the individual bits of these registers are defined in "ohci.h"
274 /* Copied from ohci.h: */
H A Duhci-hcd.c14 * support from usb-ohci.c by Adam Richter, adam@yggdrasil.com).
15 * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c)
H A Disp116x-hcd.c905 Adapted from ohci-hub.c. Currently we don't support autosuspend.
1001 /* Adapted from ohci-hub.c */ isp116x_hub_control()
H A Dmax3421-hcd.c295 /* Return same error-codes as ohci.h:cc_to_error: */
938 /* Based on ohci.h cc_to_err[]: */ max3421_handle_error()
H A Du132-hcd.c60 /* FIXME ohci.h is ONLY for internal use by the OHCI driver.
63 * file, maybe name <linux/usb/ohci.h>
66 #include "ohci.h"
H A Duhci-q.c14 * support from usb-ohci.c by Adam Richter, adam@yggdrasil.com).
15 * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c)
H A Disp1362-hcd.c1492 /* Adapted from ohci-hub.c */ isp1362_hub_status_data()
1560 /* Adapted from ohci-hub.c */ isp1362_hub_control()
/linux-4.4.14/drivers/firewire/
H A Dohci.c55 #include "ohci.h"
57 #define ohci_info(ohci, f, args...) dev_info(ohci->card.device, f, ##args)
58 #define ohci_notice(ohci, f, args...) dev_notice(ohci->card.device, f, ##args)
59 #define ohci_err(ohci, f, args...) dev_err(ohci->card.device, f, ##args)
101 struct fw_ohci *ohci; member in struct:ar_context
131 struct fw_ohci *ohci; member in struct:context
379 static void log_irqs(struct fw_ohci *ohci, u32 evt) log_irqs() argument
389 ohci_notice(ohci, "IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt, log_irqs()
428 static void log_selfids(struct fw_ohci *ohci, int generation, int self_id_count) log_selfids() argument
435 ohci_notice(ohci, "%d selfIDs, generation %d, local node ID %04x\n", log_selfids()
436 self_id_count, generation, ohci->node_id); log_selfids()
438 for (s = ohci->self_id_buffer; self_id_count--; ++s) log_selfids()
440 ohci_notice(ohci, log_selfids()
447 ohci_notice(ohci, log_selfids()
484 static void log_ar_at_event(struct fw_ohci *ohci, log_ar_at_event() argument
497 ohci_notice(ohci, "A%c evt_bus_reset, generation %d\n", log_ar_at_event()
517 ohci_notice(ohci, "A%c %s, %s\n", log_ar_at_event()
521 ohci_notice(ohci, "A%c %s, PHY %08x %08x\n", log_ar_at_event()
525 ohci_notice(ohci, log_ar_at_event()
532 ohci_notice(ohci, log_ar_at_event()
540 static inline void reg_write(const struct fw_ohci *ohci, int offset, u32 data) reg_write() argument
542 writel(data, ohci->registers + offset); reg_write()
545 static inline u32 reg_read(const struct fw_ohci *ohci, int offset) reg_read() argument
547 return readl(ohci->registers + offset); reg_read()
550 static inline void flush_writes(const struct fw_ohci *ohci) flush_writes() argument
553 reg_read(ohci, OHCI1394_Version); flush_writes()
558 * read_paged_phy_reg() require the caller to hold ohci->phy_reg_mutex.
562 static int read_phy_reg(struct fw_ohci *ohci, int addr) read_phy_reg() argument
567 reg_write(ohci, OHCI1394_PhyControl, OHCI1394_PhyControl_Read(addr)); read_phy_reg()
569 val = reg_read(ohci, OHCI1394_PhyControl); read_phy_reg()
583 ohci_err(ohci, "failed to read phy reg %d\n", addr); read_phy_reg()
589 static int write_phy_reg(const struct fw_ohci *ohci, int addr, u32 val) write_phy_reg() argument
593 reg_write(ohci, OHCI1394_PhyControl, write_phy_reg()
596 val = reg_read(ohci, OHCI1394_PhyControl); write_phy_reg()
606 ohci_err(ohci, "failed to write phy reg %d, val %u\n", addr, val); write_phy_reg()
612 static int update_phy_reg(struct fw_ohci *ohci, int addr, update_phy_reg() argument
615 int ret = read_phy_reg(ohci, addr); update_phy_reg()
626 return write_phy_reg(ohci, addr, (ret & ~clear_bits) | set_bits); update_phy_reg()
629 static int read_paged_phy_reg(struct fw_ohci *ohci, int page, int addr) read_paged_phy_reg() argument
633 ret = update_phy_reg(ohci, 7, PHY_PAGE_SELECT, page << 5); read_paged_phy_reg()
637 return read_phy_reg(ohci, addr); read_paged_phy_reg()
642 struct fw_ohci *ohci = fw_ohci(card); ohci_read_phy_reg() local
645 mutex_lock(&ohci->phy_reg_mutex); ohci_read_phy_reg()
646 ret = read_phy_reg(ohci, addr); ohci_read_phy_reg()
647 mutex_unlock(&ohci->phy_reg_mutex); ohci_read_phy_reg()
655 struct fw_ohci *ohci = fw_ohci(card); ohci_update_phy_reg() local
658 mutex_lock(&ohci->phy_reg_mutex); ohci_update_phy_reg()
659 ret = update_phy_reg(ohci, addr, clear_bits, set_bits); ohci_update_phy_reg()
660 mutex_unlock(&ohci->phy_reg_mutex); ohci_update_phy_reg()
685 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_WAKE); ar_context_link_page()
696 dma_unmap_page(ctx->ohci->card.device, ar_context_release()
705 struct fw_ohci *ohci = ctx->ohci; ar_context_abort() local
707 if (reg_read(ohci, CONTROL_CLEAR(ctx->regs)) & CONTEXT_RUN) { ar_context_abort()
708 reg_write(ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN); ar_context_abort()
709 flush_writes(ohci); ar_context_abort()
711 ohci_err(ohci, "AR error: %s; DMA stopped\n", error_msg); ar_context_abort()
795 dma_sync_single_for_cpu(ctx->ohci->card.device, ar_sync_buffers_for_cpu()
801 dma_sync_single_for_cpu(ctx->ohci->card.device, ar_sync_buffers_for_cpu()
808 (ohci->quirks & QUIRK_BE_HEADERS ? (__force __u32)(v) : le32_to_cpu(v))
815 struct fw_ohci *ohci = ctx->ohci; handle_ar_packet() local
874 p.generation = ohci->request_generation; handle_ar_packet()
876 log_ar_at_event(ohci, 'R', p.speed, p.header, evt); handle_ar_packet()
900 if (!(ohci->quirks & QUIRK_RESET_PACKET)) handle_ar_packet()
901 ohci->request_generation = (p.header[2] >> 16) & 0xff; handle_ar_packet()
902 } else if (ctx == &ohci->ar_request_ctx) { handle_ar_packet()
903 fw_core_handle_request(&ohci->card, &p); handle_ar_packet()
905 fw_core_handle_response(&ohci->card, &p); handle_ar_packet()
931 dma_sync_single_for_device(ctx->ohci->card.device, ar_recycle_buffers()
985 static int ar_context_init(struct ar_context *ctx, struct fw_ohci *ohci, ar_context_init() argument
994 ctx->ohci = ohci; ar_context_init()
1001 dma_addr = dma_map_page(ohci->card.device, ctx->pages[i], ar_context_init()
1003 if (dma_mapping_error(ohci->card.device, dma_addr)) { ar_context_init()
1019 ctx->descriptors = ohci->misc_buffer + descriptors_offset; ar_context_init()
1020 ctx->descriptors_bus = ohci->misc_buffer_bus + descriptors_offset; ar_context_init()
1050 reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), ctx->descriptors_bus | 1); ar_context_run()
1051 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN); ar_context_run()
1102 spin_lock_irqsave(&ctx->ohci->lock, flags); context_tasklet()
1104 spin_unlock_irqrestore(&ctx->ohci->lock, flags); context_tasklet()
1112 * context. Must be called with ohci->lock held.
1127 desc = dma_alloc_coherent(ctx->ohci->card.device, PAGE_SIZE, context_add_buffer()
1143 static int context_init(struct context *ctx, struct fw_ohci *ohci, context_init() argument
1146 ctx->ohci = ohci; context_init()
1178 struct fw_card *card = &ctx->ohci->card; context_release()
1187 /* Must be called with ohci->lock held */ context_get_descriptors()
1221 struct fw_ohci *ohci = ctx->ohci; context_run() local
1223 reg_write(ohci, COMMAND_PTR(ctx->regs), context_run()
1225 reg_write(ohci, CONTROL_CLEAR(ctx->regs), ~0); context_run()
1226 reg_write(ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN | extra); context_run()
1228 flush_writes(ohci); context_run()
1256 if (unlikely(ctx->ohci->quirks & QUIRK_IR_WAKE) && context_append()
1269 struct fw_ohci *ohci = ctx->ohci; context_stop() local
1273 reg_write(ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN); context_stop()
1277 reg = reg_read(ohci, CONTROL_SET(ctx->regs)); context_stop()
1284 ohci_err(ohci, "DMA context still active (0x%08x)\n", reg); context_stop()
1300 struct fw_ohci *ohci = ctx->ohci; at_context_queue_packet() local
1379 payload_bus = dma_map_single(ohci->card.device, at_context_queue_packet()
1383 if (dma_mapping_error(ohci->card.device, payload_bus)) { at_context_queue_packet()
1409 if (ohci->generation != packet->generation) { at_context_queue_packet()
1411 dma_unmap_single(ohci->card.device, payload_bus, at_context_queue_packet()
1420 reg_write(ohci, CONTROL_SET(ctx->regs), CONTEXT_WAKE); at_context_queue_packet()
1444 struct fw_ohci *ohci = context->ohci; handle_at_packet() local
1458 dma_unmap_single(ohci->card.device, packet->payload_bus, handle_at_packet()
1464 log_ar_at_event(ohci, 'T', packet->speed, packet->header, evt); handle_at_packet()
1514 packet->callback(packet, &ohci->card, packet->ack); handle_at_packet()
1525 static void handle_local_rom(struct fw_ohci *ohci, handle_local_rom() argument
1546 (void *) ohci->config_rom + i, length); handle_local_rom()
1549 fw_core_handle_response(&ohci->card, &response); handle_local_rom()
1552 static void handle_local_lock(struct fw_ohci *ohci, handle_local_lock() argument
1579 reg_write(ohci, OHCI1394_CSRData, lock_data); handle_local_lock()
1580 reg_write(ohci, OHCI1394_CSRCompareData, lock_arg); handle_local_lock()
1581 reg_write(ohci, OHCI1394_CSRControl, sel); handle_local_lock()
1584 if (reg_read(ohci, OHCI1394_CSRControl) & 0x80000000) { handle_local_lock()
1585 lock_old = cpu_to_be32(reg_read(ohci, handle_local_lock()
1593 ohci_err(ohci, "swap not done (CSR lock timeout)\n"); handle_local_lock()
1597 fw_core_handle_response(&ohci->card, &response); handle_local_lock()
1604 if (ctx == &ctx->ohci->at_request_ctx) { handle_local_request()
1606 packet->callback(packet, &ctx->ohci->card, packet->ack); handle_local_request()
1617 handle_local_rom(ctx->ohci, packet, csr); handle_local_request()
1623 handle_local_lock(ctx->ohci, packet, csr); handle_local_request()
1626 if (ctx == &ctx->ohci->at_request_ctx) handle_local_request()
1627 fw_core_handle_request(&ctx->ohci->card, packet); handle_local_request()
1629 fw_core_handle_response(&ctx->ohci->card, packet); handle_local_request()
1633 if (ctx == &ctx->ohci->at_response_ctx) { handle_local_request()
1635 packet->callback(packet, &ctx->ohci->card, packet->ack); handle_local_request()
1644 spin_lock_irqsave(&ctx->ohci->lock, flags); at_context_transmit()
1646 if (HEADER_GET_DESTINATION(packet->header[0]) == ctx->ohci->node_id && at_context_transmit()
1647 ctx->ohci->generation == packet->generation) { at_context_transmit()
1648 spin_unlock_irqrestore(&ctx->ohci->lock, flags); at_context_transmit()
1654 spin_unlock_irqrestore(&ctx->ohci->lock, flags); at_context_transmit()
1657 packet->callback(packet, &ctx->ohci->card, packet->ack); at_context_transmit()
1661 static void detect_dead_context(struct fw_ohci *ohci, detect_dead_context() argument
1666 ctl = reg_read(ohci, CONTROL_SET(regs)); detect_dead_context()
1668 ohci_err(ohci, "DMA context %s has stopped, error code: %s\n", detect_dead_context()
1672 static void handle_dead_contexts(struct fw_ohci *ohci) handle_dead_contexts() argument
1677 detect_dead_context(ohci, "ATReq", OHCI1394_AsReqTrContextBase); handle_dead_contexts()
1678 detect_dead_context(ohci, "ATRsp", OHCI1394_AsRspTrContextBase); handle_dead_contexts()
1679 detect_dead_context(ohci, "ARReq", OHCI1394_AsReqRcvContextBase); handle_dead_contexts()
1680 detect_dead_context(ohci, "ARRsp", OHCI1394_AsRspRcvContextBase); handle_dead_contexts()
1682 if (!(ohci->it_context_support & (1 << i))) handle_dead_contexts()
1685 detect_dead_context(ohci, name, OHCI1394_IsoXmitContextBase(i)); handle_dead_contexts()
1688 if (!(ohci->ir_context_support & (1 << i))) handle_dead_contexts()
1691 detect_dead_context(ohci, name, OHCI1394_IsoRcvContextBase(i)); handle_dead_contexts()
1722 static u32 get_cycle_time(struct fw_ohci *ohci) get_cycle_time() argument
1729 c2 = reg_read(ohci, OHCI1394_IsochronousCycleTimer); get_cycle_time()
1731 if (ohci->quirks & QUIRK_CYCLE_TIMER) { get_cycle_time()
1734 c2 = reg_read(ohci, OHCI1394_IsochronousCycleTimer); get_cycle_time()
1738 c2 = reg_read(ohci, OHCI1394_IsochronousCycleTimer); get_cycle_time()
1758 static u32 update_bus_time(struct fw_ohci *ohci) update_bus_time() argument
1760 u32 cycle_time_seconds = get_cycle_time(ohci) >> 25; update_bus_time()
1762 if (unlikely(!ohci->bus_time_running)) { update_bus_time()
1763 reg_write(ohci, OHCI1394_IntMaskSet, OHCI1394_cycle64Seconds); update_bus_time()
1764 ohci->bus_time = (lower_32_bits(get_seconds()) & ~0x7f) | update_bus_time()
1766 ohci->bus_time_running = true; update_bus_time()
1769 if ((ohci->bus_time & 0x40) != (cycle_time_seconds & 0x40)) update_bus_time()
1770 ohci->bus_time += 0x40; update_bus_time()
1772 return ohci->bus_time | cycle_time_seconds; update_bus_time()
1775 static int get_status_for_port(struct fw_ohci *ohci, int port_index) get_status_for_port() argument
1779 mutex_lock(&ohci->phy_reg_mutex); get_status_for_port()
1780 reg = write_phy_reg(ohci, 7, port_index); get_status_for_port()
1782 reg = read_phy_reg(ohci, 8); get_status_for_port()
1783 mutex_unlock(&ohci->phy_reg_mutex); get_status_for_port()
1796 static int get_self_id_pos(struct fw_ohci *ohci, u32 self_id, get_self_id_pos() argument
1803 entry = ohci->self_id_buffer[i]; get_self_id_pos()
1812 static int initiated_reset(struct fw_ohci *ohci) initiated_reset() argument
1817 mutex_lock(&ohci->phy_reg_mutex); initiated_reset()
1818 reg = write_phy_reg(ohci, 7, 0xe0); /* Select page 7 */ initiated_reset()
1820 reg = read_phy_reg(ohci, 8); initiated_reset()
1822 reg = write_phy_reg(ohci, 8, reg); /* set PMODE bit */ initiated_reset()
1824 reg = read_phy_reg(ohci, 12); /* read register 12 */ initiated_reset()
1833 mutex_unlock(&ohci->phy_reg_mutex); initiated_reset()
1842 static int find_and_insert_self_id(struct fw_ohci *ohci, int self_id_count) find_and_insert_self_id() argument
1848 reg = reg_read(ohci, OHCI1394_NodeID); find_and_insert_self_id()
1850 ohci_notice(ohci, find_and_insert_self_id()
1856 reg = ohci_read_phy_reg(&ohci->card, 4); find_and_insert_self_id()
1861 reg = ohci_read_phy_reg(&ohci->card, 1); find_and_insert_self_id()
1867 status = get_status_for_port(ohci, i); find_and_insert_self_id()
1873 self_id |= initiated_reset(ohci); find_and_insert_self_id()
1875 pos = get_self_id_pos(ohci, self_id, self_id_count); find_and_insert_self_id()
1877 memmove(&(ohci->self_id_buffer[pos+1]), find_and_insert_self_id()
1878 &(ohci->self_id_buffer[pos]), find_and_insert_self_id()
1879 (self_id_count - pos) * sizeof(*ohci->self_id_buffer)); find_and_insert_self_id()
1880 ohci->self_id_buffer[pos] = self_id; find_and_insert_self_id()
1888 struct fw_ohci *ohci = bus_reset_work() local
1896 reg = reg_read(ohci, OHCI1394_NodeID); bus_reset_work()
1898 ohci_notice(ohci, bus_reset_work()
1903 ohci_notice(ohci, "malconfigured bus\n"); bus_reset_work()
1906 ohci->node_id = reg & (OHCI1394_NodeID_busNumber | bus_reset_work()
1910 if (!(ohci->is_root && is_new_root)) bus_reset_work()
1911 reg_write(ohci, OHCI1394_LinkControlSet, bus_reset_work()
1913 ohci->is_root = is_new_root; bus_reset_work()
1915 reg = reg_read(ohci, OHCI1394_SelfIDCount); bus_reset_work()
1917 ohci_notice(ohci, "self ID receive error\n"); bus_reset_work()
1929 ohci_notice(ohci, "bad selfIDSize (%08x)\n", reg); bus_reset_work()
1933 generation = (cond_le32_to_cpu(ohci->self_id[0]) >> 16) & 0xff; bus_reset_work()
1937 u32 id = cond_le32_to_cpu(ohci->self_id[i]); bus_reset_work()
1938 u32 id2 = cond_le32_to_cpu(ohci->self_id[i + 1]); bus_reset_work()
1949 ohci_notice(ohci, "ignoring spurious self IDs\n"); bus_reset_work()
1954 ohci_notice(ohci, "bad self ID %d/%d (%08x != ~%08x)\n", bus_reset_work()
1958 ohci->self_id_buffer[j] = id; bus_reset_work()
1961 if (ohci->quirks & QUIRK_TI_SLLZ059) { bus_reset_work()
1962 self_id_count = find_and_insert_self_id(ohci, self_id_count); bus_reset_work()
1964 ohci_notice(ohci, bus_reset_work()
1971 ohci_notice(ohci, "no self IDs\n"); bus_reset_work()
1990 new_generation = (reg_read(ohci, OHCI1394_SelfIDCount) >> 16) & 0xff; bus_reset_work()
1992 ohci_notice(ohci, "new bus reset, discarding self ids\n"); bus_reset_work()
1997 spin_lock_irq(&ohci->lock); bus_reset_work()
1999 ohci->generation = -1; /* prevent AT packet queueing */ bus_reset_work()
2000 context_stop(&ohci->at_request_ctx); bus_reset_work()
2001 context_stop(&ohci->at_response_ctx); bus_reset_work()
2003 spin_unlock_irq(&ohci->lock); bus_reset_work()
2010 at_context_flush(&ohci->at_request_ctx); bus_reset_work()
2011 at_context_flush(&ohci->at_response_ctx); bus_reset_work()
2013 spin_lock_irq(&ohci->lock); bus_reset_work()
2015 ohci->generation = generation; bus_reset_work()
2016 reg_write(ohci, OHCI1394_IntEventClear, OHCI1394_busReset); bus_reset_work()
2018 if (ohci->quirks & QUIRK_RESET_PACKET) bus_reset_work()
2019 ohci->request_generation = generation; bus_reset_work()
2030 if (ohci->next_config_rom != NULL) { bus_reset_work()
2031 if (ohci->next_config_rom != ohci->config_rom) { bus_reset_work()
2032 free_rom = ohci->config_rom; bus_reset_work()
2033 free_rom_bus = ohci->config_rom_bus; bus_reset_work()
2035 ohci->config_rom = ohci->next_config_rom; bus_reset_work()
2036 ohci->config_rom_bus = ohci->next_config_rom_bus; bus_reset_work()
2037 ohci->next_config_rom = NULL; bus_reset_work()
2045 reg_write(ohci, OHCI1394_BusOptions, bus_reset_work()
2046 be32_to_cpu(ohci->config_rom[2])); bus_reset_work()
2047 ohci->config_rom[0] = ohci->next_header; bus_reset_work()
2048 reg_write(ohci, OHCI1394_ConfigROMhdr, bus_reset_work()
2049 be32_to_cpu(ohci->next_header)); bus_reset_work()
2053 reg_write(ohci, OHCI1394_PhyReqFilterHiSet, ~0); bus_reset_work()
2054 reg_write(ohci, OHCI1394_PhyReqFilterLoSet, ~0); bus_reset_work()
2057 spin_unlock_irq(&ohci->lock); bus_reset_work()
2060 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, bus_reset_work()
2063 log_selfids(ohci, generation, self_id_count); bus_reset_work()
2065 fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation, bus_reset_work()
2066 self_id_count, ohci->self_id_buffer, bus_reset_work()
2067 ohci->csr_state_setclear_abdicate); bus_reset_work()
2068 ohci->csr_state_setclear_abdicate = false; bus_reset_work()
2073 struct fw_ohci *ohci = data; irq_handler() local
2077 event = reg_read(ohci, OHCI1394_IntEventClear); irq_handler()
2086 reg_write(ohci, OHCI1394_IntEventClear, irq_handler()
2088 log_irqs(ohci, event); irq_handler()
2091 queue_work(selfid_workqueue, &ohci->bus_reset_work); irq_handler()
2094 tasklet_schedule(&ohci->ar_request_ctx.tasklet); irq_handler()
2097 tasklet_schedule(&ohci->ar_response_ctx.tasklet); irq_handler()
2100 tasklet_schedule(&ohci->at_request_ctx.tasklet); irq_handler()
2103 tasklet_schedule(&ohci->at_response_ctx.tasklet); irq_handler()
2106 iso_event = reg_read(ohci, OHCI1394_IsoRecvIntEventClear); irq_handler()
2107 reg_write(ohci, OHCI1394_IsoRecvIntEventClear, iso_event); irq_handler()
2112 &ohci->ir_context_list[i].context.tasklet); irq_handler()
2118 iso_event = reg_read(ohci, OHCI1394_IsoXmitIntEventClear); irq_handler()
2119 reg_write(ohci, OHCI1394_IsoXmitIntEventClear, iso_event); irq_handler()
2124 &ohci->it_context_list[i].context.tasklet); irq_handler()
2130 ohci_err(ohci, "register access failure\n"); irq_handler()
2133 reg_read(ohci, OHCI1394_PostedWriteAddressHi); irq_handler()
2134 reg_read(ohci, OHCI1394_PostedWriteAddressLo); irq_handler()
2135 reg_write(ohci, OHCI1394_IntEventClear, irq_handler()
2138 ohci_err(ohci, "PCI posted write error\n"); irq_handler()
2143 ohci_notice(ohci, "isochronous cycle too long\n"); irq_handler()
2144 reg_write(ohci, OHCI1394_LinkControlSet, irq_handler()
2156 ohci_notice(ohci, "isochronous cycle inconsistent\n"); irq_handler()
2160 handle_dead_contexts(ohci); irq_handler()
2163 spin_lock(&ohci->lock); irq_handler()
2164 update_bus_time(ohci); irq_handler()
2165 spin_unlock(&ohci->lock); irq_handler()
2167 flush_writes(ohci); irq_handler()
2172 static int software_reset(struct fw_ohci *ohci) software_reset() argument
2177 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_softReset); software_reset()
2179 val = reg_read(ohci, OHCI1394_HCControlSet); software_reset()
2201 static int configure_1394a_enhancements(struct fw_ohci *ohci) configure_1394a_enhancements() argument
2207 if (!(reg_read(ohci, OHCI1394_HCControlSet) & configure_1394a_enhancements()
2213 ret = read_phy_reg(ohci, 2); configure_1394a_enhancements()
2217 ret = read_paged_phy_reg(ohci, 1, 8); configure_1394a_enhancements()
2224 if (ohci->quirks & QUIRK_NO_1394A) configure_1394a_enhancements()
2235 ret = update_phy_reg(ohci, 5, clear, set); configure_1394a_enhancements()
2243 reg_write(ohci, offset, OHCI1394_HCControl_aPhyEnhanceEnable); configure_1394a_enhancements()
2246 reg_write(ohci, OHCI1394_HCControlClear, configure_1394a_enhancements()
2252 static int probe_tsb41ba3d(struct fw_ohci *ohci) probe_tsb41ba3d() argument
2258 reg = read_phy_reg(ohci, 2); probe_tsb41ba3d()
2265 reg = read_paged_phy_reg(ohci, 1, i + 10); probe_tsb41ba3d()
2277 struct fw_ohci *ohci = fw_ohci(card); ohci_enable() local
2281 if (software_reset(ohci)) { ohci_enable()
2282 ohci_err(ohci, "failed to reset ohci card\n"); ohci_enable()
2299 reg_write(ohci, OHCI1394_HCControlSet, ohci_enable()
2302 flush_writes(ohci); ohci_enable()
2306 lps = reg_read(ohci, OHCI1394_HCControlSet) & ohci_enable()
2311 ohci_err(ohci, "failed to set Link Power Status\n"); ohci_enable()
2315 if (ohci->quirks & QUIRK_TI_SLLZ059) { ohci_enable()
2316 ret = probe_tsb41ba3d(ohci); ohci_enable()
2320 ohci_notice(ohci, "local TSB41BA3D phy\n"); ohci_enable()
2322 ohci->quirks &= ~QUIRK_TI_SLLZ059; ohci_enable()
2325 reg_write(ohci, OHCI1394_HCControlClear, ohci_enable()
2328 reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->self_id_bus); ohci_enable()
2329 reg_write(ohci, OHCI1394_LinkControlSet, ohci_enable()
2333 reg_write(ohci, OHCI1394_ATRetries, ohci_enable()
2339 ohci->bus_time_running = false; ohci_enable()
2342 if (ohci->ir_context_support & (1 << i)) ohci_enable()
2343 reg_write(ohci, OHCI1394_IsoRcvContextControlClear(i), ohci_enable()
2346 version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; ohci_enable()
2348 reg_write(ohci, OHCI1394_InitialChannelsAvailableHi, ohci_enable()
2354 reg_write(ohci, OHCI1394_FairnessControl, 0x3f); ohci_enable()
2355 ohci->pri_req_max = reg_read(ohci, OHCI1394_FairnessControl) & 0x3f; ohci_enable()
2356 reg_write(ohci, OHCI1394_FairnessControl, 0); ohci_enable()
2357 card->priority_budget_implemented = ohci->pri_req_max != 0; ohci_enable()
2359 reg_write(ohci, OHCI1394_PhyUpperBound, FW_MAX_PHYSICAL_RANGE >> 16); ohci_enable()
2360 reg_write(ohci, OHCI1394_IntEventClear, ~0); ohci_enable()
2361 reg_write(ohci, OHCI1394_IntMaskClear, ~0); ohci_enable()
2363 ret = configure_1394a_enhancements(ohci); ohci_enable()
2392 ohci->next_config_rom = ohci_enable()
2393 dma_alloc_coherent(ohci->card.device, CONFIG_ROM_SIZE, ohci_enable()
2394 &ohci->next_config_rom_bus, ohci_enable()
2396 if (ohci->next_config_rom == NULL) ohci_enable()
2399 copy_config_rom(ohci->next_config_rom, config_rom, length); ohci_enable()
2405 ohci->next_config_rom = ohci->config_rom; ohci_enable()
2406 ohci->next_config_rom_bus = ohci->config_rom_bus; ohci_enable()
2409 ohci->next_header = ohci->next_config_rom[0]; ohci_enable()
2410 ohci->next_config_rom[0] = 0; ohci_enable()
2411 reg_write(ohci, OHCI1394_ConfigROMhdr, 0); ohci_enable()
2412 reg_write(ohci, OHCI1394_BusOptions, ohci_enable()
2413 be32_to_cpu(ohci->next_config_rom[2])); ohci_enable()
2414 reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); ohci_enable()
2416 reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000); ohci_enable()
2430 reg_write(ohci, OHCI1394_IntMaskSet, irqs); ohci_enable()
2432 reg_write(ohci, OHCI1394_HCControlSet, ohci_enable()
2436 reg_write(ohci, OHCI1394_LinkControlSet, ohci_enable()
2440 ar_context_run(&ohci->ar_request_ctx); ohci_enable()
2441 ar_context_run(&ohci->ar_response_ctx); ohci_enable()
2443 flush_writes(ohci); ohci_enable()
2446 fw_schedule_bus_reset(&ohci->card, false, true); ohci_enable()
2454 struct fw_ohci *ohci; ohci_set_config_rom() local
2458 ohci = fw_ohci(card); ohci_set_config_rom()
2483 * We use ohci->lock to avoid racing with the code that sets ohci_set_config_rom()
2484 * ohci->next_config_rom to NULL (see bus_reset_work). ohci_set_config_rom()
2488 dma_alloc_coherent(ohci->card.device, CONFIG_ROM_SIZE, ohci_set_config_rom()
2493 spin_lock_irq(&ohci->lock); ohci_set_config_rom()
2497 * push our new allocation into the ohci->next_config_rom ohci_set_config_rom()
2506 if (ohci->next_config_rom == NULL) { ohci_set_config_rom()
2507 ohci->next_config_rom = next_config_rom; ohci_set_config_rom()
2508 ohci->next_config_rom_bus = next_config_rom_bus; ohci_set_config_rom()
2512 copy_config_rom(ohci->next_config_rom, config_rom, length); ohci_set_config_rom()
2514 ohci->next_header = config_rom[0]; ohci_set_config_rom()
2515 ohci->next_config_rom[0] = 0; ohci_set_config_rom()
2517 reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); ohci_set_config_rom()
2519 spin_unlock_irq(&ohci->lock); ohci_set_config_rom()
2523 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, ohci_set_config_rom()
2534 fw_schedule_bus_reset(&ohci->card, true, true); ohci_set_config_rom()
2541 struct fw_ohci *ohci = fw_ohci(card); ohci_send_request() local
2543 at_context_transmit(&ohci->at_request_ctx, packet); ohci_send_request()
2548 struct fw_ohci *ohci = fw_ohci(card); ohci_send_response() local
2550 at_context_transmit(&ohci->at_response_ctx, packet); ohci_send_response()
2555 struct fw_ohci *ohci = fw_ohci(card); ohci_cancel_packet() local
2556 struct context *ctx = &ohci->at_request_ctx; ohci_cancel_packet()
2566 dma_unmap_single(ohci->card.device, packet->payload_bus, ohci_cancel_packet()
2569 log_ar_at_event(ohci, 'T', packet->speed, packet->header, 0x20); ohci_cancel_packet()
2572 packet->callback(packet, &ohci->card, packet->ack); ohci_cancel_packet()
2583 struct fw_ohci *ohci = fw_ohci(card); ohci_enable_phys_dma() local
2595 spin_lock_irqsave(&ohci->lock, flags); ohci_enable_phys_dma()
2597 if (ohci->generation != generation) { ohci_enable_phys_dma()
2609 reg_write(ohci, OHCI1394_PhyReqFilterLoSet, 1 << n); ohci_enable_phys_dma()
2611 reg_write(ohci, OHCI1394_PhyReqFilterHiSet, 1 << (n - 32)); ohci_enable_phys_dma()
2613 flush_writes(ohci); ohci_enable_phys_dma()
2615 spin_unlock_irqrestore(&ohci->lock, flags); ohci_enable_phys_dma()
2622 struct fw_ohci *ohci = fw_ohci(card); ohci_read_csr() local
2629 if (ohci->is_root && ohci_read_csr()
2630 (reg_read(ohci, OHCI1394_LinkControlSet) & ohci_read_csr()
2635 if (ohci->csr_state_setclear_abdicate) ohci_read_csr()
2641 return reg_read(ohci, OHCI1394_NodeID) << 16; ohci_read_csr()
2644 return get_cycle_time(ohci); ohci_read_csr()
2652 spin_lock_irqsave(&ohci->lock, flags); ohci_read_csr()
2653 value = update_bus_time(ohci); ohci_read_csr()
2654 spin_unlock_irqrestore(&ohci->lock, flags); ohci_read_csr()
2658 value = reg_read(ohci, OHCI1394_ATRetries); ohci_read_csr()
2662 return (reg_read(ohci, OHCI1394_FairnessControl) & 0x3f) | ohci_read_csr()
2663 (ohci->pri_req_max << 8); ohci_read_csr()
2673 struct fw_ohci *ohci = fw_ohci(card); ohci_write_csr() local
2678 if ((value & CSR_STATE_BIT_CMSTR) && ohci->is_root) { ohci_write_csr()
2679 reg_write(ohci, OHCI1394_LinkControlClear, ohci_write_csr()
2681 flush_writes(ohci); ohci_write_csr()
2684 ohci->csr_state_setclear_abdicate = false; ohci_write_csr()
2688 if ((value & CSR_STATE_BIT_CMSTR) && ohci->is_root) { ohci_write_csr()
2689 reg_write(ohci, OHCI1394_LinkControlSet, ohci_write_csr()
2691 flush_writes(ohci); ohci_write_csr()
2694 ohci->csr_state_setclear_abdicate = true; ohci_write_csr()
2698 reg_write(ohci, OHCI1394_NodeID, value >> 16); ohci_write_csr()
2699 flush_writes(ohci); ohci_write_csr()
2703 reg_write(ohci, OHCI1394_IsochronousCycleTimer, value); ohci_write_csr()
2704 reg_write(ohci, OHCI1394_IntEventSet, ohci_write_csr()
2706 flush_writes(ohci); ohci_write_csr()
2710 spin_lock_irqsave(&ohci->lock, flags); ohci_write_csr()
2711 ohci->bus_time = (update_bus_time(ohci) & 0x40) | ohci_write_csr()
2713 spin_unlock_irqrestore(&ohci->lock, flags); ohci_write_csr()
2719 reg_write(ohci, OHCI1394_ATRetries, value); ohci_write_csr()
2720 flush_writes(ohci); ohci_write_csr()
2724 reg_write(ohci, OHCI1394_FairnessControl, value & 0x3f); ohci_write_csr()
2725 flush_writes(ohci); ohci_write_csr()
2788 dma_sync_single_range_for_cpu(context->ohci->card.device, handle_ir_packet_per_buffer()
2827 dma_sync_single_range_for_cpu(context->ohci->card.device, handle_ir_buffer_fill()
2844 dma_sync_single_range_for_cpu(ctx->context.ohci->card.device, flush_ir_buffer_fill()
2882 dma_sync_single_range_for_cpu(context->ohci->card.device, sync_it_packet_for_cpu()
2929 static void set_multichannel_mask(struct fw_ohci *ohci, u64 channels) set_multichannel_mask() argument
2933 reg_write(ohci, OHCI1394_IRMultiChanMaskHiClear, ~hi); set_multichannel_mask()
2934 reg_write(ohci, OHCI1394_IRMultiChanMaskLoClear, ~lo); set_multichannel_mask()
2935 reg_write(ohci, OHCI1394_IRMultiChanMaskHiSet, hi); set_multichannel_mask()
2936 reg_write(ohci, OHCI1394_IRMultiChanMaskLoSet, lo); set_multichannel_mask()
2938 ohci->mc_channels = channels; set_multichannel_mask()
2944 struct fw_ohci *ohci = fw_ohci(card); ohci_allocate_iso_context() local
2951 spin_lock_irq(&ohci->lock); ohci_allocate_iso_context()
2955 mask = &ohci->it_context_mask; ohci_allocate_iso_context()
2961 ctx = &ohci->it_context_list[index]; ohci_allocate_iso_context()
2966 channels = &ohci->ir_context_channels; ohci_allocate_iso_context()
2967 mask = &ohci->ir_context_mask; ohci_allocate_iso_context()
2974 ctx = &ohci->ir_context_list[index]; ohci_allocate_iso_context()
2979 mask = &ohci->ir_context_mask; ohci_allocate_iso_context()
2981 index = !ohci->mc_allocated ? ffs(*mask) - 1 : -1; ohci_allocate_iso_context()
2983 ohci->mc_allocated = true; ohci_allocate_iso_context()
2986 ctx = &ohci->ir_context_list[index]; ohci_allocate_iso_context()
2995 spin_unlock_irq(&ohci->lock); ohci_allocate_iso_context()
3007 ret = context_init(&ctx->context, ohci, regs, callback); ohci_allocate_iso_context()
3012 set_multichannel_mask(ohci, 0); ohci_allocate_iso_context()
3021 spin_lock_irq(&ohci->lock); ohci_allocate_iso_context()
3029 ohci->mc_allocated = false; ohci_allocate_iso_context()
3034 spin_unlock_irq(&ohci->lock); ohci_allocate_iso_context()
3043 struct fw_ohci *ohci = ctx->context.ohci; ohci_start_iso() local
3053 index = ctx - ohci->it_context_list; ohci_start_iso()
3059 reg_write(ohci, OHCI1394_IsoXmitIntEventClear, 1 << index); ohci_start_iso()
3060 reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, 1 << index); ohci_start_iso()
3068 index = ctx - ohci->ir_context_list; ohci_start_iso()
3075 reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 1 << index); ohci_start_iso()
3076 reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, 1 << index); ohci_start_iso()
3077 reg_write(ohci, CONTEXT_MATCH(ctx->context.regs), match); ohci_start_iso()
3091 struct fw_ohci *ohci = fw_ohci(base->card); ohci_stop_iso() local
3097 index = ctx - ohci->it_context_list; ohci_stop_iso()
3098 reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 1 << index); ohci_stop_iso()
3103 index = ctx - ohci->ir_context_list; ohci_stop_iso()
3104 reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, 1 << index); ohci_stop_iso()
3107 flush_writes(ohci); ohci_stop_iso()
3116 struct fw_ohci *ohci = fw_ohci(base->card); ohci_free_iso_context() local
3125 spin_lock_irqsave(&ohci->lock, flags); ohci_free_iso_context()
3129 index = ctx - ohci->it_context_list; ohci_free_iso_context()
3130 ohci->it_context_mask |= 1 << index; ohci_free_iso_context()
3134 index = ctx - ohci->ir_context_list; ohci_free_iso_context()
3135 ohci->ir_context_mask |= 1 << index; ohci_free_iso_context()
3136 ohci->ir_context_channels |= 1ULL << base->channel; ohci_free_iso_context()
3140 index = ctx - ohci->ir_context_list; ohci_free_iso_context()
3141 ohci->ir_context_mask |= 1 << index; ohci_free_iso_context()
3142 ohci->ir_context_channels |= ohci->mc_channels; ohci_free_iso_context()
3143 ohci->mc_channels = 0; ohci_free_iso_context()
3144 ohci->mc_allocated = false; ohci_free_iso_context()
3148 spin_unlock_irqrestore(&ohci->lock, flags); ohci_free_iso_context()
3153 struct fw_ohci *ohci = fw_ohci(base->card); ohci_set_iso_channels() local
3160 spin_lock_irqsave(&ohci->lock, flags); ohci_set_iso_channels()
3163 if (~ohci->ir_context_channels & ~ohci->mc_channels & *channels) { ohci_set_iso_channels()
3164 *channels = ohci->ir_context_channels; ohci_set_iso_channels()
3167 set_multichannel_mask(ohci, *channels); ohci_set_iso_channels()
3171 spin_unlock_irqrestore(&ohci->lock, flags); ohci_set_iso_channels()
3182 static void ohci_resume_iso_dma(struct fw_ohci *ohci) ohci_resume_iso_dma() argument
3187 for (i = 0 ; i < ohci->n_ir ; i++) { ohci_resume_iso_dma()
3188 ctx = &ohci->ir_context_list[i]; ohci_resume_iso_dma()
3193 for (i = 0 ; i < ohci->n_it ; i++) { ohci_resume_iso_dma()
3194 ctx = &ohci->it_context_list[i]; ohci_resume_iso_dma()
3282 dma_sync_single_range_for_device(ctx->context.ohci->card.device, queue_iso_transmit()
3310 struct device *device = ctx->context.ohci->card.device; queue_iso_packet_per_buffer()
3428 dma_sync_single_range_for_device(ctx->context.ohci->card.device, queue_iso_buffer_fill()
3451 spin_lock_irqsave(&ctx->context.ohci->lock, flags); ohci_queue_iso()
3463 spin_unlock_irqrestore(&ctx->context.ohci->lock, flags); ohci_queue_iso()
3473 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_WAKE); ohci_flush_queue_iso()
3563 struct fw_ohci *ohci; pci_probe() local
3574 ohci = kzalloc(sizeof(*ohci), GFP_KERNEL); pci_probe()
3575 if (ohci == NULL) { pci_probe()
3580 fw_card_initialize(&ohci->card, &ohci_driver, &dev->dev); pci_probe()
3592 pci_set_drvdata(dev, ohci); pci_probe()
3594 spin_lock_init(&ohci->lock); pci_probe()
3595 mutex_init(&ohci->phy_reg_mutex); pci_probe()
3597 INIT_WORK(&ohci->bus_reset_work, bus_reset_work); pci_probe()
3601 ohci_err(ohci, "invalid MMIO resource\n"); pci_probe()
3608 ohci_err(ohci, "MMIO resource unavailable\n"); pci_probe()
3612 ohci->registers = pci_iomap(dev, 0, OHCI1394_REGISTER_SIZE); pci_probe()
3613 if (ohci->registers == NULL) { pci_probe()
3614 ohci_err(ohci, "failed to remap registers\n"); pci_probe()
3625 ohci->quirks = ohci_quirks[i].flags; pci_probe()
3629 ohci->quirks = param_quirks; pci_probe()
3638 ohci->misc_buffer = dma_alloc_coherent(ohci->card.device, pci_probe()
3640 &ohci->misc_buffer_bus, pci_probe()
3642 if (!ohci->misc_buffer) { pci_probe()
3647 err = ar_context_init(&ohci->ar_request_ctx, ohci, 0, pci_probe()
3652 err = ar_context_init(&ohci->ar_response_ctx, ohci, PAGE_SIZE/4, pci_probe()
3657 err = context_init(&ohci->at_request_ctx, ohci, pci_probe()
3662 err = context_init(&ohci->at_response_ctx, ohci, pci_probe()
3667 reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, ~0); pci_probe()
3668 ohci->ir_context_channels = ~0ULL; pci_probe()
3669 ohci->ir_context_support = reg_read(ohci, OHCI1394_IsoRecvIntMaskSet); pci_probe()
3670 reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, ~0); pci_probe()
3671 ohci->ir_context_mask = ohci->ir_context_support; pci_probe()
3672 ohci->n_ir = hweight32(ohci->ir_context_mask); pci_probe()
3673 size = sizeof(struct iso_context) * ohci->n_ir; pci_probe()
3674 ohci->ir_context_list = kzalloc(size, GFP_KERNEL); pci_probe()
3676 reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, ~0); pci_probe()
3677 ohci->it_context_support = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet); pci_probe()
3679 if (!ohci->it_context_support) { pci_probe()
3680 ohci_notice(ohci, "overriding IsoXmitIntMask\n"); pci_probe()
3681 ohci->it_context_support = 0xf; pci_probe()
3683 reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0); pci_probe()
3684 ohci->it_context_mask = ohci->it_context_support; pci_probe()
3685 ohci->n_it = hweight32(ohci->it_context_mask); pci_probe()
3686 size = sizeof(struct iso_context) * ohci->n_it; pci_probe()
3687 ohci->it_context_list = kzalloc(size, GFP_KERNEL); pci_probe()
3689 if (ohci->it_context_list == NULL || ohci->ir_context_list == NULL) { pci_probe()
3694 ohci->self_id = ohci->misc_buffer + PAGE_SIZE/2; pci_probe()
3695 ohci->self_id_bus = ohci->misc_buffer_bus + PAGE_SIZE/2; pci_probe()
3697 bus_options = reg_read(ohci, OHCI1394_BusOptions); pci_probe()
3700 guid = ((u64) reg_read(ohci, OHCI1394_GUIDHi) << 32) | pci_probe()
3701 reg_read(ohci, OHCI1394_GUIDLo); pci_probe()
3703 if (!(ohci->quirks & QUIRK_NO_MSI)) pci_probe()
3707 ohci_driver_name, ohci)) { pci_probe()
3708 ohci_err(ohci, "failed to allocate interrupt %d\n", dev->irq); pci_probe()
3713 err = fw_card_add(&ohci->card, max_receive, link_speed, guid); pci_probe()
3717 version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; pci_probe()
3718 ohci_notice(ohci, pci_probe()
3721 version >> 16, version & 0xff, ohci->card.index, pci_probe()
3722 ohci->n_ir, ohci->n_it, ohci->quirks, pci_probe()
3723 reg_read(ohci, OHCI1394_PhyUpperBound) ? pci_probe()
3729 free_irq(dev->irq, ohci); pci_probe()
3733 kfree(ohci->ir_context_list); pci_probe()
3734 kfree(ohci->it_context_list); pci_probe()
3735 context_release(&ohci->at_response_ctx); pci_probe()
3737 context_release(&ohci->at_request_ctx); pci_probe()
3739 ar_context_release(&ohci->ar_response_ctx); pci_probe()
3741 ar_context_release(&ohci->ar_request_ctx); pci_probe()
3743 dma_free_coherent(ohci->card.device, PAGE_SIZE, pci_probe()
3744 ohci->misc_buffer, ohci->misc_buffer_bus); pci_probe()
3746 pci_iounmap(dev, ohci->registers); pci_probe()
3752 kfree(ohci); pci_probe()
3760 struct fw_ohci *ohci = pci_get_drvdata(dev); pci_remove() local
3766 if (reg_read(ohci, OHCI1394_HCControlSet) & OHCI1394_HCControl_LPS) { pci_remove()
3767 reg_write(ohci, OHCI1394_IntMaskClear, ~0); pci_remove()
3768 flush_writes(ohci); pci_remove()
3770 cancel_work_sync(&ohci->bus_reset_work); pci_remove()
3771 fw_core_remove_card(&ohci->card); pci_remove()
3778 software_reset(ohci); pci_remove()
3779 free_irq(dev->irq, ohci); pci_remove()
3781 if (ohci->next_config_rom && ohci->next_config_rom != ohci->config_rom) pci_remove()
3782 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, pci_remove()
3783 ohci->next_config_rom, ohci->next_config_rom_bus); pci_remove()
3784 if (ohci->config_rom) pci_remove()
3785 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, pci_remove()
3786 ohci->config_rom, ohci->config_rom_bus); pci_remove()
3787 ar_context_release(&ohci->ar_request_ctx); pci_remove()
3788 ar_context_release(&ohci->ar_response_ctx); pci_remove()
3789 dma_free_coherent(ohci->card.device, PAGE_SIZE, pci_remove()
3790 ohci->misc_buffer, ohci->misc_buffer_bus); pci_remove()
3791 context_release(&ohci->at_request_ctx); pci_remove()
3792 context_release(&ohci->at_response_ctx); pci_remove()
3793 kfree(ohci->it_context_list); pci_remove()
3794 kfree(ohci->ir_context_list); pci_remove()
3796 pci_iounmap(dev, ohci->registers); pci_remove()
3799 kfree(ohci); pci_remove()
3802 dev_notice(&dev->dev, "removed fw-ohci device\n"); pci_remove()
3808 struct fw_ohci *ohci = pci_get_drvdata(dev); pci_suspend() local
3811 software_reset(ohci); pci_suspend()
3814 ohci_err(ohci, "pci_save_state failed\n"); pci_suspend()
3819 ohci_err(ohci, "pci_set_power_state failed with %d\n", err); pci_suspend()
3827 struct fw_ohci *ohci = pci_get_drvdata(dev); pci_resume() local
3835 ohci_err(ohci, "pci_enable_device failed\n"); pci_resume()
3840 if (!reg_read(ohci, OHCI1394_GUIDLo) && pci_resume()
3841 !reg_read(ohci, OHCI1394_GUIDHi)) { pci_resume()
3842 reg_write(ohci, OHCI1394_GUIDLo, (u32)ohci->card.guid); pci_resume()
3843 reg_write(ohci, OHCI1394_GUIDHi, (u32)(ohci->card.guid >> 32)); pci_resume()
3846 err = ohci_enable(&ohci->card, NULL, 0); pci_resume()
3850 ohci_resume_iso_dma(ohci); pci_resume()
H A Dinit_ohci1394_dma.c45 #include "ohci.h"
49 struct ohci { struct
53 static inline void reg_write(const struct ohci *ohci, int offset, u32 data) reg_write() argument
55 writel(data, ohci->registers + offset); reg_write()
58 static inline u32 reg_read(const struct ohci *ohci, int offset) reg_read() argument
60 return readl(ohci->registers + offset); reg_read()
66 static inline u8 __init get_phy_reg(struct ohci *ohci, u8 addr) get_phy_reg() argument
71 reg_write(ohci, OHCI1394_PhyControl, (addr << 8) | 0x00008000); get_phy_reg()
74 if (reg_read(ohci, OHCI1394_PhyControl) & 0x80000000) get_phy_reg()
78 r = reg_read(ohci, OHCI1394_PhyControl); get_phy_reg()
84 static inline void __init set_phy_reg(struct ohci *ohci, u8 addr, u8 data) set_phy_reg() argument
88 reg_write(ohci, OHCI1394_PhyControl, (addr << 8) | data | 0x00004000); set_phy_reg()
91 if (!(reg_read(ohci, OHCI1394_PhyControl) & 0x00004000)) set_phy_reg()
98 static inline void __init init_ohci1394_soft_reset(struct ohci *ohci) init_ohci1394_soft_reset() argument
102 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_softReset); init_ohci1394_soft_reset()
105 if (!(reg_read(ohci, OHCI1394_HCControlSet) init_ohci1394_soft_reset()
117 static inline void __init init_ohci1394_initialize(struct ohci *ohci) init_ohci1394_initialize() argument
123 bus_options = reg_read(ohci, OHCI1394_BusOptions); init_ohci1394_initialize()
127 reg_write(ohci, OHCI1394_BusOptions, bus_options); init_ohci1394_initialize()
130 reg_write(ohci, OHCI1394_NodeID, 0x0000ffc0); init_ohci1394_initialize()
133 reg_write(ohci, OHCI1394_HCControlSet, init_ohci1394_initialize()
137 reg_write(ohci, OHCI1394_LinkControlClear, 0xffffffff); init_ohci1394_initialize()
140 reg_write(ohci, OHCI1394_LinkControlSet, init_ohci1394_initialize()
144 reg_write(ohci, OHCI1394_LinkControlClear, 0x00000400); init_ohci1394_initialize()
147 reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, 0xffffffff); init_ohci1394_initialize()
148 reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 0xffffffff); init_ohci1394_initialize()
149 reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 0xffffffff); init_ohci1394_initialize()
150 reg_write(ohci, OHCI1394_IsoXmitIntEventClear, 0xffffffff); init_ohci1394_initialize()
153 reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000); init_ohci1394_initialize()
156 reg_write(ohci, OHCI1394_ATRetries, init_ohci1394_initialize()
162 reg_write(ohci, OHCI1394_HCControlClear, init_ohci1394_initialize()
166 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_linkEnable); init_ohci1394_initialize()
169 num_ports = get_phy_reg(ohci, 2) & 0xf; init_ohci1394_initialize()
173 set_phy_reg(ohci, 7, i); init_ohci1394_initialize()
174 status = get_phy_reg(ohci, 8); init_ohci1394_initialize()
177 set_phy_reg(ohci, 8, status & ~1); init_ohci1394_initialize()
190 static inline void __init init_ohci1394_wait_for_busresets(struct ohci *ohci) init_ohci1394_wait_for_busresets() argument
196 events = reg_read(ohci, OHCI1394_IntEventSet); init_ohci1394_wait_for_busresets()
198 reg_write(ohci, OHCI1394_IntEventClear, init_ohci1394_wait_for_busresets()
208 static inline void __init init_ohci1394_enable_physical_dma(struct ohci *ohci) init_ohci1394_enable_physical_dma() argument
210 reg_write(ohci, OHCI1394_PhyReqFilterHiSet, 0xffffffff); init_ohci1394_enable_physical_dma()
211 reg_write(ohci, OHCI1394_PhyReqFilterLoSet, 0xffffffff); init_ohci1394_enable_physical_dma()
212 reg_write(ohci, OHCI1394_PhyUpperBound, 0xffff0000); init_ohci1394_enable_physical_dma()
219 static inline void __init init_ohci1394_reset_and_init_dma(struct ohci *ohci) init_ohci1394_reset_and_init_dma() argument
222 init_ohci1394_soft_reset(ohci); init_ohci1394_reset_and_init_dma()
225 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); init_ohci1394_reset_and_init_dma()
228 reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); init_ohci1394_reset_and_init_dma()
229 reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); init_ohci1394_reset_and_init_dma()
233 init_ohci1394_initialize(ohci); init_ohci1394_reset_and_init_dma()
238 init_ohci1394_wait_for_busresets(ohci); init_ohci1394_reset_and_init_dma()
241 init_ohci1394_enable_physical_dma(ohci); init_ohci1394_reset_and_init_dma()
251 struct ohci ohci; init_ohci1394_controller() local
261 ohci.registers = (void __iomem *)fix_to_virt(FIX_OHCI1394_BASE); init_ohci1394_controller()
263 init_ohci1394_reset_and_init_dma(&ohci); init_ohci1394_controller()
/linux-4.4.14/arch/mips/include/asm/mach-loongson64/cs5536/
H A Dcs5536_vsm.h24 /* ohci module */
25 DECLARE_CS5536_MODULE(ohci)
/linux-4.4.14/arch/arm/mach-pxa/
H A Dpxa-dt.c29 OF_DEV_AUXDATA("marvell,pxa-ohci", 0x4c000000, "pxa27x-ohci", NULL),
H A Dcolibri-evalboard.c28 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dcolibri-pxa270-income.c32 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dcolibri-pxa300.c27 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dcolibri-pxa320.c29 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dcsb726.c27 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dzeus.c43 #include <linux/platform_data/usb-ohci-pxa27x.h>
525 REGULATOR_SUPPLY("vbus2", "pxa27x-ohci"),
H A Dcm-x270.c25 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dlpd270.c49 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dmxm8x10.c31 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dpxa27x.c33 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dpxa3xx.c32 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dzylonite.c33 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Ddevices.c15 #include <linux/platform_data/usb-ohci-pxa27x.h>
697 .name = "pxa27x-ohci",
H A Dpalmtreo.c43 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dpcm990-baseboard.c38 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dtrizeps4.c50 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dvpac270.c39 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dballoon3.c53 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dcm-x300.c54 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dmagician.c46 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dmainstone.c55 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dem-x270.c46 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dezx.c34 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Draumfeld.c53 #include <linux/platform_data/usb-ohci-pxa27x.h>
H A Dspitz.c48 #include <linux/platform_data/usb-ohci-pxa27x.h>
/linux-4.4.14/drivers/mfd/
H A Domap-usb-host.c39 #define OMAP_OHCI_DEVICE "ohci-omap3"
144 [OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0] = "ohci-phy-6pin-datse0",
145 [OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM] = "ohci-phy-6pin-dpdm",
146 [OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0] = "ohci-phy-3pin-datse0",
147 [OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM] = "ohci-phy-4pin-dpdm",
148 [OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0] = "ohci-tll-6pin-datse0",
149 [OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM] = "ohci-tll-6pin-dpdm",
150 [OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0] = "ohci-tll-3pin-datse0",
151 [OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM] = "ohci-tll-4pin-dpdm",
152 [OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0] = "ohci-tll-2pin-datse0",
153 [OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM] = "ohci-tll-2pin-dpdm",
227 struct platform_device *ohci; omap_usbhs_alloc_children() local
257 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ohci"); omap_usbhs_alloc_children()
265 res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "ohci-irq"); omap_usbhs_alloc_children()
273 ohci = omap_usbhs_alloc_child(OMAP_OHCI_DEVICE, resources, 2, pdata, omap_usbhs_alloc_children()
275 if (!ohci) { omap_usbhs_alloc_children()
552 { .compatible = "ti,omap-ohci", },
893 * init before ehci and ohci drivers;
895 * the omap ehci and ohci probe functions are called.
H A Dtc6393xb.c413 .name = "tmio-ohci",
/linux-4.4.14/drivers/phy/
H A Dphy-exynos5250-usb2.c206 u32 ohci; exynos5250_power_on() local
314 ohci = readl(drv->reg_phy + EXYNOS_5250_HOSTOHCICTRL); exynos5250_power_on()
316 ohci |= 0x1 << 3; exynos5250_power_on()
317 writel(ohci, drv->reg_phy + EXYNOS_5250_HOSTOHCICTRL); exynos5250_power_on()
/linux-4.4.14/arch/tile/gxio/
H A Dusb_host.c39 snprintf(file, sizeof(file), "usb_host/%d/iorpc/ohci", gxio_usb_host_init()
/linux-4.4.14/include/linux/usb/
H A Dohci_pdriver.h23 * struct usb_ohci_pdata - platform_data for generic ohci driver
H A Dhcd.h208 * (ohci 32, uhci 1024, ehci 256/512/1024).
/linux-4.4.14/arch/mips/alchemy/common/
H A Dplatform.c157 /* Power on callback for the ohci platform driver */ alchemy_ohci_power_on()
168 /* Power off/suspend callback for the ohci platform driver */ alchemy_ohci_power_off()
232 pdev->name = "ohci-platform"; alchemy_setup_usb()
272 pdev->name = "ohci-platform"; alchemy_setup_usb()
/linux-4.4.14/arch/arm/mach-omap1/include/mach/
H A Dmemory.h28 #define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev_name(dev), "ohci", 4) == 0))
/linux-4.4.14/arch/mips/ath79/
H A Ddev-usb.c98 ath79_usb_register("ohci-platform", -1, ath79_usb_setup()
128 ath79_usb_register("ohci-platform", -1, ar7240_usb_setup()
/linux-4.4.14/arch/mips/netlogic/xlr/
H A Dplatform.c137 USB_PLATFORM_DEV("ohci-platform", 1, PIC_USB_IRQ);
139 USB_PLATFORM_DEV("ohci-platform", 2, PIC_USB_IRQ);
/linux-4.4.14/arch/arm/mach-s3c24xx/
H A Dsimtec-usb.c35 #include <linux/platform_data/usb-ohci-s3c2410.h>
H A Dmach-gta02.c72 #include <linux/platform_data/usb-ohci-s3c2410.h>
/linux-4.4.14/arch/arm/mach-davinci/
H A Dusb.c160 .name = "ohci",
/linux-4.4.14/arch/arm/mach-cns3xxx/
H A Dcore.c351 { "intel,usb-ohci", CNS3XXX_USB_OHCI_BASE, "ohci-platform", &cns3xxx_usb_ohci_pdata },
H A Dcns3420vb.c199 .name = "ohci-platform",
/linux-4.4.14/arch/powerpc/platforms/52xx/
H A Dlite5200.c134 * this needs to be called before of-ohci suspend code lite5200_suspend_prepare()
/linux-4.4.14/arch/mips/jz4740/
H A Dplatform.c50 .name = "jz4740-ohci",
H A Dboard-qi_lb60.c372 REGULATOR_SUPPLY("vbus", "jz4740-ohci");
/linux-4.4.14/drivers/clk/spear/
H A Dspear6xx_clock.c265 clk_register_clkdev(clk, NULL, "e1900000.ohci"); spear6xx_clk_init()
270 clk_register_clkdev(clk, NULL, "e2100000.ohci"); spear6xx_clk_init()
H A Dspear3xx_clock.c542 clk_register_clkdev(clk, NULL, "e1900000.ohci"); spear3xx_clk_init()
543 clk_register_clkdev(clk, NULL, "e2100000.ohci"); spear3xx_clk_init()
H A Dspear1310_clock.c727 clk_register_clkdev(clk, NULL, "e4000000.ohci"); spear1310_clk_init()
733 clk_register_clkdev(clk, NULL, "e5000000.ohci"); spear1310_clk_init()
H A Dspear1340_clock.c824 clk_register_clkdev(clk, NULL, "e4000000.ohci"); spear1340_clk_init()
830 clk_register_clkdev(clk, NULL, "e5000000.ohci"); spear1340_clk_init()
/linux-4.4.14/drivers/clk/pxa/
H A Dclk-pxa27x.c123 PXA27X_PBUS_CKEN("pxa27x-ohci", NULL, USBHOST, 2, 13, 0),
H A Dclk-pxa3xx.c149 PXA3XX_PBUS_CKEN("pxa27x-ohci", NULL, USBH, 1, 4, 1, 13, 0),
/linux-4.4.14/arch/sh/kernel/cpu/sh3/
H A Dsetup-sh7720.c118 .name = "ohci-platform",
/linux-4.4.14/arch/mips/cavium-octeon/
H A Ddma-octeon.c302 /* OCTEON II ohci is only 32-bit. */ plat_swiotlb_setup()
H A Docteon-platform.c409 ohci_node = of_find_node_by_name(NULL, "ohci"); octeon_ohci_device_init()
/linux-4.4.14/arch/arm/mach-s3c64xx/
H A Dmach-smartq.c37 #include <linux/platform_data/usb-ohci-s3c2410.h>
/linux-4.4.14/arch/arm/mach-w90x900/
H A Ddev.c140 .name = "nuc900-ohci",
/linux-4.4.14/drivers/clk/samsung/
H A Dclk-s3c64xx.c387 ALIAS(HCLK_UHOST, "s3c2410-ohci", "usb-host"),
416 ALIAS(SCLK_UHOST, "s3c2410-ohci", "usb-bus-host"),
/linux-4.4.14/arch/arm/plat-samsung/
H A Ddevs.c65 #include <linux/platform_data/usb-ohci-s3c2410.h>
984 .name = "s3c2410-ohci",
/linux-4.4.14/drivers/staging/fwserial/
H A Dfwserial.h302 #define MAX_ASYNC_PAYLOAD 4096 /* ohci-defined limit */
/linux-4.4.14/arch/sh/kernel/cpu/sh4a/
H A Dsetup-sh7763.c125 .name = "ohci-platform",
H A Dsetup-sh7786.c381 .name = "ohci-platform",
H A Dsetup-sh7757.c733 .name = "ohci-platform",
/linux-4.4.14/arch/arm/mach-omap1/
H A Dusb.c242 .name = "ohci",
/linux-4.4.14/arch/arm/mach-ep93xx/
H A Dclock.c215 INIT_CK("ohci-platform", NULL, &clk_usb_host),
H A Dcore.c232 .name = "ohci-platform",
/linux-4.4.14/sound/usb/usx2y/
H A Dusbusx2y.c31 Simplified things and made ohci work again.
H A Dusbusx2yaudio.c47 To use 3 on ohci, you'd need a patch:
51 1, 2 and 4 work out of the box on ohci, if I recall correctly.
/linux-4.4.14/arch/arm/mach-lpc32xx/
H A Dclock.c1233 CLKDEV_INIT("31020000.ohci", "ck_usbd", &clk_usbd),
1235 CLKDEV_INIT("31020000.ohci", "ck_usb_otg", &clk_usb_otg_host),
/linux-4.4.14/drivers/usb/misc/
H A Duss720.c29 * usb_request_irq crashes somewhere within ohci.c
H A Dftdi-elan.c81 /* FIXME ohci.h is ONLY for internal use by the OHCI driver.
84 * file, maybe name <linux/usb/ohci.h>
87 #include "../host/ohci.h"
/linux-4.4.14/drivers/usb/core/
H A Durb.c523 /* NOTE ohci only handles up to 32 */ usb_submit_urb()
528 /* NOTE usb and ohci handle up to 2^15 */ usb_submit_urb()
/linux-4.4.14/arch/arm/mach-omap2/
H A Domap_hwmod_3xxx_data.c1940 { .name = "ohci-irq", .irq = 76 + OMAP_INTC_START, },
3327 .name = "ohci",
/linux-4.4.14/drivers/net/irda/
H A Dirda-usb.c42 * o ohci-hcd (For other USB controllers)

Completed in 2725 milliseconds