Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: ti: k3-udma-glue: move psi-l pairing in channel en/dis functions

The NAVSS UDMA will stuck if target IP module is disabled by PM while PSI-L
threads are paired UDMA<->IP and no further transfers is possible. This
could be the case for IPs J721E Main CPSW (cpsw9g).

Hence, to avoid such situation do PSI-L threads pairing only when UDMA
channel is going to be enabled as at this time DMA consumer module expected
to be active already.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20201030203000.4281-1-grygorii.strashko@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Grygorii Strashko and committed by
Vinod Koul
69973b48 63497532

+38 -26
+38 -26
drivers/dma/ti/k3-udma-glue.c
··· 303 303 goto err; 304 304 } 305 305 306 - ret = xudma_navss_psil_pair(tx_chn->common.udmax, 307 - tx_chn->common.src_thread, 308 - tx_chn->common.dst_thread); 309 - if (ret) { 310 - dev_err(dev, "PSI-L request err %d\n", ret); 311 - goto err; 312 - } 313 - 314 - tx_chn->psil_paired = true; 315 - 316 - /* reset TX RT registers */ 317 - k3_udma_glue_disable_tx_chn(tx_chn); 318 - 319 306 k3_udma_glue_dump_tx_chn(tx_chn); 320 307 321 308 return tx_chn; ··· 365 378 366 379 int k3_udma_glue_enable_tx_chn(struct k3_udma_glue_tx_channel *tx_chn) 367 380 { 381 + int ret; 382 + 383 + ret = xudma_navss_psil_pair(tx_chn->common.udmax, 384 + tx_chn->common.src_thread, 385 + tx_chn->common.dst_thread); 386 + if (ret) { 387 + dev_err(tx_chn->common.dev, "PSI-L request err %d\n", ret); 388 + return ret; 389 + } 390 + 391 + tx_chn->psil_paired = true; 392 + 368 393 xudma_tchanrt_write(tx_chn->udma_tchanx, UDMA_CHAN_RT_PEER_RT_EN_REG, 369 394 UDMA_PEER_RT_EN_ENABLE); 370 395 ··· 397 398 xudma_tchanrt_write(tx_chn->udma_tchanx, 398 399 UDMA_CHAN_RT_PEER_RT_EN_REG, 0); 399 400 k3_udma_glue_dump_tx_rt_chn(tx_chn, "txchn dis2"); 401 + 402 + if (tx_chn->psil_paired) { 403 + xudma_navss_psil_unpair(tx_chn->common.udmax, 404 + tx_chn->common.src_thread, 405 + tx_chn->common.dst_thread); 406 + tx_chn->psil_paired = false; 407 + } 400 408 } 401 409 EXPORT_SYMBOL_GPL(k3_udma_glue_disable_tx_chn); 402 410 ··· 821 815 goto err; 822 816 } 823 817 824 - ret = xudma_navss_psil_pair(rx_chn->common.udmax, 825 - rx_chn->common.src_thread, 826 - rx_chn->common.dst_thread); 827 - if (ret) { 828 - dev_err(dev, "PSI-L request err %d\n", ret); 829 - goto err; 830 - } 831 - 832 - rx_chn->psil_paired = true; 833 - 834 - /* reset RX RT registers */ 835 - k3_udma_glue_disable_rx_chn(rx_chn); 836 - 837 818 k3_udma_glue_dump_rx_chn(rx_chn); 838 819 839 820 return rx_chn; ··· 1045 1052 1046 1053 int k3_udma_glue_enable_rx_chn(struct k3_udma_glue_rx_channel *rx_chn) 1047 1054 { 1055 + int ret; 1056 + 1048 1057 if (rx_chn->remote) 1049 1058 return -EINVAL; 1050 1059 1051 1060 if (rx_chn->flows_ready < rx_chn->flow_num) 1052 1061 return -EINVAL; 1062 + 1063 + ret = xudma_navss_psil_pair(rx_chn->common.udmax, 1064 + rx_chn->common.src_thread, 1065 + rx_chn->common.dst_thread); 1066 + if (ret) { 1067 + dev_err(rx_chn->common.dev, "PSI-L request err %d\n", ret); 1068 + return ret; 1069 + } 1070 + 1071 + rx_chn->psil_paired = true; 1053 1072 1054 1073 xudma_rchanrt_write(rx_chn->udma_rchanx, UDMA_CHAN_RT_CTL_REG, 1055 1074 UDMA_CHAN_RT_CTL_EN); ··· 1083 1078 xudma_rchanrt_write(rx_chn->udma_rchanx, UDMA_CHAN_RT_CTL_REG, 0); 1084 1079 1085 1080 k3_udma_glue_dump_rx_rt_chn(rx_chn, "rxrt dis2"); 1081 + 1082 + if (rx_chn->psil_paired) { 1083 + xudma_navss_psil_unpair(rx_chn->common.udmax, 1084 + rx_chn->common.src_thread, 1085 + rx_chn->common.dst_thread); 1086 + rx_chn->psil_paired = false; 1087 + } 1086 1088 } 1087 1089 EXPORT_SYMBOL_GPL(k3_udma_glue_disable_rx_chn); 1088 1090