Received: by 10.213.65.68 with SMTP id h4csp381651imn; Tue, 3 Apr 2018 23:29:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/fhjgdhnxk/80ccyFsgXEWs4C/oYLiKgDtJd/A3snCYzZcPkHFM8TW0NM9IJaWf0nX/1cl X-Received: by 2002:a17:902:7b96:: with SMTP id w22-v6mr15837005pll.116.1522823362192; Tue, 03 Apr 2018 23:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522823362; cv=none; d=google.com; s=arc-20160816; b=VJDhkONm9mc++Pvz/KSIoCokuGbM7MDP/RSqESMIo5FbYULQ/WK4N/k4GjvCPeTyhJ +H0yzMJkc8vZ6rsM+XLLom89AzT/b6VhpspKuiwT1CWe+HIZLmhtXl7nlT9nDLtN0nT7 i9UK1rFiIdDGcaS2cCSnDkGiBLH20gqKS8MNU9ApHE/tey/of2F3Py53HHIlET8LRPQK YY4sMFcouqrnBfhRim97QY09SoQOhqYo9SUUCLYgF2KTP6EtvPKMyxb7E8lB6QHBI5CV PkmyKLPKFZA2FvBwyafAyod/K0fhML58ws6Ahax9IO+Wo9L5QRguQ0iU6X3IaS7KJIaW zHSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=FeOfDGSfYRORgE5th7Y3q6mWgr+tYMFZKMlla4iL4Z8=; b=L/KuPVAsfnZ9YPETxGIa4gjK0yx+ygZYhmkoOCzwLNtxbZj0RsOTqGr3X3sZp0mu8I wXYM+zIxUYViuJ5KrFxug1maI+qnUF/ld2UKjP+bZ6Wv8d4XbPIVneKO2wfaP9dTy/Bz EPN7m7zzIgjgl3m14t7hkFiv4iC6R0vgrcj8J9JW6f7GHjNnXrkHArtSFz//gWGvik/o U+u0OZcP+CrjaazTzaoZ512rYUvtua2a9EkfmvawGVopL3nBxpQ53E4UY7I9FqxkyB5h a0eldo3Md5XDmMCSBkOuEAhAW4m1FsWiEIZjL6KBeB1GB6utsF+2d3nYnUdq2Eu1sqjB FjWw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10si3168349pgp.45.2018.04.03.23.29.07; Tue, 03 Apr 2018 23:29:22 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750852AbeDDG2D (ORCPT + 99 others); Wed, 4 Apr 2018 02:28:03 -0400 Received: from mail.bootlin.com ([62.4.15.54]:37065 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750711AbeDDG2B (ORCPT ); Wed, 4 Apr 2018 02:28:01 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 22AED20765; Wed, 4 Apr 2018 08:28:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id E52C120644; Wed, 4 Apr 2018 08:27:59 +0200 (CEST) Date: Wed, 4 Apr 2018 08:27:59 +0200 From: Maxime Ripard To: Sergey Suloev Cc: Mark Brown , Chen-Yu Tsai , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/6] spi: sun4i: add DMA transfers support Message-ID: <20180404062759.6iplyaezcppahrpu@flea> References: <20180329185907.27281-1-ssuloev@orpaltech.com> <20180329185907.27281-7-ssuloev@orpaltech.com> <20180403081711.rqsp77mgnuvlnzt5@flea> <19d5907c-f081-21ce-1b72-7c0a331eb073@orpaltech.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nhlxsoo76i3tt5tr" Content-Disposition: inline In-Reply-To: <19d5907c-f081-21ce-1b72-7c0a331eb073@orpaltech.com> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nhlxsoo76i3tt5tr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 03, 2018 at 04:03:32PM +0300, Sergey Suloev wrote: > On 04/03/2018 11:17 AM, Maxime Ripard wrote: > > On Thu, Mar 29, 2018 at 09:59:07PM +0300, Sergey Suloev wrote: > > > +static int sun4i_spi_dma_setup(struct device *dev, > > > + struct resource *res) > > > +{ > > > + struct spi_master *master =3D dev_get_drvdata(dev); > > > + struct dma_slave_config dma_sconf; > > > + int ret; > > > + > > > + master->dma_tx =3D dma_request_slave_channel_reason(dev, "tx"); > > > + if (IS_ERR(master->dma_tx)) { > > > + dev_err(dev, "Unable to acquire DMA TX channel\n"); > > > + ret =3D PTR_ERR(master->dma_tx); > > > + goto out; > > > + } > > > + > > > + dma_sconf.direction =3D DMA_MEM_TO_DEV; > > > + dma_sconf.src_addr_width =3D DMA_SLAVE_BUSWIDTH_1_BYTE; > > > + dma_sconf.dst_addr_width =3D DMA_SLAVE_BUSWIDTH_1_BYTE; > > I guess that would depend on the size of the transfer, right? > > no > "this is the width in bytes of the source (RX)register where DMA data sha= ll > be read. If the sourceis memory this may be ignored depending on > architecture." > AFAIK is should be 1 byte for SPI side and seems to be ignored for memory > side, but as soon as I don't know what should be correct value for memory > side I just put 1 there too. I meant the number of bits per word, sorry. That width would only apply if you have 8 bits per word, but that seems to always be the case. So nevermind. > > > + dma_sconf.dst_addr =3D res->start + SUN4I_TXDATA_REG; > > > + dma_sconf.dst_maxburst =3D 1; > > > + dma_sconf.src_maxburst =3D 1; > > > > And a burst of 1 seems sub-optimal here. > > I did some tests before with 3/4 FIFO size but it didn't work and I got > stuck with 1 byte. > It seems like 1 byte is the correct value because in SPI protocol we can > only send 1 byte in 1 burst. That's not about the SPI burst, it's about the DMA burst. > >=20 > > > + ret =3D sun4i_spi_dma_setup(&pdev->dev, res); > > > + if (ret) { > > > + if (ret =3D=3D -EPROBE_DEFER) { > > > + /* wait for the dma driver to load */ > > > + goto err_free_master; > > > + } > > > + dev_warn(&pdev->dev, "DMA transfer not supported\n"); > > Saying why it's not supported would be great. > > I can put more info in this log > but there is already a message printed from sun4_spi_dma_setup() if any > error occurs Then you don't need both. Maxime --=20 Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com --nhlxsoo76i3tt5tr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlrEcG4ACgkQ0rTAlCFN r3QqkBAAlyZ6TmUCUympCkIuX4YGYN6ZlBabfQvToqyNtS1FmGl/lZi/zFRNQPR/ NfjP1l8mv6gK7p5XrdVGa3WAduYLVwfO90pkB1jdE5UDXkZUTzQfmDPJ3ji+bLl4 JYD7IdyC1W06CgZmTza1o9MQhrVnuBpvSRxERGhcDcntOExOn+O59TI2McVfQu6w aTpMpvieM78k+jXGGGP3Wln+5lBFvm2ufMgdMRuzkWA7mpWKc5QzOigQxKOqK48l oly401C58JVi0RusLwifNoN0tjaG+mzooHtNGFhvhY+r5pS2+ilj9pLqOEgmbKho Zs+WylSKeXL87aaKt1LppRIewFFFgDD44IqhT4gYEyfsDn1JXQNRTmW04dlfrOCx okHutHExWSH/PcpN9gj2cLADyg8AYu8ZW4LHgoc0SeOMvBGo6B7ZqriKsO59p6t5 d+f/VqQNbKNeC6BFreZtpbd8F4EmNGQkoRIEyJNITCOjCFY5XTe4NaVKk+YlCR1l mD8S9gs4eg9jZtoE6euSbv/LowHDy5ogY4eig+KFLCN5Vl7RD3vBf5RPb2/H4Fj2 TcK9g8jUpoSGEJWnpfyDR1C7z3pLHPmEPeUPPtLC9x0nLuZP5vykgFa8NxKjbkzH FyFdmoHqILe4C9BIfSIrzpC0LN+dDauz8Sq0phqcmj7jFsX0BGI= =whQm -----END PGP SIGNATURE----- --nhlxsoo76i3tt5tr--