18 #include <linux/kernel.h>
19 #include <linux/types.h>
22 #include <linux/errno.h>
23 #include <linux/list.h>
40 cq_put(&usb->
ep0->empty_frame_Q, pkt);
60 cq_put(&usb->
ep0->dummy_packets_Q, pkt->
data);
63 recycle_frame(usb, pkt);
135 mode =
in_8(&usb->
fhci->regs->usb_usmod);
161 u32 fw_transaction_time,
len = 0;
216 pkt = cq_get(&usb->
ep0->empty_frame_Q);
225 data = cq_get(&usb->
ep0->dummy_packets_Q);
249 cq_put(&usb->
ep0->dummy_packets_Q, pkt->
data);
250 recycle_frame(usb, pkt);
263 if (!list_empty(list)) {
264 list_move_tail(node, list);
272 static int scan_ed_list(
struct fhci_usb *usb,
275 static const int frame_part[4] = {
312 if (add_packet(usb, ed, td) < 0)
328 if (usb->
actual_frame->total_bytes >= frame_part[list_type])
333 move_head_to_tail(list);
367 if (rotate_frames(usb) != 0)
390 left = scan_ed_list(usb, &usb->
hc_list->ctrl_list,
403 static void sof_interrupt(
struct fhci_hcd *fhci)
432 fhci_dbg(fhci,
"-> %s\n", __func__);
449 fhci_dbg(fhci,
"<- %s\n", __func__);
460 fhci_dbg(fhci,
"-> %s\n", __func__);
469 fhci_warn(fhci,
"Low-Speed device is not supported, "
484 }
else if (state == 2) {
487 fhci_warn(fhci,
"Full-Speed device is not supported, "
505 fhci_dbg(fhci,
"<- %s\n", __func__);
510 struct usb_hcd *hcd = _hcd;
511 struct fhci_hcd *fhci = hcd_to_fhci(hcd);
514 spin_lock(&fhci->
lock);
525 spin_unlock(&fhci->
lock);
531 static void abort_transmission(
struct fhci_usb *usb)
548 struct fhci_hcd *fhci = hcd_to_fhci(hcd);
581 usb_er &= ~USB_E_RESET_MASK;
585 abort_transmission(fhci->
usb_lld);
586 usb_er &= ~USB_E_MSF_MASK;
596 usb_er &= ~USB_E_TXB_MASK;
601 usb_er &= ~USB_E_TXE1_MASK;
606 usb_er &= ~USB_E_RESET_MASK;
619 usb_er &= ~USB_E_IDLE_MASK;
622 spin_unlock_irqrestore(&fhci->
lock, flags);
635 static void process_done_list(
unsigned long data)
645 spin_lock(&fhci->
lock);
650 urb_priv = urb->hcpriv;
679 spin_unlock(&fhci->
lock);
703 struct ed *ed = urb->ep->hcpriv;
704 struct urb_priv *urb_priv = urb->hcpriv;
714 ed->
dev_addr = usb_pipedevice(urb->pipe);
715 ed->
ep_addr = usb_pipeendpoint(urb->pipe);
716 switch (usb_pipetype(urb->pipe)) {
726 case PIPE_ISOCHRONOUS:
735 urb->pipe, usb_pipeout(urb->pipe));
736 urb->ep->hcpriv =
ed;
737 fhci_dbg(fhci,
"new ep speed=%d max_pkt_size=%d\n",
750 if (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
751 usb_pipeout(urb->pipe)))
755 usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe),
756 usb_pipeout(urb->pipe), 1);
762 data = urb->transfer_buffer;
768 if (urb->transfer_flags & URB_ZERO_PACKET &&
769 urb->transfer_buffer_length > 0 &&
770 ((urb->transfer_buffer_length %
771 usb_maxpacket(urb->dev, urb->pipe,
772 usb_pipeout(urb->pipe))) == 0))
774 while (data_len > 4096) {
780 data, 4096, 0, 0,
true);
789 data, data_len, 0, 0,
true);
792 if (urb->transfer_flags & URB_ZERO_PACKET &&
793 cnt < urb_priv->num_of_tds) {
802 urb->start_frame = get_frame_num(fhci) + 1;
806 urb->interval, urb->start_frame,
true);
809 ed->
dev_addr = usb_pipedevice(urb->pipe);
811 usb_pipeout(urb->pipe));
828 (usb_pipeout(urb->pipe) ? FHCI_TA_IN :
839 for (cnt = 0; cnt < urb->number_of_packets; cnt++) {
847 frame += cnt * urb->interval;
850 usb_pipeout(urb->pipe) ? FHCI_TA_OUT :
853 data + urb->iso_frame_desc[cnt].offset,
854 urb->iso_frame_desc[cnt].length,
855 urb->interval, frame,
true);
868 urb->pipe |= urb_state & 0x1f;