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 0FDC8606E139 for ; Fri, 27 Nov 2026 14:26:05 +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=0YlvAQCE; 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=iNcMVji5 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=is0iyNu6Y2IwiwLO3GWjBXNEms+gOALlqOqnI1DB8OQ=; b=0YlvAQCE/OQKVCFvy/H6aYaOz7 zD8ZVCeN7YHOaKP/tIm9Q65rUoqof5Wq/1CT2GN+USI+A8ss1uOYtNk1JsR/uY9QkJx42JHGWT7z0 Dsl1CHKd2GMVJBv3xwDKzrjRfuCO3oCQFajSEysZJ8eVHQeK1v6Vme5YPbCkvvg+h2OocQCV0Z9xn a7q/+yDnKm4xxgxL9xiRoD0Ps1LX4tRxbeARpMw83o2n5XxhIhKD8QOTWT21dMhvxCgpdJiLPQ0FQ 1pL7J1qYt4qhMzroCXqsdE0W7/pSlw4RKDP+wmAipN/2SIHwjCb+AY7ZJLQdhT4DeyB8AVuxh1qnS stNIAWCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWwtn-0000000GQqc-3tVq; Fri, 27 Nov 2026 14:26:03 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWwsV-0000000GOUB-2mJH; Fri, 27 Nov 2026 14:25:02 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 64E984E417CB; Fri, 27 Nov 2026 14:24:41 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 332896049C; Fri, 27 Nov 2026 14:24:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 22E8111E68FD9; Fri, 27 Nov 2026 15:24:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1795789478; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=TBZW7Ptwz+yw8AXqBhejxSGjbWw/7ikzInaFBRYqbMw=; b=iNcMVji5FJ6CiqLt5PrRB1JZ3mB+OTxGlkV8xIWF1ejjwqQTrcOX0vXSSQ85Z2x9fXRRZu EyBYoOJrmudeLSJVqboEMsF2ZCpJQqtc+2Auxps+wVOSHd2Ib4FAL8pMmtlePbC9BCRu/f dVUgxy2omCV0x0LT//8irghtcm3zfTMOMmONKITlE1X08b5QTNXUG4kdBwjw+DQg2msRdH LaY+0h5WJ0H9melMp5ZaoeKAT6OTmuBTR6UDr+o3htZYUbimya7dqN+IELDdlqa8z1rtE+ Z1osr8DpkaZ2d1+GP/Ct6gE7Ur/NDLh8luqp6qvDNrP0vEc/VhRs+2aQkZoq8A== From: Miquel Raynal Date: Fri, 27 Nov 2026 15:22:32 +0100 Subject: [PATCH RFC v2 10/35] spi: atmel-quadspi: Consume dummy cycles directly X-Archived-By: MIME-Version: 1.0 Message-Id: <20261127-macronix-upstreaming-spi-mem-cycles-v2-10-5c93f5e5d630@bootlin.com> References: <20261127-macronix-upstreaming-spi-mem-cycles-v2-0-5c93f5e5d630@bootlin.com> In-Reply-To: <20261127-macronix-upstreaming-spi-mem-cycles-v2-0-5c93f5e5d630@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 , Tudor Ambarus , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Matthias Brugger , AngeloGioacchino Del Regno , Yogesh Gaur , Chris Packham , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Michal Simek 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, linux-trace-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, openbmc@lists.ozlabs.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-20261127_062445_375021_823B4F8D X-CRM114-Status: GOOD ( 12.64 ) 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 controller programs the dummy phase in clock cycles, but the driver converts the legacy dummy byte count into cycles. Advertise the dummy_cycles capability and use op->dummy.ncycles directly. Signed-off-by: Miquel Raynal --- drivers/spi/atmel-quadspi.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 0b695b0b3c98..abca99b32b61 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -502,7 +502,7 @@ static bool atmel_qspi_supports_op(struct spi_mem *mem, /* special case not supported by hardware */ if (op->addr.nbytes == 2 && op->cmd.buswidth != op->addr.buswidth && - op->dummy.nbytes == 0) + !op->dummy.ncycles) return false; return true; @@ -543,8 +543,8 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, return mode; ifr |= atmel_qspi_modes[mode].config; - if (op->dummy.nbytes) - dummy_cycles = op->dummy.nbytes * 8 / op->dummy.buswidth; + dummy_cycles = op->dummy.ncycles; + /* * The controller allows 24 and 32-bit addressing while NAND-flash @@ -706,14 +706,8 @@ static int atmel_qspi_sama7g5_set_cfg(struct atmel_qspi *aq, return mode; ifr |= atmel_qspi_sama7g5_modes[mode].config; - if (op->dummy.buswidth && op->dummy.nbytes) { - if (op->addr.dtr && op->dummy.dtr && op->data.dtr) - ifr |= QSPI_IFR_NBDUM(op->dummy.nbytes * 8 / - (2 * op->dummy.buswidth)); - else - ifr |= QSPI_IFR_NBDUM(op->dummy.nbytes * 8 / - op->dummy.buswidth); - } + if (op->dummy.ncycles) + ifr |= QSPI_IFR_NBDUM(op->dummy.ncycles); if (op->addr.nbytes) { ifr |= FIELD_PREP(QSPI_IFR_ADDRL_SAMA7G5, op->addr.nbytes - 1) | @@ -990,6 +984,10 @@ static const struct spi_controller_mem_ops atmel_qspi_mem_ops = { .get_name = atmel_qspi_get_name }; +static const struct spi_controller_mem_caps atmel_qspi_mem_caps = { + .dummy_cycles = true, +}; + static int atmel_qspi_set_pad_calibration(struct atmel_qspi *aq) { unsigned long pclk_rate; @@ -1441,6 +1439,7 @@ static int atmel_qspi_probe(struct platform_device *pdev) ctrl->set_cs_timing = atmel_qspi_set_cs_timing; ctrl->bus_num = -1; ctrl->mem_ops = &atmel_qspi_mem_ops; + ctrl->mem_caps = &atmel_qspi_mem_caps; ctrl->num_chipselect = 1; platform_set_drvdata(pdev, ctrl); -- 2.56.0 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic