linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] spi: dw: Auto-detect number of native CS
@ 2024-02-15 18:00 Serge Semin
  2024-02-15 18:00 ` [PATCH 1/3] spi: dw: Convert to using BITS_TO_BYTES() macro Serge Semin
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Serge Semin @ 2024-02-15 18:00 UTC (permalink / raw)
  To: Serge Semin, Mark Brown, Andy Shevchenko
  Cc: Alexey Malahov, Andy Shevchenko, Andy Shevchenko, linux-spi,
	linux-kernel

The main goal of the short series is to provide a procedure implementing
the auto-detection of the number of native Chip-Select signals supported
by the controller. The suggested algorithm is straightforward. It relies
on the fact that the SER register writable flags reflects the actual
number of available native chip-select signals. So the DW APB/AHB SSI
driver now tests the SER register for having the writable bits,
calculates the number of CS signals based on the number of set flags and
then initializes the num_cs private data field based on that, which then
will be passed to the SPI-core subsystem indicating the number of
supported hardware chip-selects. The implemented procedure will be useful
for the DW SSI device nodes not having the explicitly set "num-cs"
property. In case if the property is specified it will be utilized instead
of the auto-detection procedure.

Besides of that a small cleanup patch is introduced in the head of the
series. It converts the driver to using the BITS_TO_BYTES() macro instead
of the hard-coded DIV_ROUND_UP()-based calculation of the number of
bytes-per-transfer-word.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andy@kernel.org>
Cc: linux-spi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Serge Semin (3):
  spi: dw: Convert to using BITS_TO_BYTES() macro
  spi: dw: Add a number of native CS auto-detection
  spi: dw: Drop default number of CS setting

 drivers/spi/spi-dw-core.c | 20 ++++++++++++++++----
 drivers/spi/spi-dw-mmio.c |  7 ++-----
 2 files changed, 18 insertions(+), 9 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-02-16 18:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-15 18:00 [PATCH 0/3] spi: dw: Auto-detect number of native CS Serge Semin
2024-02-15 18:00 ` [PATCH 1/3] spi: dw: Convert to using BITS_TO_BYTES() macro Serge Semin
2024-02-15 19:28   ` Andy Shevchenko
2024-02-15 18:00 ` [PATCH 2/3] spi: dw: Add a number of native CS auto-detection Serge Semin
2024-02-15 19:31   ` Andy Shevchenko
2024-02-15 18:00 ` [PATCH 3/3] spi: dw: Drop default number of CS setting Serge Semin
2024-02-15 19:32   ` Andy Shevchenko
2024-02-16 15:36     ` Serge Semin
2024-02-16 17:00       ` Andy Shevchenko
2024-02-16 18:03         ` Serge Semin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).