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=1796212678; b=XutsyOVIhdDfhz9XWn/53kuRBTNO5kx0HP8ioea+6IR9AkdzpG1XhuWvxM/EGIFWXx+X mX8asAmlBLZp3Yoqu5h5XMSR7enTs9u7UxCidK0r/1Sip91h8yGjurBIOrIVpxG7/VYG4 mFtWZzNBFR5Z4bbFm0cjt8Oc/StX8TrZ67Tqq+I2s4Rr9QKErgLfIngOiprdopLQtaN+t siU84VztDMUy4TTUqLTaCRjz8Xn0Ot++sfqipf3S+sNTddAY3JMKUMsBm3JZFtFKj9TpI HnXt9mLLRorQbdd3Z3ZMHhUJzcBK+8JZV2F3+CAasokO/uPUSqVttT8/deY7fRQ2Wng== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796212678; 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=H0uo3REViNLgi+paODpH+PxWTAt9ZWBMlaspKy8K/aNQNbAJvaIU0tQR1Dd0s5uqX/rC RrDdJuw25rAMwpOgduzRF0vT0cXo35PIMF9KV2V3W6GvOR7/GrOyE6sxxa5dj2HBtZyLh s2HZZ+bjOBK9NRelKt13T27vhREFOSy/KuuLiWjjgRqAw8g8xcjC6D2A19YCxFrDdwQ9D SjJRUiqrS8a306bEzWO913/9q53mShla8QCHirA8PBZHnCUR1EOAkab3tt+In+1nTrG0B nstDRxtkQHAXtLWfvysOY1BUnK7N3eX9E8i83vL2YJFxos/NS1o7XFTsdohCXIKF8Bw== 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.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 8A186606A330 for ; Wed, 2 Dec 2026 11:57:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8A186606A330 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-04.galae.net (Postfix) with ESMTPS id E8FB7C2AC48; Wed, 2 Dec 2026 11:58:05 +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: 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 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