Re: [PATCH] spi: Raise limit on number of chip selects

From: Herve Codina
Date: Tue Jan 23 2024 - 06:06:40 EST


Hi Mark,

On Mon, 22 Jan 2024 01:21:46 +0000
Mark Brown <broonie@xxxxxxxxxx> wrote:

> As reported by Guenter the limit we've got on the number of chip selects is
> set too low for some systems, raise the limit. We should really remove the
> hard coded limit but this is needed as a fix so let's do the simple thing
> and raise the limit for now.
>
> Fixes: 4d8ff6b0991d ("spi: Add multi-cs memories support in SPI core")
> Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> Suggested-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
> ---
> include/linux/spi/spi.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
> index 471fe2ff9066..d71483bf253a 100644
> --- a/include/linux/spi/spi.h
> +++ b/include/linux/spi/spi.h
> @@ -21,7 +21,7 @@
> #include <uapi/linux/spi/spi.h>
>
> /* Max no. of CS supported per spi device */
> -#define SPI_CS_CNT_MAX 4
> +#define SPI_CS_CNT_MAX 8
>
> struct dma_chan;
> struct software_node;
>

I got also the issue related to SPI_CS_CNT_MAX introduced by 4d8ff6b0991d ("spi:
Add multi-cs memories support in SPI core").

Errors like the following one are raised at boot for each of my SPI devices:
spi_master spi0: No. of CS is more than max. no. of supported CS
spi_master spi0: Failed to create SPI device for /soc@ff000000/cpm@9c0/spi@a80/idt821034@0
and none of my SPI devices were probed.

On my system, 9 SPI devices are present on my SPI bus and so, I have 9 chip-selects
(gpio chip-selects in my case).

Moving the SPI_CS_CNT_MAX value from 4 to 8 is not enough to handle my case.
Tested moving SPI_CS_CNT_MAX to 16 and it was ok.

Best regards,
Hervé