Lines Matching refs: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()
250 struct mtu3 *mtu = mep->mtu; in mtu3_prepare_tx_gpd() local
256 ext_addr = GPD_EXT_BUF(mtu, upper_32_bits(req->dma)); in mtu3_prepare_tx_gpd()
257 gpd->dw3_info = cpu_to_le32(GPD_DATA_LEN(mtu, req->length)); in mtu3_prepare_tx_gpd()
262 dev_dbg(mep->mtu->dev, "TX-EP%d queue gpd=%p, enq=%p, qdma=%pad\n", in mtu3_prepare_tx_gpd()
267 ext_addr |= GPD_EXT_NGP(mtu, upper_32_bits(enq_dma)); in mtu3_prepare_tx_gpd()
271 if (mtu->gen2cp) in mtu3_prepare_tx_gpd()
293 struct mtu3 *mtu = mep->mtu; in mtu3_prepare_rx_gpd() local
299 ext_addr = GPD_EXT_BUF(mtu, upper_32_bits(req->dma)); in mtu3_prepare_rx_gpd()
300 gpd->dw0_info = cpu_to_le32(GPD_RX_BUF_LEN(mtu, req->length)); in mtu3_prepare_rx_gpd()
305 dev_dbg(mep->mtu->dev, "RX-EP%d queue gpd=%p, enq=%p, qdma=%pad\n", in mtu3_prepare_rx_gpd()
310 ext_addr |= GPD_EXT_NGP(mtu, upper_32_bits(enq_dma)); in mtu3_prepare_rx_gpd()
333 struct mtu3 *mtu = mep->mtu; in mtu3_qmu_start() local
334 void __iomem *mbase = mtu->mac_base; in mtu3_qmu_start()
348 dev_warn(mtu->dev, "Tx %d Active Now!\n", epnum); in mtu3_qmu_start()
365 dev_warn(mtu->dev, "Rx %d Active Now!\n", epnum); in mtu3_qmu_start()
377 struct mtu3 *mtu = mep->mtu; in mtu3_qmu_stop() local
378 void __iomem *mbase = mtu->mac_base; in mtu3_qmu_stop()
387 dev_dbg(mtu->dev, "%s's qmu is inactive now!\n", mep->name); in mtu3_qmu_stop()
395 dev_err(mtu->dev, "stop %s's qmu failed\n", mep->name); in mtu3_qmu_stop()
399 dev_dbg(mtu->dev, "%s's qmu stop now!\n", mep->name); in mtu3_qmu_stop()
405 dev_dbg(mep->mtu->dev, "%s flush QMU %s\n", __func__, in mtu3_qmu_flush()
418 static void qmu_tx_zlp_error_handler(struct mtu3 *mtu, u8 epnum) in qmu_tx_zlp_error_handler() argument
420 struct mtu3_ep *mep = mtu->in_eps + epnum; in qmu_tx_zlp_error_handler()
422 void __iomem *mbase = mtu->mac_base; in qmu_tx_zlp_error_handler()
436 if (GPD_DATA_LEN(mtu, le32_to_cpu(gpd_current->dw3_info)) != 0) { in qmu_tx_zlp_error_handler()
437 dev_err(mtu->dev, "TX EP%d buffer length error(!=0)\n", epnum); in qmu_tx_zlp_error_handler()
441 dev_dbg(mtu->dev, "%s send ZLP for req=%p\n", __func__, mreq); in qmu_tx_zlp_error_handler()
449 dev_err(mtu->dev, "%s wait for fifo empty fail\n", __func__); in qmu_tx_zlp_error_handler()
470 static void qmu_done_tx(struct mtu3 *mtu, u8 epnum) in qmu_done_tx() argument
472 struct mtu3_ep *mep = mtu->in_eps + epnum; in qmu_done_tx()
474 void __iomem *mbase = mtu->mac_base; in qmu_done_tx()
485 dev_dbg(mtu->dev, "%s EP%d, last=%p, current=%p, enq=%p\n", in qmu_done_tx()
493 dev_err(mtu->dev, "no correct TX req is found\n"); in qmu_done_tx()
498 request->actual = GPD_DATA_LEN(mtu, le32_to_cpu(gpd->dw3_info)); in qmu_done_tx()
505 dev_dbg(mtu->dev, "%s EP%d, deq=%p, enq=%p, complete\n", in qmu_done_tx()
510 static void qmu_done_rx(struct mtu3 *mtu, u8 epnum) in qmu_done_rx() argument
512 struct mtu3_ep *mep = mtu->out_eps + epnum; in qmu_done_rx()
514 void __iomem *mbase = mtu->mac_base; in qmu_done_rx()
524 dev_dbg(mtu->dev, "%s EP%d, last=%p, current=%p, enq=%p\n", in qmu_done_rx()
532 dev_err(mtu->dev, "no correct RX req is found\n"); in qmu_done_rx()
537 req->actual = GPD_DATA_LEN(mtu, le32_to_cpu(gpd->dw3_info)); in qmu_done_rx()
544 dev_dbg(mtu->dev, "%s EP%d, deq=%p, enq=%p, complete\n", in qmu_done_rx()
548 static void qmu_done_isr(struct mtu3 *mtu, u32 done_status) in qmu_done_isr() argument
552 for (i = 1; i < mtu->num_eps; i++) { in qmu_done_isr()
554 qmu_done_rx(mtu, i); in qmu_done_isr()
556 qmu_done_tx(mtu, i); in qmu_done_isr()
560 static void qmu_exception_isr(struct mtu3 *mtu, u32 qmu_status) in qmu_exception_isr() argument
562 void __iomem *mbase = mtu->mac_base; in qmu_exception_isr()
568 for (i = 1; i < mtu->num_eps; i++) { in qmu_exception_isr()
570 dev_err(mtu->dev, "Rx %d CS error!\n", i); in qmu_exception_isr()
573 dev_err(mtu->dev, "RX %d Length error\n", i); in qmu_exception_isr()
580 for (i = 1; i < mtu->num_eps; i++) { in qmu_exception_isr()
582 dev_dbg(mtu->dev, "RX EP%d Recv ZLP\n", i); in qmu_exception_isr()
589 for (i = 1; i < mtu->num_eps; i++) { in qmu_exception_isr()
591 dev_err(mtu->dev, "Tx %d checksum error!\n", i); in qmu_exception_isr()
594 qmu_tx_zlp_error_handler(mtu, i); in qmu_exception_isr()
600 irqreturn_t mtu3_qmu_isr(struct mtu3 *mtu) in mtu3_qmu_isr() argument
602 void __iomem *mbase = mtu->mac_base; in mtu3_qmu_isr()
613 dev_dbg(mtu->dev, "=== QMUdone[tx=%x, rx=%x] QMUexp[%x] ===\n", in mtu3_qmu_isr()
619 qmu_done_isr(mtu, qmu_done_status); in mtu3_qmu_isr()
622 qmu_exception_isr(mtu, qmu_status); in mtu3_qmu_isr()
627 int mtu3_qmu_init(struct mtu3 *mtu) in mtu3_qmu_init() argument
632 mtu->qmu_gpd_pool = dma_pool_create("QMU_GPD", mtu->dev, in mtu3_qmu_init()
635 if (!mtu->qmu_gpd_pool) in mtu3_qmu_init()
641 void mtu3_qmu_exit(struct mtu3 *mtu) in mtu3_qmu_exit() argument
643 dma_pool_destroy(mtu->qmu_gpd_pool); in mtu3_qmu_exit()