Lines Matching defs:iudma

232  * @iudma: Pointer to IUDMA channel state.
240 struct iudma_ch *iudma;
253 * @iudma: IUDMA channel used for the request.
260 struct iudma_ch *iudma;
275 * @iudma: Array of all IUDMA channels used by this controller.
307 struct iudma_ch iudma[BCM63XX_NUM_IUDMA];
562 udc->iudma[i].max_pkt = max_pkt;
582 * @iudma: IUDMA channel to use.
592 static void iudma_write(struct bcm63xx_udc *udc, struct iudma_ch *iudma,
597 const int max_bd_bytes = !irq_coalesce && !iudma->is_tx ?
598 iudma->max_pkt : IUDMA_MAX_FRAGMENT;
600 iudma->n_bds_used = 0;
602 breq->iudma = iudma;
604 if ((bytes_left % iudma->max_pkt == 0) && bytes_left && breq->req.zero)
608 struct bcm_enet_desc *d = iudma->write_bd;
612 if (d == iudma->end_bd) {
614 iudma->write_bd = iudma->bd_ring;
616 iudma->write_bd++;
618 iudma->n_bds_used++;
640 if (!iudma->is_tx || iudma->n_bds_used == iudma->n_bds ||
656 ENETDMAC_CHANCFG_REG, iudma->ch_idx);
662 * @iudma: IUDMA channel to use.
668 static int iudma_read(struct bcm63xx_udc *udc, struct iudma_ch *iudma)
671 struct bcm_enet_desc *d = iudma->read_bd;
673 if (!iudma->n_bds_used)
676 for (i = 0; i < iudma->n_bds_used; i++) {
686 if (d == iudma->end_bd)
687 d = iudma->bd_ring;
692 iudma->read_bd = d;
693 iudma->n_bds_used = 0;
700 * @iudma: IUDMA channel to reset.
702 static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma)
706 int ch_idx = iudma->ch_idx;
708 if (!iudma->is_tx)
709 bcm63xx_fifo_reset_ep(udc, max(0, iudma->ep_num));
719 if (iudma->is_tx && iudma->ep_num >= 0)
720 bcm63xx_fifo_reset_ep(udc, iudma->ep_num);
737 for (d = iudma->bd_ring; d <= iudma->end_bd; d++)
741 iudma->read_bd = iudma->write_bd = iudma->bd_ring;
742 iudma->n_bds_used = 0;
749 usb_dmas_writel(udc, iudma->bd_ring_dma, ENETDMAS_RSTART_REG, ch_idx);
760 struct iudma_ch *iudma = &udc->iudma[ch_idx];
765 iudma->ep_num = cfg->ep_num;
766 iudma->ch_idx = ch_idx;
767 iudma->is_tx = !!(ch_idx & 0x01);
768 if (iudma->ep_num >= 0) {
769 bep = &udc->bep[iudma->ep_num];
770 bep->iudma = iudma;
774 iudma->bep = bep;
775 iudma->udc = udc;
778 if (iudma->ep_num <= 0)
779 iudma->enabled = true;
781 iudma->n_bds = n_bds;
782 iudma->bd_ring = dmam_alloc_coherent(udc->dev,
784 &iudma->bd_ring_dma, GFP_KERNEL);
785 if (!iudma->bd_ring)
787 iudma->end_bd = &iudma->bd_ring[n_bds - 1];
808 iudma_reset_channel(udc, &udc->iudma[i]);
828 iudma_reset_channel(udc, &udc->iudma[i]);
1035 struct iudma_ch *iudma = bep->iudma;
1045 if (iudma->enabled) {
1050 iudma->enabled = true;
1053 iudma_reset_channel(udc, iudma);
1074 struct iudma_ch *iudma = bep->iudma;
1082 if (!iudma->enabled) {
1086 iudma->enabled = false;
1088 iudma_reset_channel(udc, iudma);
1093 iudma->is_tx);
1098 usb_gadget_giveback_request(&iudma->bep->ep, &breq->req);
1177 if (!bep->iudma->enabled) {
1182 rc = usb_gadget_map_request(&udc->gadget, req, bep->iudma->is_tx);
1186 iudma_write(udc, bep->iudma, breq);
1218 usb_gadget_unmap_request(&udc->gadget, &breq->req, bep->iudma->is_tx);
1221 iudma_reset_channel(udc, bep->iudma);
1229 iudma_write(udc, bep->iudma, next);
1385 struct iudma_ch *iudma = &udc->iudma[ch_idx];
1392 usb_gadget_map_request(&udc->gadget, req, iudma->is_tx);
1393 iudma_write(udc, iudma, breq);
1550 iudma_reset_channel(udc, &udc->iudma[IUDMA_EP0_RXCHAN]);
1627 iudma_reset_channel(udc, &udc->iudma[IUDMA_EP0_TXCHAN]);
1653 iudma_reset_channel(udc, &udc->iudma[IUDMA_EP0_RXCHAN]);
1672 iudma_reset_channel(udc, &udc->iudma[IUDMA_EP0_TXCHAN]);
2040 struct iudma_ch *iudma = dev_id;
2041 struct bcm63xx_udc *udc = iudma->udc;
2051 ENETDMAC_IR_REG, iudma->ch_idx);
2052 bep = iudma->bep;
2053 rc = iudma_read(udc, iudma);
2056 if (iudma->ch_idx == IUDMA_EP0_RXCHAN ||
2057 iudma->ch_idx == IUDMA_EP0_TXCHAN) {
2074 iudma_write(udc, iudma, breq);
2095 iudma_write(udc, iudma, next);
2098 iudma_write(udc, iudma, breq);
2105 usb_gadget_unmap_request(&udc->gadget, req, iudma->is_tx);
2161 * This file nominally shows up as /sys/kernel/debug/bcm63xx_udc/iudma
2173 struct iudma_ch *iudma = &udc->iudma[ch_idx];
2203 seq_printf(s, " desc: %d/%d used", iudma->n_bds_used,
2204 iudma->n_bds);
2206 if (iudma->bep)
2207 seq_printf(s, "; %zu queued\n", list_count_nodes(&iudma->bep->queue));
2211 for (i = 0; i < iudma->n_bds; i++) {
2212 struct bcm_enet_desc *d = &iudma->bd_ring[i];
2218 if (d == iudma->read_bd)
2220 if (d == iudma->write_bd)
2245 debugfs_create_file("iudma", 0400, root, udc, &bcm63xx_iudma_dbg_fops);
2334 dev_name(dev), &udc->iudma[i]) < 0)