Lines Matching refs:ring

55 static struct qmu_gpd *gpd_dma_to_virt(struct mtu3_gpd_ring *ring,  in gpd_dma_to_virt()  argument
58 dma_addr_t dma_base = ring->dma; in gpd_dma_to_virt()
59 struct qmu_gpd *gpd_head = ring->start; in gpd_dma_to_virt()
68 static dma_addr_t gpd_virt_to_dma(struct mtu3_gpd_ring *ring, in gpd_virt_to_dma() argument
71 dma_addr_t dma_base = ring->dma; in gpd_virt_to_dma()
72 struct qmu_gpd *gpd_head = ring->start; in gpd_virt_to_dma()
82 static void gpd_ring_init(struct mtu3_gpd_ring *ring, struct qmu_gpd *gpd) in gpd_ring_init() argument
84 ring->start = gpd; in gpd_ring_init()
85 ring->enqueue = gpd; in gpd_ring_init()
86 ring->dequeue = gpd; in gpd_ring_init()
87 ring->end = gpd + MAX_GPD_NUM - 1; in gpd_ring_init()
92 struct mtu3_gpd_ring *ring = &mep->gpd_ring; in reset_gpd_list() local
93 struct qmu_gpd *gpd = ring->start; in reset_gpd_list()
97 gpd_ring_init(ring, gpd); in reset_gpd_list()
105 struct mtu3_gpd_ring *ring = &mep->gpd_ring; in mtu3_gpd_ring_alloc() local
113 ring->dma = (dma_addr_t)gpd; in mtu3_gpd_ring_alloc()
114 gpd_ring_init(ring, gpd); in mtu3_gpd_ring_alloc()
121 struct mtu3_gpd_ring *ring = &mep->gpd_ring; in mtu3_gpd_ring_free() local
123 kfree(ring->start); in mtu3_gpd_ring_free()
124 memset(ring, 0, sizeof(*ring)); in mtu3_gpd_ring_free()
141 static struct qmu_gpd *advance_enq_gpd(struct mtu3_gpd_ring *ring) in advance_enq_gpd() argument
143 if (ring->enqueue < ring->end) in advance_enq_gpd()
144 ring->enqueue++; in advance_enq_gpd()
146 ring->enqueue = ring->start; in advance_enq_gpd()
148 return ring->enqueue; in advance_enq_gpd()
151 static struct qmu_gpd *advance_deq_gpd(struct mtu3_gpd_ring *ring) in advance_deq_gpd() argument
153 if (ring->dequeue < ring->end) in advance_deq_gpd()
154 ring->dequeue++; in advance_deq_gpd()
156 ring->dequeue = ring->start; in advance_deq_gpd()
158 return ring->dequeue; in advance_deq_gpd()
162 static int gpd_ring_empty(struct mtu3_gpd_ring *ring) in gpd_ring_empty() argument
164 struct qmu_gpd *enq = ring->enqueue; in gpd_ring_empty()
167 if (ring->enqueue < ring->end) in gpd_ring_empty()
170 next = ring->start; in gpd_ring_empty()
173 return next == ring->dequeue; in gpd_ring_empty()
184 struct mtu3_gpd_ring *ring = &mep->gpd_ring; in mtu3_prepare_tx_gpd() local
185 struct qmu_gpd *gpd = ring->enqueue; in mtu3_prepare_tx_gpd()
195 enq = advance_enq_gpd(ring); in mtu3_prepare_tx_gpd()
200 gpd->next_gpd = cpu_to_le32((u32)gpd_virt_to_dma(ring, enq)); in mtu3_prepare_tx_gpd()
221 struct mtu3_gpd_ring *ring = &mep->gpd_ring; in mtu3_prepare_rx_gpd() local
222 struct qmu_gpd *gpd = ring->enqueue; in mtu3_prepare_rx_gpd()
232 enq = advance_enq_gpd(ring); in mtu3_prepare_rx_gpd()
237 gpd->next_gpd = cpu_to_le32((u32)gpd_virt_to_dma(ring, enq)); in mtu3_prepare_rx_gpd()
262 struct mtu3_gpd_ring *ring = &mep->gpd_ring; in mtu3_qmu_start() local
267 mtu3_writel(mbase, USB_QMU_TQSAR(epnum), ring->dma); in mtu3_qmu_start()
281 mtu3_writel(mbase, USB_QMU_RQSAR(epnum), ring->dma); in mtu3_qmu_start()
349 struct mtu3_gpd_ring *ring = &mep->gpd_ring; in qmu_done_tx() local
351 struct qmu_gpd *gpd = ring->dequeue; in qmu_done_tx()
359 gpd_current = gpd_dma_to_virt(ring, cur_gpd_dma); in qmu_done_tx()
363 __func__, epnum, gpd, gpd_current, ring->enqueue); in qmu_done_tx()
377 gpd = advance_deq_gpd(ring); in qmu_done_tx()
382 __func__, epnum, ring->dequeue, ring->enqueue); in qmu_done_tx()
388 struct mtu3_gpd_ring *ring = &mep->gpd_ring; in qmu_done_rx() local
390 struct qmu_gpd *gpd = ring->dequeue; in qmu_done_rx()
397 gpd_current = gpd_dma_to_virt(ring, cur_gpd_dma); in qmu_done_rx()
401 __func__, epnum, gpd, gpd_current, ring->enqueue); in qmu_done_rx()
415 gpd = advance_deq_gpd(ring); in qmu_done_rx()
420 __func__, epnum, ring->dequeue, ring->enqueue); in qmu_done_rx()