Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp71351ybt; Thu, 9 Jul 2020 15:47:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIHBlaVHi2SyzDto6YDf9YN29D75csHo0Dj+NXJiJ8o4OfTmQynGnc8B0lItAz/gcDNxM4 X-Received: by 2002:a17:906:b15:: with SMTP id u21mr59124866ejg.520.1594334855239; Thu, 09 Jul 2020 15:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594334855; cv=none; d=google.com; s=arc-20160816; b=vEOApgn0QK78Gw1eBSmpQ3nqzmJ46ACcADMG031JRd4j+Own31D2zK7kWlKJ2YRcot nMDwSA5iCsqO0Bh6dDvo3SE83zNDNRW7oV6AFROwBmEcv+dCe2s0rvuwEo8pXfl3/vUp UpvJQfsSgEEiZ4wwWeyp2sAfqiUek/WVgJTH8bC43cRg6KfJHtP7WOYN5lI5JV+EHi4g sLSrVt8vhMUK/6sJ9sZJsZkVBEeuidXSvKM80K9LoUVs4DLTs083t1e0BMAVFXI1qH4D MjvtV+8zMrZ6zq0W5JNl2zmINH0vaXPW6ISOcxD0886G3XHzfmew1eHrt6DCxG7ra4p+ WYkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lD3gfTMR/NuiowsRMw6S61g3TxAHa8Pq5wQd4BniQuc=; b=0OCK+sCZ60xFFqv718tN1Ik5qLJT/8q+/Hm4MVLSKm9zpLfLfaT1vMAZ4K41uY1+ER SVHPvz9V9K/h7n0OTePjioWBvvem5ipiyfnI2ZjiW4TnAdLFIb/L8k64fsMzLz7Hsjoq VN6jFyajOl8xOrBloubvXneGxJ1GPHI+crk5p/XfMsQoF3m+YDNKY98ZDvKuddmyURIe 4M/Zwg99arpJdxsXz0MJsECaPuJ9EkgNxSs+9zDGizp7niUq/MVxyKIw4F+JdrpfJAfA NsEJPPVDp0o7C8elf9gopqH1eD54eP3z6gvMPDitgPMTC4LXSOHDIXNiX+Nf74GhlTy4 7MOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ch9si2815241edb.155.2020.07.09.15.47.13; Thu, 09 Jul 2020 15:47:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727856AbgGIWqn (ORCPT + 99 others); Thu, 9 Jul 2020 18:46:43 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:48198 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727081AbgGIWqU (ORCPT ); Thu, 9 Jul 2020 18:46:20 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id 0413180045E5; Thu, 9 Jul 2020 22:46:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MRoD_kFL0_oL; Fri, 10 Jul 2020 01:46:16 +0300 (MSK) From: Serge Semin To: Vinod Koul , Viresh Kumar , Andy Shevchenko , Dan Williams CC: Serge Semin , Serge Semin , Alexey Malahov , Thomas Bogendoerfer , Arnd Bergmann , Rob Herring , , , , Subject: [PATCH v7 11/11] dmaengine: dw: Initialize max_sg_nents capability Date: Fri, 10 Jul 2020 01:45:50 +0300 Message-ID: <20200709224550.15539-12-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20200709224550.15539-1-Sergey.Semin@baikalelectronics.ru> References: <20200709224550.15539-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Multi-block support provides a way to map the kernel-specific SG-table so the DW DMA device would handle it as a whole instead of handling the SG-list items or so called LLP block items one by one. So if true LLP list isn't supported by the DW DMA engine, then soft-LLP mode will be utilized to load and execute each LLP-block one by one. The soft-LLP mode of the DMA transactions execution might not work well for some DMA consumers like SPI due to its Tx and Rx buffers inter-dependency. Let's initialize the max_sg_nents DMA channels capability based on the nollp flag state. If it's true, no hardware accelerated LLP is available and max_sg_nents should be set with 1, which means that the DMA engine can handle only a single SG list entry at a time. If noLLP is set to false, then hardware accelerated LLP is supported and the DMA engine can handle infinite number of SG entries in a single DMA transaction. Signed-off-by: Serge Semin Reviewed-by: Andy Shevchenko Cc: Alexey Malahov Cc: Thomas Bogendoerfer Cc: Arnd Bergmann Cc: Rob Herring Cc: linux-mips@vger.kernel.org Cc: devicetree@vger.kernel.org --- Changelog v3: - This is a new patch created as a result of the discussion with Vinud and Andy in the framework of DW DMA burst and LLP capabilities. Changelog v4: - Use explicit if-else statement when assigning the max_sg_nents field. --- drivers/dma/dw/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c index 588b9bae827c..9dee5fa65153 100644 --- a/drivers/dma/dw/core.c +++ b/drivers/dma/dw/core.c @@ -1059,6 +1059,18 @@ static void dwc_caps(struct dma_chan *chan, struct dma_slave_caps *caps) struct dw_dma_chan *dwc = to_dw_dma_chan(chan); caps->max_burst = dwc->max_burst; + + /* + * It might be crucial for some devices to have the hardware + * accelerated multi-block transfers supported, aka LLPs in DW DMAC + * notation. So if LLPs are supported then max_sg_nents is set to + * zero which means unlimited number of SG entries can be handled in a + * single DMA transaction, otherwise it's just one SG entry. + */ + if (dwc->nollp) + caps->max_sg_nents = 1; + else + caps->max_sg_nents = 0; } int do_dma_probe(struct dw_dma_chip *chip) -- 2.26.2