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=1795629191; b=vKAhK3/HjyDl95kureGoIrUu7QKZsvHbrUoELovTUL8OZky8GnLF2W1beD5KK0dnHnS7 iCuTS2x8DfdKf77e1IN+xcnL1UYLlSX6mmGMGlOCAGkqZSP1GM5raU67/9bGlF+lACzWM MhhITh0+2ByDePVlGwbMCymJYghOLpXaWssoEHcC3ptx8TeCYVc7uAXh8dIsgM9YblfLA yQ1qjtP7t+J+N7xO+PkidkN/E35n9WaLlNBXvk9ISdr+LpjhTJU94XLgWQiidOIVgxhp8 awudJSrjLSE1chbxGKDlOOsW0hJNxSTwwDylXQ840geswILFoO0y/oDrhcjqpvdfZcg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795629191; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:From:Date: Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Last-TLS-Session-Version; bh=4e/RWoOHhDL2sVy5LbDO8W9W8W0olcvrU1DPDGSNAcg=; b=O5cPT8tEF6WrxxX3q0r0fj3xTmMF2LBTpHlBYVxNdACU8U1P24eyljfp8dCJqiTtjQbx K8OqEk9AUu5hvLkkjwriq7pVXQyh2gIA9ZLCJZLbEgsAYkPnh3NNcm294rQ++x6X8/UU0 Z9IFN0gZ2rjaAMKEAoszZ5Dxh5fZisr3Jt49Y9a7wAzkNRUXP1IPdJ7vivvb9YiKFev6H o/hnO9XIh+PEktUzPMw0ZEZE8qOVtnZaWePFpaOp8tM2Is1SNoTIjahiVxV+cLIQIzcXu JIzeJOXgC08emJngOTbbRIz22IlNHB6jhyPUOyW+oQbjRXndPZNO7KuPtnTToFdXBcg== 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=0I9axvAt; 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 C154E60A2612 for ; Wed, 25 Nov 2026 17:53:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C154E60A2612 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=0I9axvAt Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 66CBBC2BB3D; Wed, 25 Nov 2026 17:53:17 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 6DC9B60480; Wed, 25 Nov 2026 17:53:09 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6A31611E6B0CE; Wed, 25 Nov 2026 18:52:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1795629183; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=4e/RWoOHhDL2sVy5LbDO8W9W8W0olcvrU1DPDGSNAcg=; b=0I9axvAtYjofLkkZCOhpkZRXZO9wrCEJ9W8xd0tJka7dFgvXC9ZZM3ONe8yTXqcbmWdvmU 2u0mC3vpvM8T1YH13qF+TwMiyqy4HUMouxTgv812jL9BdodUDrmSJh+5DlxTB8eTJWCkCp rDMjiGhgogKRV3B9FSVGqeE/jtnNyClRK3hFiSQ+x1v0LB3Ej1kjp8qdQT5IkX1KUGcV90 iqn37JYOcUO43avU/it4dEEZ25Lu3wpqlZW6pfJQNCGZfSnkv1IJuCRH3HVTAYlePx5now YOLAwRlHqdIagHAqfLWoZE2oNxTwIAlohyg3QGNtn4pIx4KhaFiynLXm3ndyyA== From: Miquel Raynal Date: Wed, 25 Nov 2026 18:51:29 +0100 Subject: [PATCH RFC 15/16] spi: stm32-qspi: Consume dummy cycles directly X-Mailing-List: linux-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: 7bit Message-Id: <20261125-macronix-upstreaming-spi-mem-cycles-v1-15-fd036402fd37@bootlin.com> References: <20261125-macronix-upstreaming-spi-mem-cycles-v1-0-fd036402fd37@bootlin.com> In-Reply-To: <20261125-macronix-upstreaming-spi-mem-cycles-v1-0-fd036402fd37@bootlin.com> To: 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 Cc: Thomas Petazzoni , Alvin Zhou , Cheng Ming Lin , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, imx@lists.linux.dev, linux-riscv@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The spi-mem layer is now capable of providing the dummy phase in cycle units rather than bytes, provided that drivers advertize the dummy_cycle capability. Since this controller is consuming cycles and currently converts bytes into cycles, flag it capable to consume cycles directly and drop the extra conversions. Signed-off-by: Miquel Raynal --- drivers/spi/spi-stm32-qspi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index b77daba6db83..993b09cc5124 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -393,9 +393,8 @@ static int stm32_qspi_send(struct spi_device *spi, const struct spi_mem_op *op) ccr |= FIELD_PREP(CCR_ADSIZE_MASK, op->addr.nbytes - 1); } - if (op->dummy.nbytes) - ccr |= FIELD_PREP(CCR_DCYC_MASK, - op->dummy.nbytes * 8 / op->dummy.buswidth); + if (op->dummy.ncycles) + ccr |= FIELD_PREP(CCR_DCYC_MASK, op->dummy.ncycles); if (op->data.nbytes) { ccr |= FIELD_PREP(CCR_DMODE_MASK, @@ -593,7 +592,7 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl, */ if (transfer->dummy_data) { op.dummy.buswidth = transfer->tx_nbits; - op.dummy.nbytes = transfer->len; + op.dummy.ncycles = transfer->len * 8 / transfer->tx_nbits; dummy_bytes = transfer->len; /* if happens, means that message is not correctly built */ @@ -773,6 +772,10 @@ static const struct spi_controller_mem_ops stm32_qspi_mem_ops = { .poll_status = stm32_qspi_poll_status, }; +static const struct spi_controller_mem_caps stm32_qspi_mem_caps = { + .dummy_cycles = true, +}; + static int stm32_qspi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -856,6 +859,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) ctrl->setup = stm32_qspi_setup; ctrl->bus_num = -1; ctrl->mem_ops = &stm32_qspi_mem_ops; + ctrl->mem_caps = &stm32_qspi_mem_caps; ctrl->use_gpio_descriptors = true; ctrl->transfer_one_message = stm32_qspi_transfer_one_message; ctrl->num_chipselect = STM32_QSPI_MAX_NORCHIP; -- 2.56.0