[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ea6162e-5154-48ec-9570-07a800c9235b@ti.com>
Date: Fri, 5 Sep 2025 16:34:36 +0530
From: Santhosh Kumar K <s-k6@...com>
To: Théo Lebrun <theo.lebrun@...tlin.com>,
<miquel.raynal@...tlin.com>, <broonie@...nel.org>, <vigneshr@...com>,
<marex@...x.de>, <computersforpeace@...il.com>,
<grmoore@...nsource.altera.com>
CC: <linux-spi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<praneeth@...com>, <p-mantena@...com>, <a-dutta@...com>,
<u-kumar1@...com>, <s-k6@...com>
Subject: Re: [PATCH 3/4] spi: cadence-quadspi: Fix cqspi_setup_flash()
Hello Theo,
On 04/09/25 21:02, Théo Lebrun wrote:
> Hello Santhosh,
>
> On Thu Sep 4, 2025 at 3:31 PM CEST, Santhosh Kumar K wrote:
>> The 'max_cs' stores the largest chip select number. It should only
>> be updated when the current 'cs' is greater than existing 'max_cs'. So,
>> fix the condition accordingly.
>
> Good catch. Current code can only work with one chip-select.
>
> Reviewed-by: Théo Lebrun <theo.lebrun@...tlin.com>
>
> Maybe we should error out if we don't enter the loop, ie if we have no
> flash declared?
> - Before your patch, cqspi->num_chipselect was set to num-cs DT prop or
> CQSPI_MAX_CHIPSELECT as fallback.
> - After your patch, cqspi->num_chipselect is set to one.
>
> In neither case do we get an error if no flash is defined in DT.
>
> We could either return some error code or set cqspi->num_chipselect=0
> which will lead to spi_register_controller() to fail [0].
Yeah, we can use max_cs for this. Initiate max_cs with -1, check if it's
still negative after the loop part - if yes, then it didn't enter the
loop as there was no flash declared - return failure. I'll add this
logic in v2. Thanks!
Regards,
Santhosh.
>
> [0]: https://elixir.bootlin.com/linux/v6.16.4/source/drivers/spi/spi.c#L3322-L3329
>
> Thanks,
>
> --
> Théo Lebrun, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
>
Powered by blists - more mailing lists