From patchwork Fri Dec 8 10:38:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shravan chippa X-Patchwork-Id: 175762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5367173vqy; Fri, 8 Dec 2023 02:38:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGd2z4UqPY1Y1UvPUyVhmyizUgV5D5xaxiiL3ZuudOJAEdrAyJ+mdskpc6b3YP/kCZLrlhx X-Received: by 2002:a17:90a:e645:b0:286:7ef0:fb4d with SMTP id ep5-20020a17090ae64500b002867ef0fb4dmr864941pjb.6.1702031888228; Fri, 08 Dec 2023 02:38:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702031888; cv=none; d=google.com; s=arc-20160816; b=hv3eEZoIFTnfFqON187FkgeU2Ofaic/4xxvd0oQjHE5x7UhbznUaiTZ/gy4UBmr/Hg CMPbF3S05eju6lrsGNMXVMAzMq0j+7yAnVCUMGrND10cg8GDRCX2gx+snib06LoS06Gb TUPcKqKbCwRVk5rMHn2ldZWFEXAAGFNmuzxVS9sfdqS95T9AzwZ1sGFB6CWmxzRrHsXu /ztsfpu6DWh8vVv19OEotb6zHrxn1Fhuc4SQ8pJ20obK785vDiVjKQpvHA3uLu6hhPv4 PBrn4u+Z5G0SMhLT4RFASPbugWmNKkFavb+PyHbvDKAjVDaaV5Hw0Cb4pizKHBELhD/B iWeA== 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=pYjCPoVCJ0ZFH04k9qxi9KwWmc8z3Ijh2v8dNBTx52g=; fh=ShTRRczpu864z7u/uL8KOhQHPlzqNfTJPMMlbqeoRU0=; b=YQbTNWw2lWad0i1CHwsSv9R+sPAreZD2zqk5S42Lpo+ziXC87ty8tokSGI/TJBA+aW GubUWnIKnwQF5jsOyaEHuB0nakGBqnbB5qAxsK+8UEOzlzTmGprZvgCqJdCkT0Yb95uE +ecNnDRvQznqDkTR7TDwjjhHRqnusyboQ2CYSTd3Bob786So7pdjvKsh3VqDE3Nhv/Sq lPZX+gFFNEiujca7FJOfuNyljgHd80VlvrCx4zMVzkCuHleHuYD7Mys6vBFIe8twfulj z0GzvkWQxzOcOcmfdSgJj6B7o9zBwOxnSmaTMaDmQTSey7XxBNjo4vca7E7toTfE/dBz c15g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=PplmWTq3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id gx15-20020a17090b124f00b0028a18d957d1si1490506pjb.60.2023.12.08.02.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 02:38:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=PplmWTq3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 2FF76836E44D; Fri, 8 Dec 2023 02:38:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573611AbjLHKhx (ORCPT + 99 others); Fri, 8 Dec 2023 05:37:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573469AbjLHKhv (ORCPT ); Fri, 8 Dec 2023 05:37:51 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 026DE10C2; Fri, 8 Dec 2023 02:37:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1702031878; x=1733567878; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7fpfZLQ/wUMnvIzkFtnwjbFo65V7UhlC6XBu/GZbLfo=; b=PplmWTq3Hc1ZcVmtOfXwN706ZX/x7/XbFDascjkETd+5JFAIKnrjo4FQ aQJfVyvtmN6duzwVZJRxQv1ZF686K89tvtRTpL9gtQoayycR2ICR546u6 fpjQZOqD114gfHuIMlClhKa6jpJJDh5yL65ZoucajpKkqt0El27yE6Ivy XW2AHpyIbzm7Wbwenkos6MmIcyNGVdNOTIzaVLo3WFPODCmn19DDv1DIf kqEKUl4SxdCbtWoqcMiuHyirm06wVVf66YY+T2l4KPBSpHm9YCpcnacA9 +o2Wy3fLDld9zXzaoAEBT7jywDu42Hl4thrxrfNgt3+OUQknWeHzDFVJ+ Q==; X-CSE-ConnectionGUID: H3XQVRBZQ2qxsVmz7vJ8Sw== X-CSE-MsgGUID: Hl/X09+ES/+vFdJJftuD7g== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.04,260,1695711600"; d="scan'208";a="13315277" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 08 Dec 2023 03:37:50 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 8 Dec 2023 03:37:50 -0700 Received: from microchip1-OptiPlex-9020.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 8 Dec 2023 03:37:45 -0700 From: shravan chippa To: , , , , , , CC: , , , , , , Subject: [PATCH v5 1/4] dmaengine: sf-pdma: Support of_dma_controller_register() Date: Fri, 8 Dec 2023 16:08:53 +0530 Message-ID: <20231208103856.3732998-2-shravan.chippa@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231208103856.3732998-1-shravan.chippa@microchip.com> References: <20231208103856.3732998-1-shravan.chippa@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 08 Dec 2023 02:38:06 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784709789232129742 X-GMAIL-MSGID: 1784709789232129742 From: Shravan Chippa Update sf-pdma driver to adopt generic DMA device tree bindings. It calls of_dma_controller_register() with of_dma_xlate_by_chan_id to get the generic DMA device tree helper support and the DMA clients can look up the sf-pdma controller using standard APIs. Signed-off-by: Shravan Chippa --- drivers/dma/sf-pdma/sf-pdma.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/dma/sf-pdma/sf-pdma.c b/drivers/dma/sf-pdma/sf-pdma.c index 3125a2f162b4..6109e1c5a09e 100644 --- a/drivers/dma/sf-pdma/sf-pdma.c +++ b/drivers/dma/sf-pdma/sf-pdma.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "sf-pdma.h" @@ -563,7 +564,20 @@ static int sf_pdma_probe(struct platform_device *pdev) return ret; } + ret = of_dma_controller_register(pdev->dev.of_node, + of_dma_xlate_by_chan_id, pdma); + if (ret < 0) { + dev_err(&pdev->dev, + "Can't register SiFive Platform OF_DMA. (%d)\n", ret); + goto err_unregister; + } + return 0; + +err_unregister: + dma_async_device_unregister(&pdma->dma_dev); + + return ret; } static void sf_pdma_remove(struct platform_device *pdev) @@ -583,6 +597,9 @@ static void sf_pdma_remove(struct platform_device *pdev) tasklet_kill(&ch->err_tasklet); } + if (pdev->dev.of_node) + of_dma_controller_free(pdev->dev.of_node); + dma_async_device_unregister(&pdma->dma_dev); }