Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp1066186lqp; Thu, 23 May 2024 08:06:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWzHp2e4HziSSUW18SGg2B2aGGwjHp3NZqrfWyXpykHRwF8NbFdkNFR35lrRWIGEWh7PkE3XLKe5FDRbkoqb1roFs4cFT45snHpusO9Gg== X-Google-Smtp-Source: AGHT+IEJVWlbpMi4i69L5NsArWtJs/Vo5zZX0KZLOqcKu9TGQ5IoMPed3uoNoeVHMbcKOg10IWmz X-Received: by 2002:a17:906:4f0a:b0:a62:196e:12f with SMTP id a640c23a62f3a-a62281ca2dfmr345966866b.47.1716476764446; Thu, 23 May 2024 08:06:04 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b21c5csi1673487266b.351.2024.05.23.08.06.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 08:06:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187690-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b="lin99rP/"; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-187690-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187690-linux.lists.archive=gmail.com@vger.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 060301F226B5 for ; Thu, 23 May 2024 15:06:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DC3FD304; Thu, 23 May 2024 15:05:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="lin99rP/" Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BBC7B653 for ; Thu, 23 May 2024 15:05:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716476755; cv=none; b=Xl84QMqJCxRbSC4LDaXkCV/XoGN3yISWn9MAMwAvPX72NqmFVSDo5pG4KlMzRd7KobSDa+smbAdqUWKKRXhP42mbaqfWaBb8RLs7NlHizh5MNkY1jR22bMMsMbnLvqeJVdA86gJCopDLFPdyv6zvButtGeK3WeNEtwMHbyCOKG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716476755; c=relaxed/simple; bh=iFvjg3XwqgAd5mquwOsqr45UsDV9LIRXN1unBZnpmoc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jbiW3CXg+MS+M++qVjDfw4aeEwqHWAmla9nOVIkz36jGUlWSNzBz9X+4x6Jx/TRGnBhA2W6HkAno/BQv3aEsTk/5gS6c+TytkjxixxotDM/H+zOa9F5zFpXAKWu36lffOyn4O4CGUA0ytHf+sxXMxZFcyf81Jnkg5ynhgLqmnnQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=lin99rP/; arc=none smtp.client-ip=209.85.222.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-792b8d989e4so445133885a.2 for ; Thu, 23 May 2024 08:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1716476752; x=1717081552; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4uSp7T4uhgPczizgXTB01VF3ORzzoQszdtOdi980zfE=; b=lin99rP/0ByqQJCyO08MenEqr3FpNvBU8YPXeNNSNIOor0k5QEaWV1toMWwlWRevR7 MPmPrO7qWWi63Zeb2xqvTysTlKjogAWuC9xLVB0StesuwYCopBs4l+XHlajZO6rB477L ZFtsxpJdZ8kUANeSf6JqkjnzW85jSBZjPoymxha8cA6tBtYHW6GtE/8Ppmg1MTlRUTTG Fdu/0/v54iA9ztpqfV7JXiYUhzc1c0AfT6NoqbzZKtGsubckG2gOKltG2x9FYmpQQ1bt IiQJ/aRMY938i19afEwanSQUF+BfTca+duig08mR8hI7b5x6UTS0/xrfcBLx40RRBtf6 SvlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716476752; x=1717081552; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4uSp7T4uhgPczizgXTB01VF3ORzzoQszdtOdi980zfE=; b=kHZFzHv6cPmbI5aYs6E67lbcOX1QBwyjS84R8GaaNZF3RpsW5QuhMXJbRMR8YCkYoH gBd1icWNETPPkZNj4imVtg6xPpdIVgVMuY0WrpDuHVEJYEowbObGFfx++kX3ZFzY6Pee 1Wq1BoAF2f7dzPurMZHOOev8zShArDloRFXAmiL9Q+TrmidOf5epjTU4xvOxQTl2INkd qatBmtJIakf7LW1/yd3kyIokL/RTWgo0FKZbMtbYJw9YM6m2ur+CQhcu67hLxjtBKqVt n0MNDCwAnIcxgl43X3C8qTrVUedHHUFYnn6jzuFdzwZ+0nUrNl6jlkEx7vXCxizXc/bN rz0A== X-Forwarded-Encrypted: i=1; AJvYcCXIaUk4FYlR2/ogq0C5oEV3zD6zE+XNcDj4whIDkv0GVxiCJc0Q1X95aF9t5rOxeCTVbRYw7lY1VuNhzrzLyTMykDopG4tA3aKWCFeZ X-Gm-Message-State: AOJu0YzIixixGUBRWIAjpgoZSymBaTHllKShydtb63x/t7r+1rsUbJQ1 HpOLYwDUA9AlX3UetqiWc4UjPiSDGgAhMkL8DgqgWidpcILITpcMNlkDTqYzIj4= X-Received: by 2002:a05:620a:5645:b0:794:8226:710c with SMTP id af79cd13be357-794994ced65mr523642085a.70.1716476752171; Thu, 23 May 2024 08:05:52 -0700 (PDT) Received: from [192.168.0.142] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id af79cd13be357-792bf1cd143sm1500017385a.0.2024.05.23.08.05.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 May 2024 08:05:51 -0700 (PDT) Message-ID: <6e929426-25fa-4e91-8790-0774d59b34e0@baylibre.com> Date: Thu, 23 May 2024 10:05:49 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC v2 1/8] spi: dt-bindings: spi-peripheral-props: add spi-offloads property To: =?UTF-8?Q?Nuno_S=C3=A1?= , Conor Dooley Cc: Mark Brown , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?UTF-8?Q?Nuno_S=C3=A1?= , 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 References: <20240510-dlech-mainline-spi-engine-offload-2-v2-0-8707a870c435@baylibre.com> <20240510-dlech-mainline-spi-engine-offload-2-v2-1-8707a870c435@baylibre.com> <20240513-headsman-hacking-d51fcc811695@spud> <20240514-aspire-ascension-449556da3615@spud> <20240516-rudder-reburial-dcf300504c0a@spud> <20240519-abreast-haziness-096a57ef57d3@spud> <20240522-gullible-ibuprofen-cf9111c25f6f@spud> <5ad0b5782434eaf4cf565cffb0e4c14b7414ae38.camel@gmail.com> Content-Language: en-US From: David Lechner In-Reply-To: <5ad0b5782434eaf4cf565cffb0e4c14b7414ae38.camel@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 5/23/24 7:15 AM, Nuno Sá 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 AM Conor Dooley wrote: >>>> >>>> On Fri, May 17, 2024 at 11:51:58AM -0500, David Lechner wrote: >>>>> On Thu, May 16, 2024 at 4:32 PM Conor Dooley wrote: >>>>>> On Tue, May 14, 2024 at 05:56:47PM -0500, David Lechner wrote: >>>> .. >> 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. >> > > I think the data manipulation is not really a property of the engine. Typically data > going out of the offload engine goes into another "data reorder" block that is pure > HW. > >> 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 the >> 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. >> > > 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. Taking 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 frequency... > The period of the trigger signal is strictly connected with the sampling frequency of > the peripheral for example. So I see 2 things: > > 1) Enabling/Disabling the trigger could be easily done from the peripheral 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 controller brings > no added complexity. > > 2) Controlling things like the trigger period/sample_rate. This could be harder to do > over SPI (or making it generic enough) so we would still need to have the same > property on the peripheral (even if not directly connected to it). I kind of agree > with David that having the property both in the peripheral and controller is a bit > weird. > > 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 interesting at the > very least. Note that the DMA block is not really something that is part 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 already have a DMA > buffer interface so users of the peripheral can get the data without any intervention > of the driver (on the data). We "just" enable buffering and then everything happens > on HW and userspace can start requesting data. If we are going to attach the DMA in > the controller, I have no idea how we can handle it. Moreover, the offload 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. > > But maybe I'm overlooking things... And thinking more in how this can be done in SW > rather than what makes sense from an HW perspective. > > >> continuation: >> If offload engines have their own register region in the memory map, > > > Don't think it has it's own register region... David? 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 controller to control that extra part or if they had their own dedicated registers. So far, these have been fixed-purpose, so have no registers at all. But I could see 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 switch to the AXI SPI Engine registers? Also, as shown in the link below, the extra bits share a clock domain with the AXI SPI Engine. So, yes, technically I suppose they could/should? be independent 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. > >> their own resources (the RTL is gonna need at the very least a clock) >> and potentially also provide other services (like acting as an >> io-backend type device that pre-processes data) it doesn't sound like >> either the controller or peripheral nodes are the right place for these >> properties. And uh, spi-offloads gets a phandle once more... >> > > But then it would be valid for both peripheral and controller to reference that > phandle right (and get the resources of interest)? > > FWIW, maybe look at the below usecase. It has some block diagrams that may be helpful > to you: > > https://wiki.analog.com/resources/eval/user-guides/ad463x/hdl > > - Nuno Sá > >