From patchwork Thu Apr 27 12:09:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 88229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp219933vqo; Thu, 27 Apr 2023 05:11:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7v8iW3HfqyXQxKtTvSVbOtFwp7pV+iVGPxyqo6aub7gaYFC+I38faSV6B2x5LSnzxZXMCd X-Received: by 2002:a17:902:ce81:b0:1a6:b971:faf6 with SMTP id f1-20020a170902ce8100b001a6b971faf6mr1504647plg.35.1682597508675; Thu, 27 Apr 2023 05:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682597508; cv=none; d=google.com; s=arc-20160816; b=Zh0/D+bhUJF2Jkgi6yh1NHQLNo/V6EeF/WxmeCGPxc25rU/dU+ryy90e2Ug2+fZiA/ uWoaIEGbZACrLHJc6zFrWaOckQ7M3nJKbf/VsUzpxHfdjcXz9jECJOoWOoRmwlTtC46s 3kShM1bkSKtrLhOroJDgMDPDnMDlUfdIGurgeCgYCJLjXbuU6/WsMTm4VdXfMSbWxoDJ NPY7ADmEUTu/AU7eYEgdD9WacE2vrx/k/oGowj34Pc/SHpFcMsLrMZlGKDFmcJb6eTjA 2NKN6PVfOXDd58G5fuSQf0F34Nr6g75WQeKS0tOCYCUXCFVkoG25L4brx1lwEL3Na2fR dxwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=16sZ2YhEqcAT3vEUuYnQSOpaLyx08pK+uCVG1ZL4MiQ=; b=SUeS25K1gADowR5ocmaelaXzC66/jwEm08QfQH2X8rcNT+gEgGM+KbQTkiYt7BIpDk f5198o8g5AdsERW86HK2QzKCySEtyhR/52V3Y9hAcNp7QwYzdBiNwftNrnsDriEyHsmq d21WoFJRh/s8yiFC4m7StoMKfLWYra3sFyzvCrYF6VW+ix/2EGoD8G9EBAz8w9Pi2Uun o4g0OWX6ikHWUOWhf1K2WQAdGjxNbJuL0C3/nIYLrlB6Xv0A6hKJeofq0ekgo2EzTioG 1piZUHgfg5+52Gu3mdSw/32sAXzlgSMUnTHlgt1B6E2T8V/jKekW2YdvJrO6OvVpXZLR jk6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vz4AHlEp; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ik25-20020a170902ab1900b001a682651e99si18869803plb.99.2023.04.27.05.11.33; Thu, 27 Apr 2023 05:11:48 -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=@linaro.org header.s=google header.b=vz4AHlEp; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243657AbjD0MKR (ORCPT + 99 others); Thu, 27 Apr 2023 08:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243768AbjD0MKH (ORCPT ); Thu, 27 Apr 2023 08:10:07 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17594C24 for ; Thu, 27 Apr 2023 05:10:04 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2a8b3ecf59fso84226151fa.0 for ; Thu, 27 Apr 2023 05:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682597403; x=1685189403; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=16sZ2YhEqcAT3vEUuYnQSOpaLyx08pK+uCVG1ZL4MiQ=; b=vz4AHlEp+QE62eG7yxVJKxoQ73/JvVqDz/IXtIbajgj8wiHd72Tr2WBKK5AptGPVqm FSVSijVwvZnrIFX3HS+d4MRjqpKaQF6oo1ubnD2G+5rqUZS7gEi/9swWCJo2pUf7dW1v NWiHG9/k0visOcEE0ZUaHmEmL1c6+y1zorWWCpJpJGotzEh7xnbM0RatFoFQkDZOu8m1 0pHP5dxP8BHN3anOheXz8bWrdGMMOFMd1Z/MMFK1ESWG8OQDu459YRFYL1LBI3dcMzWq nB7TJNBxzBIGlS/e7obrPDYqJcYpPhNq7vcH6Rcc9b7PZ7lySXs/CLCdk084XV93KDhl KVlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682597403; x=1685189403; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=16sZ2YhEqcAT3vEUuYnQSOpaLyx08pK+uCVG1ZL4MiQ=; b=PXODMYjcOdGcKxvCtaeBGfJMQbCimdput9Ie4IDiNWJlgPBdqVz5CN5OUO0sF4jPbe rqznOPDzXnOIoUUadFx8ISMjDhdAgsfr+s2YbXaeKVKKAGckuFNbMb4d/6y2zCPwoPU2 cfbJGtOLNlAr9SzQcCEfKGBPxA6VRuI1pqWhKIe+LIdZdh9F+ZupG0ZIZBjwGAOFhF1X pgnGHS03jk4Pk35B/BZAXweufJsER6Bp7SPQ7bW4DHPTnZke93RCjVk5d648H6wLMijp urwPpjfoY2AjEBIh+n+yHlPo2SGeab2h609GUKBa0hHazXgfGkiRzP7ccFV+e6eHp3NL qpTg== X-Gm-Message-State: AC+VfDwmKPep982pSe2jwwkamuxjn5jfMl5j5VewDCmL7vyjmhpIdVRI TyjcUaeIioLHbMo3NRerXk0JNQ== X-Received: by 2002:a05:6512:3743:b0:4eb:341c:ecc5 with SMTP id a3-20020a056512374300b004eb341cecc5mr557696lfs.12.1682597403118; Thu, 27 Apr 2023 05:10:03 -0700 (PDT) Received: from [192.168.1.2] (c-05d8225c.014-348-6c756e10.bbcust.telenor.se. [92.34.216.5]) by smtp.gmail.com with ESMTPSA id e7-20020ac25467000000b004d4d7fb0e07sm2892044lfn.216.2023.04.27.05.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 05:10:02 -0700 (PDT) From: Linus Walleij Date: Thu, 27 Apr 2023 14:09:59 +0200 Subject: [PATCH v2 4/8] dmaengine: ste_dma40: Remove platform data MIME-Version: 1.0 Message-Id: <20230417-ux500-dma40-cleanup-v2-4-cdaa68a4b863@linaro.org> References: <20230417-ux500-dma40-cleanup-v2-0-cdaa68a4b863@linaro.org> In-Reply-To: <20230417-ux500-dma40-cleanup-v2-0-cdaa68a4b863@linaro.org> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski Cc: dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Linus Walleij X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764331365200768202?= X-GMAIL-MSGID: =?utf-8?q?1764331365200768202?= The Ux500 is device tree-only since ages. Delete the platform data header and push it into or next to the driver instead. Drop the non-DT probe path since this will not happen. Signed-off-by: Linus Walleij --- drivers/dma/ste_dma40.c | 56 ++++++++---- .../dma-ste-dma40.h => drivers/dma/ste_dma40.h | 101 +-------------------- drivers/dma/ste_dma40_ll.c | 3 +- 3 files changed, 41 insertions(+), 119 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index ef2a2fdaa82e..e5df28cdc4c8 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -23,11 +23,39 @@ #include #include #include -#include #include "dmaengine.h" +#include "ste_dma40.h" #include "ste_dma40_ll.h" +/** + * struct stedma40_platform_data - Configuration struct for the dma device. + * + * @dev_tx: mapping between destination event line and io address + * @dev_rx: mapping between source event line and io address + * @disabled_channels: A vector, ending with -1, that marks physical channels + * that are for different reasons not available for the driver. + * @soft_lli_chans: A vector, that marks physical channels will use LLI by SW + * which avoids HW bug that exists in some versions of the controller. + * SoftLLI introduces relink overhead that could impact performace for + * certain use cases. + * @num_of_soft_lli_chans: The number of channels that needs to be configured + * to use SoftLLI. + * @use_esram_lcla: flag for mapping the lcla into esram region + * @num_of_memcpy_chans: The number of channels reserved for memcpy. + * @num_of_phy_chans: The number of physical channels implemented in HW. + * 0 means reading the number of channels from DMA HW but this is only valid + * for 'multiple of 4' channels, like 8. + */ +struct stedma40_platform_data { + int disabled_channels[STEDMA40_MAX_PHYS]; + int *soft_lli_chans; + int num_of_soft_lli_chans; + bool use_esram_lcla; + int num_of_memcpy_chans; + int num_of_phy_chans; +}; + #define D40_NAME "dma40" #define D40_PHY_CHAN -1 @@ -2269,7 +2297,7 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src, return NULL; } -bool stedma40_filter(struct dma_chan *chan, void *data) +static bool stedma40_filter(struct dma_chan *chan, void *data) { struct stedma40_chan_cfg *info = data; struct d40_chan *d40c = @@ -2288,7 +2316,6 @@ bool stedma40_filter(struct dma_chan *chan, void *data) return err == 0; } -EXPORT_SYMBOL(stedma40_filter); static void __d40_set_prio_rt(struct d40_chan *d40c, int dev_type, bool src) { @@ -3517,16 +3544,9 @@ static int __init d40_probe(struct platform_device *pdev) int num_reserved_chans; u32 val; - if (!plat_data) { - if (np) { - if (d40_of_probe(pdev, np)) { - ret = -ENOMEM; - goto report_failure; - } - } else { - d40_err(dev, "No pdata or Device Tree provided\n"); - goto report_failure; - } + if (d40_of_probe(pdev, np)) { + ret = -ENOMEM; + goto report_failure; } base = d40_hw_detect_init(pdev); @@ -3650,11 +3670,11 @@ static int __init d40_probe(struct platform_device *pdev) d40_hw_init(base); - if (np) { - ret = of_dma_controller_register(np, d40_xlate, NULL); - if (ret) - dev_err(dev, - "could not register of_dma_controller\n"); + ret = of_dma_controller_register(np, d40_xlate, NULL); + if (ret) { + dev_err(dev, + "could not register of_dma_controller\n"); + goto destroy_cache; } dev_info(base->dev, "initialized\n"); diff --git a/include/linux/platform_data/dma-ste-dma40.h b/drivers/dma/ste_dma40.h similarity index 51% rename from include/linux/platform_data/dma-ste-dma40.h rename to drivers/dma/ste_dma40.h index 10641633facc..c697bfe16a01 100644 --- a/include/linux/platform_data/dma-ste-dma40.h +++ b/drivers/dma/ste_dma40.h @@ -1,19 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (C) ST-Ericsson SA 2007-2010 - * Author: Per Forlin for ST-Ericsson - * Author: Jonas Aaberg for ST-Ericsson - */ - #ifndef STE_DMA40_H #define STE_DMA40_H -#include -#include -#include -#include - /* * Maxium size for a single dma descriptor * Size is limited to 16 bits. @@ -118,92 +107,4 @@ struct stedma40_chan_cfg { int phy_channel; }; -/** - * struct stedma40_platform_data - Configuration struct for the dma device. - * - * @dev_tx: mapping between destination event line and io address - * @dev_rx: mapping between source event line and io address - * @disabled_channels: A vector, ending with -1, that marks physical channels - * that are for different reasons not available for the driver. - * @soft_lli_chans: A vector, that marks physical channels will use LLI by SW - * which avoids HW bug that exists in some versions of the controller. - * SoftLLI introduces relink overhead that could impact performace for - * certain use cases. - * @num_of_soft_lli_chans: The number of channels that needs to be configured - * to use SoftLLI. - * @use_esram_lcla: flag for mapping the lcla into esram region - * @num_of_memcpy_chans: The number of channels reserved for memcpy. - * @num_of_phy_chans: The number of physical channels implemented in HW. - * 0 means reading the number of channels from DMA HW but this is only valid - * for 'multiple of 4' channels, like 8. - */ -struct stedma40_platform_data { - int disabled_channels[STEDMA40_MAX_PHYS]; - int *soft_lli_chans; - int num_of_soft_lli_chans; - bool use_esram_lcla; - int num_of_memcpy_chans; - int num_of_phy_chans; -}; - -#ifdef CONFIG_STE_DMA40 - -/** - * stedma40_filter() - Provides stedma40_chan_cfg to the - * ste_dma40 dma driver via the dmaengine framework. - * does some checking of what's provided. - * - * Never directly called by client. It used by dmaengine. - * @chan: dmaengine handle. - * @data: Must be of type: struct stedma40_chan_cfg and is - * the configuration of the framework. - * - * - */ - -bool stedma40_filter(struct dma_chan *chan, void *data); - -/** - * stedma40_slave_mem() - Transfers a raw data buffer to or from a slave - * (=device) - * - * @chan: dmaengine handle - * @addr: source or destination physicall address. - * @size: bytes to transfer - * @direction: direction of transfer - * @flags: is actually enum dma_ctrl_flags. See dmaengine.h - */ - -static inline struct -dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan, - dma_addr_t addr, - unsigned int size, - enum dma_transfer_direction direction, - unsigned long flags) -{ - struct scatterlist sg; - sg_init_table(&sg, 1); - sg.dma_address = addr; - sg.length = size; - - return dmaengine_prep_slave_sg(chan, &sg, 1, direction, flags); -} - -#else -static inline bool stedma40_filter(struct dma_chan *chan, void *data) -{ - return false; -} - -static inline struct -dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan, - dma_addr_t addr, - unsigned int size, - enum dma_transfer_direction direction, - unsigned long flags) -{ - return NULL; -} -#endif - -#endif +#endif /* STE_DMA40_H */ diff --git a/drivers/dma/ste_dma40_ll.c b/drivers/dma/ste_dma40_ll.c index b5287c661eb7..4c489b126cb2 100644 --- a/drivers/dma/ste_dma40_ll.c +++ b/drivers/dma/ste_dma40_ll.c @@ -6,8 +6,9 @@ */ #include -#include +#include +#include "ste_dma40.h" #include "ste_dma40_ll.h" static u8 d40_width_to_bits(enum dma_slave_buswidth width)