Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp614319lqt; Thu, 6 Jun 2024 12:56:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWNd/J77CO6rMcar28yXkoRSPunkYDMKZSD/R6j88MDa5bvF/YBHeBY8oTmQRuQ7Ad6i4iUF47hHC4x8gnohk/Dj+5fj7qX/MEbveSiEA== X-Google-Smtp-Source: AGHT+IFKJwGEsV/AqBt5FXdNk+KveGsaHfwPGLvBMnxysRFv6vUT1GWlx/fSyEVLOw6Wq1qqoq7v X-Received: by 2002:a17:907:7f1f:b0:a68:f1ca:a8df with SMTP id a640c23a62f3a-a6cdc0e9c33mr42319166b.71.1717703813252; Thu, 06 Jun 2024 12:56:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717703813; cv=pass; d=google.com; s=arc-20160816; b=m6s2068ZjRm7MtWUUdPqSj2fj/uUjL3aNhXqWSCkdJmFcGBPpYrNU5Ga1f80BpOqlc lgN/GZ7bM1KBGxEcbZb05dKOfhZpzZn2x4UG2xHgzM7P7HoeFRLbTV5mPl1DnkU0L18x 8RmXyIH9etLObjMikCtl3OpA/69VXIjop2YTLS6IgNlZS06GLWRbmK8IaipKR9CJBOoR +aOKxlaCZKgw0U6cJ9vbj3WZzZVmu9z0yE/hPk+7mHxZjavfGtQAyqjNeWw6rWD68cnz 6OiCG3eD4dzTF1bDMYXbeX3DagVbQeikbFfUPgBLQYLuML4nytcR3M0w5KeUEy2s2ydE Kcug== 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=AdytDqtRYVnzm7SE/5i1mvkB4M1tizM3b9ra2VRKybw=; fh=kOjdsY9RwyDNZkuHYB/lLfEHiLfK5rmez0TiZ0hXLnk=; b=ZyXX/ZJfKtFZhMKNHduoOqsR5Se/QJLCHE30mUgtF3kQKjR+9e+ciGIenmWS7GNbsw /B7X09XPZSe5QFx54v0Ie86IHqkLSJ3NnjJ6rPWphp9tmvEbmAjYF1UWJCc96pasqW1I SrPY86hcHQPAKTJuR2fm9ZaknnRznVtt5OfOF0D7m4DTDRa5TjmKJUDfA7sBCcpbz5tJ mgHMCFBMPwFeyxx3Bfts7HXMGKYdTwVg7zF8ypZP2uDLclamV5s0D770Mg7bTZIuutA0 eISYwAkD3Nl+GXHEExZaH9sZXwEhlfIrCsdMhm//DDcC/xlvDvYTih3TiZPqPJiO1SGv PMaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PEQnIDyW; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-204962-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204962-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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-a6c806dadeasi94618366b.449.2024.06.06.12.56.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 12:56:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204962-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=pass header.i=@gmail.com header.s=20230601 header.b=PEQnIDyW; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-204962-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204962-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 C6D801F254FA for ; Thu, 6 Jun 2024 19:56:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C2D47316E; Thu, 6 Jun 2024 19:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PEQnIDyW" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 0EFCD4C618; Thu, 6 Jun 2024 19:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717703801; cv=none; b=uHfEZS+AlDhJV8yw65zWkl0hPMaBwhUVSF6ElqybmrYgIV7n6QZm5LCBU/fYrFAkagXWxavHnuVrpkBqc961uPAgl79baw+55x2Efx82bYPKLuYy5Kcb7pcz4m46oDdj76G9sgV9fnWbGNJdfsvAAFEyf22DyCWzHatT1OkDtWA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717703801; c=relaxed/simple; bh=Qurdt8ueT0yPwWNrPmEHkTDIsNDf38jckmh+NndaPUQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XEPLYiK+08H8rUNpcQgKHxmneNONpmSDN0cC3nGQNBw8ITbppgOCKsDscCY1nJW92qf+VLfPcTCIVXcAriCFhyVm9/LNTGyQe+Ea1NNaAyA52DwcDXuKLZl/nQbfT5VtpC8sOXml98LiJS7u2Z6tn9oyZFNUsqy+ObohVwUNvaY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PEQnIDyW; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1f47f07aceaso12858025ad.0; Thu, 06 Jun 2024 12:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717703799; x=1718308599; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AdytDqtRYVnzm7SE/5i1mvkB4M1tizM3b9ra2VRKybw=; b=PEQnIDyWQ1bcgfyhlnRBR2UcYfrKFVwvb00c6xeGdCZtmN0SYbDXeAB2O9IkHsTFEW 0dO9tgA+lBfH2x1a+bwjvcj1OVF6mxNUgD+Y94OtMOrJkpQh/yaT1Aa1AF3smXfG8urT GT2Qjs4c5wetpJ7f+fOgBWOEB7Joj//DzQqn2gKjY3HQbylVkkET8lx8QQ35b6D3k9fi 4qRKfTK2PYmHkI3f7xpfSTC+keMKKsH9u9rC38hWgP7+G8dlc4hfKIadhEy/4WxR5HeH X0wSulG43pZ7hKoKiZxBHz+hZ6DhLLLsqO1QKVn52EeSTGMcY+zgL/A5h4Q5+ZbuKd49 vQMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717703799; x=1718308599; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AdytDqtRYVnzm7SE/5i1mvkB4M1tizM3b9ra2VRKybw=; b=IXY1sdOJRMs1Rwk2PwnmeJpZWsayaT16tGgpvhX/29/jWu3IcDYmmTwLHjYhEy5LWh XIe+1Cz8jpfvUlTfluCsnO9Z9mvIaYJBr1cV46hZEOniLxH7MuX9JN/m5LZzX/+w9Oy/ 6NVHz2J0RJT8NpbiZp6qAOhOEUZ+8CweH8MzqLg5jTe92Z2XH+H9STCcYyHs4GahIU8+ a73zXtjEPL7aILEdsIjCIv3aQF4xYzSPzJf0aUwsA6YN5FxMsIF0PgA9xTCy+h7e/6cM XpNswr+xCsBbYlC9KFywSbSoKMgSnEXpfY848tTTDRVZWlkxK+QtotszkHM6+3Pmy7IW TcYA== X-Forwarded-Encrypted: i=1; AJvYcCXTB/PZbLCFlwGAkYBd7L9/Ti7Ygq1bD48v/fw1ANOB3dltCb58TYF0lhBsWLshntVXNnxhyCwsAb6HclDkZO7phdXaTuYaxrpafi6NImZxEVkrKCue9ZjSi8InRkc/2o5LowGT3lw7vvNdnSCNC1M9YCPbjQ4QfFNJDLJEj+FGuTolSzY9QyxZdz9RFI/jGhZELMcRUeu6EmCe6YhzIg== X-Gm-Message-State: AOJu0YzzUdvextnZiTqSSk+ImXXLKhDufK3V/g2OhuYdKsw/G24I+QgQ iL7jrKW6X7ShFHU1mDAsEwdw1K7ZwRqIw8bFq0dwp2Y7AGA4xJVCzNw+fkwK X-Received: by 2002:a17:902:e84d:b0:1f6:8466:e4d7 with SMTP id d9443c01a7336-1f6d03c0d9bmr7664275ad.51.1717703799114; Thu, 06 Jun 2024 12:56:39 -0700 (PDT) Received: from localhost ([2804:30c:167a:4100:8407:a7e5:9b87:8081]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd76075bsm19243465ad.40.2024.06.06.12.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 12:56:38 -0700 (PDT) Date: Thu, 6 Jun 2024 16:57:52 -0300 From: Marcelo Schmitt To: Mark Brown Cc: Marcelo Schmitt , lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, nuno.sa@analog.com, dlechner@baylibre.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/6] spi: Add SPI mode bit for MOSI idle state configuration Message-ID: References: <0a716b10-0ae0-425f-919a-ea5d8b7975b6@sirena.org.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0a716b10-0ae0-425f-919a-ea5d8b7975b6@sirena.org.uk> Hi, On 06/05, Mark Brown wrote: > On Tue, Jun 04, 2024 at 07:41:47PM -0300, Marcelo Schmitt wrote: > > > The behavior of an SPI controller data output line (SDO or MOSI or COPI > > (Controller Output Peripheral Input) for disambiguation) is not specified > > when the controller is not clocking out data on SCLK edges. However, there > > exist SPI peripherals that require specific COPI line state when data is > > not being clocked out of the controller. > > This is an optimisation for accelerating devices that need a specific > value, really if these devices need a value they should send it. I see it more like an extension of SPI controller functionality. Though I guess it might also be used for optimization if tx is known to be always 0s or always 1s for a device. > > > #define SPI_MOSI_IDLE_LOW _BITUL(17) /* leave mosi line low when idle */ > > +#define SPI_MOSI_IDLE_HIGH _BITUL(18) /* leave mosi line high when idle */ > > Realistically we'll have a large set of drivers that are expecting the > line to be held low so I'm not sure we need that option. I would also Yes, I also think most SPI devices, if ever requiring anything, would expect the MOSI line to be low. But this patchset is about the exception to that. :) > expect to have an implementation of these options in the core which > supplies buffers with the relevant data for use with controllers that > don't have the feature (similar to how _MUST_TX and _MUST_RX are done). > Even without that we'd need feature detection so that drivers that try > to use this aren't just buggy when used with a controller that doesn't > implement it, but once you're detecting you may as well just make things > work. As far as I searched, the definitions for SPI protocol usually don't specify any behavior for the MOSI line when the controller is not clocking out data. So, I think SPI controllers that are not capable of implementing any type of MOSI idle configuration are anyway compliant to what is usual SPI. For those that can implement such feature, I thought peripherals could request it by setting SPI mode bits. If the controller can provide MOSI idle state configuration, then the controller sets itself to act according to what peripheral asked. If MOSI idle configuration is not supported, then we just move on and let peripheral driver adapt to what is supported? Guess we can't blame an SPI controller for it not supporting something that is not specified in usual SPI protocols. But yeah, it's not that evident what this patch set is all about and why this is wanted so I made a wiki page to explain the reasoning for this set. https://wiki.analog.com/software/linux/docs/spi/spi_copi_idle?rev=1717699755 Hopefully the figures with timing diagrams and transfer captures there will provide quicker understanding of this rather than I try to explain it with only text. If you still think we need feature detection for MOSI idle capability just let me know, I'll implement what be needed. Thanks, Marcelo