diff options
author | Vignesh Raghavendra <vigneshr@ti.com> | 2020-07-06 13:26:23 +0530 |
---|---|---|
committer | Lokesh Vutla <lokeshvutla@ti.com> | 2020-07-13 20:58:34 +0530 |
commit | 5d257849987fbeab96bf8cd953cab7c825a9b359 (patch) | |
tree | 10b379164ba8280b32d61ba4500a293b4cfffda6 /drivers | |
parent | db08a1df430d5a4f87cc72901b7581b86eb89742 (diff) | |
download | u-boot-5d257849987fbeab96bf8cd953cab7c825a9b359.zip u-boot-5d257849987fbeab96bf8cd953cab7c825a9b359.tar.gz u-boot-5d257849987fbeab96bf8cd953cab7c825a9b359.tar.bz2 |
soc: ti: k3-ringacc: Add an API to request pair of rings
Add new API k3_ringacc_request_rings_pair() to request pair of rings at
once, as in the most case Rings are used with DMA channels which required
to request pair of rings - one to feed DMA with descriptors (TX/RX FDQ) and
one to receive completions (RX/TX CQ). This will allow to simplify Ringacc
API users.
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/soc/ti/k3-navss-ringacc.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/soc/ti/k3-navss-ringacc.c b/drivers/soc/ti/k3-navss-ringacc.c index f31ffaf..81de75a 100644 --- a/drivers/soc/ti/k3-navss-ringacc.c +++ b/drivers/soc/ti/k3-navss-ringacc.c @@ -321,6 +321,29 @@ error: return NULL; } +int k3_nav_ringacc_request_rings_pair(struct k3_nav_ringacc *ringacc, + int fwd_id, int compl_id, + struct k3_nav_ring **fwd_ring, + struct k3_nav_ring **compl_ring) +{ + int ret = 0; + + if (!fwd_ring || !compl_ring) + return -EINVAL; + + *fwd_ring = k3_nav_ringacc_request_ring(ringacc, fwd_id, 0); + if (!(*fwd_ring)) + return -ENODEV; + + *compl_ring = k3_nav_ringacc_request_ring(ringacc, compl_id, 0); + if (!(*compl_ring)) { + k3_nav_ringacc_ring_free(*fwd_ring); + ret = -ENODEV; + } + + return ret; +} + static void k3_ringacc_ring_reset_sci(struct k3_nav_ring *ring) { struct k3_nav_ringacc *ringacc = ring->parent; |