spi: cadence-qspi: set maximum chip-select to 4
authorThéo Lebrun <theo.lebrun@bootlin.com>
Fri, 9 Feb 2024 13:45:31 +0000 (14:45 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 21 Feb 2024 16:27:19 +0000 (16:27 +0000)
commit7cc3522aedb5f4360c4502b2e89b279b7aa94ceb
tree69a57fbbcfad868b0b3b178592f58bb1c39372f0
parent0d62c64a8e48438545dcef7e5d2f4839ff5cfe4c
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>
drivers/spi/spi-cadence-quadspi.c