From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
"Jakub \"Kuba\" Czapiga" <czapiga@google.com>
Cc: Pratyush Yadav <pratyush@kernel.org>,
Michael Walle <mwalle@kernel.org>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
Konrad Adamczyk <konrada@google.com>,
Adeel Arshad <adeel.arshad@intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH] mtd: spi-nor: core: Check read CR support
Date: Wed, 10 Sep 2025 16:00:10 +0100 [thread overview]
Message-ID: <4991cd24-c549-4f4c-a7cb-c9f0e331c4bc@linaro.org> (raw)
In-Reply-To: <87a532cqnr.fsf@bootlin.com>
On 9/10/25 3:45 PM, Miquel Raynal wrote:
> Hello,
>
> On 10/09/2025 at 16:30:43 +02, "Jakub \"Kuba\" Czapiga" <czapiga@google.com> wrote:
>
>> Hi Miquèl,
>>
>> On Wed, Sep 10, 2025 at 2:05 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>>>
>>> Hi Jakub,
>>>
>>>> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
>>>> index ac4b960101cc..79deee3a50d3 100644
>>>> --- a/drivers/mtd/spi-nor/core.c
>>>> +++ b/drivers/mtd/spi-nor/core.c
>>>> @@ -2608,6 +2608,10 @@ static int spi_nor_setup(struct spi_nor *nor,
>>>> }
>>>> }
>>>>
>>>> + /* Some SPI controllers might not support CR read opcode. */
>>>> + if (spi_nor_read_cr(nor, nor->bouncebuf) == -EOPNOTSUPP)
>>>
>>> There is a spi_nor_spimem_check_op() helper which might be better suited
>>> for this purpose?
>>
>> spi_nor_spimem_check_op() works only for spi-mem devices. spi_nor_read_cr()
>> handles both spi-mem and spi-nor controller. Using spi_nor_spimem_check_op()
>> would require adding a variation of spi_nor_read_cr() that would use
>> spi_nor_spimem_check_op() for spi-mem and spi_nor_controller_ops_read_reg()
>> for spi-nor controller.
>> Another way would be to do this check only for the spi-mem as spi-nor
>> controllers seem to be deprecated in favour of spi-mem.
>
> I'll let that choice to SPI NOR maintainers but we've collectively asked
> to switch in favor of the spi memory API for quite some time, I would
> not care too much about compatibility with the two remaining controllers
> that have not yet been converted.
>
That's correct. It's been a few years now since we stopped adding new
support for the SPI NOR controllers, so feel free to ignore that part.
All we did on that front was to make sure we don't break anything.
> But here is a proper illustration why spi-mem rocks and why SPI NOR
> controllers, besides making no sense (because we also have SPI NANDs
> now) have a flacky API as of today's standards.
Right. I'd very much like to see the SPI NOR controllers converted to
spimem or removed altogether.
Cheers,
ta
prev parent reply other threads:[~2025-09-10 15:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-10 10:33 Jakub Czapiga
2025-09-10 12:04 ` Miquel Raynal
2025-09-10 14:30 ` Jakub "Kuba" Czapiga
2025-09-10 14:45 ` Miquel Raynal
2025-09-10 15:00 ` Tudor Ambarus [this message]
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=4991cd24-c549-4f4c-a7cb-c9f0e331c4bc@linaro.org \
--to=tudor.ambarus@linaro.org \
--cc=adeel.arshad@intel.com \
--cc=czapiga@google.com \
--cc=konrada@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mika.westerberg@linux.intel.com \
--cc=miquel.raynal@bootlin.com \
--cc=mwalle@kernel.org \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/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
all inboxes | Powered by JetHome®