linux-block.git
6 months agospi: s3c64xx: deprecate fifo_lvl_mask, rx_lvl_offset and port_id
Tudor Ambarus [Fri, 16 Feb 2024 07:05:53 +0000 (07:05 +0000)]
spi: s3c64xx: deprecate fifo_lvl_mask, rx_lvl_offset and port_id

Deprecate fifo_lvl_mask, rx_lvl_offset and port_id. One shall use
{rx, tx}_fifomask instead. Add messages to each port configuration.

Suggested-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240216070555.2483977-11-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: s3c64xx: get rid of the OF alias ID dependency
Tudor Ambarus [Fri, 16 Feb 2024 07:05:52 +0000 (07:05 +0000)]
spi: s3c64xx: get rid of the OF alias ID dependency

Compatibles that set ``port_conf->{rx, tx}_fifomask`` are now safe to
get rid of the OF alias ID dependency. Let the driver probe even without
the alias for these.

With this we also protect the FIFO_LVL_MASK calls from
s3c64xx_spi_set_fifomask().

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240216070555.2483977-10-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: s3c64xx: introduce s3c64xx_spi_set_port_id()
Tudor Ambarus [Fri, 16 Feb 2024 07:05:51 +0000 (07:05 +0000)]
spi: s3c64xx: introduce s3c64xx_spi_set_port_id()

Prepare driver to get rid of the of alias ID dependency. Split the
port_id logic into a dedicated method.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240216070555.2483977-9-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: s3c64xx: let the SPI core determine the bus number
Tudor Ambarus [Fri, 16 Feb 2024 07:05:50 +0000 (07:05 +0000)]
spi: s3c64xx: let the SPI core determine the bus number

Let the core determine the bus number, either by getting the alias ID
(as the driver forces now), or by allocating a dynamic bus number when
the alias is absent. Prepare the driver to allow dt aliases to be
absent.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240216070555.2483977-8-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: s3c64xx: allow FIFO depth to be determined from the compatible
Tudor Ambarus [Fri, 16 Feb 2024 07:05:49 +0000 (07:05 +0000)]
spi: s3c64xx: allow FIFO depth to be determined from the compatible

There are SoCs that use the same FIFO depth for all the instances of the
SPI IP. See the fifo_lvl_mask defined for gs101 for example:
    .fifo_lvl_mask  = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
                        0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f},

Instead of specifying the FIFO depth with the same value for all 16
nodes in this case, allow such SoCs to infer the FIFO depth from the
compatible. There are other SoCs than can benefit of this, see:
{gs101, fsd, exynos850, s3c641, s3c2443}_spi_port_config.

The FIFO depth inferred from the compatible has a higher precedence than
the one that might be specified via device tree, the driver shall know
better.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240216070555.2483977-7-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: s3c64xx: retrieve the FIFO depth from the device tree
Tudor Ambarus [Fri, 16 Feb 2024 07:05:48 +0000 (07:05 +0000)]
spi: s3c64xx: retrieve the FIFO depth from the device tree

There are SoCs that configure different FIFO depths for their instances
of the SPI IP. See the fifo_lvl_mask defined for exynos4_spi_port_config
for example:
        .fifo_lvl_mask  = { 0x1ff, 0x7F, 0x7F },
The first instance of the IP is configured with 256 bytes FIFOs, whereas
the last two are configured with 64 bytes FIFOs.

Instead of mangling with the .fifo_lvl_mask and its dependency of the DT
alias ID, allow such SoCs to determine the FIFO depth via the
``fifo-depth`` DT property.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240216070555.2483977-6-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: s3c64xx: determine the fifo depth only once
Tudor Ambarus [Fri, 16 Feb 2024 07:05:47 +0000 (07:05 +0000)]
spi: s3c64xx: determine the fifo depth only once

Determine the FIFO depth only once, at probe time.
``sdd->fifo_depth`` can be set later on with the FIFO depth
specified in the device tree.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240216070555.2483977-5-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: s3c64xx: allow full FIFO masks
Tudor Ambarus [Fri, 16 Feb 2024 07:05:46 +0000 (07:05 +0000)]
spi: s3c64xx: allow full FIFO masks

The driver is wrong because is using partial register field masks for the
SPI_STATUS.{RX, TX}_FIFO_LVL register fields.

We see s3c64xx_spi_port_config.fifo_lvl_mask with different values for
different instances of the same IP. Take s5pv210_spi_port_config for
example, it defines:
.fifo_lvl_mask  = { 0x1ff, 0x7F },

fifo_lvl_mask is used to determine the FIFO depth of the instance of the
IP. In this case, the integrator uses a 256 bytes FIFO for the first SPI
instance of the IP, and a 64 bytes FIFO for the second instance. While
the first mask reflects the SPI_STATUS.{RX, TX}_FIFO_LVL register
fields, the second one is two bits short. Using partial field masks is
misleading and can hide problems of the driver's logic.

Allow platforms to specify the full FIFO mask, regardless of the FIFO
depth.

Introduce {rx, tx}_fifomask to represent the SPI_STATUS.{RX, TX}_FIFO_LVL
register fields. It's a shifted mask defining the field's length and
position. We'll be able to deprecate the use of @rx_lvl_offset, as the
shift value can be determined from the mask. The existing compatibles
shall start using {rx, tx}_fifomask so that they use the full field mask
and to avoid shifting the mask to position, and then shifting it back to
zero in the {TX, RX}_FIFO_LVL macros.

@rx_lvl_offset will be deprecated in a further patch, after we have the
infrastructure to deprecate @fifo_lvl_mask as well.

No functional change intended.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240216070555.2483977-4-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: s3c64xx: define a magic value
Tudor Ambarus [Fri, 16 Feb 2024 07:05:45 +0000 (07:05 +0000)]
spi: s3c64xx: define a magic value

Define a magic value, it will be used in the next patch as well.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240216070555.2483977-3-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: dt-bindings: introduce FIFO depth properties
Tudor Ambarus [Fri, 16 Feb 2024 07:05:44 +0000 (07:05 +0000)]
spi: dt-bindings: introduce FIFO depth properties

There are SPI IPs that can be configured by the integrator with a
specific FIFO depth depending on the system's capabilities. For example,
the samsung USI SPI IP can be configured by the integrator with a TX/RX
FIFO from 8 byte to 256 bytes.

Introduce the ``fifo-depth`` property for such instances of IPs where the
same FIFO depth is used for both RX and TX. Introduce ``rx-fifo-depth``
and ``tx-fifo-depth`` properties for cases where the RX FIFO depth is
different from the TX FIFO depth.

Make the dedicated RX/TX properties dependent on each other and mutual
exclusive with the other.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://msgid.link/r/20240216070555.2483977-2-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: axi-spi-engine: small cleanups
Mark Brown [Mon, 4 Mar 2024 20:23:00 +0000 (20:23 +0000)]
spi: axi-spi-engine: small cleanups

Merge series from David Lechner <dlechner@baylibre.com>:

This series contains a few small cleanups to the axi-spi-engine driver,
mostly suggested from previous reviews.

6 months agospi: axi-spi-engine: use struct_size() macro
David Lechner [Mon, 4 Mar 2024 16:04:25 +0000 (10:04 -0600)]
spi: axi-spi-engine: use struct_size() macro

This makes use of the struct_size() macro to calculate the size of the
struct axi_spi_engine when allocating it.

Suggested-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://msgid.link/r/20240304-mainline-axi-spi-engine-small-cleanups-v2-3-5b14ed729a31@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: axi-spi-engine: use __counted_by() attribute
David Lechner [Mon, 4 Mar 2024 16:04:24 +0000 (10:04 -0600)]
spi: axi-spi-engine: use __counted_by() attribute

This adds the __counted_by() attribute to the flex array at the end of
struct spi_engine_program in the AXI SPI Engine controller driver.

The assignment of the length field has to be reordered to be before
the access to the flex array in order to avoid potential compiler
warnings/errors due to adding the __counted_by() attribute.

Suggested-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://msgid.link/r/20240304-mainline-axi-spi-engine-small-cleanups-v2-2-5b14ed729a31@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: axi-spi-engine: remove p from struct spi_engine_message_state
David Lechner [Mon, 4 Mar 2024 16:04:23 +0000 (10:04 -0600)]
spi: axi-spi-engine: remove p from struct spi_engine_message_state

The program pointer p in struct spi_engine_message_state in the AXI SPI
Engine controller driver was assigned but never read so it can be
removed.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://msgid.link/r/20240304-mainline-axi-spi-engine-small-cleanups-v2-1-5b14ed729a31@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: dt-bindings: samsung: make dma properties not required
Tudor Ambarus [Fri, 1 Mar 2024 11:55:46 +0000 (11:55 +0000)]
spi: dt-bindings: samsung: make dma properties not required

Since the addition of the driver in 2009, the driver selects between DMA
and polling mode depending on the transfer length - DMA mode for
transfers bigger than the FIFO depth, polling mode otherwise. All
versions of the IP support polling mode, make the dma properties not
required.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240301115546.2266676-1-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: stm32-qspi: Replace of_gpio.h by proper one
Andy Shevchenko [Wed, 28 Feb 2024 19:46:32 +0000 (21:46 +0200)]
spi: stm32-qspi: Replace of_gpio.h by proper one

of_gpio.h is deprecated and subject to remove.
The driver doesn't use it directly, replace it
with what is really being used.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://msgid.link/r/20240228194632.3606563-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: pic32: Replace of_gpio.h by proper one
Andy Shevchenko [Wed, 28 Feb 2024 19:48:08 +0000 (21:48 +0200)]
spi: pic32: Replace of_gpio.h by proper one

of_gpio.h is deprecated and subject to remove.
The driver doesn't use it directly, replace it
with what is really being used.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://msgid.link/r/20240228194818.3606841-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: dt-bindings: atmel,at91rm9200-spi: remove 9x60 compatible from list
Varshini Rajendran [Fri, 23 Feb 2024 17:26:38 +0000 (22:56 +0530)]
spi: dt-bindings: atmel,at91rm9200-spi: remove 9x60 compatible from list

Remove microchip,sam9x60-spi compatible from the list as the driver used
has the compatible atmel,at91rm9200-spi and sam9x60 devices also use the
same compatible as fallback. So removing the microchip,sam9x60-spi
compatible from the list since it is not needed.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240223172638.672366-1-varshini.rajendran@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agospi: ppc4xx: Fix fallout from rename in struct spi_bitbang
Uwe Kleine-König [Sat, 10 Feb 2024 16:40:07 +0000 (17:40 +0100)]
spi: ppc4xx: Fix fallout from rename in struct spi_bitbang

I failed to adapt this driver because it's not enabled in a powerpc
allmodconfig build and also wasn't hit by my grep expertise. Fix
accordingly.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402100815.XQXw9XCF-lkp@intel.com/
Fixes: 2259233110d9 ("spi: bitbang: Follow renaming of SPI "master" to "controller"")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://msgid.link/r/20240210164006.208149-7-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: add support for pre-cooking messages
Mark Brown [Mon, 26 Feb 2024 17:54:12 +0000 (17:54 +0000)]
spi: add support for pre-cooking messages

Merge series from David Lechner <dlechner@baylibre.com>:

This is a follow-up to [1] where it was suggested to break down the
proposed SPI offload support into smaller series.

This takes on the first suggested task of introducing an API to
"pre-cook" SPI messages. This idea was first discussed extensively in
2013 [2][3] and revisited more briefly 2022 [4].

The goal here is to be able to improve performance (higher throughput,
and reduced CPU usage) by allowing peripheral drivers that use the
same struct spi_message repeatedly to "pre-cook" the message once to
avoid repeating the same validation, and possibly other operations each
time the message is sent.

This series includes __spi_validate() and the automatic splitting of
xfers in the optimizations. Another frequently suggested optimization
is doing DMA mapping only once. This is not included in this series, but
can be added later (preferably by someone with a real use case for it).

To show how this all works and get some real-world measurements, this
series includes the core changes, optimization of a SPI controller
driver, and optimization of an ADC driver. This test case was only able
to take advantage of the single validation optimization, since it didn't
require splitting transfers. With these changes, CPU usage of the
threaded interrupt handler, which calls spi_sync(), was reduced from
83% to 73% while at the same time the sample rate (frequency of SPI
xfers) was increased from 20kHz to 25kHz.

[1]: https://lore.kernel.org/linux-spi/20240109-axi-spi-engine-series-3-v1-1-e42c6a986580@baylibre.com/T/
[2]: https://lore.kernel.org/linux-spi/E81F4810-48DD-41EE-B110-D0D848B8A510@martin.sperl.org/T/
[3]: https://lore.kernel.org/linux-spi/39DEC004-10A1-47EF-9D77-276188D2580C@martin.sperl.org/T/
[4]: https://lore.kernel.org/linux-spi/20220525163946.48ea40c9@erd992/T/

7 months agospi: spi-mem: add statistics support to ->exec_op() calls
Théo Lebrun [Fri, 16 Feb 2024 16:42:19 +0000 (17:42 +0100)]
spi: spi-mem: add statistics support to ->exec_op() calls

Current behavior is that spi-mem operations do not increment statistics,
neither per-controller nor per-device, if ->exec_op() is used. For
operations that do NOT use ->exec_op(), stats are increased as the
usual spi_sync() is called.

The newly implemented spi_mem_add_op_stats() function is strongly
inspired by spi_statistics_add_transfer_stats(); locking logic and
l2len computation comes from there.

Statistics that are being filled: bytes{,_rx,_tx}, messages, transfers,
errors, timedout, transfer_bytes_histo_*.

Note about messages & transfers counters: in the fallback to spi_sync()
case, there are from 1 to 4 transfers per message. We only register one
big transfer in the ->exec_op() case as that is closer to reality.

This patch is NOT touching:
 - spi_async, spi_sync, spi_sync_immediate: those counters describe
   precise function calls, incrementing them would be lying. I believe
   comparing the messages counter to spi_async+spi_sync is a good way
   to detect ->exec_op() calls, but I might be missing edge cases
   knowledge.
 - transfers_split_maxsize: splitting cannot happen if ->exec_op() is
   provided.

Reviewed-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://msgid.link/r/20240216-spi-mem-stats-v2-1-9256dfe4887d@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: axi-spi-engine: move message compile to optimize_message
David Lechner [Mon, 19 Feb 2024 22:33:21 +0000 (16:33 -0600)]
spi: axi-spi-engine: move message compile to optimize_message

In the AXI SPI Engine driver, compiling the message is an expensive
operation. Previously, it was done per message transfer in the
prepare_message hook. This patch moves the message compile to the
optimize_message hook so that it is only done once per message in
cases where the peripheral driver calls spi_optimize_message().

This can be a significant performance improvement for some peripherals.
For example, the ad7380 driver saw a 13% improvement in throughput
when using the AXI SPI Engine driver with this patch.

Since we now need two message states, one for the optimization stage
that doesn't change for the lifetime of the message and one that is
reset on each transfer for managing the current transfer state, the old
msg->state is split into msg->opt_state and spi_engine->msg_state. The
latter is included in the driver struct now since there is only one
current message at a time that can ever use it and it is in a hot path
so avoiding allocating a new one on each message transfer saves a few
cpu cycles and lets us get rid of the prepare_message callback.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://msgid.link/r/20240219-mainline-spi-precook-message-v2-4-4a762c6701b9@baylibre.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: stm32: move splitting transfers to optimize_message
David Lechner [Mon, 19 Feb 2024 22:33:20 +0000 (16:33 -0600)]
spi: stm32: move splitting transfers to optimize_message

Since splitting transfers was moved to spi_optimize_message() in the
core SPI code, we now need to use the optimize_message callback in the
STM32 SPI driver to ensure that the operation is only performed once
when spi_optimize_message() is used by peripheral drivers explicitly.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://msgid.link/r/20240219-mainline-spi-precook-message-v2-3-4a762c6701b9@baylibre.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: move splitting transfers to spi_optimize_message()
David Lechner [Mon, 19 Feb 2024 22:33:19 +0000 (16:33 -0600)]
spi: move splitting transfers to spi_optimize_message()

Splitting transfers is an expensive operation so we can potentially
optimize it by doing it only once per optimization of the message
instead of repeating each time the message is transferred.

The transfer splitting functions are currently the only user of
spi_res_alloc() so spi_res_release() can be safely moved at this time
from spi_finalize_current_message() to spi_unoptimize_message().

The doc comments of the public functions for splitting transfers are
also updated so that callers will know when it is safe to call them
to ensure proper resource management.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://msgid.link/r/20240219-mainline-spi-precook-message-v2-2-4a762c6701b9@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: add spi_optimize_message() APIs
David Lechner [Mon, 19 Feb 2024 22:33:18 +0000 (16:33 -0600)]
spi: add spi_optimize_message() APIs

This adds a new spi_optimize_message() function that can be used to
optimize SPI messages that are used more than once. Peripheral drivers
that use the same message multiple times can use this API to perform SPI
message validation and controller-specific optimizations once and then
reuse the message while avoiding the overhead of revalidating the
message on each spi_(a)sync() call.

Internally, the SPI core will also call this function for each message
if the peripheral driver did not explicitly call it. This is done to so
that controller drivers don't have to have multiple code paths for
optimized and non-optimized messages.

A hook is provided for controller drivers to perform controller-specific
optimizations.

Suggested-by: Martin Sperl <kernel@martin.sperl.org>
Link: https://lore.kernel.org/linux-spi/39DEC004-10A1-47EF-9D77-276188D2580C@martin.sperl.org/
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://msgid.link/r/20240219-mainline-spi-precook-message-v2-1-4a762c6701b9@baylibre.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: cadence-qspi: report correct number of chip-select
Théo Lebrun [Fri, 9 Feb 2024 13:45:32 +0000 (14:45 +0100)]
spi: cadence-qspi: report correct number of chip-select

Set the ->num_chipselect field in struct cqspi_st and struct
spi_controller to the current number of chip-select. The value is
dependent on declared flashes in devicetree.

Previously, the num-cs property from devicetree or the maximum value was
being reported.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Link: https://msgid.link/r/20240209-cdns-qspi-cs-v1-3-a4f9dfed9ab4@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: cadence-qspi: set maximum chip-select to 4
Théo Lebrun [Fri, 9 Feb 2024 13:45:31 +0000 (14:45 +0100)]
spi: cadence-qspi: set maximum chip-select to 4

Change the maximum chip-select count in cadence-qspi to 4 instead of 16.
The value gets used as default ->num_chipselect when the num-cs DT
property isn't received from devicetree. It also determines the
cqspi->f_pdata array size.

Hardware only supports values up to 4; see cqspi_chipselect() that sets
CS using a one-bit-per-CS 4-bit register field.

Add a static_assert() call as a defensive measure to ensure we stay
under the SPI subsystem limit. It got set to 4 when introduced in
4d8ff6b0991d ("spi: Add multi-cs memories support in SPI core") and
later increased to 16 in 2f8c7c3715f2 ("spi: Raise limit on number of
chip selects").

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Link: https://msgid.link/r/20240209-cdns-qspi-cs-v1-2-a4f9dfed9ab4@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: cadence-qspi: assert each subnode flash CS is valid
Théo Lebrun [Fri, 9 Feb 2024 13:45:30 +0000 (14:45 +0100)]
spi: cadence-qspi: assert each subnode flash CS is valid

Check each flash CS against the num-cs property from devicetree.
Fallback to the driver max supported value (CQSPI_MAX_CHIPSELECT) if
num-cs isn't present.

cqspi->num_chipselect is set in cqspi_of_get_pdata() to the num-cs
devicetree property, or to CQSPI_MAX_CHIPSELECT if num-cs is not set.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Link: https://msgid.link/r/20240209-cdns-qspi-cs-v1-1-a4f9dfed9ab4@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: spi-summary.rst: fix underline length
Randy Dunlap [Fri, 16 Feb 2024 05:16:37 +0000 (21:16 -0800)]
spi: spi-summary.rst: fix underline length

The change to use "target" requires an underline to be extended by
one more character to fix a documentation build warning:

  Documentation/spi/spi-summary.rst:274: WARNING: Title underline too short.
  Declare target Devices
  ^^^^^^^^^^^^^^^^^^^^^

Fixes: hash ("spi: Update the "master/slave" terminology in documentation")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Dhruva Gole <d-gole@ti.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Link: https://msgid.link/r/20240216051637.10920-1-rdunlap@infradead.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: Update the "master/slave" terminology in documentation
Dhruva Gole [Thu, 15 Feb 2024 08:54:05 +0000 (14:24 +0530)]
spi: Update the "master/slave" terminology in documentation

Update the master/slave terminology wherever possible to adopt usage of
the controller/host/target. Some parts have been left untouched because
they were sysfs entries and will probably end up being inaccurate if
simply replaced here.

Signed-off-by: Dhruva Gole <d-gole@ti.com>
Link: https://msgid.link/r/20240215085404.1711976-1-d-gole@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: dw: remove redundant assignment to variable len
Colin Ian King [Thu, 15 Feb 2024 13:16:03 +0000 (13:16 +0000)]
spi: dw: remove redundant assignment to variable len

The variable id len being initialized with a value that is never read,
it is being re-assigned later on in a for-loop. The initialization is
redundant and can be removed.

Cleans up clang scan build warning:
drivers/spi/spi-dw-dma.c:580:17: warning: Although the value stored
to 'len' is used in the enclosing expression, the value is never
actually read from 'len' [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Acked-by: Serge Semin <fancer.lancer@gmail.com>
Link: https://msgid.link/r/20240215131603.2062332-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: mchp-pci1xxxx: release resources on error in probe()
Dan Carpenter [Tue, 13 Feb 2024 18:07:45 +0000 (21:07 +0300)]
spi: mchp-pci1xxxx: release resources on error in probe()

Call pci_release_regions(pdev) before returning on this error path.

Fixes: 3e7cfd6ad29a ("spi: mchp-pci1xxxx: Add support for DMA in SPI")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://msgid.link/r/efc92197-4023-4bfe-bc63-452e7ed112e8@moroto.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: gpio: Follow renaming of SPI "master" to "controller"
Andy Shevchenko [Fri, 9 Feb 2024 16:54:23 +0000 (18:54 +0200)]
spi: gpio: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. Recent work by Uwe
completes this renaming. However, there are plenty of leftovers in
the comments and in-code documentation. Update them as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240209165423.2305493-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: pxa2xx: Use typedef for dma_filter_fn
Krzysztof Kozlowski [Thu, 8 Feb 2024 20:21:54 +0000 (21:21 +0100)]
spi: pxa2xx: Use typedef for dma_filter_fn

Use existing typedef for dma_filter_fn to avoid duplicating type
definition.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240208202154.630336-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: pl022: Add missing dma_filter field kerneldoc
Krzysztof Kozlowski [Thu, 8 Feb 2024 20:21:53 +0000 (21:21 +0100)]
spi: pl022: Add missing dma_filter field kerneldoc

Add kerneldoc for dma_filter field in struct pl022_ssp_controller.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240208202154.630336-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: pl022: Use typedef for dma_filter_fn
Krzysztof Kozlowski [Thu, 8 Feb 2024 20:21:52 +0000 (21:21 +0100)]
spi: pl022: Use typedef for dma_filter_fn

Use existing typedef for dma_filter_fn to avoid duplicating type
definition.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240208202154.630336-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: straightforward cleanup
Mark Brown [Thu, 8 Feb 2024 20:26:15 +0000 (20:26 +0000)]
spi: s3c64xx: straightforward cleanup

Merge series from Tudor Ambarus <tudor.ambarus@linaro.org>:

Various simple cleanups for the s3c64xx driver.  Tested with gs101-spi.

7 months agospi: get rid of some legacy macros
Mark Brown [Thu, 8 Feb 2024 20:19:18 +0000 (20:19 +0000)]
spi: get rid of some legacy macros

Merge series from Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:

This series finishes off the removal of some of the legacy names for
SPI controllers and devices.

7 months agospi: s3c64xx: add support for google,gs101-spi
Mark Brown [Thu, 8 Feb 2024 19:13:39 +0000 (19:13 +0000)]
spi: s3c64xx: add support for google,gs101-spi

Merge series from Tudor Ambarus <tudor.ambarus@linaro.org>:

The Google GCS101 uses a variant of the Samsung SPI controller IP.

7 months agospi: mchp-pci1xxxx: DMA support for copying data to and from SPI Buf
Thangaraj Samynathan [Wed, 7 Feb 2024 08:06:21 +0000 (13:36 +0530)]
spi: mchp-pci1xxxx: DMA support for copying data to and from SPI Buf

pci1xxxx_spi_transfer_with_dma adds DMA support to copy the data between
host cpu buffer and SPI IO Buffer.
On DMA Completion interrupt, the next SPI transaction is initiated in isr.
Helper functions pci1xxxx_spi_setup, pci1xxxx_spi_setup_dma_from_io,
pci1xxxx_spi_setup_dma_to_io and pci1xxxx_start_spi_xfer are added for
setting up spi, setting up dma operations, and to start spi transfer
respectively. In the existing implementation, codes are replaced with
helper functions wherever applicable.

Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
Link: https://lore.kernel.org/r/20240207080621.30742-3-thangaraj.s@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: mchp-pci1xxxx: Add support for DMA in SPI
Thangaraj Samynathan [Wed, 7 Feb 2024 08:06:20 +0000 (13:36 +0530)]
spi: mchp-pci1xxxx: Add support for DMA in SPI

In PCI1xxxx C0, support for DMA in PCIe endpoint is added
to enhance the SPI performance. With this support, the
performance is improved from 6Mbps to 17Mbps with 20Mhz clock.
- DMA Supports two Channels, 0 and 1
- SPI Instance 0 uses chan 0 and SPI Instance 1 uses chan 1
- DMA can be used only if SPI is mapped to PF0 in the multi
function endpoint and the MSI interrupt is supported
- MSI interrupt of one of the SPI instance is assigned to the DMA
and both channels 0 and 1 share the same irq, the MSI address and
MSI Data of the irq is obtained and stored in DMA registers to
generate interrupt

Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com>
Link: https://lore.kernel.org/r/20240207080621.30742-2-thangaraj.s@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: add support for google,gs101-spi
Tudor Ambarus [Wed, 7 Feb 2024 11:15:16 +0000 (11:15 +0000)]
spi: s3c64xx: add support for google,gs101-spi

Add support for GS101 SPI. GS101 integrates 16 SPI nodes, all with 64
bytes FIFOs. GS101 allows just 32 bit register accesses, otherwise a
Serror Interrupt is raised. Do the write reg accesses in 32 bits.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207111516.2563218-5-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: add s3c64xx_iowrite{8,16}_32_rep accessors
Tudor Ambarus [Wed, 7 Feb 2024 11:15:15 +0000 (11:15 +0000)]
spi: s3c64xx: add s3c64xx_iowrite{8,16}_32_rep accessors

Allow SoCs that require 32 bits register accesses to write data in
chunks of 8 or 16 bits. One SoC that requires 32 bit register accesses
is the google gs101. The operation is rare, thus open code it in the
driver rather than making it generic (through asm-generic/io.h).

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207111516.2563218-4-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: prepare for a different flavor of iowrite rep
Tudor Ambarus [Wed, 7 Feb 2024 11:15:14 +0000 (11:15 +0000)]
spi: s3c64xx: prepare for a different flavor of iowrite rep

There are SoCs (gs101) that allow only 32 bit register accesses. As the
requirement is rare enough, for those SoCs we'll open code in the driver
some s3c64xx_iowrite{8,16}_32_rep() accessors. Prepare for such addition.

Suggested-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Link: https://lore.kernel.org/r/20240207111516.2563218-3-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: dt-bindings: samsung: add google,gs101-spi compatible
Tudor Ambarus [Wed, 7 Feb 2024 11:15:13 +0000 (11:15 +0000)]
spi: dt-bindings: samsung: add google,gs101-spi compatible

Add "google,gs101-spi" dedicated compatible for representing SPI of
Google GS101 SoC.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207111516.2563218-2-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: drop a superfluous bitwise NOT operation
Tudor Ambarus [Wed, 7 Feb 2024 12:04:31 +0000 (12:04 +0000)]
spi: s3c64xx: drop a superfluous bitwise NOT operation

val &= ~mask;
val |= mask;

is equivalent to:
val |= mask;

Drop the superfluous bitwise NOT operation.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-18-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: remove duplicated definition
Tudor Ambarus [Wed, 7 Feb 2024 12:04:30 +0000 (12:04 +0000)]
spi: s3c64xx: remove duplicated definition

S3C64XX_SPI_TRAILCNT brings no benefit in terms of name over
S3C64XX_SPI_MAX_TRAILCNT. Remove the duplicated definition.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-17-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: downgrade dev_warn to dev_dbg for optional dt props
Tudor Ambarus [Wed, 7 Feb 2024 12:04:29 +0000 (12:04 +0000)]
spi: s3c64xx: downgrade dev_warn to dev_dbg for optional dt props

"samsung,spi-src-clk" and "num-cs" are optional dt properties. Downgrade
the message from warning to debug message.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-16-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: drop blank line between declarations
Tudor Ambarus [Wed, 7 Feb 2024 12:04:28 +0000 (12:04 +0000)]
spi: s3c64xx: drop blank line between declarations

Drop the blank line and move the logical operation in the body of the
function rather than in initialization list.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-15-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: return ETIMEDOUT for wait_for_completion_timeout()
Tudor Ambarus [Wed, 7 Feb 2024 12:04:27 +0000 (12:04 +0000)]
spi: s3c64xx: return ETIMEDOUT for wait_for_completion_timeout()

ETIMEDOUT is more specific than EIO, use it for
wait_for_completion_timeout().

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-14-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: rename prepare_dma() to s3c64xx_prepare_dma()
Tudor Ambarus [Wed, 7 Feb 2024 12:04:26 +0000 (12:04 +0000)]
spi: s3c64xx: rename prepare_dma() to s3c64xx_prepare_dma()

Don't monopolize the name. Prepend the driver prefix to the function
name.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-13-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: propagate the dma_submit_error() error code
Tudor Ambarus [Wed, 7 Feb 2024 12:04:25 +0000 (12:04 +0000)]
spi: s3c64xx: propagate the dma_submit_error() error code

DMA submit should just add the dma descriptor to a queue, without firing
it. EIO is misleading and hides what happens in DMA. Propagate the
dma_submit_error() error code, don't overwrite it.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-12-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: check return code of dmaengine_slave_config()
Tudor Ambarus [Wed, 7 Feb 2024 12:04:24 +0000 (12:04 +0000)]
spi: s3c64xx: check return code of dmaengine_slave_config()

Check the return code of dmaengine_slave_config().

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-11-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: move common code outside if else
Tudor Ambarus [Wed, 7 Feb 2024 12:04:23 +0000 (12:04 +0000)]
spi: s3c64xx: move common code outside if else

Move common code outside if else to avoid code duplication.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-10-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: remove else after return
Tudor Ambarus [Wed, 7 Feb 2024 12:04:22 +0000 (12:04 +0000)]
spi: s3c64xx: remove else after return

Else case is not needed after a return, remove it.

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-9-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: remove unneeded (void *) casts in of_match_table
Tudor Ambarus [Wed, 7 Feb 2024 12:04:21 +0000 (12:04 +0000)]
spi: s3c64xx: remove unneeded (void *) casts in of_match_table

of_device_id::data is an opaque pointer. No explicit cast is needed.
Remove unneeded (void *) casts in of_match_table.

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-8-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: fix typo, s/configuartion/configuration
Tudor Ambarus [Wed, 7 Feb 2024 12:04:20 +0000 (12:04 +0000)]
spi: s3c64xx: fix typo, s/configuartion/configuration

Fix typo, s/configuartion/configuration.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-7-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: avoid possible negative array index
Tudor Ambarus [Wed, 7 Feb 2024 12:04:19 +0000 (12:04 +0000)]
spi: s3c64xx: avoid possible negative array index

The platform id is used as an index into the fifo_lvl_mask array.
Platforms can come with a negative device ID, PLATFORM_DEVID_NONE (-1),
thus we risked a negative array index. Catch such cases and fail to
probe.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-6-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: explicitly include <linux/types.h>
Tudor Ambarus [Wed, 7 Feb 2024 12:04:18 +0000 (12:04 +0000)]
spi: s3c64xx: explicitly include <linux/types.h>

The driver uses u32 and relies on an implicit inclusion of
<linux/types.h>.

It is good practice to directly include all headers used, it avoids
implicit dependencies and spurious breakage if someone rearranges
headers and causes the implicit include to vanish.

Include the missing header.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-5-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: explicitly include <linux/bits.h>
Tudor Ambarus [Wed, 7 Feb 2024 12:04:17 +0000 (12:04 +0000)]
spi: s3c64xx: explicitly include <linux/bits.h>

The driver uses GENMASK() but does not include <linux/bits.h>.

It is good practice to directly include all headers used, it avoids
implicit dependencies and spurious breakage if someone rearranges
headers and causes the implicit include to vanish.

Include the missing header.

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-4-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: explicitly include <linux/io.h>
Tudor Ambarus [Wed, 7 Feb 2024 12:04:16 +0000 (12:04 +0000)]
spi: s3c64xx: explicitly include <linux/io.h>

The driver uses readl() but does not include <linux/io.h>.

It is good practice to directly include all headers used, it avoids
implicit dependencies and spurious breakage if someone rearranges
headers and causes the implicit include to vanish.

Include the missing header.

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-3-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: s3c64xx: sort headers alphabetically
Tudor Ambarus [Wed, 7 Feb 2024 12:04:15 +0000 (12:04 +0000)]
spi: s3c64xx: sort headers alphabetically

Sorting headers alphabetically helps locating duplicates,
and makes it easier to figure out where to insert new headers.

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20240207120431.2766269-2-tudor.ambarus@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoDocumentation: spi: Update documentation for renaming "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:46 +0000 (19:40 +0100)]
Documentation: spi: Update documentation for renaming "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. Adapt the documentation
accordingly.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/3d643e22cacff12d3918ad5224baa1d01813d03b.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: Drop compat layer from renaming "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:45 +0000 (19:40 +0100)]
spi: Drop compat layer from renaming "master" to "controller"

Now that all in-tree users followed the rename, the compat stuff can go
away.  This completes the renaming started with commit 8caab75fd2c2
("spi: Generalize SPI "master" to "controller"")

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/ad1d949325b61a4682e8d6ecf9d05da751e6a99f.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: fsl-lib: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:44 +0000 (19:40 +0100)]
spi: fsl-lib: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/b3d724ca2b641f1d717a7ddb9810bdf27168dc35.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agowifi: libertas: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:43 +0000 (19:40 +0100)]
wifi: libertas: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Kalle Valo <kvalo@kernel.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/971429eacddbad4c2f49b783ddd68746c1929ab3.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agovideo: fbdev: mmp: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:42 +0000 (19:40 +0100)]
video: fbdev: mmp: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/136f59b6e272e5ff7ec210627c9c3ea27d066d51.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agousb: gadget: max3420_udc: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:41 +0000 (19:40 +0100)]
usb: gadget: max3420_udc: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/5caf03b6f321a9870aabb9282f1f22211d052740.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agotpm_tis_spi: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:40 +0000 (19:40 +0100)]
tpm_tis_spi: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/29000c8fc0612974242e3c23d14dd4771b92c71e.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agostaging: greybus: spi: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:39 +0000 (19:40 +0100)]
staging: greybus: spi: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/f6f0568df29f9a51358e86326b917d81af8aba74.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agostaging: fbtft: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:38 +0000 (19:40 +0100)]
staging: fbtft: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/df79f22caf31d2c5ca2b15b33670323d1e1120c7.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: spidev: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:37 +0000 (19:40 +0100)]
spi: spidev: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/15ebfdf58a6590962bdd51b49b2e85a69b3bf443.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: slave-mt27xx: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:36 +0000 (19:40 +0100)]
spi: slave-mt27xx: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/184a5263af2ec01fd5ad9b8db667ae4d6cbec948.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: loopback-test: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:35 +0000 (19:40 +0100)]
spi: loopback-test: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/2f57c89d601d0875cd245a2e95c915b9bfcfc47d.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: geni-qcom: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:34 +0000 (19:40 +0100)]
spi: geni-qcom: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver. This was already tried before in commit 8726bdcef62e ("spi:
geni-qcom: switch to use modern name"), that's why this change is so
small.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/895f9a42691dcea037b30dcce5e61be0b44e3a25.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: cavium: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:33 +0000 (19:40 +0100)]
spi: cavium: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/8aa122cffa6c8c18cc3367def872f81cd9471f2a.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: cadence-quadspi: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:32 +0000 (19:40 +0100)]
spi: cadence-quadspi: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/d741960846b7f4896eeff91a4c8c7dfa8a6f8b7b.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: cadence-quadspi: Don't emit error message on allocation error
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:31 +0000 (19:40 +0100)]
spi: cadence-quadspi: Don't emit error message on allocation error

Drivers are not supposed to emit an error message when a memory
allocation fails, as the kernel is very loud in this case already
anyhow.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/8da90785395664bf17d16428f46e84b95ef5cc3b.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: bitbang: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:30 +0000 (19:40 +0100)]
spi: bitbang: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
the SPI bitbang controller drivers.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/f7f949feb803acb8bea75798f41371a13287f4e8.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoplatform/chrome: cros_ec_spi: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:29 +0000 (19:40 +0100)]
platform/chrome: cros_ec_spi: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Tzung-Bi Shih <tzungbi@kernel.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/cfbafd8a581a3ca37134cb84cef4370959012d9d.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agonet: vertexcom: mse102x: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:28 +0000 (19:40 +0100)]
net: vertexcom: mse102x: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Reviewed-by: Simon Horman <horms@kernel.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/feacee68c00f6f976c82864ba2f10a3f0c1b99f2.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agonet: ks8851: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:27 +0000 (19:40 +0100)]
net: ks8851: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Reviewed-by: Simon Horman <horms@kernel.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/4f26761c0c86072a084b2a20439da1d0a681b07b.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agomtd: dataflash: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:26 +0000 (19:40 +0100)]
mtd: dataflash: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/38bf50b391c117621e406fa8cd00c4daef78615c.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agommc: mmc_spi: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:25 +0000 (19:40 +0100)]
mmc: mmc_spi: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/a9c95759cf77a19c160d1d497c76ac5770c67684.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agomisc: gehc-achc: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:24 +0000 (19:40 +0100)]
misc: gehc-achc: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/3c93bf41d2399d06b5a379a76c8f6e877f3560b7.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agomedia: v4l2-subdev: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:23 +0000 (19:40 +0100)]
media: v4l2-subdev: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
v4l2_spi_new_subdev().

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/b6e3a53ce75dfb8a21a5958a381070944dfa0875.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agomedia: usb/msi2500: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:22 +0000 (19:40 +0100)]
media: usb/msi2500: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/d4dc8acc3c4105b9093e97f6337a81d11e6d30ae.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agomedia: netup_unidvb: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:21 +0000 (19:40 +0100)]
media: netup_unidvb: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/c37fceef8c631c5b49538f3f143573b605fc2c24.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agomedia: mgb4: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:20 +0000 (19:40 +0100)]
media: mgb4: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Reviewed-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/ccad7ad4176265bf90af92add18a0242652f5a84.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoInput: synaptics-rmi4 - follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:19 +0000 (19:40 +0100)]
Input: synaptics-rmi4 - follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/b88413456c970a97319fa7e505768bf82966541b.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoInput: pxspad - follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:18 +0000 (19:40 +0100)]
Input: pxspad - follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/820fa151077dc192391d546aec35328680803f9f.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoiio: adc: ad_sigma_delta: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:17 +0000 (19:40 +0100)]
iio: adc: ad_sigma_delta: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/de866d09c80c89816df62602ba4ba8ba30e9971f.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoieee802154: ca8210: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:16 +0000 (19:40 +0100)]
ieee802154: ca8210: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Reviewed-by: Simon Horman <horms@kernel.org>
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/dec96b1d3cf43bb442128957b27d02007ffeb68d.1707324794.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agofpga: ice40-spi: Follow renaming of SPI "master" to "controller"
Uwe Kleine-König [Wed, 7 Feb 2024 18:40:15 +0000 (19:40 +0100)]
fpga: ice40-spi: Follow renaming of SPI "master" to "controller"

In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
some functions and struct members were renamed. To not break all drivers
compatibility macros were provided.

To be able to remove these compatibility macros push the renaming into
this driver.

Acked-by: Xu Yilun <yilun.xu@intel.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/6a3ddedc955cf55dddbc68ccf5ff5e46af5e8b6f.1707324793.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: axi-spi-engine: move msg finalization out of irq handler
David Lechner [Wed, 7 Feb 2024 14:51:25 +0000 (08:51 -0600)]
spi: axi-spi-engine: move msg finalization out of irq handler

As a general principal, it is best to do as little as possible in an
interrupt handler. This patch reworks the AXI SPI Engine driver to move
timer_delete_sync() and spi_finalize_current_message() out of the
interrupt handler. Instead, spi_finalize_current_message() is moved to
the transfer_one_message function (similar to nearly all other SPI
controllers). A completion is now used to wait for the sync interrupt
that indicates that the message is complete. The watchdog timer is no
longer needed since we can use the wait_for_completion_timeout()
function to wait for the message to complete with the same effect.

As a bonus, these changes also improve throughput of the SPI controller.
For example, this was tested on a ZynqMP with a 80MHz SCLK reading 4
byte samples from an ADC. The max measured throughput increased from
26k to 28k samples per second.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240207-axi-spi-engine-round-2-1-v2-2-40c0b4e85352@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: axi-spi-engine: remove use of ida for sync id
David Lechner [Wed, 7 Feb 2024 14:51:24 +0000 (08:51 -0600)]
spi: axi-spi-engine: remove use of ida for sync id

Profiling has shown that ida_alloc_range() accounts for about 10% of the
time spent in spi_sync() when using the AXI SPI Engine controller. This
call is used to create a unique id for each SPI message to match to an
IRQ when the message is complete.

Since the core SPI code serializes messages in a message queue, we can
only have one message in flight at a time, namely host->cur_msg. This
means that we can use a fixed value instead of a unique id for each
message since there can never be more than one message pending at a
time.

This patch removes the use of ida for the sync id and replaces it with a
constant value. This simplifies the driver and improves performance.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240207-axi-spi-engine-round-2-1-v2-1-40c0b4e85352@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: drop gpf arg from __spi_split_transfer_maxsize()
David Lechner [Tue, 6 Feb 2024 20:06:46 +0000 (14:06 -0600)]
spi: drop gpf arg from __spi_split_transfer_maxsize()

The __spi_split_transfer_maxsize() function has a gpf argument to allow
callers to specify the type of memory allocation that needs to be used.
However, this function only allocates struct spi_transfer and is not
intended to be used from atomic contexts so this type should always be
GFP_KERNEL, so we can just drop the argument.

Some callers of these functions also passed GFP_DMA, but since only
struct spi_transfer is allocated and not any tx/rx buffers, this is
not actually necessary and is removed in this commit.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240206200648.1782234-1-dlechner@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: fsl-dspi: A couple of error handling
Mark Brown [Tue, 6 Feb 2024 09:31:58 +0000 (09:31 +0000)]
spi: fsl-dspi: A couple of error handling

Merge series from andy.shevchenko@gmail.com:

A couple of error handling improvements here:
- unshadowing error code from dmaengine_slave_config()
- making error messages uniform

7 months agospi: spi-rockchip: Fix max_native_cs
Luis de Arquer [Fri, 26 Jan 2024 19:46:44 +0000 (20:46 +0100)]
spi: spi-rockchip: Fix max_native_cs

Signed-off-by: Luis de Arquer <luis.dearquer@inertim.com>
Link: https://lore.kernel.org/r/4d18808e85b85077761c5655083f20ebfd7d3770.camel@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agospi: spi-rockchip: Fix out of bounds array access
Luis de Arquer [Fri, 26 Jan 2024 19:46:22 +0000 (20:46 +0100)]
spi: spi-rockchip: Fix out of bounds array access

Since spi-rockchip enables use_gpio_descriptors and the
SPI_CONTROLLER_GPIO_SS flag, the spi subsytem may call set_cs()
for spi devices with indexes above ROCKCHIP_SPI_MAX_CS_NUM

Remove array cs_asserted[] which held a shadow copy of the state
of the chip select lines with the only purpose of optimizing out
rewriting a chip select line to the current state (no-op)
This case is already handled by spi.c

Signed-off-by: Luis de Arquer <luis.dearquer@inertim.com>
Link: https://lore.kernel.org/r/d0a0c4b94f933f7f43973c34765214303ee82b77.camel@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>