From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.171.202.116 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796213187; b=DrWf8iMgnVF+6SGkx+OCtMtw9n11a8TYGcPBGhOvsTbIT1tqAaHrCkckq1JMwhCPWkUr 0nnB9JzMC3OqYbBQPDE+lC5ViELvAA5M+mVRpzS/gFnKU5fxkE0Cep1it4szq9/9hC52q JAln2uSnu1UFs5e3RWWj2tGi6sCHUw7QThI2DY8DxOeSbYbosyTJoKSK9OiqY7K2e2D3w lx0Tlx4jWCWolc9fVIyZhq3vpClG6aqVtHDwiaQ7bB/iPyNqkl9GyP6vpYFWA/JsXasT6 DzBR93FbQ8HzL5xQ/WgLqwmnQgej0w1uti0npGkxySCgF/mJzQQG4+mJnFM8UYuaz2A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796213187; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:From:To:Cc: Subject:In-Reply-To:References:User-Agent:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding: X-Last-TLS-Session-Version; bh=Ao2xVS3ur3mCwTkavXXyz/+1/qPySnjrq8ZgI/L+G3g=; b=Q1/A9qtITM8iMDkHT7uKNsj4E68BlqK8Uj8no4IDcF6jXeJ95wQhpvJQSP163m0vDJRK KYEa5w78x/AkSAflwNPSlq3KC0luTQBTCMameIyqhXPf6C2bmL05PJt9uPn9srCcLDKVS WqgmvPX9YHWctdvaxrGvdijAXiOzXwwAPugmf7XAKLbfDoYndWgB4FLNvL4ZwT4hC6ZBR HORMds1/LQdLYftXHcKoY/xnPJh6fFrGOxH8AAczcvH+QWTEU/norwCDV9dzqVUn4kF9T leta5Kj7vOu7i5DjGmuTJoKTJ91mK/BkhaJaYzMdfyFrZKwM7ekIPylEavHQkqdgiaA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b="Uq9Sy6/x"; arc=none smtp.remote-ip=185.171.202.116 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7529E606A32F for ; Wed, 2 Dec 2026 12:06:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7529E606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=Uq9Sy6/x Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id E7C6CC2AC48; Wed, 2 Dec 2026 12:06:34 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B0A4D6075F; Wed, 2 Dec 2026 12:06:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 977F411EA0F0C; Wed, 02 Dec 2026 13:05:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796213176; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Ao2xVS3ur3mCwTkavXXyz/+1/qPySnjrq8ZgI/L+G3g=; b=Uq9Sy6/xxagTmrxtXuvPfAaka8IUPUAuIjDHWeO77Qit1tfDXvBQ/rNlJxBZNgpN5SSx+u rgLqnRJoNWOKrb8WlJWfUmAspEELhnGKqpkurASwKNtIi0FLLas+TOFqxsfqAdtmedw4eS Cen/0OC0jVkjOwaTLzTMO9dayVIzyLccfQt9MTFOI9yBMLDjJmxpgT1UwlJI0ainFfUkAn /E4jG9Fp3UuwgW925KVZxGGPNVgoPlL0CO0GZELJ9MJcuiSd1f55mp8886BjhiLm0TzZ1l K38yTY5kIYB6KIy8/BsJRgXkzGtpIgvbsDnaoK+WMWCg0BGt0FgupmluS264Ng== From: Miquel Raynal To: Bough Chen Cc: sashiko-reviews@lists.linux.dev, Mark Brown , Liang Yang , Feng Chen , Xianwei Zhao , Han Xu , Conor Dooley , Valentina Fernandez , Daire McNamara , Haibo Chen , Jyan Chou , Yu-Chun Lin , Maxime Coquelin , Alexandre Torgue , Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra , Tudor Ambarus , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Matthias Brugger , AngeloGioacchino Del Regno , Yogesh Gaur , Chris Packham , Jonathan =?utf-8?Q?Neusch=C3=A4fer?= , Michal Simek , Thomas Petazzoni , Alvin Zhou , Cheng Ming Lin , linux-amlogic@lists.infradead.org, imx@lists.linux.dev, linux-stm32@st-md-mailman.stormreply.com, linux-mtd@lists.infradead.org, linux-trace-kernel@vger.kernel.org, Frank.Li@kernel.org, neil.armstrong@linaro.org Subject: Re: [PATCH RFC v2 22/35] spi: nxp-xspi: Reject mixed DTR modes In-Reply-To: <20261130132047.igchvhjuku6hp3bq@shlinux89> (Bough Chen's message of "Mon, 30 Nov 2026 21:20:47 +0800") References: <20261127-macronix-upstreaming-spi-mem-cycles-v2-0-5c93f5e5d630@bootlin.com> <20261127-macronix-upstreaming-spi-mem-cycles-v2-22-5c93f5e5d630@bootlin.com> <20261130132047.igchvhjuku6hp3bq@shlinux89> User-Agent: mu4e 1.12.12; emacs 30.2 Date: Wed, 02 Dec 2026 13:05:58 +0100 Message-ID: <87jylrnazd.fsf@bootlin.com> X-Mailing-List: imx@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 On 30/11/2026 at 21:20:47 +08, Bough Chen wrote: > On Fri, Nov 27, 2026 at 02:58:51PM +0000, sashiko-bot@kernel.org wrote: >> Thank you for your contribution! Sashiko AI review found 1 potential >> issue to consider: >> - [Medium] spi: nxp-xspi: inconsistent DTR detection in >> nxp_xspi_supports_op() >> -- >>=20 >> commit ce8d7a3ff5fbe9ec51a6d3a172d4b7891aaf62c1 >> Author: Miquel Raynal >>=20 >> spi: nxp-xspi: Reject mixed DTR modes >>=20 >> This commit updates nxp_xspi_supports_op() to reject SPI memory operatio= ns >> that mix DTR and SDR phases. >>=20 >> > diff --git a/drivers/spi/spi-nxp-xspi.c b/drivers/spi/spi-nxp-xspi.c >> > index ccd00c744d186..f2a847b5fd27d 100644 >> > --- a/drivers/spi/spi-nxp-xspi.c >> > +++ b/drivers/spi/spi-nxp-xspi.c >> > @@ -385,8 +385,18 @@ static bool nxp_xspi_supports_op(struct spi_mem *= mem, >> > const struct spi_mem_op *op) >> > { >> > struct nxp_xspi *xspi =3D spi_controller_get_devdata(mem->spi->contr= oller); >> > + bool all_true, all_false; >> > int ret; >> >=20=20 >> > + all_true =3D op->cmd.dtr && >> > + (!op->addr.nbytes || op->addr.dtr) && >> > + (!op->data.nbytes || op->data.dtr); >> > + >> > + all_false =3D !op->cmd.dtr && !op->addr.dtr && !op->data.dtr; >> > + >> > + if (!all_true && !all_false) >> > + return false; >>=20 >> [Severity: Medium] >> Does this DTR check match how nxp_xspi_select_mem() detects DTR operatio= ns >> and how the dummy phase is validated? >>=20 >> In nxp_xspi_select_mem(), op_is_dtr requires dtr to be set on all four >> phases unconditionally: >>=20 >> drivers/spi/spi-nxp-xspi.c:nxp_xspi_select_mem() { >> ... >> /* xspi only support one DTR mode: 8D-8D-8D */ >> bool op_is_dtr =3D op->cmd.dtr && op->addr.dtr && op->dummy.dtr && op->= data.dtr; >> ... >> } >>=20 >> Standard Octal DTR templates that omit an address, dummy, or data phase >> (such as SPINAND_PROG_LOAD_8D_8D_8D_OP or SPINAND_WR_EN_8D_0_0_OP) leave >> dtr as false on the unused phase via SPI_MEM_OP_NO_DUMMY, >> SPI_MEM_OP_NO_ADDR, or SPI_MEM_OP_NO_DATA. Those operations pass >> all_true here, and nxp_xspi_prepare_lut() emits DDR LUT instructions for >> the active phases, but nxp_xspi_select_mem() evaluates op_is_dtr as false >> and calls nxp_xspi_disable_ddr(). > > This is a really good catch. I double check the spi nor, for spi nor WR_E= N, > it is 8D-0D-0D-0D, add.dtr, dummy.dtr and data.dtr are all true. > xspi and fspi do not run any OCT DTR spi-nand before, so the bool op_is_d= tr > maybe not correct. > Can we just change the spi nand to align with spi nor? While I agree there is a problem, I don't really like this proposal. If there is (for exemple) no address phase, I do not expect any settings to be set for this phase. Forcing DTR=3Dtrue there seems the wrong way to tackle the problem. Either the driver shall be fixed (for not evaluating op_is_dtr as false) or supports_op() shall return false in some well crafted conditions. Thanks, Miqu=C3=A8l