dma: ti: k3-udma: Do not touch RT registers before channel configuration
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Thu, 25 Apr 2019 06:38:15 +0000 (12:08 +0530)
committerTom Rini <trini@konsulko.com>
Fri, 3 May 2019 11:23:17 +0000 (07:23 -0400)
Upcoming sysfw (2019.03) will not open the channelized firewalls during
init, it only going to do so in response to the channel configuration
message.

Remove the channel state checks done before the channel configuration and
move it after the configuration for warning purposes.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
drivers/dma/ti/k3-udma.c

index e9ca09d8d3296e062ac675e0217f5f3f1f18dd04..a5fc7809bc41919c8cf964b907abbebbdb0cb8ca 100644 (file)
@@ -575,14 +575,6 @@ static int udma_get_tchan(struct udma_chan *uc)
 
        pr_debug("chan%d: got tchan%d\n", uc->id, uc->tchan->id);
 
-       if (udma_is_chan_running(uc)) {
-               dev_warn(ud->dev, "chan%d: tchan%d is running!\n", uc->id,
-                        uc->tchan->id);
-               udma_stop(uc);
-               if (udma_is_chan_running(uc))
-                       dev_err(ud->dev, "chan%d: won't stop!\n", uc->id);
-       }
-
        return 0;
 }
 
@@ -602,14 +594,6 @@ static int udma_get_rchan(struct udma_chan *uc)
 
        pr_debug("chan%d: got rchan%d\n", uc->id, uc->rchan->id);
 
-       if (udma_is_chan_running(uc)) {
-               dev_warn(ud->dev, "chan%d: rchan%d is running!\n", uc->id,
-                        uc->rchan->id);
-               udma_stop(uc);
-               if (udma_is_chan_running(uc))
-                       dev_err(ud->dev, "chan%d: won't stop!\n", uc->id);
-       }
-
        return 0;
 }
 
@@ -652,14 +636,6 @@ static int udma_get_chan_pair(struct udma_chan *uc)
 
        pr_debug("chan%d: got t/rchan%d pair\n", uc->id, chan_id);
 
-       if (udma_is_chan_running(uc)) {
-               dev_warn(ud->dev, "chan%d: t/rchan%d pair is running!\n",
-                        uc->id, chan_id);
-               udma_stop(uc);
-               if (udma_is_chan_running(uc))
-                       dev_err(ud->dev, "chan%d: won't stop!\n", uc->id);
-       }
-
        return 0;
 }
 
@@ -1071,6 +1047,15 @@ static int udma_alloc_chan_resources(struct udma_chan *uc)
                }
        }
 
+       if (udma_is_chan_running(uc)) {
+               dev_warn(ud->dev, "chan%d: is running!\n", uc->id);
+               udma_stop(uc);
+               if (udma_is_chan_running(uc)) {
+                       dev_err(ud->dev, "chan%d: won't stop!\n", uc->id);
+                       goto err_free_res;
+               }
+       }
+
        /* PSI-L pairing */
        ret = udma_navss_psil_pair(ud, uc->src_thread, uc->dst_thread);
        if (ret) {