Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1095786imu; Wed, 16 Jan 2019 12:39:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN5MvGmfgjcgWhGEe6erFo/xhBNBzDrTPokJBHl43yQBmJV+zbLPfKfx/INL2c9Mw8sTFVli X-Received: by 2002:a65:43c5:: with SMTP id n5mr10896785pgp.250.1547671194180; Wed, 16 Jan 2019 12:39:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547671194; cv=none; d=google.com; s=arc-20160816; b=gY/kZDycezfGM0QGf8+2O2gkpk2w05B5ZPqIi/A1/2OvhbD7k9zRenZfUQIGuXt2Fp 6qKOferbwkhduxHVzCJ5JG9nsVfmU0R6kfofgqhgBrwD6IO95RFrHm9oi1x+sX3kZRXf Ks2cp5rwzMLTG/AmOD5HUVcyqdMp5iRhONsjPcAC6QPgp7rMSgL9fRXy+pIvc/skT8K1 nXQytIldxOaquoS3G01Lp3s48Y4t88F572PkZNTIxFii/dPKsgN2vV5ZSUxMKlwWwaeo EEZc0YVibPg3LZNLjY4iPP8aISebmy885PMDvuU+FKIapxMT0bFaY1wSUaZJ0Dsb5w4z 4J/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8GFQOZ7n26hJwTe+SbE/kil5VqtCXnuqCM7ZGqr2mBo=; b=RivGV2dr3uviRZ8F6ChmW6di8O+6N4R31bF9+iQjdcphcKRpTk/CG/Bw1B5k7QzgfQ URsh5aIczaYKf8GUaoa8o7Z83A9QayZw7MUwffZ5jMbNVjltt7FyQ4UCFWCKpdfexRQA XiZ3oLeaAkXdh1LBNtCOwGsz6o6swB0KOLyf1ozu/14FyIjkfnfKo7B89T1mImZolUaV mvQB3MtlGhYISHkH1Bnakh/A/XasbPHvoljKxxy0+djvjgoC6i1bWFM16Z1at0fXWYxq 9ou45mifOwBcdf7nCsMW1/doQjX8fbsxoXNkiQLCdmnIAoc6GOYSCSSwhqjL4LBZNX/e E8fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hb7GBJZL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si6990486pgd.248.2019.01.16.12.39.38; Wed, 16 Jan 2019 12:39:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hb7GBJZL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728611AbfAPCeV (ORCPT + 99 others); Tue, 15 Jan 2019 21:34:21 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:40256 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728243AbfAPCeU (ORCPT ); Tue, 15 Jan 2019 21:34:20 -0500 Received: by mail-lj1-f194.google.com with SMTP id n18-v6so4123597lji.7 for ; Tue, 15 Jan 2019 18:34:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8GFQOZ7n26hJwTe+SbE/kil5VqtCXnuqCM7ZGqr2mBo=; b=Hb7GBJZL4fR/QbQLBKElHgx8/xv4vVFyNha9GmsCMiHigpT0J5Yie7qAtoCfEnHEVg t0o/uOwxzeZ7yIUhj6SR52SynSKmY7cA4p+u/uFugMPHbQ1KQgUI/SBMv7A1Hmjnsg4Z oquklbKJ5oSbP+Lr6Uyospy/f9YBLbc7Qlocw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8GFQOZ7n26hJwTe+SbE/kil5VqtCXnuqCM7ZGqr2mBo=; b=U16ME+P7FvKat1v7sCeoapXp2BWTf2Ld/xGqUQb/O97tAxKUUYgzTI7/gFqxHsAion BDwb3p9xP4KvHvlixKgrw1kmEp1rGtaQQji4uiWlKLFSUe6NQnxPaYwt0gRV3vK5vMPQ z10oplg7GQNrxo6nsAb7av16eUV6Ysclb6s1ab6WXR41913xKZqLRlN1wsi1ycrIfg/a Qxl1EQKiglZLz/zH4HoHJwA+HBC3uPxF1wdkPz//OFWRf/ZGHpN7JStB4yjYQ9W83kok mHOlnhMD6wDLMhEMk6XUxkkBKh3Fu5HsJCwNKQp4Mn+UbxngqfoLunod/DtyGIqp1ObV kECQ== X-Gm-Message-State: AJcUuke1c60RRq1GvtRNco7K/ExRREN6bXUe+dt1rAC4WizD6On08ZzX Ti3i3IFgeU8NezAVt8+obVRScV4HlDN+2AONZvNPlUitlQboFA== X-Received: by 2002:a2e:5109:: with SMTP id f9-v6mr5106444ljb.52.1547606058443; Tue, 15 Jan 2019 18:34:18 -0800 (PST) MIME-Version: 1.0 References: <324f3106dbff2f28baae098b05219f1384fda97a.1547559542.git.baolin.wang@linaro.org> <20190115143042.GB5522@sirena.org.uk> In-Reply-To: <20190115143042.GB5522@sirena.org.uk> From: Baolin Wang Date: Wed, 16 Jan 2019 10:34:05 +0800 Message-ID: Subject: Re: [PATCH 4/4] spi: sprd: Add DMA mode support To: Mark Brown Cc: Rob Herring , Mark Rutland , Orson Zhai , Chunyan Zhang , lanqing.liu@unisoc.com, linux-spi@vger.kernel.org, DTML , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark, On Tue, 15 Jan 2019 at 22:30, Mark Brown wrote: > > On Tue, Jan 15, 2019 at 09:46:53PM +0800, Baolin Wang wrote: > > From: Lanqing Liu > > > > Add DMA mode support for the Spreadtrum SPI controller, and we will enable > > SPI interrupt to help to complete the SPI transfer work in DMA mode. > > Again this looks good, one thing to check though: > > > +static bool sprd_spi_can_dma(struct spi_controller *sctlr, > > + struct spi_device *spi, struct spi_transfer *t) > > +{ > > + struct sprd_spi *ss = spi_controller_get_devdata(sctlr); > > + > > + return ss->dma.enable; > > +} > > Is it always a benefit to use DMA? One reason this is a function rather > than just a property is that even if the device can DMA any size of > transfer often for short transfers the performance is better if you use > PIO since the overhead of setting up the DMA controller, waiting and > then taking the interrupt when it finishes ends up being more than the > cost of just reading and writing directly to the FIFOs for PIO. Firstly we want to simplify the transfer, once we enable the DMA, we always want to use DMA mode. But I think you are reasonable, we will optimize the can_dma() ops for short transfers to improve the performance. Thanks for your comments. -- Baolin Wang Best Regards