Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1609747lqb; Sun, 26 May 2024 08:43:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUVslALgPYDmKhz1WkoicTeG0q9CER5PsbMRrCIgbsyVRILGa0wzqhHc24kHbQYQGF3/jDHWFiGoKA/AzX/cJUA4g8GAefR+Opw1b7WbQ== X-Google-Smtp-Source: AGHT+IFB6ZwX78A/GZuRHqpUWTVPQ7eRsxRNVpAcnou9f/tAt3WamlaLvhmne9jH1EvXwAwJo2In X-Received: by 2002:a17:902:d492:b0:1f4:a057:f927 with SMTP id d9443c01a7336-1f4a058014cmr1232885ad.45.1716738186210; Sun, 26 May 2024 08:43:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716738186; cv=pass; d=google.com; s=arc-20160816; b=Pr+0f53mvA7LasjyAHeH0UJk03EJ0RVAPoztRLov8ZaPeiLaRiCu/HNwjf5y2Ke23U dxwDHutRI1DqIScV1zz2IfN6A5ONzHs6hQuNpoNWXQGaOyX3vXsuZg3KofTuSkuYnqFB KK/7GPuCB08h9Q85zM5gNlVDtp0U82fUj6f3UiJ/hFaF8m3FzDNmdB0rr1T7rdVnQYOw P53XbvMry9UYDA57ndA/QH7gmJ4ew7jFELtcERu6Ye+Bc6zXZAFUun8fjIWoJxN/IYsU 54UT7BDx26YK4KlhLIX4eRkzTPCOF78oaKkVfL5E5H/yH3VIvgRztNR52Kcv7h8IDyo3 64kQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=w1hV+o9VMoEuHtxMcY5o2sdXb9ZgHMWgw7Zcrosmm9U=; fh=IXMGd4GklKQ0dbVVyRpx7NfitH0uYlLShyw3TLE2zWQ=; b=Mn2oHWh+UEhL2vp8F1xuouA1h0mjv8ECCFCsJvcr5Y7T5lSJCYzQc/utiWI99SlNTm r4HI0xs1iiLYqJBTSD9Z4/XnVVhMo4gVmiRZnu0T2qvU3kMmioa0UJOsNm++XuH8hZoi Sk7rS3cNbRGBIsIBpWlADaW5JB2HeS8hOVXot/qvRiPla7BTYUZX3T2LCUufskFm/Zvd FJBmFNq4+i6UytDbWhyIfbkrELw0nKl3C+QYogBN3IcRJMe7/uY3SDD8qhEK6/03WJ9j Fsjy9uwwAOq02udJXDSk2Gs6+mmUjpaPv/J0qvWH7Vk2DkyEtPwNwKPeItdkvqwhBQ5i XBwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iFLlqHZj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-189775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c9bba0esi46020865ad.489.2024.05.26.08.43.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 08:43:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iFLlqHZj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-189775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D20442811FC for ; Sun, 26 May 2024 15:43:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BBD817C7B; Sun, 26 May 2024 15:42:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iFLlqHZj" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6FBB17C60; Sun, 26 May 2024 15:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716738176; cv=none; b=fefi37gOZRNi89+z1v+xk8H+CqW+25EZNoNmMksZde4i9k7IJsy+7N4Vj+92xpbRza3ovkoQajHwKtfZGJ67x7ZyDBLcBq/Qp5cvvE7YCejYAkokw+QigKTRCxpTHpaMFq4KtajqANH4BaTXCUHgBxANekh9yMgHC5Mna3lxmXU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716738176; c=relaxed/simple; bh=w1hV+o9VMoEuHtxMcY5o2sdXb9ZgHMWgw7Zcrosmm9U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qsAnTTQwGmwuW221D4b/1+OXu9Y48XnE8aIABF/od00MItvq8pqfno+kxt/hTG7Wcxyan5us7LtxYQpOK8dn4ySbNKdTEXScZDwtvcKnH9BW/zTQJfyS1SJMfXeioava6J9ijm1yAysciOBe99NK/5mH8CeTveUd65jF0hr2P1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iFLlqHZj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43538C2BD10; Sun, 26 May 2024 15:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716738175; bh=w1hV+o9VMoEuHtxMcY5o2sdXb9ZgHMWgw7Zcrosmm9U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iFLlqHZj5dP1+EsmPRPfJRKKlDubmvVR2+GtJtV/+s6tuToyvZpYHHvYnanLKRlLx JhwbPLXhz5pDWE8IYQjuPlhmqlhifCnTV46E7b6Sm2V/zXPfSzwmc3HOHYgBEO+bSy +XZWocMZp2z/Yu+byru68egErXTi02yfF53W2Gvk3s6hPjQgKRLs/RN1GNKR8r8HOg +FqMUrgk8d0s1VIqfFzx6z0e0mcVSuCDjHX89DGFPloL66xoFDIGBuQsIoZBmxRqGz fUqafOP9CpI/X3VGbKFKpA5pdxQqgR4rCznXzpMhgFbjc//+wEV2nILhxmXU+GnSt5 45SXQ5WRfKKuw== Date: Sun, 26 May 2024 16:42:50 +0100 From: Conor Dooley To: David Lechner Cc: Nuno =?iso-8859-1?Q?S=E1?= , Mark Brown , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nuno =?iso-8859-1?Q?S=E1?= , Michael Hennerich , Lars-Peter Clausen , David Jander , Martin Sperl , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: Re: [PATCH RFC v2 1/8] spi: dt-bindings: spi-peripheral-props: add spi-offloads property Message-ID: <20240526-spotting-relapsing-ffb60b535c18@spud> References: <20240514-aspire-ascension-449556da3615@spud> <20240516-rudder-reburial-dcf300504c0a@spud> <20240519-abreast-haziness-096a57ef57d3@spud> <20240522-gullible-ibuprofen-cf9111c25f6f@spud> <5ad0b5782434eaf4cf565cffb0e4c14b7414ae38.camel@gmail.com> <6e929426-25fa-4e91-8790-0774d59b34e0@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="38StDdanHQmO3L2P" Content-Disposition: inline In-Reply-To: <6e929426-25fa-4e91-8790-0774d59b34e0@baylibre.com> --38StDdanHQmO3L2P Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 23, 2024 at 10:05:49AM -0500, David Lechner wrote: > On 5/23/24 7:15 AM, Nuno S=C3=A1 wrote: > > On Wed, 2024-05-22 at 19:24 +0100, Conor Dooley wrote: > >> On Tue, May 21, 2024 at 09:54:39AM -0500, David Lechner wrote: > >>> On Sun, May 19, 2024 at 7:53=E2=80=AFAM Conor Dooley wrote: > >>>> > >>>> On Fri, May 17, 2024 at 11:51:58AM -0500, David Lechner wrote: > >>>>> On Thu, May 16, 2024 at 4:32=E2=80=AFPM Conor Dooley wrote: > >>>>>> On Tue, May 14, 2024 at 05:56:47PM -0500, David Lechner wrote: > >>>> >=20 > ... >=20 > >> To remind myself, "Application 2" featured an offload engine designed > >> specifically to work with a particular data format that would strip a > >> CRC byte and check the validity of the data stream. > >> > >=20 > > I think the data manipulation is not really a property of the engine. T= ypically data > > going out of the offload engine goes into another "data reorder" block = that is pure > > HW. > >=20 > >> I think you're right something like that is a stretch to say that that > >> is a feature of the SPI controller - but I still don't believe that > >> modelling it as part of the ADC is correct. I don't fully understand t= he > >> io-backends and how they work yet, but the features you describe there > >> seem like something that should/could be modelled as one, with its own > >> node and compatible etc. Describing custom RTL stuff ain't always > >> strightforward, but the stuff from Analog is versioned and documented > >> etc so it shouldn't be quite that hard. > >> > >=20 > > Putting this in io-backends is likely a stretch but one thing to add is= that the > > peripheral is always (I think) kind of the consumer of the resources. T= aking the > > trigger (PWM) as an example and even when it is directly connected with= the offload > > block, the peripheral still needs to know about it. Think of sampling f= requency... > > The period of the trigger signal is strictly connected with the samplin= g frequency of > > the peripheral for example. So I see 2 things: > >=20 > > 1) Enabling/Disabling the trigger could be easily done from the periphe= ral even with > > the resource in the spi engine. I think David already has some code in = the series > > that would make this trivial and so having the property in the spi cont= roller brings > > no added complexity. > >=20 > > 2) Controlling things like the trigger period/sample_rate. This could b= e harder to do > > over SPI (or making it generic enough) so we would still need to have t= he same > > property on the peripheral (even if not directly connected to it). I ki= nd of agree > > with David that having the property both in the peripheral and controll= er is a bit > > weird. > >=20 > > And the DMA block is a complete different story. Sharing that data back= with the > > peripheral driver (in this case, the IIO subsystem) would be very inter= esting at the > > very least. Note that the DMA block is not really something that is par= t of the > > controller nor the offload block. It is an external block that gets the= data coming > > out of the offload engine (or the data reorder block). In IIO, we alrea= dy have a DMA > > buffer interface so users of the peripheral can get the data without an= y intervention > > of the driver (on the data). We "just" enable buffering and then everyt= hing happens > > on HW and userspace can start requesting data. If we are going to attac= h the DMA in > > the controller, I have no idea how we can handle it. Moreover, the offl= oad it's > > really just a way of replaying the same spi transfer over and over and = that happens > > in HW so I'm not sure how we could "integrate" that with dmaengine. > >=20 > > But maybe I'm overlooking things... And thinking more in how this can b= e done in SW > > rather than what makes sense from an HW perspective. > >=20 > >=20 > >> continuation: > >> If offload engines have their own register region in the memory map, > >=20 > >=20 > > Don't think it has it's own register region... David? >=20 > I think the question here was if the CRC checker IP block (or descrambler= shown > in the link below, or whatever) had registers in the offload/SPI controll= er > to control that extra part or if they had their own dedicated registers. I don't think there was a question here at all. I was simply stating that if the offload engine was not just a subordinate feature of the SPI controller, but also provided additional data processing features then treating the offload engine as a component of the SPI controller would not be accurate. > So far, > these have been fixed-purpose, so have no registers at all. But I could s= ee > needing a register, e.g. for turning it on or off. In this case, I think = it > does become something like an io-backend. Or would we add this on/off swi= tch > to the AXI SPI Engine registers? Seems to be that the CRC checking is a separate piece of IP though, and so is not part of the offload engine at all, so my concern was misplaced. I think whether or not you have registers to control it, it should be represented in DT. How do you know it is there otherwise? > Also, as shown in the link below, the extra bits share a clock domain wit= h the > AXI SPI Engine. So, yes, technically I suppose they could/should? be inde= pendent > consumers of the same clock like Conor suggests below. It does seems kind= of > goofy if we have to write a driver just to turn on a clock that is already > guaranteed to be on though. You wouldn't necessarily need to write a driver for it, you could reach out and turn it on from the backend consumer for example. And, obviously there may be other ways that the FPGA design is configured where the clock is not shared with the SPI controller or the offload engine. --38StDdanHQmO3L2P Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZlNYegAKCRB4tDGHoIJi 0p//AP94S+X1TgXzvOP8jFQtnTOXCYT5iXNNaILC5azI/oPwmAEAhpLXc29r8igQ eiVFFU2qSsUCwA+W1hiajgJZLdKtDQA= =zON3 -----END PGP SIGNATURE----- --38StDdanHQmO3L2P--