From patchwork Tue Nov 14 08:39:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Vadapalli X-Patchwork-Id: 164752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1725044vqg; Tue, 14 Nov 2023 00:39:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcmKqs/gXcwAKCM7tJuKSD6jKKxUXlTs9bZORiV+Bro46+xQn9slGIGTRHLlv3ayibWmKI X-Received: by 2002:a05:6a20:12c3:b0:16b:c20d:f979 with SMTP id v3-20020a056a2012c300b0016bc20df979mr11318224pzg.13.1699951175506; Tue, 14 Nov 2023 00:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699951175; cv=none; d=google.com; s=arc-20160816; b=hkx2PZga+vnn0J/cvwIb25911nBUlYdwxyILhdng2dMCxSid5CpaOlF9vwMQC4jd1C 2xuJvhAZv5vxPbLLemVk+pyYl10Bi5g13bNJBBpxjHXx6f9QX5Rjm13OXrDWkez+q4uH rU39U2IrUNSXCc1Wj5ayQ8XOderbhYBt7xiMBDcZBcv3Fh5JlKqEr5uefosZzne8EEmk E4MppSlh9XRVX4kaZiFYwsZfmYAtHVXjFe3ExEC3+fEHzQw+DFuARwF8Dn1QJddVS+qH w0vpYvUTFXeWSxpdhEG9nLQNM78SNiGeljBcZn2HjjqQCH+HHsvpUEU81lrMqj1euMvE oFaw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V4T4sch1tiJyW5MPqw/gLkRYEZf1vXcBY1djKhH51uw=; fh=kWHopdWuWktDcnjSO11R7sPQi0EWg865jqRuCsOPYXE=; b=rvOFE5x/gYeABmJhckFrNMlXhVx5DbCjvvKXS6yY0BjJmlgZtwcSdIs2wZwtGv8n6a jMC5x6QNk11U9om188O/rxSPBdUhZ0r4rpyIwftV7j1XpXpMTOoAUXMghMF7Y8ZGXpM6 8u46RP7HDIZiUyW58cOU5xHD+4z/fA3pROjeH2w4CfT4y+FN+ber7uwzN5PGLhmkJJI4 pO8tsnDx8jB7/JHYfG1afFAYowCQegGF6bzd2q3rF18uQIHP+mJ4KiBAC7IOlbzS6MXQ unJtpXxrrXd72ODq0BFPUxGd7kh2lEEDyHrlFRrc9SlxCle0ZZSAtdJu7Hp6lMOhgcp8 B61w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=iFW3YfWV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e7-20020a656887000000b005b9066580d1si7317639pgt.754.2023.11.14.00.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 00:39:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=iFW3YfWV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B434C80D6E6E; Tue, 14 Nov 2023 00:39:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232375AbjKNIjZ (ORCPT + 30 others); Tue, 14 Nov 2023 03:39:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232236AbjKNIjX (ORCPT ); Tue, 14 Nov 2023 03:39:23 -0500 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4ADEA4; Tue, 14 Nov 2023 00:39:19 -0800 (PST) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3AE8dCG8057956; Tue, 14 Nov 2023 02:39:12 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1699951152; bh=V4T4sch1tiJyW5MPqw/gLkRYEZf1vXcBY1djKhH51uw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=iFW3YfWVXcgqieUhxHueCPSYl/pvidMSBpnCX50iM7DQOFjFNQmRAnXcVZXhABHS0 vPlHuDDbbTqJX5fS1gvfhH4FIokNGH0Bv2qLFjax6h1Bf6/u+zorATjsMb4iPrKIaB NUvRE0W1GT4Xxw92VmwPjimixE5dEcmXBrsRCi4M= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3AE8dCSn003849 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 14 Nov 2023 02:39:12 -0600 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 14 Nov 2023 02:39:11 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 14 Nov 2023 02:39:12 -0600 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 3AE8d6OE128120; Tue, 14 Nov 2023 02:39:09 -0600 From: Siddharth Vadapalli To: , CC: , , , , , Subject: [PATCH 1/4] dmaengine: ti: k3-udma-glue: Add function to parse channel by ID Date: Tue, 14 Nov 2023 14:09:03 +0530 Message-ID: <20231114083906.3143548-2-s-vadapalli@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114083906.3143548-1-s-vadapalli@ti.com> References: <20231114083906.3143548-1-s-vadapalli@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 14 Nov 2023 00:39:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782528003968625414 X-GMAIL-MSGID: 1782528003968625414 The existing helper function of_k3_udma_glue_parse() fetches the DMA Channel thread ID from the device-tree node. This makes it necessary to have a device-tree node with the Channel thread IDs populated. However, in the case where the thread ID is known by alternate methods (an example being that of Firmware running on remote core sharing details of the thread IDs), there is no equivalent function to implement the functionality of the existing of_k3_udma_glue_parse() function. Add the of_k3_udma_glue_parse_chn_by_id() helper function which accepts the thread ID as an argument, thereby making it unnecessary to have a device-tree node for obtaining the thread ID. Since of_k3_udma_glue_parse() and of_k3_udma_glue_parse_chn_by_id() share a lot of code in common, create a new function to handle the common code which is named as of_k3_udma_glue_parse_chn_common(). Signed-off-by: Siddharth Vadapalli --- drivers/dma/ti/k3-udma-glue.c | 81 +++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 27 deletions(-) diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c index c278d5facf7d..9979785d30aa 100644 --- a/drivers/dma/ti/k3-udma-glue.c +++ b/drivers/dma/ti/k3-udma-glue.c @@ -111,6 +111,35 @@ static int of_k3_udma_glue_parse(struct device_node *udmax_np, return 0; } +static int of_k3_udma_glue_parse_chn_common(struct k3_udma_glue_common *common, u32 thread_id, + bool tx_chn) +{ + if (tx_chn && !(thread_id & K3_PSIL_DST_THREAD_ID_OFFSET)) + return -EINVAL; + + if (!tx_chn && (thread_id & K3_PSIL_DST_THREAD_ID_OFFSET)) + return -EINVAL; + + /* get psil endpoint config */ + common->ep_config = psil_get_ep_config(thread_id); + if (IS_ERR(common->ep_config)) { + dev_err(common->dev, + "No configuration for psi-l thread 0x%04x\n", + thread_id); + return PTR_ERR(common->ep_config); + } + + common->epib = common->ep_config->needs_epib; + common->psdata_size = common->ep_config->psd_size; + + if (tx_chn) + common->dst_thread = thread_id; + else + common->src_thread = thread_id; + + return 0; +} + static int of_k3_udma_glue_parse_chn(struct device_node *chn_np, const char *name, struct k3_udma_glue_common *common, bool tx_chn) @@ -153,38 +182,36 @@ static int of_k3_udma_glue_parse_chn(struct device_node *chn_np, common->atype_asel = dma_spec.args[1]; } - if (tx_chn && !(thread_id & K3_PSIL_DST_THREAD_ID_OFFSET)) { - ret = -EINVAL; + ret = of_k3_udma_glue_parse_chn_common(common, thread_id, tx_chn); + if (ret) goto out_put_spec; - } - - if (!tx_chn && (thread_id & K3_PSIL_DST_THREAD_ID_OFFSET)) { - ret = -EINVAL; - goto out_put_spec; - } - - /* get psil endpoint config */ - common->ep_config = psil_get_ep_config(thread_id); - if (IS_ERR(common->ep_config)) { - dev_err(common->dev, - "No configuration for psi-l thread 0x%04x\n", - thread_id); - ret = PTR_ERR(common->ep_config); - goto out_put_spec; - } - - common->epib = common->ep_config->needs_epib; - common->psdata_size = common->ep_config->psd_size; - - if (tx_chn) - common->dst_thread = thread_id; - else - common->src_thread = thread_id; out_put_spec: of_node_put(dma_spec.np); return ret; -}; +} + +static int +of_k3_udma_glue_parse_chn_by_id(struct device_node *udmax_np, struct k3_udma_glue_common *common, + bool tx_chn, u32 thread_id) +{ + int ret = 0; + + if (unlikely(!udmax_np)) + return -EINVAL; + + ret = of_k3_udma_glue_parse(udmax_np, common); + if (ret) + goto out_put_spec; + + ret = of_k3_udma_glue_parse_chn_common(common, thread_id, tx_chn); + if (ret) + goto out_put_spec; + +out_put_spec: + of_node_put(udmax_np); + return ret; +} static void k3_udma_glue_dump_tx_chn(struct k3_udma_glue_tx_channel *tx_chn) { From patchwork Tue Nov 14 08:39:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Vadapalli X-Patchwork-Id: 164755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1725123vqg; Tue, 14 Nov 2023 00:39:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0uvmZMl3TmsoQGUTXCIxnbPtyB7f1vydcICn9iQT2Firkuoac4Q5M2B61JBqvlvbPkFW1 X-Received: by 2002:a05:6a20:441f:b0:186:7509:7f62 with SMTP id ce31-20020a056a20441f00b0018675097f62mr5078311pzb.28.1699951186568; Tue, 14 Nov 2023 00:39:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699951186; cv=none; d=google.com; s=arc-20160816; b=Sr6F5wsG3T+PhfkqyHxLxqnWWgYp/4GAuTxILWmEOeb55lgpuCUAUf8Uvj1GJQMquV e873Og6tm2YHF3HumuxYQRyFrqSQSP1zN9Yz+1jyEElNbAvQToD+jRhiQCRkIl413Kiw sx1BdFNcZztoL4E6fimP/3h0RGVemBtDSZq+1BneOA4VhrVZtiswyObuoSt4j85jrTDl YLG9AXrCyvsgHnWUlgBXl8TwM4M6Wlf7L03UZ0Ur1D8wVPSeXh5PozzhxQh6aNrkC23p /VWp+uZf6UnDQbc9G0GSS8klB47XrHO0B7dVwpe5uCImOYYEQF4tMg4+0FEwq9Vs6TOU QkWg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ty0k+nUDroDXWh953h5rmRqpmQr5kzDJwr8S4izFvZo=; fh=kWHopdWuWktDcnjSO11R7sPQi0EWg865jqRuCsOPYXE=; b=Rmy6AQ6qSjfghyFpvug8DaDjbXo9I2GoYoYuiz9q4McQ/mYgg+anFYhOGxZMSwOEHT kWv+n/rCCT0+PSJazry68DvqP3scTEGVrv/UTM0o3X9Qc7IRmVM91GDBxC+0mduR+GHC gwpPslbrmCX/4aD7qXzVnaNW3l5OVjwZgeovyDPWXi6wRG2WeMDS5fZUnIU3rqvcwgAR SgYG6qM8SEvcE2SDR9DVPAgNByj6wq1gtvqoshTov5dFNJymkW4TnvKv21+4w89KgaOV gMjyv/vgagMhFhja7KKYBJR9jM86Dumze9KRYwMJRrry/Ip9Jpfd25RxQarNOlZsKj0M Vu9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=VlYacUJA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id r73-20020a632b4c000000b005b915369810si7190358pgr.590.2023.11.14.00.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 00:39:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=VlYacUJA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7079B801D0EC; Tue, 14 Nov 2023 00:39:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232413AbjKNIjc (ORCPT + 30 others); Tue, 14 Nov 2023 03:39:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232383AbjKNIj0 (ORCPT ); Tue, 14 Nov 2023 03:39:26 -0500 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D64E1AD; Tue, 14 Nov 2023 00:39:22 -0800 (PST) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3AE8dEsH042821; Tue, 14 Nov 2023 02:39:14 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1699951154; bh=ty0k+nUDroDXWh953h5rmRqpmQr5kzDJwr8S4izFvZo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=VlYacUJAxaGh1qUTekCrKjbV7SwdwWSUaCkFls7iga0tXEd73qPzuf57z8fsXH1YV AKlQZVrC9fg86hQIcx8W/YtfH2P7rnUCCnHCT3TY7oUT0BZGHLxwzZy3yoMvQ3Cp8K LP3GuEln7aTWGpm54RrbZxrfXVpLo1hNsLEP5A+8= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3AE8dEK0003866 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 14 Nov 2023 02:39:14 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 14 Nov 2023 02:39:14 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 14 Nov 2023 02:39:14 -0600 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 3AE8d6OF128120; Tue, 14 Nov 2023 02:39:12 -0600 From: Siddharth Vadapalli To: , CC: , , , , , Subject: [PATCH 2/4] dmaengine: ti: k3-udma-glue: Add function to request TX channel by ID Date: Tue, 14 Nov 2023 14:09:04 +0530 Message-ID: <20231114083906.3143548-3-s-vadapalli@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114083906.3143548-1-s-vadapalli@ti.com> References: <20231114083906.3143548-1-s-vadapalli@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 14 Nov 2023 00:39:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782528015599370544 X-GMAIL-MSGID: 1782528015599370544 The existing function k3_udma_glue_request_tx_chn() supports requesting a TX DMA channel by its name. Add support to request TX channel by ID in the form of a new function k3_udma_glue_request_tx_chn_by_id() and export it. Since the implementation of k3_udma_glue_request_tx_chn_by_id() reuses most of the code in k3_udma_glue_request_tx_chn(), create a new function for the common code named as k3_udma_glue_request_tx_chn_common(). Signed-off-by: Siddharth Vadapalli --- drivers/dma/ti/k3-udma-glue.c | 101 +++++++++++++++++++++++-------- include/linux/dma/k3-udma-glue.h | 4 ++ 2 files changed, 79 insertions(+), 26 deletions(-) diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c index 9979785d30aa..d3f04d446c4e 100644 --- a/drivers/dma/ti/k3-udma-glue.c +++ b/drivers/dma/ti/k3-udma-glue.c @@ -278,29 +278,13 @@ static int k3_udma_glue_cfg_tx_chn(struct k3_udma_glue_tx_channel *tx_chn) return tisci_rm->tisci_udmap_ops->tx_ch_cfg(tisci_rm->tisci, &req); } -struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev, - const char *name, struct k3_udma_glue_tx_channel_cfg *cfg) +static int +k3_udma_glue_request_tx_chn_common(struct device *dev, + struct k3_udma_glue_tx_channel *tx_chn, + struct k3_udma_glue_tx_channel_cfg *cfg) { - struct k3_udma_glue_tx_channel *tx_chn; int ret; - tx_chn = devm_kzalloc(dev, sizeof(*tx_chn), GFP_KERNEL); - if (!tx_chn) - return ERR_PTR(-ENOMEM); - - tx_chn->common.dev = dev; - tx_chn->common.swdata_size = cfg->swdata_size; - tx_chn->tx_pause_on_err = cfg->tx_pause_on_err; - tx_chn->tx_filt_einfo = cfg->tx_filt_einfo; - tx_chn->tx_filt_pswords = cfg->tx_filt_pswords; - tx_chn->tx_supr_tdpkt = cfg->tx_supr_tdpkt; - - /* parse of udmap channel */ - ret = of_k3_udma_glue_parse_chn(dev->of_node, name, - &tx_chn->common, true); - if (ret) - goto err; - tx_chn->common.hdesc_size = cppi5_hdesc_calc_size(tx_chn->common.epib, tx_chn->common.psdata_size, tx_chn->common.swdata_size); @@ -316,7 +300,7 @@ struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev, if (IS_ERR(tx_chn->udma_tchanx)) { ret = PTR_ERR(tx_chn->udma_tchanx); dev_err(dev, "UDMAX tchanx get err %d\n", ret); - goto err; + return ret; } tx_chn->udma_tchan_id = xudma_tchan_get_id(tx_chn->udma_tchanx); @@ -329,7 +313,7 @@ struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev, 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; + return ret; } if (xudma_is_pktdma(tx_chn->common.udmax)) { @@ -353,7 +337,7 @@ struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev, &tx_chn->ringtxcq); if (ret) { dev_err(dev, "Failed to get TX/TXCQ rings %d\n", ret); - goto err; + return ret; } /* Set the dma_dev for the rings to be configured */ @@ -369,13 +353,13 @@ struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev, ret = k3_ringacc_ring_cfg(tx_chn->ringtx, &cfg->tx_cfg); if (ret) { dev_err(dev, "Failed to cfg ringtx %d\n", ret); - goto err; + return ret; } ret = k3_ringacc_ring_cfg(tx_chn->ringtxcq, &cfg->txcq_cfg); if (ret) { dev_err(dev, "Failed to cfg ringtx %d\n", ret); - goto err; + return ret; } /* request and cfg psi-l */ @@ -386,11 +370,42 @@ struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev, ret = k3_udma_glue_cfg_tx_chn(tx_chn); if (ret) { dev_err(dev, "Failed to cfg tchan %d\n", ret); - goto err; + return ret; } k3_udma_glue_dump_tx_chn(tx_chn); + return 0; +} + +struct k3_udma_glue_tx_channel * +k3_udma_glue_request_tx_chn(struct device *dev, const char *name, + struct k3_udma_glue_tx_channel_cfg *cfg) +{ + struct k3_udma_glue_tx_channel *tx_chn; + int ret; + + tx_chn = devm_kzalloc(dev, sizeof(*tx_chn), GFP_KERNEL); + if (!tx_chn) + return ERR_PTR(-ENOMEM); + + tx_chn->common.dev = dev; + tx_chn->common.swdata_size = cfg->swdata_size; + tx_chn->tx_pause_on_err = cfg->tx_pause_on_err; + tx_chn->tx_filt_einfo = cfg->tx_filt_einfo; + tx_chn->tx_filt_pswords = cfg->tx_filt_pswords; + tx_chn->tx_supr_tdpkt = cfg->tx_supr_tdpkt; + + /* parse of udmap channel */ + ret = of_k3_udma_glue_parse_chn(dev->of_node, name, + &tx_chn->common, true); + if (ret) + goto err; + + ret = k3_udma_glue_request_tx_chn_common(dev, tx_chn, cfg); + if (ret) + goto err; + return tx_chn; err: @@ -399,6 +414,40 @@ struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev, } EXPORT_SYMBOL_GPL(k3_udma_glue_request_tx_chn); +struct k3_udma_glue_tx_channel * +k3_udma_glue_request_tx_chn_by_id(struct device *dev, struct k3_udma_glue_tx_channel_cfg *cfg, + struct device_node *udmax_np, u32 thread_id) +{ + struct k3_udma_glue_tx_channel *tx_chn; + int ret; + + tx_chn = devm_kzalloc(dev, sizeof(*tx_chn), GFP_KERNEL); + if (!tx_chn) + return ERR_PTR(-ENOMEM); + + tx_chn->common.dev = dev; + tx_chn->common.swdata_size = cfg->swdata_size; + tx_chn->tx_pause_on_err = cfg->tx_pause_on_err; + tx_chn->tx_filt_einfo = cfg->tx_filt_einfo; + tx_chn->tx_filt_pswords = cfg->tx_filt_pswords; + tx_chn->tx_supr_tdpkt = cfg->tx_supr_tdpkt; + + ret = of_k3_udma_glue_parse_chn_by_id(udmax_np, &tx_chn->common, true, thread_id); + if (ret) + goto err; + + ret = k3_udma_glue_request_tx_chn_common(dev, tx_chn, cfg); + if (ret) + goto err; + + return tx_chn; + +err: + k3_udma_glue_release_tx_chn(tx_chn); + return ERR_PTR(ret); +} +EXPORT_SYMBOL_GPL(k3_udma_glue_request_tx_chn_by_id); + void k3_udma_glue_release_tx_chn(struct k3_udma_glue_tx_channel *tx_chn) { if (tx_chn->psil_paired) { diff --git a/include/linux/dma/k3-udma-glue.h b/include/linux/dma/k3-udma-glue.h index e443be4d3b4b..6205d84430ca 100644 --- a/include/linux/dma/k3-udma-glue.h +++ b/include/linux/dma/k3-udma-glue.h @@ -26,6 +26,10 @@ struct k3_udma_glue_tx_channel; struct k3_udma_glue_tx_channel *k3_udma_glue_request_tx_chn(struct device *dev, const char *name, struct k3_udma_glue_tx_channel_cfg *cfg); +struct k3_udma_glue_tx_channel * +k3_udma_glue_request_tx_chn_by_id(struct device *dev, struct k3_udma_glue_tx_channel_cfg *cfg, + struct device_node *udmax_np, u32 thread_id); + void k3_udma_glue_release_tx_chn(struct k3_udma_glue_tx_channel *tx_chn); int k3_udma_glue_push_tx_chn(struct k3_udma_glue_tx_channel *tx_chn, struct cppi5_host_desc_t *desc_tx, From patchwork Tue Nov 14 08:39:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Vadapalli X-Patchwork-Id: 164753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1725103vqg; Tue, 14 Nov 2023 00:39:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHD57y26qxMaoVcqgpHEkxojSGZ5LpO3adqsa55GNWiaH0HNYI9dkr7FwyzTteb2jTy5Puu X-Received: by 2002:a17:90b:4a84:b0:27d:7887:ddc5 with SMTP id lp4-20020a17090b4a8400b0027d7887ddc5mr10116262pjb.32.1699951182798; Tue, 14 Nov 2023 00:39:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699951182; cv=none; d=google.com; s=arc-20160816; b=OV2FgA9S3PqhSUvEg3LRsoCde2y1DNHwaAObSoC2LPwCsCoOQ6QtNfg2rn74DRJg0n YIg7WBGet7/yAn0EkJ+aBHrnctZM0SW2MfP+afaSXBQ89WgbzOfnc1AktVuu74p5pOLk oVEnxiQiMH6KdzVdhrKhbLIFdKGh1wGZxHy3BqakoC+NJRiu04+O/mdn+Fd8x5EQR8ec Uy2NC0vvUJARQy6wsJhDJbRj1kQf3g3eObUDRK8z4TS9cAktlEWxHm9ARPYukXAuyHmV gVegjyFDJpGQUTyr/c0BJkQUx/XK15h5NOw+VOFjfxbZiQkdx7YDg82jA3UL2HpMz1rp vcTQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VPVOyYGUIuFjbpFVz4WDtMguuciLFwkUVgaypjccsg0=; fh=kWHopdWuWktDcnjSO11R7sPQi0EWg865jqRuCsOPYXE=; b=O0WkU80MuN4Ap2i7DJM0QXCRg7Ind7Tzs8/bN639KDiiyOAn/n6A+8smSgymxfbNyi 8A/6tVj1iDI1GoZ8Ej5OLjSkTphFl7DzRFVKjdlkTRIha7OjTyCTNnGLMZf3NkI0SQkZ lyM/VUkntN1Z6HrNhwGvLsBdUR+FsMVLZhe6OCQ7hla4j1dEFLK6m+bBB4EWL4lvEVvn elW/cIOlptXE8vE07BPhfKerY8hQVROOc0lqT/fjrZpY0MhY81PhPK8lMqZuyyrg+nR+ SEhD8iduaglKBCN4+7KJ/lXjX68sPpJhMO1Gu0JHTmJL8LKOSEumli9JuiPTabNF4Ghn bJzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=xIW2j0q4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id pi17-20020a17090b1e5100b00274e5b20e65si8175605pjb.50.2023.11.14.00.39.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 00:39:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=xIW2j0q4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A6014801D0EE; Tue, 14 Nov 2023 00:39:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232405AbjKNIjg (ORCPT + 30 others); Tue, 14 Nov 2023 03:39:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232392AbjKNIj3 (ORCPT ); Tue, 14 Nov 2023 03:39:29 -0500 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEF3DA4; Tue, 14 Nov 2023 00:39:24 -0800 (PST) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3AE8dH3f020383; Tue, 14 Nov 2023 02:39:17 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1699951157; bh=VPVOyYGUIuFjbpFVz4WDtMguuciLFwkUVgaypjccsg0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=xIW2j0q4Euj9+lGrWySdNdlBwkv+ueoWif38je4lPRkBegALlh+CS6tF02AQP6eD2 OiZu4sTxKrXFfRamGYZdkZJGrdDZ4T4n8dnlH7k57qp2Ip/XjCf6R81DRq4Lir+0Y6 4ZH3flS01hTxx/2EHpe+TKlauHl/wX7zP7158jIQ= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3AE8dHHm019436 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 14 Nov 2023 02:39:17 -0600 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 14 Nov 2023 02:39:17 -0600 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.23 via Frontend Transport; Tue, 14 Nov 2023 02:39:17 -0600 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 3AE8d6OG128120; Tue, 14 Nov 2023 02:39:15 -0600 From: Siddharth Vadapalli To: , CC: , , , , , Subject: [PATCH 3/4] dmaengine: ti: k3-udma-glue: Add function to request RX channel by ID Date: Tue, 14 Nov 2023 14:09:05 +0530 Message-ID: <20231114083906.3143548-4-s-vadapalli@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114083906.3143548-1-s-vadapalli@ti.com> References: <20231114083906.3143548-1-s-vadapalli@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 14 Nov 2023 00:39:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782528011035748561 X-GMAIL-MSGID: 1782528011035748561 The existing function k3_udma_glue_request_remote_rx_chn() supports requesting an RX DMA channel and flow by the name of the RX DMA channel. Add support to request RX channel by ID in the form of a new function k3_udma_glue_request_remote_rx_chn_by_id() and export it. Since the implementation of k3_udma_glue_request_remote_rx_chn_by_id() reuses most of the code in k3_udma_glue_request_remote_rx_chn(), create a new function k3_udma_glue_request_remote_rx_chn_common() for the common code. Signed-off-by: Siddharth Vadapalli --- drivers/dma/ti/k3-udma-glue.c | 140 ++++++++++++++++++++++--------- include/linux/dma/k3-udma-glue.h | 4 + 2 files changed, 103 insertions(+), 41 deletions(-) diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c index d3f04d446c4e..167fe77de71e 100644 --- a/drivers/dma/ti/k3-udma-glue.c +++ b/drivers/dma/ti/k3-udma-glue.c @@ -1076,52 +1076,21 @@ k3_udma_glue_request_rx_chn_priv(struct device *dev, const char *name, return ERR_PTR(ret); } -static struct k3_udma_glue_rx_channel * -k3_udma_glue_request_remote_rx_chn(struct device *dev, const char *name, - struct k3_udma_glue_rx_channel_cfg *cfg) +static int +k3_udma_glue_request_remote_rx_chn_common(struct k3_udma_glue_rx_channel *rx_chn, + struct k3_udma_glue_rx_channel_cfg *cfg, + struct device *dev) { - struct k3_udma_glue_rx_channel *rx_chn; int ret, i; - if (cfg->flow_id_num <= 0 || - cfg->flow_id_use_rxchan_id || - cfg->def_flow_cfg || - cfg->flow_id_base < 0) - return ERR_PTR(-EINVAL); - - /* - * Remote RX channel is under control of Remote CPU core, so - * Linux can only request and manipulate by dedicated RX flows - */ - - rx_chn = devm_kzalloc(dev, sizeof(*rx_chn), GFP_KERNEL); - if (!rx_chn) - return ERR_PTR(-ENOMEM); - - rx_chn->common.dev = dev; - rx_chn->common.swdata_size = cfg->swdata_size; - rx_chn->remote = true; - rx_chn->udma_rchan_id = -1; - rx_chn->flow_num = cfg->flow_id_num; - rx_chn->flow_id_base = cfg->flow_id_base; - rx_chn->psil_paired = false; - - /* parse of udmap channel */ - ret = of_k3_udma_glue_parse_chn(dev->of_node, name, - &rx_chn->common, false); - if (ret) - goto err; - rx_chn->common.hdesc_size = cppi5_hdesc_calc_size(rx_chn->common.epib, - rx_chn->common.psdata_size, - rx_chn->common.swdata_size); + rx_chn->common.psdata_size, + rx_chn->common.swdata_size); rx_chn->flows = devm_kcalloc(dev, rx_chn->flow_num, sizeof(*rx_chn->flows), GFP_KERNEL); - if (!rx_chn->flows) { - ret = -ENOMEM; - goto err; - } + if (!rx_chn->flows) + return -ENOMEM; rx_chn->common.chan_dev.class = &k3_udma_glue_devclass; rx_chn->common.chan_dev.parent = xudma_get_device(rx_chn->common.udmax); @@ -1132,7 +1101,7 @@ k3_udma_glue_request_remote_rx_chn(struct device *dev, const char *name, 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; + return ret; } if (xudma_is_pktdma(rx_chn->common.udmax)) { @@ -1144,19 +1113,108 @@ k3_udma_glue_request_remote_rx_chn(struct device *dev, const char *name, ret = k3_udma_glue_allocate_rx_flows(rx_chn, cfg); if (ret) - goto err; + return ret; for (i = 0; i < rx_chn->flow_num; i++) rx_chn->flows[i].udma_rflow_id = rx_chn->flow_id_base + i; k3_udma_glue_dump_rx_chn(rx_chn); + return 0; +} + +static struct k3_udma_glue_rx_channel * +k3_udma_glue_request_remote_rx_chn(struct device *dev, const char *name, + struct k3_udma_glue_rx_channel_cfg *cfg) +{ + struct k3_udma_glue_rx_channel *rx_chn; + int ret; + + if (cfg->flow_id_num <= 0 || + cfg->flow_id_use_rxchan_id || + cfg->def_flow_cfg || + cfg->flow_id_base < 0) + return ERR_PTR(-EINVAL); + + /* + * Remote RX channel is under control of Remote CPU core, so + * Linux can only request and manipulate by dedicated RX flows + */ + + rx_chn = devm_kzalloc(dev, sizeof(*rx_chn), GFP_KERNEL); + if (!rx_chn) + return ERR_PTR(-ENOMEM); + + rx_chn->common.dev = dev; + rx_chn->common.swdata_size = cfg->swdata_size; + rx_chn->remote = true; + rx_chn->udma_rchan_id = -1; + rx_chn->flow_num = cfg->flow_id_num; + rx_chn->flow_id_base = cfg->flow_id_base; + rx_chn->psil_paired = false; + + /* parse of udmap channel */ + ret = of_k3_udma_glue_parse_chn(dev->of_node, name, + &rx_chn->common, false); + if (ret) + goto err; + + ret = k3_udma_glue_request_remote_rx_chn_common(rx_chn, cfg, dev); + if (ret) + goto err; + + return rx_chn; + +err: + k3_udma_glue_release_rx_chn(rx_chn); + return ERR_PTR(ret); +} + +struct k3_udma_glue_rx_channel * +k3_udma_glue_request_remote_rx_chn_by_id(struct device *dev, struct device_node *udmax_np, + struct k3_udma_glue_rx_channel_cfg *cfg, u32 thread_id) +{ + struct k3_udma_glue_rx_channel *rx_chn; + int ret; + + if (cfg->flow_id_num <= 0 || + cfg->flow_id_use_rxchan_id || + cfg->def_flow_cfg || + cfg->flow_id_base < 0) + return ERR_PTR(-EINVAL); + + /* + * Remote RX channel is under control of Remote CPU core, so + * Linux can only request and manipulate by dedicated RX flows + */ + + rx_chn = devm_kzalloc(dev, sizeof(*rx_chn), GFP_KERNEL); + if (!rx_chn) + return ERR_PTR(-ENOMEM); + + rx_chn->common.dev = dev; + rx_chn->common.swdata_size = cfg->swdata_size; + rx_chn->remote = true; + rx_chn->udma_rchan_id = -1; + rx_chn->flow_num = cfg->flow_id_num; + rx_chn->flow_id_base = cfg->flow_id_base; + rx_chn->psil_paired = false; + + ret = of_k3_udma_glue_parse_chn_by_id(udmax_np, &rx_chn->common, false, thread_id); + if (ret) + goto err; + + ret = k3_udma_glue_request_remote_rx_chn_common(rx_chn, cfg, dev); + if (ret) + goto err; + return rx_chn; err: k3_udma_glue_release_rx_chn(rx_chn); return ERR_PTR(ret); } +EXPORT_SYMBOL_GPL(k3_udma_glue_request_remote_rx_chn_by_id); struct k3_udma_glue_rx_channel * k3_udma_glue_request_rx_chn(struct device *dev, const char *name, diff --git a/include/linux/dma/k3-udma-glue.h b/include/linux/dma/k3-udma-glue.h index 6205d84430ca..a81d1b8f889c 100644 --- a/include/linux/dma/k3-udma-glue.h +++ b/include/linux/dma/k3-udma-glue.h @@ -108,6 +108,10 @@ struct k3_udma_glue_rx_channel_cfg { struct k3_udma_glue_rx_channel; +struct k3_udma_glue_rx_channel * +k3_udma_glue_request_remote_rx_chn_by_id(struct device *dev, struct device_node *udmax_np, + struct k3_udma_glue_rx_channel_cfg *cfg, u32 thread_id); + struct k3_udma_glue_rx_channel *k3_udma_glue_request_rx_chn( struct device *dev, const char *name, From patchwork Tue Nov 14 08:39:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Vadapalli X-Patchwork-Id: 164754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1725122vqg; Tue, 14 Nov 2023 00:39:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCUfADvPjf9Lo+yGnasO3LhYDG0dDCmD0FDCkliOqnakJJF/8xq2UlhO1odtP0BKA7AM66 X-Received: by 2002:a17:902:da89:b0:1cc:3932:4a95 with SMTP id j9-20020a170902da8900b001cc39324a95mr1845783plx.62.1699951186158; Tue, 14 Nov 2023 00:39:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699951186; cv=none; d=google.com; s=arc-20160816; b=oK5kY8j3b39ntJXeaOl0y9LkKEBgAE9a493DpZfyIvMmWt3bMdo3Xjv0morJXiYAeB HDaOwMwAk9+c0EQCS5D7QhihsyO41pVK4rzCrcY/m8lRg2PBP0JVX/AerdRWa9ICijN6 EDgjGJJSutyApe4QSbv/uM7hplMQmrgyZxy42YtZcdceCnmhh5cQYXmkgBMtpKJcHnkP Rs271i8GByIycInxl/5yPL9foyvYI90pc4WbE6meU8cokOZXt60Gcgf7UhenKy3Qo0XH M4wrcljrMJc00YZ3bZtDuTUPMMiUDZA7taUO2SANax1G0fPyJPahRuS8sEYjjIjU41jX mqhw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YxxSV/Iq5pcLxWMtOGqpMQxefWGrkV/IHCtaCrNJvsI=; fh=kWHopdWuWktDcnjSO11R7sPQi0EWg865jqRuCsOPYXE=; b=p+awm5IuBBoxOvF9HgaIT52pbCp1wgJN69EWu27dc9ncbl+fYNeEBnfoKWK6m1gfEt AUCwAw5qborVcZ7t9PsFwVsQ0WUxzbf6CEGs9nCSztmBLpAhL1W72AYtklzFml1uk3Pv zYDaAHOC6PF4d7DIVgcKH1AtdCc02TRiq0JALZR3aytThAuH8N3v06fOMfCyRU1Gxj3H +cHQTpALuIS6XMOzCPxC04IFpc2Mw1azW1bcO2eU8Z0GHrTOimA9F50ISV4PiM9p8fL4 GlW33Vk/Gf1V707WRW4tFotrWk3zkTHXwG1WB3SR8Afn4oJGwemDElcAFgdvZDC3Qzmu /Cxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=xztT5IOe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id c14-20020a170902d48e00b001cc2bb98bdasi8064230plg.448.2023.11.14.00.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 00:39:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=xztT5IOe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B687F801D0F3; Tue, 14 Nov 2023 00:39:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232395AbjKNIji (ORCPT + 30 others); Tue, 14 Nov 2023 03:39:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232386AbjKNIj2 (ORCPT ); Tue, 14 Nov 2023 03:39:28 -0500 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B034D42; Tue, 14 Nov 2023 00:39:24 -0800 (PST) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3AE8dKdY075666; Tue, 14 Nov 2023 02:39:20 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1699951160; bh=YxxSV/Iq5pcLxWMtOGqpMQxefWGrkV/IHCtaCrNJvsI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=xztT5IOePOA0ShmwuSjd4Kiae+NtBJNRyiWAVyktPux1HH8pVBaD75pcr6EFEfppe K2Ws683YgniURFrTL+Pf9Vdbo32mwtQiWBdaXCF3n/qUNiZgbVBBloTX8SdWUEvqSk 2bQuXsoIPgLPwQnDNRCzZmQV0bmUR/eiS8oeE958= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3AE8dJ06072602 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 14 Nov 2023 02:39:19 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 14 Nov 2023 02:39:19 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 14 Nov 2023 02:39:19 -0600 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 3AE8d6OH128120; Tue, 14 Nov 2023 02:39:17 -0600 From: Siddharth Vadapalli To: , CC: , , , , , Subject: [PATCH 4/4] dmaengine: ti: k3-udma-glue: Update name for remote RX channel device Date: Tue, 14 Nov 2023 14:09:06 +0530 Message-ID: <20231114083906.3143548-5-s-vadapalli@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114083906.3143548-1-s-vadapalli@ti.com> References: <20231114083906.3143548-1-s-vadapalli@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 14 Nov 2023 00:39:43 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782528014894080441 X-GMAIL-MSGID: 1782528014894080441 A single RX Channel can have multiple flows. It is possible that a single device requests multiple flows on the same RX Channel. In such cases, the existing implementation of naming the device on the basis of the RX Channel can result in duplicate names. The existing implementation only uses the RX Channel source thread when naming, which implies duplicate names when different flows are being requested on the same RX Channel. In order to avoid duplicate names, include the RX flow as well in the name. Signed-off-by: Siddharth Vadapalli --- drivers/dma/ti/k3-udma-glue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c index 167fe77de71e..9415f03757bb 100644 --- a/drivers/dma/ti/k3-udma-glue.c +++ b/drivers/dma/ti/k3-udma-glue.c @@ -1094,8 +1094,8 @@ k3_udma_glue_request_remote_rx_chn_common(struct k3_udma_glue_rx_channel *rx_chn 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); + dev_set_name(&rx_chn->common.chan_dev, "rchan_remote-0x%04x-0x%02x", + rx_chn->common.src_thread, rx_chn->flow_id_base); ret = device_register(&rx_chn->common.chan_dev); if (ret) { dev_err(dev, "Channel Device registration failed %d\n", ret);