Lines Matching refs:musb_ep
33 struct musb *musb, struct musb_ep *musb_ep) in map_dma_buffer() argument
40 if (!is_dma_capable() || !musb_ep->dma) in map_dma_buffer()
48 compatible = dma->is_compatible(musb_ep->dma, in map_dma_buffer()
49 musb_ep->packet_sz, request->request.buf, in map_dma_buffer()
86 struct musb_ep *musb_ep = request->ep; in unmap_dma_buffer() local
88 if (!is_buffer_mapped(request) || !musb_ep->dma) in unmap_dma_buffer()
123 struct musb_ep *ep, in musb_g_giveback()
158 static void nuke(struct musb_ep *ep, const int status) in nuke()
208 static inline int max_ep_writesize(struct musb *musb, struct musb_ep *ep) in max_ep_writesize()
226 struct musb_ep *musb_ep; in txstate() local
232 musb_ep = req->ep; in txstate()
235 if (!musb_ep->desc) { in txstate()
237 musb_ep->end_point.name); in txstate()
242 if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) { in txstate()
251 fifo_count = min(max_ep_writesize(musb, musb_ep), in txstate()
256 musb_ep->end_point.name, csr); in txstate()
262 musb_ep->end_point.name, csr); in txstate()
267 epnum, musb_ep->packet_sz, fifo_count, in txstate()
277 musb_ep->dma->max_len); in txstate()
284 if (request_size < musb_ep->packet_sz) in txstate()
285 musb_ep->dma->desired_mode = 0; in txstate()
287 musb_ep->dma->desired_mode = 1; in txstate()
290 musb_ep->dma, musb_ep->packet_sz, in txstate()
291 musb_ep->dma->desired_mode, in txstate()
294 if (musb_ep->dma->desired_mode == 0) { in txstate()
322 if (!musb_ep->hb_mult || in txstate()
324 musb_ep->type)) in txstate()
358 musb_ep->dma, musb_ep->packet_sz, in txstate()
363 c->channel_release(musb_ep->dma); in txstate()
364 musb_ep->dma = NULL; in txstate()
371 musb_ep->dma, musb_ep->packet_sz, in txstate()
385 musb_write_fifo(musb_ep->hw_ep, fifo_count, in txstate()
395 musb_ep->end_point.name, use_dma ? "dma" : "pio", in txstate()
412 struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_in; in musb_g_tx() local
417 req = next_request(musb_ep); in musb_g_tx()
421 musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr); in musb_g_tx()
423 dma = is_dma_capable() ? musb_ep->dma : NULL; in musb_g_tx()
450 musb_dbg(musb, "%s dma still busy?", musb_ep->end_point.name); in musb_g_tx()
468 request->actual += musb_ep->dma->actual_len; in musb_g_tx()
470 epnum, csr, musb_ep->dma->actual_len, request); in musb_g_tx()
478 && (request->length % musb_ep->packet_sz == 0) in musb_g_tx()
485 (musb_ep->packet_sz - 1))))) in musb_g_tx()
502 musb_g_giveback(musb_ep, request, 0); in musb_g_tx()
512 req = musb_ep->desc ? next_request(musb_ep) : NULL; in musb_g_tx()
515 musb_ep->end_point.name); in musb_g_tx()
533 struct musb_ep *musb_ep; in rxstate() local
542 musb_ep = &hw_ep->ep_in; in rxstate()
544 musb_ep = &hw_ep->ep_out; in rxstate()
546 fifo_count = musb_ep->packet_sz; in rxstate()
549 if (!musb_ep->desc) { in rxstate()
551 musb_ep->end_point.name); in rxstate()
556 if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) { in rxstate()
563 musb_ep->end_point.name, csr); in rxstate()
569 struct dma_channel *channel = musb_ep->dma; in rxstate()
577 musb_ep->packet_sz, in rxstate()
603 if (request->short_not_ok && fifo_count == musb_ep->packet_sz) in rxstate()
619 channel = musb_ep->dma; in rxstate()
662 musb_ep->dma->desired_mode = 1; in rxstate()
664 if (!musb_ep->hb_mult && in rxstate()
665 musb_ep->hw_ep->rx_double_buffered) in rxstate()
672 musb_ep->dma->desired_mode = 0; in rxstate()
677 musb_ep->packet_sz, in rxstate()
695 channel = musb_ep->dma; in rxstate()
698 if (fifo_count < musb_ep->packet_sz) in rxstate()
717 if (transfer_size <= musb_ep->packet_sz) { in rxstate()
718 musb_ep->dma->desired_mode = 0; in rxstate()
720 musb_ep->dma->desired_mode = 1; in rxstate()
727 musb_ep->packet_sz, in rxstate()
738 musb_ep->end_point.name, in rxstate()
740 musb_ep->packet_sz); in rxstate()
746 struct dma_channel *channel = musb_ep->dma; in rxstate()
751 musb_ep->packet_sz, in rxstate()
774 musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *) in rxstate()
791 fifo_count < musb_ep->packet_sz) in rxstate()
792 musb_g_giveback(musb_ep, request, 0); in rxstate()
804 struct musb_ep *musb_ep; in musb_g_rx() local
810 musb_ep = &hw_ep->ep_in; in musb_g_rx()
812 musb_ep = &hw_ep->ep_out; in musb_g_rx()
816 req = next_request(musb_ep); in musb_g_rx()
824 dma = is_dma_capable() ? musb_ep->dma : NULL; in musb_g_rx()
826 musb_dbg(musb, "<== %s, rxcsr %04x%s %p", musb_ep->end_point.name, in musb_g_rx()
841 musb_dbg(musb, "%s iso overrun on %p", musb_ep->name, request); in musb_g_rx()
847 musb_dbg(musb, "%s, incomprx", musb_ep->end_point.name); in musb_g_rx()
853 musb_ep->end_point.name, csr); in musb_g_rx()
864 request->actual += musb_ep->dma->actual_len; in musb_g_rx()
871 & (musb_ep->packet_sz - 1))) { in musb_g_rx()
879 && (musb_ep->dma->actual_len in musb_g_rx()
880 == musb_ep->packet_sz)) { in musb_g_rx()
891 musb_g_giveback(musb_ep, request, 0); in musb_g_rx()
902 req = next_request(musb_ep); in musb_g_rx()
920 struct musb_ep *musb_ep; in musb_gadget_enable() local
933 musb_ep = to_musb_ep(ep); in musb_gadget_enable()
934 hw_ep = musb_ep->hw_ep; in musb_gadget_enable()
936 musb = musb_ep->musb; in musb_gadget_enable()
938 epnum = musb_ep->current_epnum; in musb_gadget_enable()
942 if (musb_ep->desc) { in musb_gadget_enable()
946 musb_ep->type = usb_endpoint_type(desc); in musb_gadget_enable()
966 musb_ep->hb_mult = tmp; in musb_gadget_enable()
968 musb_ep->hb_mult = 0; in musb_gadget_enable()
971 musb_ep->packet_sz = usb_endpoint_maxp(desc); in musb_gadget_enable()
972 tmp = musb_ep->packet_sz * (musb_ep->hb_mult + 1); in musb_gadget_enable()
981 musb_ep->is_in = 1; in musb_gadget_enable()
982 if (!musb_ep->is_in) in musb_gadget_enable()
999 if (can_bulk_split(musb, musb_ep->type)) in musb_gadget_enable()
1000 musb_ep->hb_mult = (hw_ep->max_packet_sz_tx / in musb_gadget_enable()
1001 musb_ep->packet_sz) - 1; in musb_gadget_enable()
1002 musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz in musb_gadget_enable()
1003 | (musb_ep->hb_mult << 11)); in musb_gadget_enable()
1009 if (musb_ep->type == USB_ENDPOINT_XFER_ISOC) in musb_gadget_enable()
1020 musb_ep->is_in = 0; in musb_gadget_enable()
1021 if (musb_ep->is_in) in musb_gadget_enable()
1038 musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz in musb_gadget_enable()
1039 | (musb_ep->hb_mult << 11)); in musb_gadget_enable()
1049 if (musb_ep->type == USB_ENDPOINT_XFER_ISOC) in musb_gadget_enable()
1051 else if (musb_ep->type == USB_ENDPOINT_XFER_INT) in musb_gadget_enable()
1065 musb_ep->dma = c->channel_alloc(c, hw_ep, in musb_gadget_enable()
1068 musb_ep->dma = NULL; in musb_gadget_enable()
1070 musb_ep->desc = desc; in musb_gadget_enable()
1071 musb_ep->busy = 0; in musb_gadget_enable()
1072 musb_ep->wedged = 0; in musb_gadget_enable()
1076 musb_driver_name, musb_ep->end_point.name, in musb_gadget_enable()
1077 musb_ep_xfertype_string(musb_ep->type), in musb_gadget_enable()
1078 musb_ep->is_in ? "IN" : "OUT", in musb_gadget_enable()
1079 musb_ep->dma ? "dma, " : "", in musb_gadget_enable()
1080 musb_ep->packet_sz); in musb_gadget_enable()
1097 struct musb_ep *musb_ep; in musb_gadget_disable() local
1101 musb_ep = to_musb_ep(ep); in musb_gadget_disable()
1102 musb = musb_ep->musb; in musb_gadget_disable()
1103 epnum = musb_ep->current_epnum; in musb_gadget_disable()
1110 if (musb_ep->is_in) { in musb_gadget_disable()
1121 nuke(musb_ep, -ESHUTDOWN); in musb_gadget_disable()
1123 musb_ep->desc = NULL; in musb_gadget_disable()
1124 musb_ep->end_point.desc = NULL; in musb_gadget_disable()
1130 musb_dbg(musb, "%s", musb_ep->end_point.name); in musb_gadget_disable()
1141 struct musb_ep *musb_ep = to_musb_ep(ep); in musb_alloc_request() local
1149 request->epnum = musb_ep->current_epnum; in musb_alloc_request()
1150 request->ep = musb_ep; in musb_alloc_request()
1202 struct musb_ep *musb_ep; in musb_gadget_queue() local
1213 musb_ep = to_musb_ep(ep); in musb_gadget_queue()
1214 musb = musb_ep->musb; in musb_gadget_queue()
1219 if (request->ep != musb_ep) in musb_gadget_queue()
1238 request->epnum = musb_ep->current_epnum; in musb_gadget_queue()
1239 request->tx = musb_ep->is_in; in musb_gadget_queue()
1241 map_dma_buffer(request, musb, musb_ep); in musb_gadget_queue()
1246 if (!musb_ep->desc) { in musb_gadget_queue()
1255 list_add_tail(&request->list, &musb_ep->req_list); in musb_gadget_queue()
1258 if (!musb_ep->busy && &request->list == musb_ep->req_list.next) { in musb_gadget_queue()
1277 struct musb_ep *musb_ep = to_musb_ep(ep); in musb_gadget_dequeue() local
1282 struct musb *musb = musb_ep->musb; in musb_gadget_dequeue()
1284 if (!ep || !request || req->ep != musb_ep) in musb_gadget_dequeue()
1291 list_for_each_entry(r, &musb_ep->req_list, list) { in musb_gadget_dequeue()
1303 if (musb_ep->req_list.next != &req->list || musb_ep->busy) in musb_gadget_dequeue()
1304 musb_g_giveback(musb_ep, request, -ECONNRESET); in musb_gadget_dequeue()
1307 else if (is_dma_capable() && musb_ep->dma) { in musb_gadget_dequeue()
1310 musb_ep_select(musb->mregs, musb_ep->current_epnum); in musb_gadget_dequeue()
1312 status = c->channel_abort(musb_ep->dma); in musb_gadget_dequeue()
1316 musb_g_giveback(musb_ep, request, -ECONNRESET); in musb_gadget_dequeue()
1321 musb_g_giveback(musb_ep, request, -ECONNRESET); in musb_gadget_dequeue()
1337 struct musb_ep *musb_ep = to_musb_ep(ep); in musb_gadget_set_halt() local
1338 u8 epnum = musb_ep->current_epnum; in musb_gadget_set_halt()
1339 struct musb *musb = musb_ep->musb; in musb_gadget_set_halt()
1353 if ((USB_ENDPOINT_XFER_ISOC == musb_ep->type)) { in musb_gadget_set_halt()
1360 request = next_request(musb_ep); in musb_gadget_set_halt()
1369 if (musb_ep->is_in) { in musb_gadget_set_halt()
1379 musb_ep->wedged = 0; in musb_gadget_set_halt()
1383 if (musb_ep->is_in) { in musb_gadget_set_halt()
1408 if (!musb_ep->busy && !value && request) { in musb_gadget_set_halt()
1423 struct musb_ep *musb_ep = to_musb_ep(ep); in musb_gadget_set_wedge() local
1428 musb_ep->wedged = 1; in musb_gadget_set_wedge()
1435 struct musb_ep *musb_ep = to_musb_ep(ep); in musb_gadget_fifo_status() local
1436 void __iomem *epio = musb_ep->hw_ep->regs; in musb_gadget_fifo_status()
1439 if (musb_ep->desc && !musb_ep->is_in) { in musb_gadget_fifo_status()
1440 struct musb *musb = musb_ep->musb; in musb_gadget_fifo_status()
1441 int epnum = musb_ep->current_epnum; in musb_gadget_fifo_status()
1458 struct musb_ep *musb_ep = to_musb_ep(ep); in musb_gadget_fifo_flush() local
1459 struct musb *musb = musb_ep->musb; in musb_gadget_fifo_flush()
1460 u8 epnum = musb_ep->current_epnum; in musb_gadget_fifo_flush()
1474 if (musb_ep->is_in) { in musb_gadget_fifo_flush()
1702 init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in) in init_peripheral_ep()