From: Rosen Penev <rosenp@gmail.com>
To: linux-spi@vger.kernel.org
Cc: Mark Brown <broonie@kernel.org>,
Boris Brezillon <boris.brezillon@collabora.com>,
Mauro Lima <mauro.lima@eclypsium.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Tudor Ambarus <tudor.ambarus@linaro.org>,
Lee Jones <lee@kernel.org>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] spi: intel: only check locked opmenu for SW sequencer operations
Date: Sun, 1 Nov 2026 12:03:13 -0800 [thread overview]
Message-ID: <20261101200313.16411-1-rosenp@gmail.com> (raw)
On controllers that use the software sequencer for register access (LPT
and BYT), intel_spi_supports_mem_op() rejects any operation whose opcode
is not in the BIOS-locked OPMENU. However the check is applied to every
operation, including normal data reads and writes which are always
executed by the hardware sequencer and never consult the OPMENU.
On a Dell Precision M4800 (Lynx Point) the BIOS locks OPMENU to
{02, 3b, 20, 05, 9f, 9f, 00, 00}, which lacks both READ (0x03) and
FAST_READ (0x0b). As a result every read op is rejected and spi-nor
fails to probe both flash components:
intel-spi intel-spi: 0x3 not supported
intel-spi intel-spi: 0xb not supported
spi-nor spi0.0: can't select read settings supported by both the SPI controller and memory.
spi-nor spi0.0: probe with driver spi-nor failed with error -22
Only enforce the OPMENU check for operations that actually go through
the software sequencer: register reads/writes when swseq_reg is set and
erase when swseq_erase is set. With this both flash chips (W25Q64 and
W25Q32) probe and read back correctly.
Fixes: e23e5a05d1fd ("mtd: spi-nor: intel-spi: Convert to SPI MEM")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/spi/spi-intel.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c
index 7494b921a743..6f1414b199e6 100644
--- a/drivers/spi/spi-intel.c
+++ b/drivers/spi/spi-intel.c
@@ -754,6 +754,18 @@ intel_spi_match_mem_op(struct intel_spi *ispi, const struct spi_mem_op *op)
return NULL;
}
+static bool intel_spi_op_uses_swseq(const struct intel_spi *ispi,
+ const struct intel_spi_mem_op *iop)
+{
+ if (iop->exec_op == intel_spi_read_reg ||
+ iop->exec_op == intel_spi_write_reg)
+ return ispi->swseq_reg;
+ if (iop->exec_op == intel_spi_erase)
+ return ispi->swseq_erase;
+ /* Data reads and writes always use the HW sequencer */
+ return false;
+}
+
static bool intel_spi_supports_mem_op(struct spi_mem *mem,
const struct spi_mem_op *op)
{
@@ -768,9 +780,11 @@ static bool intel_spi_supports_mem_op(struct spi_mem *mem,
/*
* For software sequencer check that the opcode is actually
- * present in the opmenu if it is locked.
+ * present in the opmenu if it is locked. Operations executed by
+ * the hardware sequencer do not use the opmenu so skip the check
+ * for them.
*/
- if (ispi->swseq_reg && ispi->locked) {
+ if (ispi->locked && intel_spi_op_uses_swseq(ispi, iop)) {
int i;
/* Check if it is in the locked opcodes list */
--
2.56.0
reply other threads:[~2026-11-01 20:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261101200313.16411-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=boris.brezillon@collabora.com \
--cc=broonie@kernel.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mauro.lima@eclypsium.com \
--cc=tudor.ambarus@linaro.org \
/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®