Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp206607rwl; Tue, 4 Apr 2023 22:19:15 -0700 (PDT) X-Google-Smtp-Source: AKy350YVZAg44WIqlRZditguDSdKQG9v4XRbKCuk784R7IaQHQp1lI0TpKGPi0zGmYfUBsYIuUWq X-Received: by 2002:a17:903:2288:b0:19e:bfec:7928 with SMTP id b8-20020a170903228800b0019ebfec7928mr6281631plh.24.1680671955193; Tue, 04 Apr 2023 22:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680671955; cv=none; d=google.com; s=arc-20160816; b=a/1wDsjM6M47rSfZ5EwMamx2ntq9hYGlQCjWyVjGXA2QdPwkXNSCT8hIZWJMFqd7Oe tabl/5NAe5DqvE88bUkJVZ0BIYyi5jhZenDQPBu9nsKui4KiKxHeQ0MhF/FuKfe25z4q I6g8SnpwMwx3PreQCFQ+V/zDbTstjxEXGaLYUZWiPVPH7elYe0y2K7ZonRrsl37hYdHG 2Ll42EDHxraojnEruNzIPKFmcyH/V+jo1nDEn4qjYbCVEwp4vG5l22xFabyfW9J6AGqi x7ZYETL2IUc6D8O/IIQd9GIl2UysGyS12BVza3/bIa8SH+VkhXPrYF+HkpVOnViJih1x QuyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=HyY5f+LPZ0dJBsWVVmO0EyBFssVpLwhs+Kw/bLISOo4=; b=GNu1aoy58rFI+GV8IrU4e3b+y34RKg8CRmA+LQaYbY7+qo2sGhI5aAcUoXQuHEMrLI d0uwWy6zhqfiuuWe2yXIKq1lG02Y8WCE7muSpTUy3Y/uOZK8S4Kvmv0u5XPxJUeQi3Lx rm9Tn4MRdrgAJN/Aekfn9qAsMz7rNVrykNRhFZej0vO6vZQcAJ5Eemv7JsMP99Bh9Aft FYbNhAB4+6h+dbS5XhxeJb0UQN/w4RPDjdTkEA4nk1wIrMi5HWAe54uIAhpb0AceqMrt ynrOPnaC575f7S32gBhA6bm20lxk6fJUiTZ+9+EucP8loAKi+bjdg1ALkA81oC74ph1m anZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="bFtq/B0P"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g19-20020a170902d1d300b001a24c038c76si11070964plb.512.2023.04.04.22.19.03; Tue, 04 Apr 2023 22:19:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="bFtq/B0P"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236841AbjDEFLa (ORCPT + 99 others); Wed, 5 Apr 2023 01:11:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229943AbjDEFL2 (ORCPT ); Wed, 5 Apr 2023 01:11:28 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD53F3A8E; Tue, 4 Apr 2023 22:11:27 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3355BGvn027461; Wed, 5 Apr 2023 00:11:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1680671476; bh=HyY5f+LPZ0dJBsWVVmO0EyBFssVpLwhs+Kw/bLISOo4=; h=From:To:CC:Subject:Date; b=bFtq/B0Pl/rvCzKNtCCiSprdYF5ys8GU91Z4rguSdCnPDmcvcyDBQ5/x1PDEnH9/a /iB7FA5dC/jMs5GaX4MC1GJidjzoHSgtB8Ck2L7WwxLG0WgOi/lr31rxqinjqqqe6q iuBfFpIJ9dZ/zXS0b0f8DjmWdrVn18Vt+SyjfX6s= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3355BGsc088122 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 5 Apr 2023 00:11:16 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Wed, 5 Apr 2023 00:11:15 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Wed, 5 Apr 2023 00:11:16 -0500 Received: from uda0492258.dhcp.ti.com (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3355BDNJ066548; Wed, 5 Apr 2023 00:11:13 -0500 From: Siddharth Vadapalli To: , CC: , , , , , Subject: [PATCH v2] dmaengine: ti: k3-udma-glue: do not create glue dma devices for udma channels Date: Wed, 5 Apr 2023 10:41:12 +0530 Message-ID: <20230405051112.1364277-1-s-vadapalli@ti.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Grygorii Strashko In case K3 DMA glue layer is using UDMA channels (AM65/J721E/J7200) it doesn't need to create own DMA devices per RX/TX channels as they are never used and just waste resources. The UDMA based platforms are coherent and UDMA device iteslf is used for DMA memory management. Hence, update K3 DMA glue layer to create K3 DMA glue DMA devices per RX/TX channels only in case of PKTDMA (AM64) where coherency configurable per DMA channel. Signed-off-by: Grygorii Strashko Signed-off-by: Siddharth Vadapalli --- Changes from v1: - Add missing put_device() at all 3 occurrences: * In k3_udma_glue_request_tx_chn() * In k3_udma_glue_request_rx_chn_priv() * In k3_udma_glue_request_remote_rx_chn() v1: https://lore.kernel.org/all/20230404081158.1266530-1-s-vadapalli@ti.com/ drivers/dma/ti/k3-udma-glue.c | 73 ++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c index 789193ed0386..ab8ac52e38e4 100644 --- a/drivers/dma/ti/k3-udma-glue.c +++ b/drivers/dma/ti/k3-udma-glue.c @@ -293,19 +293,19 @@ struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev, } tx_chn->udma_tchan_id = xudma_tchan_get_id(tx_chn->udma_tchanx); - tx_chn->common.chan_dev.class = &k3_udma_glue_devclass; - tx_chn->common.chan_dev.parent = xudma_get_device(tx_chn->common.udmax); - dev_set_name(&tx_chn->common.chan_dev, "tchan%d-0x%04x", - tx_chn->udma_tchan_id, tx_chn->common.dst_thread); - ret = device_register(&tx_chn->common.chan_dev); - if (ret) { - dev_err(dev, "Channel Device registration failed %d\n", ret); - put_device(&tx_chn->common.chan_dev); - tx_chn->common.chan_dev.parent = NULL; - goto err; - } - if (xudma_is_pktdma(tx_chn->common.udmax)) { + tx_chn->common.chan_dev.class = &k3_udma_glue_devclass; + tx_chn->common.chan_dev.parent = xudma_get_device(tx_chn->common.udmax); + dev_set_name(&tx_chn->common.chan_dev, "tchan%d-0x%04x", + tx_chn->udma_tchan_id, tx_chn->common.dst_thread); + ret = device_register(&tx_chn->common.chan_dev); + if (ret) { + dev_err(dev, "Channel Device registration failed %d\n", ret); + put_device(&tx_chn->common.chan_dev); + tx_chn->common.chan_dev.parent = NULL; + goto err; + } + /* prepare the channel device as coherent */ tx_chn->common.chan_dev.dma_coherent = true; dma_coerce_mask_and_coherent(&tx_chn->common.chan_dev, @@ -912,19 +912,19 @@ k3_udma_glue_request_rx_chn_priv(struct device *dev, const char *name, } rx_chn->udma_rchan_id = xudma_rchan_get_id(rx_chn->udma_rchanx); - rx_chn->common.chan_dev.class = &k3_udma_glue_devclass; - rx_chn->common.chan_dev.parent = xudma_get_device(rx_chn->common.udmax); - dev_set_name(&rx_chn->common.chan_dev, "rchan%d-0x%04x", - rx_chn->udma_rchan_id, rx_chn->common.src_thread); - ret = device_register(&rx_chn->common.chan_dev); - if (ret) { - dev_err(dev, "Channel Device registration failed %d\n", ret); - put_device(&rx_chn->common.chan_dev); - rx_chn->common.chan_dev.parent = NULL; - goto err; - } - if (xudma_is_pktdma(rx_chn->common.udmax)) { + rx_chn->common.chan_dev.class = &k3_udma_glue_devclass; + rx_chn->common.chan_dev.parent = xudma_get_device(rx_chn->common.udmax); + dev_set_name(&rx_chn->common.chan_dev, "rchan%d-0x%04x", + rx_chn->udma_rchan_id, rx_chn->common.src_thread); + ret = device_register(&rx_chn->common.chan_dev); + if (ret) { + dev_err(dev, "Channel Device registration failed %d\n", ret); + put_device(&rx_chn->common.chan_dev); + rx_chn->common.chan_dev.parent = NULL; + goto err; + } + /* prepare the channel device as coherent */ rx_chn->common.chan_dev.dma_coherent = true; dma_coerce_mask_and_coherent(&rx_chn->common.chan_dev, @@ -1044,19 +1044,20 @@ k3_udma_glue_request_remote_rx_chn(struct device *dev, const char *name, goto err; } - rx_chn->common.chan_dev.class = &k3_udma_glue_devclass; - rx_chn->common.chan_dev.parent = xudma_get_device(rx_chn->common.udmax); - dev_set_name(&rx_chn->common.chan_dev, "rchan_remote-0x%04x", - rx_chn->common.src_thread); - ret = device_register(&rx_chn->common.chan_dev); - if (ret) { - dev_err(dev, "Channel Device registration failed %d\n", ret); - put_device(&rx_chn->common.chan_dev); - rx_chn->common.chan_dev.parent = NULL; - goto err; - } - if (xudma_is_pktdma(rx_chn->common.udmax)) { + rx_chn->common.chan_dev.class = &k3_udma_glue_devclass; + rx_chn->common.chan_dev.parent = xudma_get_device(rx_chn->common.udmax); + dev_set_name(&rx_chn->common.chan_dev, "rchan_remote-0x%04x", + rx_chn->common.src_thread); + + ret = device_register(&rx_chn->common.chan_dev); + if (ret) { + dev_err(dev, "Channel Device registration failed %d\n", ret); + put_device(&rx_chn->common.chan_dev); + rx_chn->common.chan_dev.parent = NULL; + goto err; + } + /* prepare the channel device as coherent */ rx_chn->common.chan_dev.dma_coherent = true; dma_coerce_mask_and_coherent(&rx_chn->common.chan_dev, -- 2.25.1