Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4426599ybg; Mon, 8 Jun 2020 07:37:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrvpHWvJeurmFg3WMQVU6illSGs1w7aMck5H+LefWkCTyaP6XfdAjPhbgwUXa0IBz5e62q X-Received: by 2002:a17:906:7696:: with SMTP id o22mr20116633ejm.245.1591627040694; Mon, 08 Jun 2020 07:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591627040; cv=none; d=google.com; s=arc-20160816; b=besR1FIjWRJVHqJB5u/IfM8Hsko0jJ/Z/xeK6+DWNREWdLSjY93zHx7ze/aO9m2vmz +7zvdgB1N3w7kddkMCQzbUDYRFfYYFi2DPwSfVgieOe25lD766mEMlq5vRdEWX1qfjeK qZyvnHUuk+POgaRBwKG/PwJq8DME2JDlc0/hivfIClBXirQLxUtjulv+qdMk3o0B2Bff NTPAKtao4usH1rGuCkRhBO6ENBSLv8t+EZznkVLcX3hs6wGEyBnjnO4T5wPIocmvdIyU U+yX8Uw4RlMj4TZ9eDfF94uS6IMg7X/ob+G28Rxld06DE1uSEfibnKaC3jrh030eiTrL wetA== 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:dkim-signature; bh=qAEpc/LczRx7w8PBW0aeSYCfTusH2FinH5LQCra4dZU=; b=rAeCTOUFanzJWZGz/g8f0kqjZdUf72N5zBLX+nupi/lTh9sqnjGrJDETzcpTsKios8 XLWXwXAZYUINkO9WlGDT7dfYmfVSh5JsPQg2DERb6B5wlfQsAeRtf7zdg6EF3dTUaBJh vXVpDi4AFpWaVDe8+iywi3vKGrYufJ+E/OCfQy6a7ceLlsbb+yNBlzL4lUvwe6gtscEO tTE6f6YgVU/Cg4v2gN7wPGi7AAqa0k0KUK4FXBn0riBxkn3fV70DhGYV7s+QttZOhii1 I8w4HKi91RdKZvtPw7kgh0kUoHXD5LKVmuUD8KuIaLzmEU3FtI5RFcrnSknAYPyDUnfH ZQEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q7mbEcSg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg28si9092375edb.495.2020.06.08.07.36.57; Mon, 08 Jun 2020 07:37:20 -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; dkim=pass header.i=@kernel.org header.s=default header.b=q7mbEcSg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730016AbgFHOfC (ORCPT + 99 others); Mon, 8 Jun 2020 10:35:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:48144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729938AbgFHOfB (ORCPT ); Mon, 8 Jun 2020 10:35:01 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A42492053B; Mon, 8 Jun 2020 14:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591626901; bh=se07oWpX9Vc9YGWIWXRJxx09yVt7wFgerxA1Los/EJE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q7mbEcSg+/zhqjXLAyy2REvz73FjXmyY1tuwYpyG0jPt2Up6kIWVbYfu324qSUOx8 mvtayzWIg2FUQiMANalVpYJNrft4AeJhJb7M2QBEn6Mt7YWWrgsw4GlJ1rbHWXBriy Nd25PVMOlWx1aygpW8+3b8YRF88v+H8x2LrVoRZU= Date: Mon, 8 Jun 2020 15:34:58 +0100 From: Mark Brown To: Robin Gong Cc: mark.rutland@arm.com, robh+dt@kernel.org, catalin.marinas@arm.com, vkoul@kernel.org, will.deacon@arm.com, shawnguo@kernel.org, festevam@gmail.com, s.hauer@pengutronix.de, martin.fuzzey@flowbird.group, u.kleine-koenig@pengutronix.de, dan.j.williams@intel.com, matthias.schiffer@ew.tq-group.com, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de, linux-imx@nxp.com, dmaengine@vger.kernel.org Subject: Re: [PATCH v9 RESEND 01/13] spi: imx: add dma_sync_sg_for_device after fallback from dma Message-ID: <20200608143458.GH4593@sirena.org.uk> References: <1591485677-20533-1-git-send-email-yibin.gong@nxp.com> <1591485677-20533-2-git-send-email-yibin.gong@nxp.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="VkqCAaSJIySsbD6j" Content-Disposition: inline In-Reply-To: <1591485677-20533-2-git-send-email-yibin.gong@nxp.com> X-Cookie: I'm rated PG-34!! User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --VkqCAaSJIySsbD6j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 07, 2020 at 07:21:05AM +0800, Robin Gong wrote: > In case dma transfer failed and fallback to pio, tx_buf/rx_buf need to be > taken care cache since they have already been maintained by spi.c Is this needed as part of this series? This looks like an independent fix and it seems better to get this in independently.=20 > Fixes: bcd8e7761ec9("spi: imx: fallback to PIO if dma setup failure") > Signed-off-by: Robin Gong > Reported-by: Matthias Schiffer > Link: https://lore.kernel.org/linux-arm-kernel/5d246dd81607bb6e5cb9af86ad= 4e53f7a7a99c50.camel@ew.tq-group.com/ The Link is usually to the patch on the list. > --- a/drivers/spi/spi-imx.c > +++ b/drivers/spi/spi-imx.c > @@ -1456,6 +1456,13 @@ static int spi_imx_pio_transfer(struct spi_device = *spi, > return -ETIMEDOUT; > } > =20 > + if (transfer->rx_sg.sgl) { > + struct device *rx_dev =3D spi->controller->dma_rx->device->dev; > + > + dma_sync_sg_for_device(rx_dev, transfer->rx_sg.sgl, > + transfer->rx_sg.nents, DMA_TO_DEVICE); > + } > + > return transfer->len; > } This is confusing - why are we DMA mapping to the device after doing a PIO transfer? --VkqCAaSJIySsbD6j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl7eTJIACgkQJNaLcl1U h9AmVQgAgF2rPJqmixW0OscJdAzTqAWK/RzhC/aIQ0M2AWtflewynWvGc7rEB0gU edNL29WS+Daa76JCcvlaMpJkmrRbylXM8sVNWcnIHwyXvp8sizcvcqcyNl5jE8ls vfCYPQjBxCwE6vBYG7zaLTooQ/tgT6KDQtijCN7Vg+cqsTba5YU6cQS8LIYxBL0L c6lvNJBB/eY2dYwWRlNPURlD+8Ur9bwZ464iui3Ivk3Zx3j59QfTYc4/AOGXYRkE ZdhxXYE7TH9f7eeDWHDZwOc9W+LEp7+6Yj7ON7gPgHndlK/dGrTYNEFa6Q4dPHGp ng06qs5xaleX4+/qjTTPf+UIkpv6/g== =0xWQ -----END PGP SIGNATURE----- --VkqCAaSJIySsbD6j--