mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: "Michael Walle" <mwalle@kernel.org>
Cc: "Pratyush Yadav" <pratyush@kernel.org>,
	 "Takahiro Kuwano" <takahiro.kuwano@infineon.com>,
	 "Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	 "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	 "Jon Hunter" <jonathanh@nvidia.com>,
	"Steam Lin" <STLin2@winbond.com>,
	 <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mtd: spi-nor: Fix quad-enable for flashes with QER bit in SR1
Date: Fri, 11 Sep 2026 11:34:09 +0200	[thread overview]
Message-ID: <87ik4cqgha.fsf@bootlin.com> (raw)
In-Reply-To: <87o6e4qh5g.fsf@bootlin.com> (Miquel Raynal's message of "Fri, 11 Sep 2026 11:19:39 +0200")

On 11/09/2026 at 11:19:39 +02, Miquel Raynal <miquel.raynal@bootlin.com> wrote:

>>> -	ret = spi_nor_read_sr1_and_sr2(nor, sr);
>>> +	if (qe_mask[0])
>>> +		ret = spi_nor_read_sr1(nor, sr);
>>> +	else
>>> +		ret = spi_nor_read_sr1_and_sr2(nor, sr);
>>
>> Shouldn't that be the other way around?
>>
>> +	if (qe_mask[1])
>> +		ret = spi_nor_read_sr1_and_sr2(nor, sr);
>> +	else
>> +		ret = spi_nor_read_sr1(nor, sr);
>>
>> I know qe_mask won't be spread across two SRs. Just to be
>> correct and make it easier to grok.
>
> Why is the second version easier to parse? First version is maybe more
> future proof since we are treating a specific case. Because either it is
> a specific chip (Mxic) or we end up in the more common case. There is
> only one QER entry for qe_mask[0], many for qe_mask[1], and chances are
> that in the future we will mostly see new chips only using a qe_mask[1]
> mask. So having this in the else doesn't sound so strange to me? I also
> don't think we will ever see masks spanning the two registers.

The problem still persists because there is the check which also fails
reading SR2.

Michael, we moved to swp.c that handling, introducing a "careful"
revision, was this actually relevant? Shouldn't we have the handling of
the lack of SR2 read back into the main core like before?

Possible steps forward:
1- Add extra logic in the "and_check" helper, kind of duplicating what
   is in the swp.c file (not my favourite)
2- Move the "careful" handling (which does not return errors when a
   register read is absent) back from swp.c into core.c.

What do you prefer?

Thanks,
Miquèl

  parent reply	other threads:[~2026-09-11  9:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11  8:55 Miquel Raynal
2026-09-11  9:04 ` Michael Walle
2026-09-11  9:19   ` Miquel Raynal
2026-09-11  9:30     ` Michael Walle
2026-09-11  9:34     ` Miquel Raynal [this message]
2026-09-11 10:00       ` Michael Walle
2026-09-11 10:43         ` Miquel Raynal
2026-09-11  9:12 ` sashiko-bot
2026-09-11 10:33 ` Jon Hunter
2026-09-11 12:06   ` Michael Walle

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=87ik4cqgha.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=STLin2@winbond.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mwalle@kernel.org \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=takahiro.kuwano@infineon.com \
    --cc=thomas.petazzoni@bootlin.com \
    --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®