From: Johan Alvarado <contact@c127.dev>
To: broonie@kernel.org, md.alam@oss.qualcomm.com
Cc: Johan Alvarado <contact@c127.dev>,
sashiko-reviews@lists.linux.dev, j4g8y7@gmail.com,
konradybcio@kernel.org, pengpeng@iscas.ac.cn,
miquel.raynal@bootlin.com, quic_varada@quicinc.com,
quic_srichara@quicinc.com, linux-spi@vger.kernel.org,
linux-mtd@lists.infradead.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] spi: spi-qpic-snand: drop the redundant ECC context handling
Date: Fri, 11 Sep 2026 19:05:13 -0500 [thread overview]
Message-ID: <20260912000516.653989-1-contact@c127.dev> (raw)
In-Reply-To: <20260911191010.990EE1F000FF@smtp.kernel.org>
On Fri, Sep 11, 2026 at 07:10:10PM +0000, sashiko-bot@kernel.org wrote:
> Is this assumption accurate for all configurations?
> If the device tree specifies ON-DIE or software ECC (nand,ecc-engine =
> "on-die"), or if a non-NAND SPI memory device (like spi-nor) is attached to
> this controller, won't the host's init_ctx be bypassed?
The engine is selected by the nand-ecc-engine phandle, or by
nand-no-ecc-engine and nand-use-soft-ecc-engine; the core does not read a
nand,ecc-engine = "on-die" property. A chip node that phandles itself, or
that omits the property and takes the SPI-NAND default, does land on the
on-die engine, and qcom_spi_ecc_init_ctx_pipelined() is then never called.
That configuration has never worked. The page helpers are gated on
qspi->page_rw and qspi->oob_rw, which only
qcom_spi_ecc_prepare_io_req_pipelined() sets, so qcom_spi_read_page()
returns 0 with the buffer untouched while spi_mem_no_dirmap_read() reports
the full length as read. Removing the phandle on an IPQ5018 board confirms
it: the chip probes, then UBI reports "no valid UBI magic found inside
mtd15" and "failed to attach mtd13, error -22". A block erase there took
cfg0_raw and cfg1_raw from the zeroed scratch struct, which is a wrong
erase configuration rather than a working one. So this patch changes no
configuration that works today, and the three in-tree boards using this
controller all set nand-ecc-engine = <&qpic_nand>.
For spi-nor, the binding documents a spi-nand child only, and
qcom_spi_cmd_mapping() returns -EOPNOTSUPP for opcodes outside the
SPI-NAND set, RDSR 0x05 and SFDP 0x5A among them, so such a probe fails
before an mtd is registered.
A mismatched device tree should still not panic, and the silent read is
the worse half of it. Refusing page access and block erase in
qcom_spi_exec_op() while the context is NULL covers both. I have that
patch ready and will send it on top once this series is applied, so it
does not hold anything here up. It cannot go in qcom_spi_supports_op():
spinand_select_op_variant() uses that callback to choose the cache op
templates during detection, long before any ECC context exists, so
rejecting page operations there leaves no variant supported and the chip
fails to probe with "unknown raw ID".
Best regards,
Johan
prev parent reply other threads:[~2026-09-12 0:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 18:44 [PATCH v2 0/2] spi: spi-qpic-snand: fix the stale ECC context pointer Johan Alvarado
2026-09-11 18:44 ` [PATCH v2 1/2] spi: spi-qpic-snand: publish the ECC context to snandc->qspi Johan Alvarado
2026-09-11 18:44 ` [PATCH v2 2/2] spi: spi-qpic-snand: drop the redundant ECC context handling Johan Alvarado
2026-09-11 19:10 ` sashiko-bot
2026-09-12 0:05 ` Johan Alvarado [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=20260912000516.653989-1-contact@c127.dev \
--to=contact@c127.dev \
--cc=broonie@kernel.org \
--cc=j4g8y7@gmail.com \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=md.alam@oss.qualcomm.com \
--cc=miquel.raynal@bootlin.com \
--cc=pengpeng@iscas.ac.cn \
--cc=quic_srichara@quicinc.com \
--cc=quic_varada@quicinc.com \
--cc=sashiko-reviews@lists.linux.dev \
/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®