Lines Matching full:mtu

38 #define GPD_RX_BUF_LEN(mtu, x)	\  argument
41 ((mtu)->gen2cp) ? GPD_RX_BUF_LEN_EL(x_) : GPD_RX_BUF_LEN_OG(x_); \
46 #define GPD_DATA_LEN(mtu, x) \ argument
49 ((mtu)->gen2cp) ? GPD_DATA_LEN_EL(x_) : GPD_DATA_LEN_OG(x_); \
57 #define GPD_EXT_NGP(mtu, x) \ argument
60 ((mtu)->gen2cp) ? GPD_EXT_NGP_EL(x_) : GPD_EXT_NGP_OG(x_); \
63 #define GPD_EXT_BUF(mtu, x) \ argument
66 ((mtu)->gen2cp) ? GPD_EXT_BUF_EL(x_) : GPD_EXT_BUF_OG(x_); \
171 gpd = dma_pool_zalloc(mep->mtu->qmu_gpd_pool, GFP_ATOMIC, &ring->dma); in mtu3_gpd_ring_alloc()
184 dma_pool_free(mep->mtu->qmu_gpd_pool, in mtu3_gpd_ring_free()
191 struct mtu3 *mtu = mep->mtu; in mtu3_qmu_resume() local
192 void __iomem *mbase = mtu->mac_base; in mtu3_qmu_resume()
249 struct mtu3 *mtu = mep->mtu; in mtu3_prepare_tx_gpd() local
255 ext_addr = GPD_EXT_BUF(mtu, upper_32_bits(req->dma)); in mtu3_prepare_tx_gpd()
256 gpd->dw3_info = cpu_to_le32(GPD_DATA_LEN(mtu, req->length)); in mtu3_prepare_tx_gpd()
261 dev_dbg(mep->mtu->dev, "TX-EP%d queue gpd=%p, enq=%p, qdma=%pad\n", in mtu3_prepare_tx_gpd()
266 ext_addr |= GPD_EXT_NGP(mtu, upper_32_bits(enq_dma)); in mtu3_prepare_tx_gpd()
270 if (mtu->gen2cp) in mtu3_prepare_tx_gpd()
292 struct mtu3 *mtu = mep->mtu; in mtu3_prepare_rx_gpd() local
298 ext_addr = GPD_EXT_BUF(mtu, upper_32_bits(req->dma)); in mtu3_prepare_rx_gpd()
299 gpd->dw0_info = cpu_to_le32(GPD_RX_BUF_LEN(mtu, req->length)); in mtu3_prepare_rx_gpd()
304 dev_dbg(mep->mtu->dev, "RX-EP%d queue gpd=%p, enq=%p, qdma=%pad\n", in mtu3_prepare_rx_gpd()
309 ext_addr |= GPD_EXT_NGP(mtu, upper_32_bits(enq_dma)); in mtu3_prepare_rx_gpd()
332 struct mtu3 *mtu = mep->mtu; in mtu3_qmu_start() local
333 void __iomem *mbase = mtu->mac_base; in mtu3_qmu_start()
347 dev_warn(mtu->dev, "Tx %d Active Now!\n", epnum); in mtu3_qmu_start()
364 dev_warn(mtu->dev, "Rx %d Active Now!\n", epnum); in mtu3_qmu_start()
376 struct mtu3 *mtu = mep->mtu; in mtu3_qmu_stop() local
377 void __iomem *mbase = mtu->mac_base; in mtu3_qmu_stop()
386 dev_dbg(mtu->dev, "%s's qmu is inactive now!\n", mep->name); in mtu3_qmu_stop()
394 dev_err(mtu->dev, "stop %s's qmu failed\n", mep->name); in mtu3_qmu_stop()
398 dev_dbg(mtu->dev, "%s's qmu stop now!\n", mep->name); in mtu3_qmu_stop()
404 dev_dbg(mep->mtu->dev, "%s flush QMU %s\n", __func__, in mtu3_qmu_flush()
417 static void qmu_tx_zlp_error_handler(struct mtu3 *mtu, u8 epnum) in qmu_tx_zlp_error_handler() argument
419 struct mtu3_ep *mep = mtu->in_eps + epnum; in qmu_tx_zlp_error_handler()
421 void __iomem *mbase = mtu->mac_base; in qmu_tx_zlp_error_handler()
435 if (GPD_DATA_LEN(mtu, le32_to_cpu(gpd_current->dw3_info)) != 0) { in qmu_tx_zlp_error_handler()
436 dev_err(mtu->dev, "TX EP%d buffer length error(!=0)\n", epnum); in qmu_tx_zlp_error_handler()
440 dev_dbg(mtu->dev, "%s send ZLP for req=%p\n", __func__, mreq); in qmu_tx_zlp_error_handler()
448 dev_err(mtu->dev, "%s wait for fifo empty fail\n", __func__); in qmu_tx_zlp_error_handler()
469 static void qmu_done_tx(struct mtu3 *mtu, u8 epnum) in qmu_done_tx() argument
471 struct mtu3_ep *mep = mtu->in_eps + epnum; in qmu_done_tx()
473 void __iomem *mbase = mtu->mac_base; in qmu_done_tx()
484 dev_dbg(mtu->dev, "%s EP%d, last=%p, current=%p, enq=%p\n", in qmu_done_tx()
492 dev_err(mtu->dev, "no correct TX req is found\n"); in qmu_done_tx()
497 request->actual = GPD_DATA_LEN(mtu, le32_to_cpu(gpd->dw3_info)); in qmu_done_tx()
504 dev_dbg(mtu->dev, "%s EP%d, deq=%p, enq=%p, complete\n", in qmu_done_tx()
509 static void qmu_done_rx(struct mtu3 *mtu, u8 epnum) in qmu_done_rx() argument
511 struct mtu3_ep *mep = mtu->out_eps + epnum; in qmu_done_rx()
513 void __iomem *mbase = mtu->mac_base; in qmu_done_rx()
523 dev_dbg(mtu->dev, "%s EP%d, last=%p, current=%p, enq=%p\n", in qmu_done_rx()
531 dev_err(mtu->dev, "no correct RX req is found\n"); in qmu_done_rx()
536 req->actual = GPD_DATA_LEN(mtu, le32_to_cpu(gpd->dw3_info)); in qmu_done_rx()
543 dev_dbg(mtu->dev, "%s EP%d, deq=%p, enq=%p, complete\n", in qmu_done_rx()
547 static void qmu_done_isr(struct mtu3 *mtu, u32 done_status) in qmu_done_isr() argument
551 for (i = 1; i < mtu->num_eps; i++) { in qmu_done_isr()
553 qmu_done_rx(mtu, i); in qmu_done_isr()
555 qmu_done_tx(mtu, i); in qmu_done_isr()
559 static void qmu_exception_isr(struct mtu3 *mtu, u32 qmu_status) in qmu_exception_isr() argument
561 void __iomem *mbase = mtu->mac_base; in qmu_exception_isr()
567 for (i = 1; i < mtu->num_eps; i++) { in qmu_exception_isr()
569 dev_err(mtu->dev, "Rx %d CS error!\n", i); in qmu_exception_isr()
572 dev_err(mtu->dev, "RX %d Length error\n", i); in qmu_exception_isr()
579 for (i = 1; i < mtu->num_eps; i++) { in qmu_exception_isr()
581 dev_dbg(mtu->dev, "RX EP%d Recv ZLP\n", i); in qmu_exception_isr()
588 for (i = 1; i < mtu->num_eps; i++) { in qmu_exception_isr()
590 dev_err(mtu->dev, "Tx %d checksum error!\n", i); in qmu_exception_isr()
593 qmu_tx_zlp_error_handler(mtu, i); in qmu_exception_isr()
599 irqreturn_t mtu3_qmu_isr(struct mtu3 *mtu) in mtu3_qmu_isr() argument
601 void __iomem *mbase = mtu->mac_base; in mtu3_qmu_isr()
612 dev_dbg(mtu->dev, "=== QMUdone[tx=%x, rx=%x] QMUexp[%x] ===\n", in mtu3_qmu_isr()
618 qmu_done_isr(mtu, qmu_done_status); in mtu3_qmu_isr()
621 qmu_exception_isr(mtu, qmu_status); in mtu3_qmu_isr()
626 int mtu3_qmu_init(struct mtu3 *mtu) in mtu3_qmu_init() argument
631 mtu->qmu_gpd_pool = dma_pool_create("QMU_GPD", mtu->dev, in mtu3_qmu_init()
634 if (!mtu->qmu_gpd_pool) in mtu3_qmu_init()
640 void mtu3_qmu_exit(struct mtu3 *mtu) in mtu3_qmu_exit() argument
642 dma_pool_destroy(mtu->qmu_gpd_pool); in mtu3_qmu_exit()