Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1056299ybs; Mon, 25 May 2020 06:15:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh1FLnHfXGAVOnH8xQJW47O82Cp6NdqqNKyGbuqon/+22bAV6eHeCEb38+ckFWJiBzIuyv X-Received: by 2002:a05:6402:1558:: with SMTP id p24mr16134180edx.32.1590412534584; Mon, 25 May 2020 06:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590412534; cv=none; d=google.com; s=arc-20160816; b=vP37QzNRwY0Wo9f5/3w1AnFmBJmQUD5QR3pwlWuE8aoUga/jyCLgAKN+0R7tIeUTLl /Clt31aXq320FDfJeREf87iWdJPwDXntORatkQyiAwePd+o5O5ViyM1hM3p2v8kqY9Zm BLVgmjZ3OAgADRsxFhaXzzwiu4W+A6AMxU26sUDeJhXOSZYs+4buAkLiNCUl8uX1iMnw k9+HQQVVCnSXGqz13B2YdQxnzAO8Az4iqU7Swip0i+6gylduOC+LZniqNho4NL/pkZ+6 a0Q9WH+na1HXB6ltjzccFN/GnQl4wbvNjgwJfejZ5GpyfNpwjFv16PCRdqhfVEtQwR5k anoQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=tmXu2NrJPKJ0+Re9G/K+p+kotiH6S1u3OAmERUJdGiI=; b=hkT36dE6mrU0k+f/BxmtkjhhBxe0q5eE+wvIXGzy5Zwl8kAWocmCmCaxxFgk8lxQqE rklnQypyEsyUKUTfa2230evIWxCEd6NLcZErgsDjis2awjojzurEU/QEIHUwkRHbNmuD DqB0Y03ll2gkLfXaS0xn6Iv4mqjRMPvJVG9XnliMBVAzEBnISmHOsXh1JzYYjqi5qnbR t4fT3P0Y715F8UqYM2oNiZjutpPQtxnJo6u5P5wLWsjthnHFY99j6v0WKiQUeMxOWLfy pHw746xJW4ZAdzqXkrDrdGe5pvU+qbHx7pOPWylIvIWf+BjZRGB1L1WEuy3kEyKUHB7i NTZA== 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 u14si9729926ejx.342.2020.05.25.06.15.11; Mon, 25 May 2020 06:15:34 -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 S2403804AbgEYNMS (ORCPT + 99 others); Mon, 25 May 2020 09:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390583AbgEYNMS (ORCPT ); Mon, 25 May 2020 09:12:18 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAE25C05BD43 for ; Mon, 25 May 2020 06:12:17 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jdCtl-00075J-DR; Mon, 25 May 2020 15:12:09 +0200 Received: from [IPv6:2a03:f580:87bc:d400:d406:10d7:6286:51e5] (unknown [IPv6:2a03:f580:87bc:d400:d406:10d7:6286:51e5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mkl@blackshift.org", Issuer "StartCom Class 1 Client CA" (not verified)) (Authenticated sender: mkl@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id 07A1B505BD0; Mon, 25 May 2020 13:12:06 +0000 (UTC) Subject: Re: [PATCH] can: mcp251x: convert to half-duplex SPI To: Mark Brown Cc: Tim Harvey , open list , linux-can@vger.kernel.org, Wolfgang Grandegger , =?UTF-8?Q?Timo_Schl=c3=bc=c3=9fler?= , Andy Shevchenko , linux-spi@vger.kernel.org, Jan Glauber , Robert Richter References: <1582655734-20890-1-git-send-email-tharvey@gateworks.com> <0ac77abd-0df5-e437-ea46-f6c77f59b81c@pengutronix.de> <0b351fe3-8fe9-572f-fd85-e2aed22873e3@pengutronix.de> <7b85e098-b9a9-dd14-203f-100cdf2e703e@pengutronix.de> <20200525113106.GB4544@sirena.org.uk> <20200525125743.GF4544@sirena.org.uk> From: Marc Kleine-Budde Autocrypt: addr=mkl@pengutronix.de; prefer-encrypt=mutual; keydata= mQINBFFVq30BEACtnSvtXHoeHJxG6nRULcvlkW6RuNwHKmrqoksispp43X8+nwqIFYgb8UaX zu8T6kZP2wEIpM9RjEL3jdBjZNCsjSS6x1qzpc2+2ivjdiJsqeaagIgvy2JWy7vUa4/PyGfx QyUeXOxdj59DvLwAx8I6hOgeHx2X/ntKAMUxwawYfPZpP3gwTNKc27dJWSomOLgp+gbmOmgc 6U5KwhAxPTEb3CsT5RicsC+uQQFumdl5I6XS+pbeXZndXwnj5t84M+HEj7RN6bUfV2WZO/AB Xt5+qFkC/AVUcj/dcHvZwQJlGeZxoi4veCoOT2MYqfR0ax1MmN+LVRvKm29oSyD4Ts/97cbs XsZDRxnEG3z/7Winiv0ZanclA7v7CQwrzsbpCv+oj+zokGuKasofzKdpywkjAfSE1zTyF+8K nxBAmzwEqeQ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U/V8Nqjrl 6bGG2quo5YzJuXKjtKjZ4R6k762pHJ3tnzI/jnlc1sXz Message-ID: Date: Mon, 25 May 2020 15:12:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200525125743.GF4544@sirena.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/25/20 2:57 PM, Mark Brown wrote: > On Mon, May 25, 2020 at 02:41:31PM +0200, Marc Kleine-Budde wrote: >> On 5/25/20 1:31 PM, Mark Brown wrote: > >>> This isn't something that every individual driver should be doing, such >>> rewriting should happen in the core so that everything sees the benefit. > >> The core could merge several half duplex transfers (until there's as cs_change) >> into a single full duplex transfer. > > Yes, that is what I am suggesting. Where in the SPI stack do you see such a "merge" function? One point to clarify is when and where to allocate and free the memory for the contiguous full duplex buffers. >> I think it's not easy to detect and reliable to split a full duplex transfer >> into half duplex ones. How can you tell, if the controller is supposed to tx 0x0 >> or actually receive. > > I don't understand how that could possibly work or why it would make > sense? ACK, I was just thinking loud about options. >> I think spi_write_then_read() can be extended to generate one full duplex >> transfer instead on two half duplex ones it does a memcpy() anyways. > > This has the same problem as doing it in any other driver code - it > causes a needless incompatibility with three wire and single duplex > devices. What about the note "portable code should never use this for more than 32 bytes" in spi_write_then_read()? The CAN driver in question may read more than 32 bytes of data. >> To get a feeling for the use cases, this is what I do in the regmap read >> function of a (not yet mainlined) CAN SPI driver. > > Like I say it's probably better if code like this gets pushed into the > SPI core where we've got more information about what the controller can > do and there's more win from doing the tuning since more devices and > systems can take advantage of it. ACK Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |