Lines Matching refs:qh
173 static void musb_ep_set_qh(struct musb_hw_ep *ep, int is_in, struct musb_qh *qh) in musb_ep_set_qh() argument
176 ep->in_qh = qh; in musb_ep_set_qh()
178 ep->out_qh = qh; in musb_ep_set_qh()
193 musb_start_urb(struct musb *musb, int is_in, struct musb_qh *qh) in musb_start_urb() argument
198 struct urb *urb = next_urb(qh); in musb_start_urb()
201 struct musb_hw_ep *hw_ep = qh->hw_ep; in musb_start_urb()
207 qh->offset = 0; in musb_start_urb()
208 qh->segsize = 0; in musb_start_urb()
211 switch (qh->type) { in musb_start_urb()
221 qh->iso_idx = 0; in musb_start_urb()
222 qh->frame = 0; in musb_start_urb()
234 qh, urb, address, qh->epnum, in musb_start_urb()
236 ({char *s; switch (qh->type) { in musb_start_urb()
247 musb_ep_set_qh(hw_ep, is_in, qh); in musb_start_urb()
255 switch (qh->type) { in musb_start_urb()
271 qh->frame = 0; in musb_start_urb()
275 qh->frame = urb->start_frame; in musb_start_urb()
318 static inline void musb_save_toggle(struct musb_qh *qh, int is_in, in musb_save_toggle() argument
321 void __iomem *epio = qh->hw_ep->regs; in musb_save_toggle()
334 usb_settoggle(urb->dev, qh->epnum, !is_in, csr ? 1 : 0); in musb_save_toggle()
347 struct musb_qh *qh = musb_ep_get_qh(hw_ep, is_in); in musb_advance_schedule() local
348 struct musb_hw_ep *ep = qh->hw_ep; in musb_advance_schedule()
349 int ready = qh->is_ready; in musb_advance_schedule()
355 switch (qh->type) { in musb_advance_schedule()
358 musb_save_toggle(qh, is_in, urb); in musb_advance_schedule()
368 qh->is_ready = 0; in musb_advance_schedule()
370 qh->is_ready = ready; in musb_advance_schedule()
375 if (list_empty(&qh->hep->urb_list)) { in musb_advance_schedule()
395 qh->hep->hcpriv = NULL; in musb_advance_schedule()
397 switch (qh->type) { in musb_advance_schedule()
404 if (qh->mux == 1) { in musb_advance_schedule()
405 head = qh->ring.prev; in musb_advance_schedule()
406 list_del(&qh->ring); in musb_advance_schedule()
407 kfree(qh); in musb_advance_schedule()
408 qh = first_qh(head); in musb_advance_schedule()
418 kfree(qh); in musb_advance_schedule()
419 qh = NULL; in musb_advance_schedule()
424 if (qh != NULL && qh->is_ready) { in musb_advance_schedule()
426 hw_ep->epnum, is_in ? 'R' : 'T', next_urb(qh)); in musb_advance_schedule()
427 musb_start_urb(musb, is_in, qh); in musb_advance_schedule()
464 struct musb_qh *qh = hw_ep->in_qh; in musb_host_packet_rx() local
471 urb->transfer_buffer, qh->offset, in musb_host_packet_rx()
485 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_packet_rx()
503 done = (++qh->iso_idx >= urb->number_of_packets); in musb_host_packet_rx()
507 buf = buffer + qh->offset; in musb_host_packet_rx()
508 length = urb->transfer_buffer_length - qh->offset; in musb_host_packet_rx()
517 qh->offset += length; in musb_host_packet_rx()
521 || (rx_count < qh->maxpacket) in musb_host_packet_rx()
559 musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep) in musb_rx_reinit() argument
598 musb_write_rxfunaddr(ep->target_regs, qh->addr_reg); in musb_rx_reinit()
599 musb_write_rxhubaddr(ep->target_regs, qh->h_addr_reg); in musb_rx_reinit()
600 musb_write_rxhubport(ep->target_regs, qh->h_port_reg); in musb_rx_reinit()
603 musb_writeb(musb->mregs, MUSB_FADDR, qh->addr_reg); in musb_rx_reinit()
606 musb_writeb(ep->regs, MUSB_RXTYPE, qh->type_reg); in musb_rx_reinit()
607 musb_writeb(ep->regs, MUSB_RXINTERVAL, qh->intv_reg); in musb_rx_reinit()
616 qh->maxpacket | ((qh->hb_mult - 1) << 11)); in musb_rx_reinit()
622 struct musb_hw_ep *hw_ep, struct musb_qh *qh, in musb_tx_dma_program() argument
627 u16 pkt_size = qh->maxpacket; in musb_tx_dma_program()
640 if (qh->hb_mult == 1) in musb_tx_dma_program()
662 qh->segsize = length; in musb_tx_dma_program()
697 struct musb_qh *qh = musb_ep_get_qh(hw_ep, !is_out); in musb_ep_program() local
698 u16 packet_sz = qh->maxpacket; in musb_ep_program()
704 qh->addr_reg, qh->epnum, is_out ? "out" : "in", in musb_ep_program()
705 qh->h_addr_reg, qh->h_port_reg, in musb_ep_program()
759 if (usb_gettoggle(urb->dev, qh->epnum, 1)) in musb_ep_program()
777 musb_write_txfunaddr(mbase, epnum, qh->addr_reg); in musb_ep_program()
778 musb_write_txhubaddr(mbase, epnum, qh->h_addr_reg); in musb_ep_program()
779 musb_write_txhubport(mbase, epnum, qh->h_port_reg); in musb_ep_program()
782 musb_writeb(mbase, MUSB_FADDR, qh->addr_reg); in musb_ep_program()
786 musb_writeb(epio, MUSB_TXTYPE, qh->type_reg); in musb_ep_program()
790 else if (can_bulk_split(musb, qh->type)) in musb_ep_program()
796 qh->maxpacket | in musb_ep_program()
797 ((qh->hb_mult - 1) << 11)); in musb_ep_program()
798 musb_writeb(epio, MUSB_TXINTERVAL, qh->intv_reg); in musb_ep_program()
800 musb_writeb(epio, MUSB_NAKLIMIT0, qh->intv_reg); in musb_ep_program()
803 qh->type_reg); in musb_ep_program()
806 if (can_bulk_split(musb, qh->type)) in musb_ep_program()
813 hw_ep, qh, urb, offset, len)) in musb_ep_program()
818 qh->segsize = load_count; in musb_ep_program()
830 musb_rx_reinit(musb, qh, hw_ep); in musb_ep_program()
833 if (usb_gettoggle(urb->dev, qh->epnum, 0)) in musb_ep_program()
838 if (qh->type == USB_ENDPOINT_XFER_INT) in musb_ep_program()
859 qh->segsize = len; in musb_ep_program()
873 qh->segsize); in musb_ep_program()
899 struct musb_qh *qh = hw_ep->in_qh; in musb_h_ep0_continue() local
913 if (len < qh->maxpacket) { in musb_h_ep0_continue()
939 fifo_count = min_t(size_t, qh->maxpacket, in musb_h_ep0_continue()
977 struct musb_qh *qh = hw_ep->in_qh; in musb_h_ep0_irq() local
982 urb = next_urb(qh); in musb_h_ep0_irq()
991 csr, qh, len, urb, musb->ep0_stage); in musb_h_ep0_irq()
1116 struct musb_qh *qh = hw_ep->out_qh; in musb_host_tx() local
1117 struct urb *urb = next_urb(qh); in musb_host_tx()
1266 length = qh->segsize; in musb_host_tx()
1267 qh->offset += length; in musb_host_tx()
1273 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_tx()
1276 if (++qh->iso_idx >= urb->number_of_packets) { in musb_host_tx()
1284 } else if (dma && urb->transfer_buffer_length == qh->offset) { in musb_host_tx()
1288 if (qh->segsize < qh->maxpacket) in musb_host_tx()
1290 else if (qh->offset == urb->transfer_buffer_length in musb_host_tx()
1295 offset = qh->offset; in musb_host_tx()
1314 urb->actual_length = qh->offset; in musb_host_tx()
1318 if (musb_tx_dma_program(musb->dma_controller, hw_ep, qh, urb, in musb_host_tx()
1336 if (length > qh->maxpacket) in musb_host_tx()
1337 length = qh->maxpacket; in musb_host_tx()
1341 qh->segsize = length; in musb_host_tx()
1441 struct musb_qh *qh = hw_ep->in_qh; in musb_host_rx() local
1453 urb = next_urb(qh); in musb_host_rx()
1494 if (USB_ENDPOINT_XFER_ISOC != qh->type) { in musb_host_rx()
1506 && qh->mux == 1 in musb_host_rx()
1591 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_rx()
1600 if (++qh->iso_idx >= urb->number_of_packets) in musb_host_rx()
1609 || dma->actual_len < qh->maxpacket); in musb_host_rx()
1656 qh->offset, in musb_host_rx()
1665 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_rx()
1699 > qh->maxpacket) in musb_host_rx()
1736 if (qh->hb_mult == 1) in musb_host_rx()
1747 dma, qh->maxpacket, in musb_host_rx()
1774 qh->offset += xfer_len; in musb_host_rx()
1789 struct musb_qh *qh, in musb_schedule() argument
1799 struct urb *urb = next_urb(qh); in musb_schedule()
1802 if (qh->type == USB_ENDPOINT_XFER_CONTROL) { in musb_schedule()
1835 diff -= (qh->maxpacket * qh->hb_mult); in musb_schedule()
1852 toggle = usb_gettoggle(urb->dev, qh->epnum, !is_in); in musb_schedule()
1855 if (!is_in && (qh->type == USB_ENDPOINT_XFER_BULK) && in musb_schedule()
1864 if (best_end < 0 && qh->type == USB_ENDPOINT_XFER_BULK) { in musb_schedule()
1878 if (is_in && qh->dev) in musb_schedule()
1879 qh->intv_reg = in musb_schedule()
1880 (USB_SPEED_HIGH == qh->dev->speed) ? 8 : 4; in musb_schedule()
1887 qh->mux = 0; in musb_schedule()
1889 dev_dbg(musb->controller, "qh %p periodic slot %d\n", qh, best_end); in musb_schedule()
1893 list_add_tail(&qh->ring, head); in musb_schedule()
1894 qh->mux = 1; in musb_schedule()
1896 qh->hw_ep = hw_ep; in musb_schedule()
1897 qh->hep->hcpriv = qh; in musb_schedule()
1899 musb_start_urb(musb, is_in, qh); in musb_schedule()
1926 struct musb_qh *qh; local
1938 qh = ret ? NULL : hep->hcpriv;
1939 if (qh)
1940 urb->hcpriv = qh;
1951 if (qh || ret)
1960 qh = kzalloc(sizeof *qh, mem_flags);
1961 if (!qh) {
1968 qh->hep = hep;
1969 qh->dev = urb->dev;
1970 INIT_LIST_HEAD(&qh->ring);
1971 qh->is_ready = 1;
1973 qh->maxpacket = usb_endpoint_maxp(epd);
1974 qh->type = usb_endpoint_type(epd);
1980 qh->hb_mult = 1 + ((qh->maxpacket >> 11) & 0x03);
1981 if (qh->hb_mult > 1) {
1982 int ok = (qh->type == USB_ENDPOINT_XFER_ISOC);
1991 qh->maxpacket &= 0x7ff;
1994 qh->epnum = usb_endpoint_num(epd);
1997 qh->addr_reg = (u8) usb_pipedevice(urb->pipe);
2000 type_reg = (qh->type << 4) | qh->epnum;
2011 qh->type_reg = type_reg;
2014 switch (qh->type) {
2046 qh->intv_reg = interval;
2061 qh->h_addr_reg = (u8) parent->devnum;
2066 qh->h_port_reg = (u8) urb->dev->ttport;
2068 qh->h_addr_reg =
2071 qh->h_addr_reg |= 0x80;
2080 qh->h_addr_reg = hubaddr;
2081 qh->h_port_reg = portnr;
2096 kfree(qh);
2097 qh = NULL;
2100 ret = musb_schedule(musb, qh,
2104 urb->hcpriv = qh;
2116 kfree(qh);
2126 static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) argument
2128 struct musb_hw_ep *ep = qh->hw_ep;
2194 struct musb_qh *qh; local
2209 qh = urb->hcpriv;
2210 if (!qh)
2225 if (!qh->is_ready
2226 || urb->urb_list.prev != &qh->hep->urb_list
2227 || musb_ep_get_qh(qh->hw_ep, is_in) != qh) {
2228 int ready = qh->is_ready;
2230 qh->is_ready = 0;
2232 qh->is_ready = ready;
2237 if (ready && list_empty(&qh->hep->urb_list)) {
2238 qh->hep->hcpriv = NULL;
2239 list_del(&qh->ring);
2240 kfree(qh);
2243 ret = musb_cleanup_urb(urb, qh);
2257 struct musb_qh *qh; local
2262 qh = hep->hcpriv;
2263 if (qh == NULL)
2269 qh->is_ready = 0;
2270 if (musb_ep_get_qh(qh->hw_ep, is_in) == qh) {
2271 urb = next_urb(qh);
2278 musb_cleanup_urb(urb, qh);
2284 urb = next_urb(qh);
2286 musb_advance_schedule(musb, urb, qh->hw_ep, is_in);
2294 musb_giveback(musb, next_urb(qh), -ESHUTDOWN);
2297 list_del(&qh->ring);
2298 kfree(qh);