]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
soc: ti: k3-ringacc: Add an API to request pair of rings
authorVignesh Raghavendra <vigneshr@ti.com>
Mon, 6 Jul 2020 07:56:23 +0000 (13:26 +0530)
committerLokesh Vutla <lokeshvutla@ti.com>
Mon, 13 Jul 2020 15:28:34 +0000 (20:58 +0530)
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>
drivers/soc/ti/k3-navss-ringacc.c
include/linux/soc/ti/k3-navss-ringacc.h

index f31ffaf5aed3ab613ac6e05e0cbd368a1633002b..81de75af2075ee9acd8e30d42800c24e020d9042 100644 (file)
@@ -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;
index 7b027f8bd4b7fed96d24803153ba1c5e4c43988e..9176277ff0bcc8cb98dc969ad67c7f65439ab83b 100644 (file)
@@ -100,6 +100,10 @@ struct k3_nav_ring_cfg {
 struct k3_nav_ring *k3_nav_ringacc_request_ring(struct k3_nav_ringacc *ringacc,
                                                int id, u32 flags);
 
+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);
 /**
  * k3_nav_ringacc_get_dev - get pointer on RA device
  * @ringacc: pointer on RA