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 CAEC1606A323 for ; Wed, 25 Nov 2026 17:54:53 +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=q+ZtMt4x; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=p6/IBmiI; 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=uOVjcbep 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=erIv1ZnJ33bBcmuscNVTOVOAdlzdDWXfUk49GCGP5kg=; b=q+ZtMt4xUWkKDwdkjWw5zYTzYt Y3bWVhFg4pzPcrPgSs1kNrs7WJ7Uc71euFFMEXI6m2TsL2p2kumYjFQU/YdaBeaW4Mz9hW0hb6YVl qM872kt22jBg57XUapvqQUuVg5iTGk8xD1h1G3ajYHC5vQrIusk6ekquBRFJAyVNAG5SnJAEIwZo8 rajebQqrZiCYK1fbG7WBzCtHVei4BM9XT0iG1Ow9+SfnXkoa82+BTkeYWQyvLVcGXgfI8tP06N0KT g3HU26rgLRQqOSV+yWTq4dqGkGvi4/Nwf+/zItiN/of9EHDego327zDwtgIMbhqM0Lgl6ihqndxdy t6ZCtAIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWHCm-0000000Ar5v-0MW7; Wed, 25 Nov 2026 17:54:52 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWHAt-0000000AoNi-0Cnv; Wed, 25 Nov 2026 17:52:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=HpXPXHLNQKnCKm1KDIi186rpwyG3ClwcXK0+xR+nAi0=; b=p6/IBmiIlvUcwNbESqHu3wKvKs hgqcgapoXNaPbR/CLO0hO6CJmqpcOPY7dko3jp6C6LJbMvK1TCjFxjHrnpZBZRfmCtxB2yopXn08v Pjy7XJN3gzGJcPTD2yMA6JYF0elEgjlmuq7JLmFDCjjbw8Ji/biNAcfiwmiNiYZ2JGmCaVTaP+Ogi a8lqx4F9XahuJISMuig0aqEfzh43MHYGppm5RY9mARc/jfDKzeVCgR9G29ew0fZ4HK9cJ4ehPQwB6 aieqEmhpynXswy36868R3o4zJNWvGbZSB+2sd1GhCMxKW+uiFiAcvWgayyBfgHRc0BdJo9zvR28v/ DqKBsipg==; Received: from smtpout-04.galae.net ([185.171.202.116]) by desiato.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWHAq-00000005bPA-1CT4; Wed, 25 Nov 2026 17:52:53 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 320A0C2BB3D; Wed, 25 Nov 2026 17:52:59 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 3BFC860480; Wed, 25 Nov 2026 17:52:51 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 06DFD11E6B0AE; Wed, 25 Nov 2026 18:52:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1795629169; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=HpXPXHLNQKnCKm1KDIi186rpwyG3ClwcXK0+xR+nAi0=; b=uOVjcbepMVghU3Xt2SG7QOb3JSmFCzapwgCUKfCq9dpEuxMxrMF93Wnd+O30WhLzMFIgFc JSLJPATYaztrx0hrKJSs9Uyl6NXlzRaSqjgJApKdQlTI2ZycKuiR61ZvZzef0QoxSK31ql DXHYqcajgfd7cM5w5si0xxNxXmbT4hn1jBHeLQKGqeaquYILRvY8HgVg16J3e9TztQ7l83 +H/yh+E0k+N/D0A2ozCcCkRXpVswYatbiSBtrPcDSim4vsMez55JCsWw1wKFhPX11dhEqX HdyGKYUmakcaHCNQ7oGkWsYEnoGbkdKwS197xUICWrQ+RwIvAEpmZmtrKFlA/g== From: Miquel Raynal Date: Wed, 25 Nov 2026 18:51:27 +0100 Subject: [PATCH RFC 13/16] spi: sn-f-ospi: Consume dummy cycles directly X-Archived-By: MIME-Version: 1.0 Message-Id: <20261125-macronix-upstreaming-spi-mem-cycles-v1-13-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_175252_312232_993D93DF X-CRM114-Status: GOOD ( 13.61 ) X-Spam-Score: -0.2 (/) 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-sn-f-ospi.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-sn-f-ospi.c b/drivers/spi/spi-sn-f-ospi.c index f0320e96fe23..ecfcf228c587 100644 --- a/drivers/spi/spi-sn-f-ospi.c +++ b/drivers/spi/spi-sn-f-ospi.c @@ -114,14 +114,6 @@ struct f_ospi { struct mutex mlock; }; -static u32 f_ospi_get_dummy_cycle(const struct spi_mem_op *op) -{ - if (!op->dummy.nbytes) - return 0; - - return (op->dummy.nbytes * 8) / op->dummy.buswidth; -} - static void f_ospi_clear_irq(struct f_ospi *ospi) { writel(OSPI_IRQ_CS_DEASSERT | OSPI_IRQ_CS_TRANS_COMP, @@ -348,7 +340,7 @@ static int f_ospi_indir_prepare_op(struct f_ospi *ospi, struct spi_mem *mem, f_ospi_config_indir_protocol(ospi, mem, op); - writel(f_ospi_get_dummy_cycle(op), ospi->base + OSPI_DMY_INDIR); + writel(op->dummy.ncycles, ospi->base + OSPI_DMY_INDIR); writel(op->addr.val, ospi->base + OSPI_ADDR); writel(op->cmd.opcode, ospi->base + OSPI_CMD_IDX_INDIR); @@ -553,7 +545,7 @@ static bool f_ospi_supports_op_width(struct spi_mem *mem, static bool f_ospi_supports_op(struct spi_mem *mem, const struct spi_mem_op *op) { - if (f_ospi_get_dummy_cycle(op) > OSPI_DUMMY_CYCLE_MAX) + if (op.dummy.ncycles > OSPI_DUMMY_CYCLE_MAX) return false; if (op->addr.nbytes > 4) @@ -580,6 +572,7 @@ static const struct spi_controller_mem_ops f_ospi_mem_ops = { static const struct spi_controller_mem_caps f_ospi_mem_caps = { .per_op_freq = true, + .dummy_cycles = true, }; static int f_ospi_init(struct f_ospi *ospi) -- 2.56.0 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic