All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	 Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Vaishnav Achath <vaishnav.a@ti.com>,
	 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
	"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
	"Gregory CLEMENT" <gregory.clement@bootlin.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Tawfik Bayouk" <tawfik.bayouk@mobileye.com>,
	"Théo Lebrun" <theo.lebrun@bootlin.com>
Subject: [PATCH 06/11] spi: cadence-qspi: minimise register accesses on each op if !DTR
Date: Fri, 08 Mar 2024 18:18:21 +0100	[thread overview]
Message-ID: <20240308-cdns-qspi-mbly-v1-6-a503856dd205@bootlin.com> (raw)
In-Reply-To: <20240308-cdns-qspi-mbly-v1-0-a503856dd205@bootlin.com>

cqspi_enable_dtr() is called for each operation, commands or not, reads
or writes. It writes CQSPI_REG_CONFIG then waits for idle (three
successful reads). Skip that in the no-DTR case if DTR is already
disabled.

It cannot be skipped in the DTR case as cqspi_setup_opcode_ext() writes
to a register and we must wait for idle state.

According to ftrace, the average cqspi_exec_mem_op() call goes from
85.4µs to 83.6µs when reading 235M over UBIFS on an octal flash.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
 drivers/spi/spi-cadence-quadspi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index d178148788f0..0fc452bab0ee 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -492,8 +492,11 @@ static int cqspi_enable_dtr(struct cqspi_flash_pdata *f_pdata,
 		if (ret)
 			return ret;
 	} else {
-		reg &= ~CQSPI_REG_CONFIG_DTR_PROTO;
-		reg &= ~CQSPI_REG_CONFIG_DUAL_OPCODE;
+		unsigned int mask = CQSPI_REG_CONFIG_DTR_PROTO | CQSPI_REG_CONFIG_DUAL_OPCODE;
+		/* Shortcut if DTR is already disabled. */
+		if ((reg & mask) == 0)
+			return 0;
+		reg &= ~mask;
 	}
 
 	writel(reg, reg_base + CQSPI_REG_CONFIG);

-- 
2.44.0


  parent reply	other threads:[~2024-03-08 17:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 17:18 [PATCH 00/11] spi: cadence-qspi: add Mobileye EyeQ5 support Théo Lebrun
2024-03-08 17:18 ` [PATCH 01/11] dt-bindings: qspi: cdns,qspi-nor: add mobileye,eyeq5-ospi compatible Théo Lebrun
2024-03-09 12:11   ` Krzysztof Kozlowski
2024-03-08 17:18 ` [PATCH 02/11] spi: cadence-qspi: switch from legacy names to modern ones Théo Lebrun
2024-03-08 17:18 ` [PATCH 03/11] spi: cadence-qspi: allow building for MIPS Théo Lebrun
2024-03-08 17:18 ` [PATCH 04/11] spi: cadence-qspi: store device data pointer in private struct Théo Lebrun
2024-03-08 17:18 ` [PATCH 05/11] spi: cadence-qspi: add FIFO depth detection quirk Théo Lebrun
2024-03-08 17:18 ` Théo Lebrun [this message]
2024-03-08 17:18 ` [PATCH 07/11] spi: cadence-qspi: add no-IRQ mode to indirect reads Théo Lebrun
2024-03-08 17:18 ` [PATCH 08/11] spi: cadence-qspi: add early busywait to cqspi_wait_for_bit() Théo Lebrun
2024-03-08 17:18 ` [PATCH 09/11] spi: cadence-qspi: add mobileye,eyeq5-ospi compatible Théo Lebrun
2024-03-08 17:18 ` [PATCH 10/11] MIPS: mobileye: eyeq5: Add SPI-NOR controller node Théo Lebrun
2024-03-08 17:18 ` [PATCH 11/11] MIPS: mobileye: eyeq5: add octal flash node to eval board DTS Théo Lebrun
2024-03-11 14:06   ` Tudor Ambarus
2024-03-11 14:06     ` Tudor Ambarus
2024-03-11 14:55     ` Pratyush Yadav
2024-03-11 14:55       ` Pratyush Yadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240308-cdns-qspi-mbly-v1-6-a503856dd205@bootlin.com \
    --to=theo.lebrun@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tawfik.bayouk@mobileye.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=vaishnav.a@ti.com \
    --cc=vladimir.kondratiev@mobileye.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.