From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 7E305606A32E for ; Wed, 25 Nov 2026 17:59:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=iQodpGB+; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=0I9axvAt DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=FIBKMP4nZoqbzRr8i0pCnN3an/uST3IDafioHLZPmwI=; b=iQodpGB+YpYURaypBjhM+Vg2wz VfvNpw0efaevXhQiFet3Bm/D29QppdhQbvUIS7PqCSdICJ7WIS0fs+r+FNDPXLQB9J6/oMVckEBbN RFvxtfOn9mpsDapf+g924N9VOaNH4BiiUBmlAnfsxd4jBU+r53Knuj3ri+BKWfUpxYYVVZ9ExztWa cg08oWLLUR9NzvbbHT04kijcLjEnqHwDxNXNag00AN5Lev+ALqz3mQkaSKFs8tUparwESxe/stVMb 6AGsYSjQ32PgTSLxG5CF0FSAJ8d4b2wLppzRV2cGH8C+sp54XXuZAWZFE3g3YeTDvcTNsnphazhN9 f2F5Swsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWHHM-0000000Au9U-0W2U; Wed, 25 Nov 2026 17:59:36 +0000 Received: from smtpout-02.galae.net ([185.246.84.56]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWHGs-0000000Atvi-30qt for linux-amlogic@lists.infradead.org; Wed, 25 Nov 2026 17:59:16 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id A21201A17FD; Wed, 25 Nov 2026 17:53:09 +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-Archived-By: MIME-Version: 1.0 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261125_095907_788473_7CD3FA98 X-CRM114-Status: GOOD ( 12.76 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic