From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.246.84.56 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796212677; b=J2aZG7Lh6vwGAHpekaDNJBmMKfFEv0Y0fSd1S9amhU6ORVYUnJU++5F2j35KkmubJxA6 5TUrepInm+8ms0girtjZz5dmHZeDZar0EgOn8vsZNeqy6zc6bcbdtbTCk3DW0OUTLt4br PkgXYxgXd7VoiHNvyZ95EIlbGg1DnDVEUbRhA+4y+t4iFIYukOK1fvAL9Wpu6iSOE3ibO F2nFYecMTRSS/aR6yTM3Kawv7UPVJbDno0CI8lrYFCWN/NdJWT/513RNKL0LIQdgYbFF9 aDUn9zfGuQ1JxShSQf8/FRHa4X+kTE35kviMHf2OIgLwIO8/KsI/mIY+rqnCPgjj8og== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796212677; 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=GWsy+PUsp8vxv+2fkU45mFlmJ+m3uZlGDGh1lvTCVoA=; b=ql8vfKTqD3wH44wn+8FdYxlmsKP83ubFVxsUykQmrgdtcW9zQIet6SObq5Re+hsvhhC7 egxDqQeqCAETnQkmHzK8FH8BC6WE9gfxYx7qZlPDXr3c7Ii4eDTmJa476TwEiD1iqH9J9 5gRKaf3oYnFcjSZ7OHGzEh1Ac5adVAADjZYmygCcpFDidmN6V5A1BNKA/Xj/lbIOMnvSU oaB/JB9BT0BJP93hFLBHIkvr0rXQVVts9mxkDSmOC9272ZfZvO00dGLaBzJDVHn7CCmxT MB0IZdxNBSUOTZzX0pLpjFS0vm80TslQFzS7GOHLHN1rMwVDGvRYXMxfgDOaumMEXvw== 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=NeksnabE; arc=none smtp.remote-ip=185.246.84.56 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 CDF4E606A333 for ; Wed, 2 Dec 2026 11:57:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CDF4E606A333 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=NeksnabE Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 1AD061A18D8; Wed, 2 Dec 2026 11:57:55 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D13846075F; Wed, 2 Dec 2026 11:57:54 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EB73511EA17C3; Wed, 02 Dec 2026 12:57:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796212668; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=GWsy+PUsp8vxv+2fkU45mFlmJ+m3uZlGDGh1lvTCVoA=; b=NeksnabEsCXg6c5dha49oaHx7NT/78hL0AhsLDHOUsmeB+TNz7kvJN14oDhn3YsXllk35c jfuJkwtPkodCXJA7/Z2dzZFdWWOdmblT++iKgrCYO+7DIM0izseGPv3R3oroNklH/9pWi8 WZw17OtzN5ltsZLLGiW8KRbAW8usn/CjAG3XiUdVnbc4go9GCy0E4tFT42nfEMVRWehGUC YpUYMAEY2e6zQopdjfr24KuMuWDVnreu7qYn7Np1fug1L5CTR1/283tz/Oi/uaVGCdNKW6 N5+DOlXJOlT+Isux6bbfV9tvG+MZ7nq+H6PFyyI1NbeC4w4Y//GnuSJaR+kYDQ== 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 18/35] spi: nxp-fspi: Consume dummy cycles directly In-Reply-To: <20261130113125.v73uwhnmr2p65crc@shlinux89> (Bough Chen's message of "Mon, 30 Nov 2026 19:31:25 +0800") References: <20261127-macronix-upstreaming-spi-mem-cycles-v2-0-5c93f5e5d630@bootlin.com> <20261127-macronix-upstreaming-spi-mem-cycles-v2-18-5c93f5e5d630@bootlin.com> <20261130113125.v73uwhnmr2p65crc@shlinux89> User-Agent: mu4e 1.12.12; emacs 30.2 Date: Wed, 02 Dec 2026 12:57:36 +0100 Message-ID: <87pkvjnbdb.fsf@bootlin.com> X-Mailing-List: linux-trace-kernel@vger.kernel.org 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 19:31:25 +08, Bough Chen wrote: > On Fri, Nov 27, 2026 at 02:50:31PM +0000, sashiko-bot@kernel.org wrote: >> Thank you for your contribution! Sashiko AI review found 1 potential >> issue to consider: >> - [High] spi: nxp-fspi: LUT_DUMMY_DDR operand halved in >> nxp_fspi_prepare_lut() >> -- >>=20 >> commit 1599225157c651da7c372805ec30cf72cfe8b69c >> Author: Miquel Raynal >>=20 >> spi: nxp-fspi: Consume dummy cycles directly >>=20 >> This commit enables the dummy_cycles capability in the NXP FlexSPI driver >> and replaces the dummy byte-to-cycle conversions with op->dummy.ncycles. >>=20 >> > diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c >> > index 66cb58f95fdb1..e6fdded67a00e 100644 >> > --- a/drivers/spi/spi-nxp-fspi.c >> > +++ b/drivers/spi/spi-nxp-fspi.c >> [ ... ] >> > @@ -567,8 +567,7 @@ static bool nxp_fspi_supports_op(struct spi_mem *m= em, >> > return false; >> >=20=20 >> > /* Max 64 dummy clock cycles supported */ >> > - if (op->dummy.buswidth && >> > - (op->dummy.nbytes * 8 / op->dummy.buswidth > 64)) >> > + if (op->dummy.ncycles > 64) >> > return false; >> >=20=20 >> > /* Max data length, check controller limits and alignment */ >> > @@ -652,16 +651,15 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi= *f, >> > lutidx++; >> > } >> >=20=20 >> > - /* dummy bytes, if needed */ >> > - if (op->dummy.nbytes) { >> > + /* dummy cycles, if needed */ >> > + if (op->dummy.ncycles) { >> > lutval[lutidx / 2] |=3D LUT_DEF(lutidx, op->dummy.dtr ? LUT_DUMMY_D= DR : LUT_DUMMY, >> > /* >> > * Due to FlexSPI controller limitation number of PAD for dummy >> > * buswidth needs to be programmed as equal to data buswidth. >> > */ >> > LUT_PAD(op->data.buswidth), >> > - op->dummy.nbytes * 8 / >> > - op->dummy.buswidth); >> > + op->dummy.ncycles); >> > lutidx++; >> > } >>=20 >> [Severity: High] >> Does passing op->dummy.ncycles directly to LUT_DUMMY_DDR halve the dummy >> cycles programmed in DTR mode? >>=20 >> In DTR mode, FlexSPI runs the serial root clock at 2x the flash SCLK rate >> and LUT_DUMMY_DDR counts DDR half-cycles (2 * ncycles). Previously, DTR >> callers doubled op->dummy.nbytes to account for two transfers per clock, >> and op->dummy.nbytes * 8 / op->dummy.buswidth intentionally did not divi= de >> by 2, yielding 2 * ncycles. With .dummy_cycles set, >> spi_mem_dummy_bytes_to_cycles() divides by 2 * op->dummy.buswidth when >> op->dummy.dtr is true (and direct ncycles callers pass full SCLK cycles), >> so nxp_fspi_prepare_lut() now programs half the required LUT_DUMMY_DDR >> operand and breaks DTR flash reads. > > Correct, I double check the RM, the value here in LUT should be 2 * op->d= ummy.ncycles. I will correct it. > But the value here do not impact the sample result, because current flexs= pi use external > DQS to sample the data for OCT DTR mode. I sent a DQS series, maybe you would like to have a look and enable the DQS capability for you controllers there. As of today there is no official handling of DQS, so chips may or may not enable it. This series clarifies it. https://lore.kernel.org/linux-spi/179554764437.947306.7383226666322227871.b= 4-ty@b4/ Thanks, Miqu=C3=A8l