Commit 4927b1ab authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Santosh Shilimkar

dmaengine: ti: k3-udma: Switch to k3_ringacc_request_rings_pair

We only request ring pairs via K3 DMA driver, switch to use the new
k3_ringacc_request_rings_pair() to simplify the code.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Acked-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
parent 40a2a7c3
...@@ -271,20 +271,12 @@ struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev, ...@@ -271,20 +271,12 @@ struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev,
atomic_set(&tx_chn->free_pkts, cfg->txcq_cfg.size); atomic_set(&tx_chn->free_pkts, cfg->txcq_cfg.size);
/* request and cfg rings */ /* request and cfg rings */
tx_chn->ringtx = k3_ringacc_request_ring(tx_chn->common.ringacc, ret = k3_ringacc_request_rings_pair(tx_chn->common.ringacc,
tx_chn->udma_tchan_id, 0); tx_chn->udma_tchan_id, -1,
if (!tx_chn->ringtx) { &tx_chn->ringtx,
ret = -ENODEV; &tx_chn->ringtxcq);
dev_err(dev, "Failed to get TX ring %u\n", if (ret) {
tx_chn->udma_tchan_id); dev_err(dev, "Failed to get TX/TXCQ rings %d\n", ret);
goto err;
}
tx_chn->ringtxcq = k3_ringacc_request_ring(tx_chn->common.ringacc,
-1, 0);
if (!tx_chn->ringtxcq) {
ret = -ENODEV;
dev_err(dev, "Failed to get TXCQ ring\n");
goto err; goto err;
} }
...@@ -587,22 +579,16 @@ static int k3_udma_glue_cfg_rx_flow(struct k3_udma_glue_rx_channel *rx_chn, ...@@ -587,22 +579,16 @@ static int k3_udma_glue_cfg_rx_flow(struct k3_udma_glue_rx_channel *rx_chn,
} }
/* request and cfg rings */ /* request and cfg rings */
flow->ringrx = k3_ringacc_request_ring(rx_chn->common.ringacc, ret = k3_ringacc_request_rings_pair(rx_chn->common.ringacc,
flow_cfg->ring_rxq_id, 0); flow_cfg->ring_rxq_id,
if (!flow->ringrx) { flow_cfg->ring_rxfdq0_id,
ret = -ENODEV; &flow->ringrxfdq,
dev_err(dev, "Failed to get RX ring\n"); &flow->ringrx);
if (ret) {
dev_err(dev, "Failed to get RX/RXFDQ rings %d\n", ret);
goto err_rflow_put; goto err_rflow_put;
} }
flow->ringrxfdq = k3_ringacc_request_ring(rx_chn->common.ringacc,
flow_cfg->ring_rxfdq0_id, 0);
if (!flow->ringrxfdq) {
ret = -ENODEV;
dev_err(dev, "Failed to get RXFDQ ring\n");
goto err_ringrx_free;
}
ret = k3_ringacc_ring_cfg(flow->ringrx, &flow_cfg->rx_cfg); ret = k3_ringacc_ring_cfg(flow->ringrx, &flow_cfg->rx_cfg);
if (ret) { if (ret) {
dev_err(dev, "Failed to cfg ringrx %d\n", ret); dev_err(dev, "Failed to cfg ringrx %d\n", ret);
...@@ -673,8 +659,6 @@ static int k3_udma_glue_cfg_rx_flow(struct k3_udma_glue_rx_channel *rx_chn, ...@@ -673,8 +659,6 @@ static int k3_udma_glue_cfg_rx_flow(struct k3_udma_glue_rx_channel *rx_chn,
err_ringrxfdq_free: err_ringrxfdq_free:
k3_ringacc_ring_free(flow->ringrxfdq); k3_ringacc_ring_free(flow->ringrxfdq);
err_ringrx_free:
k3_ringacc_ring_free(flow->ringrx); k3_ringacc_ring_free(flow->ringrx);
err_rflow_put: err_rflow_put:
......
...@@ -1418,17 +1418,12 @@ static int udma_alloc_tx_resources(struct udma_chan *uc) ...@@ -1418,17 +1418,12 @@ static int udma_alloc_tx_resources(struct udma_chan *uc)
if (ret) if (ret)
return ret; return ret;
uc->tchan->t_ring = k3_ringacc_request_ring(ud->ringacc, ret = k3_ringacc_request_rings_pair(ud->ringacc, uc->tchan->id, -1,
uc->tchan->id, 0); &uc->tchan->t_ring,
if (!uc->tchan->t_ring) { &uc->tchan->tc_ring);
ret = -EBUSY; if (ret) {
goto err_tx_ring;
}
uc->tchan->tc_ring = k3_ringacc_request_ring(ud->ringacc, -1, 0);
if (!uc->tchan->tc_ring) {
ret = -EBUSY; ret = -EBUSY;
goto err_txc_ring; goto err_ring;
} }
memset(&ring_cfg, 0, sizeof(ring_cfg)); memset(&ring_cfg, 0, sizeof(ring_cfg));
...@@ -1447,10 +1442,9 @@ static int udma_alloc_tx_resources(struct udma_chan *uc) ...@@ -1447,10 +1442,9 @@ static int udma_alloc_tx_resources(struct udma_chan *uc)
err_ringcfg: err_ringcfg:
k3_ringacc_ring_free(uc->tchan->tc_ring); k3_ringacc_ring_free(uc->tchan->tc_ring);
uc->tchan->tc_ring = NULL; uc->tchan->tc_ring = NULL;
err_txc_ring:
k3_ringacc_ring_free(uc->tchan->t_ring); k3_ringacc_ring_free(uc->tchan->t_ring);
uc->tchan->t_ring = NULL; uc->tchan->t_ring = NULL;
err_tx_ring: err_ring:
udma_put_tchan(uc); udma_put_tchan(uc);
return ret; return ret;
...@@ -1499,16 +1493,11 @@ static int udma_alloc_rx_resources(struct udma_chan *uc) ...@@ -1499,16 +1493,11 @@ static int udma_alloc_rx_resources(struct udma_chan *uc)
rflow = uc->rflow; rflow = uc->rflow;
fd_ring_id = ud->tchan_cnt + ud->echan_cnt + uc->rchan->id; fd_ring_id = ud->tchan_cnt + ud->echan_cnt + uc->rchan->id;
rflow->fd_ring = k3_ringacc_request_ring(ud->ringacc, fd_ring_id, 0); ret = k3_ringacc_request_rings_pair(ud->ringacc, fd_ring_id, -1,
if (!rflow->fd_ring) { &rflow->fd_ring, &rflow->r_ring);
ret = -EBUSY; if (ret) {
goto err_rx_ring;
}
rflow->r_ring = k3_ringacc_request_ring(ud->ringacc, -1, 0);
if (!rflow->r_ring) {
ret = -EBUSY; ret = -EBUSY;
goto err_rxc_ring; goto err_ring;
} }
memset(&ring_cfg, 0, sizeof(ring_cfg)); memset(&ring_cfg, 0, sizeof(ring_cfg));
...@@ -1533,10 +1522,9 @@ static int udma_alloc_rx_resources(struct udma_chan *uc) ...@@ -1533,10 +1522,9 @@ static int udma_alloc_rx_resources(struct udma_chan *uc)
err_ringcfg: err_ringcfg:
k3_ringacc_ring_free(rflow->r_ring); k3_ringacc_ring_free(rflow->r_ring);
rflow->r_ring = NULL; rflow->r_ring = NULL;
err_rxc_ring:
k3_ringacc_ring_free(rflow->fd_ring); k3_ringacc_ring_free(rflow->fd_ring);
rflow->fd_ring = NULL; rflow->fd_ring = NULL;
err_rx_ring: err_ring:
udma_put_rflow(uc); udma_put_rflow(uc);
err_rflow: err_rflow:
udma_put_rchan(uc); udma_put_rchan(uc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment