Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Luis de Arquer <ldearquer@gmail.com>
To: amit.kumar-mahapatra@amd.com, broonie@kernel.org, linux@roeck-us.net
Cc: linux-spi@vger.kernel.org
Subject: Regression on max controller CS lines
Date: Tue, 06 Feb 2024 19:59:20 +0100	[thread overview]
Message-ID: <c518235ce0ccc878726fd1d97d0e56070ed89103.camel@gmail.com> (raw)

Hi,

After commit 4d8ff6b0991d5e86b17b235fc46ec62e9195cb9b "spi: Add multi-cs memories support in SPI core":

The code parsing device tree for a spi device seems to impose a limit on the number of cs lines for the *controller*.
From the commit:

@@ -2295,14 +2385,53 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
        return 0;
    }
 
+   if (ctlr->num_chipselect > SPI_CS_CNT_MAX) {
+       dev_err(&ctlr->dev, "No. of CS is more than max. no. of supported CS\n");
+       return -EINVAL;
+   }
+

(Note that, if I am not wrong, of_spi_parse_dt() is parsing the device tree for the device, not the controller)

Why limiting ctlr->num_chipselect to SPI_CS_CNT_MAX (4)? And why do the check here (if any, do it in spi_register_controller()) ? If I understand correctly, SPI_CS_CNT_MAX is the maximum number of cs
lines on the spi peripheral using parallel mode, but that should not imply a restriction on the controller itself.

I have seen this has been discussed already[1], but rather than increasing SPI_CS_CNT_MAX, isn't it better to remove this check altogether?

(I ended up here because I am using a board with 12 CS gpio lines, and this change broke it)

[1] https://lore.kernel.org/all/d3c93c4c-3754-480c-84c2-9455ec8af702@roeck-us.net/

Luis

             reply	other threads:[~2024-02-06 18:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 18:59 Luis de Arquer [this message]
2024-02-07  9:38 ` Regression on max controller CS lines Mark Brown

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=c518235ce0ccc878726fd1d97d0e56070ed89103.camel@gmail.com \
    --to=ldearquer@gmail.com \
    --cc=amit.kumar-mahapatra@amd.com \
    --cc=broonie@kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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