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.
308 struct iudma_ch iudma[BCM63XX_NUM_IUDMA];
565 udc->iudma[i].max_pkt = max_pkt;
585 * @iudma: IUDMA channel to use.
595 static void iudma_write(struct bcm63xx_udc *udc, struct iudma_ch *iudma,
600 const int max_bd_bytes = !irq_coalesce && !iudma->is_tx ?
601 iudma->max_pkt : IUDMA_MAX_FRAGMENT;
603 iudma->n_bds_used = 0;
605 breq->iudma = iudma;
607 if ((bytes_left % iudma->max_pkt == 0) && bytes_left && breq->req.zero)
611 struct bcm_enet_desc *d = iudma->write_bd;
615 if (d == iudma->end_bd) {
617 iudma->write_bd = iudma->bd_ring;
619 iudma->write_bd++;
621 iudma->n_bds_used++;
643 if (!iudma->is_tx || iudma->n_bds_used == iudma->n_bds ||
659 ENETDMAC_CHANCFG_REG, iudma->ch_idx);
665 * @iudma: IUDMA channel to use.
671 static int iudma_read(struct bcm63xx_udc *udc, struct iudma_ch *iudma)
674 struct bcm_enet_desc *d = iudma->read_bd;
676 if (!iudma->n_bds_used)
679 for (i = 0; i < iudma->n_bds_used; i++) {
689 if (d == iudma->end_bd)
690 d = iudma->bd_ring;
695 iudma->read_bd = d;
696 iudma->n_bds_used = 0;
703 * @iudma: IUDMA channel to reset.
705 static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma)
709 int ch_idx = iudma->ch_idx;
711 if (!iudma->is_tx)
712 bcm63xx_fifo_reset_ep(udc, max(0, iudma->ep_num));
722 if (iudma->is_tx && iudma->ep_num >= 0)
723 bcm63xx_fifo_reset_ep(udc, iudma->ep_num);
740 for (d = iudma->bd_ring; d <= iudma->end_bd; d++)
744 iudma->read_bd = iudma->write_bd = iudma->bd_ring;
745 iudma->n_bds_used = 0;
752 usb_dmas_writel(udc, iudma->bd_ring_dma, ENETDMAS_RSTART_REG, ch_idx);
763 struct iudma_ch *iudma = &udc->iudma[ch_idx];
768 iudma->ep_num = cfg->ep_num;
769 iudma->ch_idx = ch_idx;
770 iudma->is_tx = !!(ch_idx & 0x01);
771 if (iudma->ep_num >= 0) {
772 bep = &udc->bep[iudma->ep_num];
773 bep->iudma = iudma;
777 iudma->bep = bep;
778 iudma->udc = udc;
781 if (iudma->ep_num <= 0)
782 iudma->enabled = true;
784 iudma->n_bds = n_bds;
785 iudma->bd_ring = dmam_alloc_coherent(udc->dev,
787 &iudma->bd_ring_dma, GFP_KERNEL);
788 if (!iudma->bd_ring)
790 iudma->end_bd = &iudma->bd_ring[n_bds - 1];
811 iudma_reset_channel(udc, &udc->iudma[i]);
831 iudma_reset_channel(udc, &udc->iudma[i]);
1038 struct iudma_ch *iudma = bep->iudma;
1048 if (iudma->enabled) {
1053 iudma->enabled = true;
1056 iudma_reset_channel(udc, iudma);
1077 struct iudma_ch *iudma = bep->iudma;
1085 if (!iudma->enabled) {
1089 iudma->enabled = false;
1091 iudma_reset_channel(udc, iudma);
1096 iudma->is_tx);
1101 usb_gadget_giveback_request(&iudma->bep->ep, &breq->req);
1180 if (!bep->iudma->enabled) {
1185 rc = usb_gadget_map_request(&udc->gadget, req, bep->iudma->is_tx);
1189 iudma_write(udc, bep->iudma, breq);
1221 usb_gadget_unmap_request(&udc->gadget, &breq->req, bep->iudma->is_tx);
1224 iudma_reset_channel(udc, bep->iudma);
1232 iudma_write(udc, bep->iudma, next);
1388 struct iudma_ch *iudma = &udc->iudma[ch_idx];
1395 usb_gadget_map_request(&udc->gadget, req, iudma->is_tx);
1396 iudma_write(udc, iudma, breq);
1553 iudma_reset_channel(udc, &udc->iudma[IUDMA_EP0_RXCHAN]);
1630 iudma_reset_channel(udc, &udc->iudma[IUDMA_EP0_TXCHAN]);
1656 iudma_reset_channel(udc, &udc->iudma[IUDMA_EP0_RXCHAN]);
1675 iudma_reset_channel(udc, &udc->iudma[IUDMA_EP0_TXCHAN]);
2044 struct iudma_ch *iudma = dev_id;
2045 struct bcm63xx_udc *udc = iudma->udc;
2055 ENETDMAC_IR_REG, iudma->ch_idx);
2056 bep = iudma->bep;
2057 rc = iudma_read(udc, iudma);
2060 if (iudma->ch_idx == IUDMA_EP0_RXCHAN ||
2061 iudma->ch_idx == IUDMA_EP0_TXCHAN) {
2078 iudma_write(udc, iudma, breq);
2099 iudma_write(udc, iudma, next);
2102 iudma_write(udc, iudma, breq);
2109 usb_gadget_unmap_request(&udc->gadget, req, iudma->is_tx);
2165 * This file nominally shows up as /sys/kernel/debug/bcm63xx_udc/iudma
2177 struct iudma_ch *iudma = &udc->iudma[ch_idx];
2208 seq_printf(s, " desc: %d/%d used", iudma->n_bds_used,
2209 iudma->n_bds);
2211 if (iudma->bep) {
2213 list_for_each(pos, &iudma->bep->queue)
2220 for (i = 0; i < iudma->n_bds; i++) {
2221 struct bcm_enet_desc *d = &iudma->bd_ring[i];
2227 if (d == iudma->read_bd)
2229 if (d == iudma->write_bd)
2256 debugfs_create_file("iudma", 0400, root, udc, &bcm63xx_iudma_dbg_fops);
2341 dev_name(dev), &udc->iudma[i]) < 0)