public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Mark Brown <broonie@kernel.org>,
	Marcelo Schmitt <marcelo.schmitt@analog.com>
Cc: 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,
	marcelo.schmitt1@gmail.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
Date: Wed, 5 Jun 2024 11:37:48 -0500	[thread overview]
Message-ID: <5dcd9701-2725-4aff-9e73-d8f2e038be75@baylibre.com> (raw)
In-Reply-To: <0a716b10-0ae0-425f-919a-ea5d8b7975b6@sirena.org.uk>

On 6/5/24 7:24 AM, 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.

I think this description is missing a key detail that the tx data line
needs to be high just before and also during the CS assertion at the start
of each message.

And it would be helpful to have this more detailed description in the
source code somewhere and not just in the commit message.

> 
> This is an optimisation for accelerating devices that need a specific
> value, really if these devices need a value they should send it.
> 
>>  #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
> 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.

I could see something like this working for controllers that leave the
tx data line in the state of the last bit of a write transfer. I.e. do a
write transfer of 0xff (using the smallest number of bits per word
supported by the controller) with CS not asserted, then assert CS, then
do the rest of actual the transfers requested by the peripheral.

But it doesn't seem like it would work for controllers that always
return the tx data line to a low state after a write since this would
mean that the data line would still be low during the CS assertion
which is what we need to prevent.



  reply	other threads:[~2024-06-05 16:37 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 22:40 [PATCH v3 0/6] Add support for AD4000 series of ADCs Marcelo Schmitt
2024-06-04 22:41 ` [PATCH v3 1/6] spi: Add SPI mode bit for MOSI idle state configuration Marcelo Schmitt
2024-06-05  9:14   ` Nuno Sá
2024-06-05 12:02     ` Mark Brown
2024-06-06 20:10       ` Marcelo Schmitt
2024-06-07 13:52         ` Mark Brown
2024-06-05 12:24   ` Mark Brown
2024-06-05 16:37     ` David Lechner [this message]
2024-06-05 17:04       ` Mark Brown
2024-06-06 22:08         ` Marcelo Schmitt
2024-06-07 13:51           ` Mark Brown
2024-06-06 19:57     ` Marcelo Schmitt
2024-06-07 13:50       ` Mark Brown
2024-06-07 14:55         ` Marcelo Schmitt
2024-06-04 22:42 ` [PATCH v3 2/6] spi: bitbang: Implement support " Marcelo Schmitt
2024-06-05  9:30   ` Nuno Sá
2024-06-04 22:42 ` [PATCH v3 3/6] spi: spi-gpio: Add " Marcelo Schmitt
2024-06-05  9:26   ` Nuno Sá
2024-06-04 22:43 ` [PATCH v3 4/6] spi: spi-axi-spi-engine: Add support for MOSI idle configuration Marcelo Schmitt
2024-06-05  9:25   ` Nuno Sá
2024-06-05 17:03   ` David Lechner
2024-06-06  6:51     ` Nuno Sá
2024-06-06 13:21       ` David Lechner
2024-06-06 21:31         ` Marcelo Schmitt
2024-06-07  7:15           ` Nuno Sá
2024-06-07 14:40             ` Marcelo Schmitt
2024-06-09  9:11               ` Jonathan Cameron
2024-06-04 22:43 ` [PATCH v3 5/6] dt-bindings: iio: adc: Add AD4000 Marcelo Schmitt
2024-06-05 17:14   ` Conor Dooley
2024-06-07 14:35     ` Marcelo Schmitt
2024-06-07 14:49       ` Conor Dooley
2024-06-05  9:31 ` [PATCH v3 0/6] Add support for AD4000 series of ADCs Nuno Sá
2024-06-05 11:19   ` Marcelo Schmitt
2024-06-05 11:14 ` [PATCH v3 6/6] iio: adc: Add support for AD4000 Marcelo Schmitt
2024-06-05 13:03   ` Nuno Sá
2024-06-09  9:23     ` Jonathan Cameron
2024-06-11 10:34       ` Andy Shevchenko
2024-06-11 17:05         ` Jonathan Cameron
2024-06-05 20:50   ` kernel test robot
2024-06-05 21:32   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5dcd9701-2725-4aff-9e73-d8f2e038be75@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=marcelo.schmitt@analog.com \
    --cc=nuno.sa@analog.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox